a479feb5 by white

first commit

0 parents
Showing 440 changed files with 4848 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.idea
/haocaigui.iml
/target
/target/*
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>haocaigui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
1111
\ No newline at end of file
1111
\ No newline at end of file
111
\ No newline at end of file
## 测试账号
``` text
普通用户名 hsz ,111111
管理员用户名 csbr,111111
```
## 系统配置参数说明
> 配置参数在application-dev.properties目录下
``` properties
app.fx.min.width=1280 界面大小设置
app.fx.min.height=1024
app.fx.full.screen=true 是否全屏幕
```
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
测试用用户名 hsz ,111111
管理员用户名 csbr,111111
配置参数在application-dev.properties目录下
app.fx.min.width=1280 界面大小设置
app.fx.min.height=1024
app.fx.full.screen=true 是否全屏幕
以下是数据库配置
spring.datasource.password:tpmysqladmin@!2017
spring.datasource.url:jdbc:mysql://192.168.3.206:3306/hcg?autoReconnect=true&autoReconnectForPools=true&useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username:root
配置完成后执行start.bat可以启动程序。 配置文件在config目录下。
logging.config=classpath:logback_dev.xml
#DATASOURCE
spring.datasource.name=demo
spring.datasource.connectionProperties:druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
spring.datasource.driver-class-name:com.mysql.jdbc.Driver
spring.datasource.filters:stat,wall,log4j
spring.datasource.initialSize:5
spring.datasource.maxActive:20
spring.datasource.maxPoolPreparedStatementPerConnectionSize:20
spring.datasource.maxWait:60000
spring.datasource.minEvictableIdleTimeMillis:300000
spring.datasource.minIdle:5
spring.datasource.password:tpmysqladmin@!2017
spring.datasource.poolPreparedStatements:true
spring.datasource.testOnBorrow:false
spring.datasource.testOnReturn:false
spring.datasource.testWhileIdle:true
spring.datasource.timeBetweenEvictionRunsMillis:60000
spring.datasource.type:com.alibaba.druid.pool.DruidDataSource
spring.datasource.url:jdbc:mysql://192.168.3.206:3306/hcg?autoReconnect=true&autoReconnectForPools=true&useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username:root
spring.datasource.validationQuery:SELECT'X'
mybatis.type-aliases-package=com.csbr.model
#mybatis.basePackage=com.csbr.mapper
mybatis.mapper-locations=classpath:mapper/*.xml
mapper.mappers=com.csbr.mybatis.MyMapper
mapper.not-empty=false
mapper.identity=MYSQL
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql
csbr.mybatis.basepackage=com.csbr.mapper
app.cabinet.group.code=a11
app.nodatabase=false
app.usedelaytime=10
app.session.timeout=600
app.fx.min.width=1280
app.fx.min.height=1024
app.fx.full.screen=false
app.title=haocaigui
app.welcome.img=cn/csbr/app/ControlsFX.png
app.welcome.backgroud.img=cn/csbr/app/bar.png
\ No newline at end of file
spring.profiles.active=${spring_profiles_active:dev}
#management.security.enabled=false
java -jar ./lib/haocaigui-1.0-SNAPSHOT.jar JAVA_OPTS="-Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.virtualKeyboard=javafx"
No preview for this file type
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class CRFID_RFIDRD204 */
#ifndef _Included_CRFID_RFIDRD204
#define _Included_CRFID_RFIDRD204
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: CRFID_RFIDRD204
* Method: RD_OpenCom
* Signature: (Ljava/lang/String;II)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1OpenCom
(JNIEnv *, jclass, jstring, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_CloseCom
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1CloseCom
(JNIEnv *, jclass, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_InitPort
* Signature: (II[B)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1InitPort
(JNIEnv *, jclass, jint, jint, jbyteArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_ClosePort
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1ClosePort
(JNIEnv *, jclass, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_LoadDefParam
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1LoadDefParam
(JNIEnv *, jclass, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SaveDefParam
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SaveDefParam
(JNIEnv *, jclass, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_GetSysInfo
* Signature: (IILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1GetSysInfo
(JNIEnv *, jclass, jint, jint, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_GetProductInfo
* Signature: (IILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1GetProductInfo
(JNIEnv *, jclass, jint, jint, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_ResumeSystem
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1ResumeSystem
(JNIEnv *, jclass, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetWorkModeAuto
* Signature: (IILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetWorkModeAuto
(JNIEnv *, jclass, jint, jint, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetWorkModePs
* Signature: (IILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetWorkModePs
(JNIEnv *, jclass, jint, jint, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetAntennaCount
* Signature: (IILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetAntennaCount
(JNIEnv *, jclass, jint, jint, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetAntenna
* Signature: (IIII)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetAntenna
(JNIEnv *, jclass, jint, jint, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetOrderTimeout
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetOrderTimeout
(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetTagType
* Signature: (IILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetTagType
(JNIEnv *, jclass, jint, jint, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetBeep
* Signature: (IIIII)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetBeep
(JNIEnv *, jclass, jint, jint, jint, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetSyncParam
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetSyncParam
(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_GetIRStation
* Signature: (IILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1GetIRStation
(JNIEnv *, jclass, jint, jint, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_LedControlWithAntena
* Signature: (IIIIII)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1LedControlWithAntena
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_GetHeart
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1GetHeart
(JNIEnv *, jclass, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SetInventTagPsMultiAntena
* Signature: (IILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SetInventTagPsMultiAntena
(JNIEnv *, jclass, jint, jint, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_GetInventTagPsMultiAntena
* Signature: (ILjava/lang/String;II)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1GetInventTagPsMultiAntena
(JNIEnv *, jclass, jint, jstring, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_SearchTag
* Signature: (II[CLjava/lang/String;[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1SearchTag
(JNIEnv *, jclass, jint, jint, jcharArray, jstring, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_DetectTagMultiAntenna
* Signature: (I[CI)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1DetectTagMultiAntenna
(JNIEnv *, jclass, jint, jcharArray, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_DetectTagMultiAntennaUnFilter
* Signature: (I[CI)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1DetectTagMultiAntennaUnFilter
(JNIEnv *, jclass, jint, jcharArray, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_DetectTagMultiAntenaV
* Signature: (I[CII)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1DetectTagMultiAntenaV
(JNIEnv *, jclass, jint, jcharArray, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_InventoryTagPsSingle
* Signature: (II[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1InventoryTagPsSingle
(JNIEnv *, jclass, jint, jint, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_InventoryTagPsAfiSingle
* Signature: (II[C[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1InventoryTagPsAfiSingle
(JNIEnv *, jclass, jint, jint, jcharArray, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_InventoryTagPsAfiMany
* Signature: (II[C[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1InventoryTagPsAfiMany
(JNIEnv *, jclass, jint, jint, jcharArray, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_ReadTagData
* Signature: (III[CII[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1ReadTagData
(JNIEnv *, jclass, jint, jint, jint, jcharArray, jint, jint, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_WriteTagData
* Signature: (III[CII[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1WriteTagData
(JNIEnv *, jclass, jint, jint, jint, jcharArray, jint, jint, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_LockBlock
* Signature: (III[CII)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1LockBlock
(JNIEnv *, jclass, jint, jint, jint, jcharArray, jint, jint);
/*
* Class: CRFID_RFIDRD204
* Method: RD_ReadTagAfi
* Signature: (III[CLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1ReadTagAfi
(JNIEnv *, jclass, jint, jint, jint, jcharArray, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_WriteTagAfi
* Signature: (III[CLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1WriteTagAfi
(JNIEnv *, jclass, jint, jint, jint, jcharArray, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_LockTagAfi
* Signature: (III[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1LockTagAfi
(JNIEnv *, jclass, jint, jint, jint, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_ReadTagDsfid
* Signature: (III[CLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1ReadTagDsfid
(JNIEnv *, jclass, jint, jint, jint, jcharArray, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_WriteTagDsfid
* Signature: (III[CLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1WriteTagDsfid
(JNIEnv *, jclass, jint, jint, jint, jcharArray, jstring);
/*
* Class: CRFID_RFIDRD204
* Method: RD_LockTagDsfid
* Signature: (III[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1LockTagDsfid
(JNIEnv *, jclass, jint, jint, jint, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_GetTagInfo
* Signature: (IIILjava/lang/String;[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1GetTagInfo
(JNIEnv *, jclass, jint, jint, jint, jstring, jcharArray);
/*
* Class: CRFID_RFIDRD204
* Method: RD_ReadTagSafety
* Signature: (IIILjava/lang/String;II[C)I
*/
JNIEXPORT jint JNICALL Java_CRFID_RFIDRD204_RD_1ReadTagSafety
(JNIEnv *, jclass, jint, jint, jint, jstring, jint, jint, jcharArray);
#ifdef __cplusplus
}
#endif
#endif
No preview for this file type
#ifndef BYRFID_HEADER
#define BYRFID_HEADER
//�򿪴���
int __stdcall RD_OpenCom(const char* pPort, int nBaudRate, int nCFlow);
//�رմ���
int __stdcall RD_CloseCom(int hComm);
//������������
int __stdcall RD_initPort(int lPort, int nPort,char* pIP);
//�Ͽ���������
int __stdcall RD_closePort(int h)��
//15693��ǩר������
//****************************************************************************************
//��ͻ��ǩ���
int __stdcall RD_InventoryTagPsMany(int hComm, int nIndex, char* pUid);
//��AFI��ͻ��ǩ���
int __stdcall RD_InventoryTagPsAfiMany(int hComm, int nIndex, char* pAfi,char* pUid);
//����ģʽ�¼���ǩ(��·�������л����ι���)
int __stdcall RD_DetectTagMultiAntenna(int hComm, char* pUidInfo, int &nUidCount);
//����ģʽ�¼���ǩ(��·�������л�������)
int __stdcall RD_DetectTagMultiAntennaUnFilter(int hComm, char* pUidInfo, int &nUidCount);
//����ģʽ�¼���ǩ(������Ϣ����ѹֵ��Ϣ)
int __stdcall RD_DetectTagMultiAntenaV(int hComm, char* pInfo, int &nCount, int &nFinish);
//����ģʽ�¶��ǩ���
int __stdcall RD_SetInventTagPsMultiAntena(int hComm, int nIndex, char* pAntena);
//��ȡ����ģʽ�¶����߱�ǩ�����Ϣ
int __stdcall RD_GetInventTagPsMultiAntena(int hComm, char* pInfo, int &nCount, int &nFinish);
//���ұ�ǩ
int __stdcall RD_SearchTag(int hComm, int nIndex, char* pUid, char* pAntena,char* pInfo);
//�������
int __stdcall RD_GetHeart(int hComm, int nIndex);
//**************************************************************************************
//�豸������������
//**************************************************************************************
//��ϵͳĬ�ϲ�������ϵͳ��ǰ��������
int __stdcall RD_LoadDefParam(int hComm, int nIndex);
//��ϵͳ��ǰ���������洢ΪϵͳĬ�ϲ���
int __stdcall RD_SaveDefParam(int hComm, int nIndex);
//��ȡ����ϵͳ��������
int __stdcall RD_GetSysInfo(int hComm, int nIndex, char* pValParam);
//��ϵͳ���������λ
int __stdcall RD_ResetDevice(int hComm, int nIndex);
//�л���������ģʽ
int __stdcall RD_SetWorkModeAuto(int hComm, int nIndex, char* pValue);
//���ñ�������ģʽ
int __stdcall RD_SetWorkModePs(int hComm, int nIndex, char* pValue);
//���ö�д��ID
int __stdcall RD_SetID(int hComm, int nIndex, int nID);
//����ϵͳĬ�ϱ�ǩ����
int __stdcall RD_SetTagType(int hComm, int nIndex, char* pTagType);
//���ñ�ǩ����ʱ��
int __stdcall RD_SetTagTime(int hComm, int nIndex, int nTime);
//���ñ�ǩ��ʱʱ��
int __stdcall RD_SetTagTimeout(int hComm, int nIndex, int nTime);
//���ñ�ǩ��ʱʱ��
int __stdcall RD_SetOrderTimeout(int hComm, int nIndex, int nTime);
//���÷�����
int __stdcall RD_SetBuzzer(int hComm, int nIndex, int nValue);
//ϵͳ�����ȡ��Ʒ��Ϣ
int __stdcall RD_GetProductInfo(int hComm, int nIndex, char* pValParam);
//�ָ���������
int __stdcall RD_ResumeSystem(int hComm, int nIndex);
//�޸IJ�����
int __stdcall RD_SetBaudRates(int hComm, int nIndex, int nBaudRate);
//������żͬ��
int __stdcall RD_SetParity(int hComm, int nIndex, int nMode);
//��·������������
int __stdcall RD_SetAntenna(int hComm, int nIndex, int nLocation, int nAntenna);
//��·������������
int __stdcall RD_SetAntennaCount(int hComm, int nIndex, char *pInfo);
//���ñ�ǩ������
int __stdcall RD_SetInventTagTimes(int hComm, int nIndex, int nTimes);
//��ȡ����״̬
int __stdcall RD_GetIRStation(int hComm, int nIndex, char* pState);
//ָʾ�ƿ���
int __stdcall RD_LedControlWithAntena(int hComm, int nIndex,int nColor, int nLedCtrl,int nParam,int nAntena);
#endif
No preview for this file type
No preview for this file type
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>csbr.cn</groupId>
<artifactId>haocaigui</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>central</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<layout>default</layout>
<!-- 是否开启发布版构件下载 -->
<releases>
<enabled>true</enabled>
</releases>
<!-- 是否开启快照版构件下载 -->
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>nexus_public</id>
<!-- <url>http://test.csylcloud.com:8081/nexus/content/groups/public/</url>-->
<url>https://repository.jboss.org/nexus/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus_public</id>
<!--<url>http://test.csylcloud.com:8081/nexus/content/groups/public/</url>-->
<url>https://repository.jboss.org/nexus/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.cwbase</groupId>
<artifactId>logback-redis-appender</artifactId>
<version>1.1.5</version>
<exclusions>
<exclusion>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.1.23</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.controlsfx/controlsfx -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>8.40.14</version>
</dependency>
<dependency>
<groupId>de.roskenet</groupId>
<artifactId>springboot-javafx-support</artifactId>
<version>2.1.5</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.13.1.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.31</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.csbr</groupId>
<artifactId>util-spring-boot-starter</artifactId>
<version>1.0.1</version>
<exclusions>
<exclusion>
<groupId>com.csbr</groupId>
<artifactId>exception</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.csbr</groupId>
<artifactId>mybatis-springboot-starter</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.14</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>4.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bytedeco/javacv-platform -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv-platform</artifactId>
<version>1.4.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bytedeco.javacpp-presets/opencv-platform -->
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv-platform</artifactId>
<version>3.4.1-1.4.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.2.RELEASE</version>
</plugin>
<!-- tag::plugin[] -->
<!--<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>192.168.3.239:5000/zuul_proxy</imageName>
<newName>http://192.168.3.239:5000/zuul_proxy</newName>
<serverId>docker-hub</serverId>
<registryUrl>http://192.168.3.239:5000</registryUrl>
<exposes>5000</exposes>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- end::plugin[] -->
</plugins>
</build>
</project>
#Wed Feb 23 10:44:17 CST 2022
kjjpwd=111111
kjj=Ctrl+Alt+A
kjjispwd=\u662F
package cn.csbr.app.Facerecognition;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfDouble;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.opencv.ml.SVM;
import org.opencv.objdetect.CascadeClassifier;
import org.opencv.objdetect.HOGDescriptor;
import org.opencv.videoio.VideoCapture;
import org.opencv.videoio.Videoio;
public class CaptureBasic extends JPanel {
private BufferedImage mImg;
private BufferedImage mat2BI(Mat mat) {
int dataSize = mat.cols() * mat.rows() * (int) mat.elemSize();
byte[] data = new byte[dataSize];
mat.get(0, 0, data);
int type = mat.channels() == 1 ?
BufferedImage.TYPE_BYTE_GRAY : BufferedImage.TYPE_3BYTE_BGR;
if (type == BufferedImage.TYPE_3BYTE_BGR) {
for (int i = 0; i < dataSize; i += 3) {
byte blue = data[i + 0];
data[i + 0] = data[i + 2];
data[i + 2] = blue;
}
}
BufferedImage image = new BufferedImage(mat.cols(), mat.rows(), type);
image.getRaster().setDataElements(0, 0, mat.cols(), mat.rows(), data);
return image;
}
public void paintComponent(Graphics g) {
if (mImg != null) {
g.drawImage(mImg, 0, 0, mImg.getWidth(), mImg.getHeight(), this);
}
}
public static void main(String[] args) {
try {
// System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat capImg = new Mat();
VideoCapture capture = new VideoCapture(0);
int height = (int) capture.get(Videoio.CAP_PROP_FRAME_HEIGHT);
int width = (int) capture.get(Videoio.CAP_PROP_FRAME_WIDTH);
if (height == 0 || width == 0) {
throw new Exception("camera not found!");
}
JFrame frame = new JFrame("camera");
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
CaptureBasic panel = new CaptureBasic();
panel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
System.out.println("click");
}
@Override
public void mouseMoved(MouseEvent arg0) {
System.out.println("move");
}
@Override
public void mouseReleased(MouseEvent arg0) {
System.out.println("mouseReleased");
}
@Override
public void mousePressed(MouseEvent arg0) {
System.out.println("mousePressed");
}
@Override
public void mouseExited(MouseEvent arg0) {
System.out.println("mouseExited");
//System.out.println(arg0.toString());
}
@Override
public void mouseDragged(MouseEvent arg0) {
System.out.println("mouseDragged");
//System.out.println(arg0.toString());
}
});
frame.setContentPane(panel);
frame.setVisible(true);
frame.setSize(width + frame.getInsets().left + frame.getInsets().right,
height + frame.getInsets().top + frame.getInsets().bottom);
int n = 0;
Mat temp = new Mat();
while (frame.isShowing() && n < 500) {
//System.out.println("第"+n+"张");
capture.read(capImg);
Imgproc.cvtColor(capImg, temp, Imgproc.COLOR_RGB2GRAY);
//Imgcodecs.imwrite("G:/opencv/lw/neg/back"+n+".png", temp);
panel.mImg = panel.mat2BI(detectFace(capImg));
panel.repaint();
//n++;
//break;
}
capture.release();
frame.dispose();
} catch (Exception e) {
System.out.println("例外:" + e);
} finally {
System.out.println("--done--");
}
}
/**
* opencv实现人脸识别
*
* @param img
*/
public static Mat detectFace(Mat img) throws Exception {
System.out.println("Running DetectFace ... ");
// 从配置文件lbpcascade_frontalface.xml中创建一个人脸识别器,该文件位于opencv安装目录中
CascadeClassifier faceDetector = new CascadeClassifier("D:\\TDDOWNLOAD\\opencv\\sources\\data\\haarcascades\\haarcascade_frontalface_alt.xml");
// 在图片中检测人脸
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(img, faceDetections);
//System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
Rect[] rects = faceDetections.toArray();
if (rects != null && rects.length >= 1) {
for (Rect rect : rects) {
Imgproc.rectangle(img, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height),
new Scalar(0, 0, 255), 2);
}
}
return img;
}
/**
* opencv实现人型识别,hog默认的分类器。所以效果不好。
*
* @param img
*/
public static Mat detectPeople(Mat img) {
//System.out.println("detectPeople...");
if (img.empty()) {
System.out.println("image is exist");
}
HOGDescriptor hog = new HOGDescriptor();
hog.setSVMDetector(HOGDescriptor.getDefaultPeopleDetector());
System.out.println(HOGDescriptor.getDefaultPeopleDetector());
//hog.setSVMDetector(HOGDescriptor.getDaimlerPeopleDetector());
MatOfRect regions = new MatOfRect();
MatOfDouble foundWeights = new MatOfDouble();
//System.out.println(foundWeights.toString());
hog.detectMultiScale(img, regions, foundWeights);
for (Rect rect : regions.toArray()) {
Imgproc.rectangle(img, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 0, 255), 2);
}
return img;
}
}
package cn.csbr.app.Facerecognition;
import cn.csbr.app.gui.page.AbstractPage;
import cn.csbr.app.gui.page.AppPage;
import cn.csbr.app.gui.page.useAndBackTab.BackTabPage2;
import cn.csbr.app.gui.page.useAndBackTab.InboundTabPage2;
import cn.csbr.app.gui.page.useAndBackTab.UseTabPage2;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.FrameGrabber;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.Buffer;
public class FaceWindow {
Stage primaryStage;
int isshow = 0;
public void start(Stage stage) {
if(isshow == 1) {
isshow = 0;
primaryStage.close();
}
primaryStage = new Stage();
primaryStage.initOwner(stage);
//primaryStage.initModality(Modality.APPLICATION_MODAL);
primaryStage.initStyle(StageStyle.TRANSPARENT);
VBox root = new VBox();
ImageView imageView=new ImageView();
JavaCvTest javaCvTest=new JavaCvTest();
try {
javaCvTest.open();
Frame frame= javaCvTest.getImage();
Buffer[] buffers=frame.image;
javaCvTest.close();
} catch (FrameGrabber.Exception e) {
e.printStackTrace();
}
InputStream buffin = new ByteArrayInputStream(null, 0,100);
try {
BufferedImage img = ImageIO.read(buffin);
} catch (IOException e) {
e.printStackTrace();
}
// root.getChildren().addAll(hBbtns,lbczr,center,closebtn);
Scene scene = new Scene(root, 600, 1000);
primaryStage.setScene(scene);
primaryStage.setX(70);
primaryStage.setY(120);
root.setStyle("-fx-background-color: white;-fx-border-color: #bababa;-fx-border-insets: 1 1 1 1");
if(isshow == 0) {
isshow = 1;
primaryStage.show();
}
primaryStage.setOnCloseRequest((WindowEvent event)->{
//mainPage.refreturn();
});
}
}
package cn.csbr.app.Facerecognition;
import org.bytedeco.javacv.*;
import javax.swing.*;
public class JavaCvTest {
public static void main(String[] args) {
// try {
// testCamera();
// } catch (InterruptedException e) {
// e.printStackTrace();
// } catch (FrameGrabber.Exception e) {
// e.printStackTrace();
// }
FaceWindow faceWindow=new FaceWindow();
faceWindow.start(null);
}
public static void testCamera() throws InterruptedException, FrameGrabber.Exception {
OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(1);
grabber.start(); //开始获取摄像头数据
CanvasFrame canvas = new CanvasFrame("摄像头");//新建一个窗口
canvas.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
canvas.setAlwaysOnTop(true);
while (true) {
if (!canvas.isDisplayable()) {//窗口是否关闭
grabber.stop();//停止抓取
System.exit(-1);//退出
}
Frame frame = grabber.grab();
canvas.showImage(frame);//获取摄像头图像并放到窗口上显示, 这里的Frame frame=grabber.grab(); frame是一帧视频图像
Thread.sleep(50);//50毫秒刷新一次图像
}
}
OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(1);
public void open() throws FrameGrabber.Exception {
grabber.start();
}
public void close() throws FrameGrabber.Exception {
grabber.stop();//停止抓取
}
public Frame getImage() throws FrameGrabber.Exception {
return grabber.grab();
}
public static void testCamera1() throws FrameGrabber.Exception, InterruptedException {
VideoInputFrameGrabber grabber = VideoInputFrameGrabber.createDefault(1);
grabber.start();
CanvasFrame canvasFrame = new CanvasFrame("摄像头");
canvasFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
canvasFrame.setAlwaysOnTop(true);
while (true) {
if (!canvasFrame.isDisplayable()) {
grabber.stop();
System.exit(-1);
}
Frame frame = grabber.grab();
canvasFrame.showImage(frame);
Thread.sleep(30);
}
}
}
package cn.csbr.app.auth;
import cn.csbr.app.config.FxConfigure;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.app.gui.page.WelcomePage;
import cn.csbr.app.gui.util.DialogUtils;
import javafx.application.Platform;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 检查是否登录权限切面
*/
@Aspect
@Component
public class AuthCheckAspect {
@Autowired
private WelcomePage welcomePage;
@Autowired
private GUIContext guiContext;
@Autowired
private LoginService loginService;
@Autowired
private FxConfigure fxConfigure;
/**
* 配置检查登录的切面范围
*/
@Pointcut("execution(public * cn.csbr.app.service.*.*(..))")
public void authCheck() {
}
/**
* 实际进行登录检查的控制点
*
* @param joinPoint
* @throws Throwable
*/
@Before("authCheck()")
public void deBefore(JoinPoint joinPoint) throws Throwable {
if (fxConfigure.isNodatabase()) {
System.out.println("=================no database:" + joinPoint.getSignature());
return;
}
try {
loginService.checkLogin();
} catch (Exception e) {
loginService.logout();
Platform.runLater(() -> {
DialogUtils.showAlert(e.getMessage(), v -> {
guiContext.updateMainContent(welcomePage.getContent());
});
});
e.printStackTrace();
}
}
/**
* 处理操作后刷新超时时间
*
* @param jp
*/
@After("authCheck()")
public void after(JoinPoint jp) {
loginService.updateAction();
}
}
package cn.csbr.app.auth;
import cn.csbr.springboot.dao.model.Cabinet;
/**
* 耗材柜登录的回调类
*/
public interface LoginCabinetActionCallBack {
public boolean callback(String cardCode, Cabinet cabinet);
}
package cn.csbr.app.auth;
import cn.csbr.app.config.FxConfigure;
import cn.csbr.springboot.dao.mapper.CabinetMapper;
import cn.csbr.springboot.dao.model.Cabinet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/**
* 封装 耗材柜查找 。开柜门 以及扫描刷卡信息等操作
* 这个类用于登录前使用和后边的业务类分开
*/
@Service
public class LoginCabinetService {
@Autowired
private CabinetMapper cabinetMapper;
@Autowired
private FxConfigure fxConfigure;
private List<Cabinet> arrayList;
/**
* 有个固定条件就这个柜子的柜子组
* 查询全部一个柜子组下所有的柜子
*
* @return
*/
public List<Cabinet> queryAllCabinet() {
if (arrayList == null) {
Cabinet cabinet = new Cabinet();
cabinet.setGroupcode(fxConfigure.getCabinetGroupCode());
arrayList = this.queryCabinetByCondition(cabinet);
}
return arrayList;
}
/**
* 有个固定条件就这个柜子的柜子组
*
* @param cabinet
* @return
*/
public List<Cabinet> queryCabinetByCondition(Cabinet cabinet) {
if (cabinet.getGroupcode() == null) {
cabinet.setGroupcode(fxConfigure.getCabinetGroupCode());
}
Example condition = new Example(Cabinet.class);
condition.createCriteria().andEqualTo("cabinetcode", cabinet.getCabinetcode()).andEqualTo("groupcode", cabinet.getGroupcode());
return cabinetMapper.selectByExample(condition);
}
}
package cn.csbr.app.auth;
import cn.csbr.app.config.FxConfigure;
import cn.csbr.app.exception.AuthException;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.app.gui.handler.ToCardInpageHandler;
import cn.csbr.app.gui.util.DialogUtils;
import cn.csbr.app.model.LoginUser;
import javafx.application.Platform;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* 刷卡登录驻留线程启动类
*/
@Service
public class LoginInitService {
Logger logger = LoggerFactory.getLogger(LoginInitService.class);
@Autowired
private LoginService loginService;
@Autowired
private LoginCabinetService cabinetService;
@Autowired
private ToCardInpageHandler toCardInpageHandler;
@Autowired
private FxConfigure fxConfigure;
@Autowired
private GUIContext guiContext;
private boolean noDatabaseLogin() {
try {
loginService.checkLogin();
} catch (Exception e) {
e.printStackTrace();
if (guiContext.getLoginingFlag()) { // 已经登录可以开门
return false;
}
loginService.login(new LoginUser());
Platform.runLater(() -> {
//打开cardloinged 界面
toCardInpageHandler.handle(null);
});
}
return false;
}
}
package cn.csbr.app.auth;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.app.gui.page.MainPage;
import cn.csbr.app.model.LoginUser;
import javafx.application.Platform;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 还没写什么逻辑
* 指纹登录入口
*/
@Service
public class TouchLoginService {
@Autowired
private MainPage mainPage;
@Autowired
private GUIContext context;
@Autowired
private LoginService loginService;
public void touchLogin() {
loginService.login(new LoginUser());
Platform.runLater(() -> {
context.updateMainContent(mainPage.getContent());
});
}
public void holdTouch() {
}
}
package cn.csbr.app;
import cn.csbr.app.gui.GUIContext;
import com.csbr.util.MD5Util;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import java.io.IOException;
import static cn.csbr.app.hardware.HFbwcabinet.HFbwcabinetApi.BWInitCabinet;
//@SpringBootApplication
public class ceshiRfid extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
}
public static void main(String[] args) {
//String s="e10adc3949ba59abbe56e057f20f883e";
String s=MD5Util.md5Encode("111111");
String show = ceshiRfid.show(s);
System.out.println(show);
}
public static String show (String inStr) {
char[] a = inStr.toCharArray();
for(int i =0;i<a.length;i++){
a[i]=(char)(a[i]^'t');
}
String s = new String(a);
return s;
}
}
/*private Stage stage = null;
private GUIContext context;
public static ConfigurableApplicationContext applicationContext;
public static void main(String[] args) {
System.setProperty("jna.encoding", "GBK");
System.setProperty("jna.library.path", "/");
System.setProperty("jna.debug_load", "false");
ceshiRfid.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
// 面板,节点放置在面板中央
Thread thread = new Thread(() -> {
try {
this.stage = primaryStage;
Button button = new Button("退出");
button.setOnMouseClicked((e)->{
System.exit(0);
});
Platform.runLater(()->{
StackPane bp = new StackPane();
GridPane gpButton = new GridPane();
gpButton.add(button,1,0);
bp.getChildren().add(gpButton);
Scene scene = new Scene(bp,300,200);
stage.setScene(scene);
stage.show();
applicationContext = SpringApplication.run(this.getClass());
context = applicationContext.getBean(GUIContext.class);
//启动指纹刷卡线程
BWInitCabinet();
});
}
catch (Exception e) {
e.printStackTrace();
}
});
thread.start();
}
*/
package cn.csbr.app.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
/**
* 所有的配置参数都汇集到这个类里边了
*/
@Component
public class FxConfigure {
/**
* 是否无数据库模式
*/
@Value("${app.nodatabase}")
private boolean nodatabase;
@Value("${app.fx.min.width}")
private double minWidth;
@Value("${app.fx.min.height}")
private double minHeight;
@Value("${app.fx.full.screen}")
private boolean fullScreen;
/**
* 现在没啥用
*/
@Value("${app.title}")
private String appTitle;
// app.welcome.img=cn/csbr/app/ControlsFX.png
/**
* 闪屏图片现在没啥用
*/
@Value("${app.welcome.img}")
private String welcomeImg;
// app.welcome.backgroud.img=cn/csbr/app/bar.png
/**
* 背景图片现在没啥用
*/
@Value("${app.welcome.backgroud.img}")
private String welcomeBackgroundImg;
/**
* session 超时时间
*/
@Value("${app.session.timeout}")
private Integer timout;
/**
* 管理柜子组编码
*/
@Value("${app.cabinet.group.code}")
private String cabinetGroupCode;
/**
* 用户操作的间隔时间
*/
@Value("${app.usedelaytime}")
private Integer usedelaytime;
public Integer getUsedelaytime() {
return usedelaytime;
}
public void setUsedelaytime(Integer usedelaytime) {
this.usedelaytime = usedelaytime;
}
public String getWelcomeImg() {
return welcomeImg;
}
public void setWelcomeImg(String welcomeImg) {
this.welcomeImg = welcomeImg;
}
public String getWelcomeBackgroundImg() {
return welcomeBackgroundImg;
}
public void setWelcomeBackgroundImg(String welcomeBackgroundImg) {
this.welcomeBackgroundImg = welcomeBackgroundImg;
}
//
public String getAppTitle() {
return appTitle;
}
public void setAppTitle(String appTitle) {
this.appTitle = appTitle;
}
public double getMinWidth() {
return minWidth;
}
public void setMinWidth(double minWidth) {
this.minWidth = minWidth;
}
public double getMinHeight() {
return minHeight;
}
public void setMinHeight(double minHeight) {
this.minHeight = minHeight;
}
public boolean isFullScreen() {
return fullScreen;
}
public void setFullScreen(boolean fullScreen) {
this.fullScreen = fullScreen;
}
public Integer getTimout() {
return timout;
}
public void setTimout(Integer timout) {
this.timout = timout;
}
public String getCabinetGroupCode() {
return cabinetGroupCode;
}
public void setCabinetGroupCode(String cabinetGroupCode) {
this.cabinetGroupCode = cabinetGroupCode;
}
public boolean isNodatabase() {
return nodatabase;
}
public void setNodatabase(boolean nodatabase) {
this.nodatabase = nodatabase;
}
}
package cn.csbr.app.exception;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* 自定义的业务异常--需要捕获
*
* @author lid
*/
public class ApiException extends Exception {
private String errorMsg;
public ApiException() {
super("发生错误!");
this.errorMsg = "发生错误!";//默认信息
}
public ApiException(String errorMsg) {
super("发生错误!");
this.errorMsg = errorMsg;//默认信息
}
public <T> ApiException(String msg, Class<T> logObj) {
super(msg);
setErrorMsg(msg);
// 记录日志
Logger logger = LogManager.getLogger(logObj);
logger.error(msg);
}
@Override
public String getMessage() {
return super.getMessage();
}
@Override
public String toString() {
return super.toString();
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
}
package cn.csbr.app.exception;
import java.util.List;
/** 权限相关异常
* Created by tdl on 2017/4/28.
*/
public class AuthException extends RuntimeException {
private int level;
private List<String> codes;
private String message;
public AuthException() {
init();
}
/**
* @param level 错误等级
* @param message 错误原始描述
*/
public AuthException(int level, String message) {
super(message);
this.message = message;
init();
this.level = level;
}
/**
* @param level 错误等级
* @param codes 错误编码集合
* @param message 原始的错误信息
*/
public AuthException(int level, List<String> codes, String message) {
super(message);
this.message = message;
init();
this.level = level;
this.codes = codes;
}
public AuthException(String message) {
super(message);
this.message = message;
init();
}
public AuthException(String message, Throwable cause) {
super(message, cause);
this.message = message;
}
public AuthException(Throwable cause) {
super(cause);
}
public AuthException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
this.message = message;
init();
}
private final void init() {
level = 0;
codes = null;
}
/**
* @return 错误等级
*/
public int getLevel() {
return level;
}
/**
* @return 错误编码,每个元素是一个错误编码
*/
public List<String> getCodes() {
return codes;
}
public String getMessage() {
return this.message;
}
}
package cn.csbr.app.exception;
import java.util.List;
/**业务异常
* Created by tdl on 2017/4/28.
*/
public class LogicException extends RuntimeException {
private int level;
private List<String> codes;
private String message;
public LogicException() {
init();
}
/**
* @param level 错误等级
* @param message 错误原始描述
*/
public LogicException(int level, String message) {
super(message);
this.message = message;
init();
this.level = level;
}
/**
* @param level 错误等级
* @param codes 错误编码集合
* @param message 原始的错误信息
*/
public LogicException(int level, List<String> codes, String message) {
super(message);
this.message = message;
init();
this.level = level;
this.codes = codes;
}
public LogicException(String message) {
super(message);
this.message = message;
init();
}
public LogicException(String message, Throwable cause) {
super(message, cause);
this.message = message;
}
public LogicException(Throwable cause) {
super(cause);
}
public LogicException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
this.message = message;
init();
}
private final void init() {
level = 0;
codes = null;
}
/**
* @return 错误等级
*/
public int getLevel() {
return level;
}
/**
* @return 错误编码,每个元素是一个错误编码
*/
public List<String> getCodes() {
return codes;
}
public String getMessage() {
return this.message;
}
}
package cn.csbr.app.gui;
public interface RefreshCallBack {
void RefreshData();
}
package cn.csbr.app.gui.component.New.table;
import cn.csbr.app.gui.component.common.ActionCallBack;
import cn.hutool.core.convert.Convert;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.AccessibleAttribute;
import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Label;
import javafx.scene.control.TableCell;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import java.awt.*;
/**
* 单按钮的通过操作单元格
* @param <T>
* @param <Y>
*/
public class ActionHboxRow1<T, Y> extends TableCell<T, Y> {
private boolean isbutton=false;
private String btntext="操作";
private EventHandler<ActionEvent> e;
public ActionHboxRow1(boolean isbotton, String btntext, EventHandler<ActionEvent> e) {
this.isbutton=isbotton;
this.btntext=btntext;
this.e=e;
}
@Override
protected void updateItem(Y item, boolean empty) {
if (item != null) {
super.updateItem(item, empty);
Integer colunmindex= Convert.toInt( this.queryAccessibleAttribute(AccessibleAttribute.COLUMN_INDEX));
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
String[] items=item.toString().split(",");
if(this.getIndex()%2==1){
if(colunmindex==2) {
HBox hBox = new HBox();
hBox.setTranslateY(20);
hBox.setTranslateX(20);
VBox vBoxleft = new VBox();
Label label1 = new Label(items[0]);
label1.setStyle("-fx-font-weight: bold");
Label label2 = new Label(items[1]);
label2.setTranslateY(8);
vBoxleft.getChildren().addAll(label1,label2);
VBox vBoxright = new VBox();
Label label3 = new Label(items[2]);
label3.setStyle("-fx-font-weight: bold");
Label label4 = new Label(items[3]);
label4.setTranslateY(8);
vBoxright.setTranslateX(120);
vBoxright.getChildren().addAll(label3,label4);
if(isbutton) {
Button button = new Button(btntext);
if(items.length==5&&items[4]!=null){
button.setUserData(items[4]);
}
button.setOnAction(e);
button.setMaxHeight(40);
button.setMinHeight(40);
button.setMaxWidth(100);
button.setMinWidth(100);
button.setTranslateX(-50);
button.setTranslateY(50);
//button.setText("详情");
button.setStyle("-fx-border-color:#d4d4d4;-fx-border-width:1;-fx-background-color: white;" +
"-fx-border-radius: 10");
vBoxright.getChildren().add(button);
}
hBox.getChildren().addAll(vBoxleft, vBoxright);
setGraphic(hBox);
}else{
VBox hBox = new VBox();
hBox.setTranslateY(20);
Label label1 = new Label(items[0]);
label1.setStyle("-fx-font-weight: bold");
VBox hBoxitems = new VBox();
for (int i = 1; i < items.length; i++) {
Label labeitem = new Label(items[i]);
if ((i == 1) && (colunmindex == 1)) {
labeitem.setStyle("-fx-text-fill: #37b6ed");
}
hBoxitems.getChildren().add(labeitem);
}
hBox.setTranslateX(20);
hBoxitems.setTranslateY(8);
hBox.getChildren().addAll(label1, hBoxitems);
setGraphic(hBox);
}
}else {
HBox hBox=new HBox();
Label labelleft=new Label(items[0]);
labelleft.setTranslateX(20);
labelleft.setStyle("-fx-font-weight: bold");
// labelleft.setStyle("-fx-font-weight: bold");
Label labelright=new Label(items[1]);
if(items[1].equals("报损")) {
labelright.setStyle("-fx-text-fill: red");
}else if(items[1].equals("正常")){
labelright.setStyle("-fx-text-fill: green");
}else {
labelright.setStyle("-fx-text-fill: black");
}
labelright.setTranslateX(40);
hBox.getChildren().addAll(labelleft,labelright);
hBox.setTranslateY(2);
setGraphic(hBox);
}
// hBox.setMinHeight(200);
// hBox.setMaxHeight(200);
}
}
}
package cn.csbr.app.gui.component.New.table;
import cn.csbr.app.gui.component.common.ActionCallBack;
import cn.csbr.app.gui.util.ButtonSize;
import cn.csbr.app.gui.util.ButtonUtils;
import javafx.scene.control.*;
import javafx.scene.layout.HBox;
/**
* 单按钮的通过操作单元格
* @param <T>
* @param <Y>
*/
public class ActionHboxRow2<T, Y> extends TableCell<T, Y> {
//final HBox actionBtn = ButtonUtils.createButton("按钮", ButtonBar.ButtonData.OK_DONE, new ButtonSize(100, 40), null);
private ActionCallBack callBack;
public ActionHboxRow2() {
this.callBack = callBack;
}
@Override
protected void updateItem(Y item, boolean empty) {
if (item != null) {
super.updateItem(item, empty);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
HBox hBox=new HBox();
// hBox.setMinHeight(200);
// hBox.setMaxHeight(200);
setGraphic(hBox);
}
}
}
package cn.csbr.app.gui.component.New.table;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.app.gui.page.query.UseQueryDetailPage;
import cn.csbr.app.model.TableModelTest;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.util.EventListener;
import java.util.List;
import static cn.csbr.app.FxApp.applicationContext;
import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
/**
* 消耗记录表
*/
public class DomeButtonFeeTable extends TableView<TableModelTest> {
private final TableColumn<TableModelTest, String> index = new TableColumn<>("列1");
private final TableColumn<TableModelTest, String> checkType = new TableColumn<>("列2");
private final TableColumn<TableModelTest, String> traceCode = new TableColumn<>("列3");
private EventHandler<ActionEvent> e2;
public ObservableList<TableModelTest> items;
private String txt="详情";
public void setBtnTxt(String txt){
this.txt=txt;
}
public DomeButtonFeeTable(EventHandler<ActionEvent> e2) {
index.setPrefWidth(200);
this.e2=e2;
items = FXCollections.observableArrayList();
setItems(items);
index.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getLeft()));
index.setPrefWidth(230);
index.setCellFactory(p -> {
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(false,null,null);
return hBox;
});
checkType.setCellValueFactory(p -> {
return new SimpleStringProperty(p.getValue().getCentre());
});
checkType.setCellFactory(e->{
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(false,null,null);
return hBox;
});
checkType.setPrefWidth(240);
traceCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getRight()));
traceCode.setCellFactory(p -> {
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(true,txt,e2);
return hBox;
});
traceCode.setPrefWidth(230);
getColumns().setAll(index, checkType,traceCode);
this.setMinHeight(getDataTableMinHeight(60));
this.getStylesheets().add("styles/inboundtableNew.css");
this.setId("#tableView_memory");
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
this.setWidth(getScreenWidth()+30);
this.setMinWidth(getScreenWidth()+30);
this.setEditable(false);
this.setStyle("-fx-font-size: 1.2em;");
this.getStyleClass().add("remove-scroll");
ObservableList<TableColumn<TableModelTest,?>> columns= getColumns();
for(TableColumn column:columns){
column.setStyle("-fx-wrap-text:true;-fx-text-alignment: center;-fx-alignment: baseline-center;");
}
}
public synchronized ObservableList<TableModelTest> generateData(List<TableModelTest> datas) {
items.addAll(datas);
return items;
}
public void updateDatas(List<TableModelTest> datas) {
generateData(datas);
}
//清除原有数据的更新
public void clearUpdateDatas(List<TableModelTest> datas) {
items.clear();
generateData(datas);
}
public void pop(UseQueryDetailPage useQueryDetailPage) {
Stage primaryStage = new Stage();
GUIContext guiContext = applicationContext.getBean(GUIContext.class);
primaryStage.initModality(Modality.APPLICATION_MODAL);
primaryStage.initOwner(guiContext.getPrimaryStage());
BorderPane root = new BorderPane();
AnchorPane anchor = new AnchorPane();
anchor.getChildren().addAll(useQueryDetailPage.createContent());
//anchor.getChildren().add(new Button("test"));
root.setCenter(anchor);
Scene scene = new Scene(root, 720, 800);
primaryStage.resizableProperty().setValue(Boolean.FALSE);
primaryStage.setScene(scene);
primaryStage.getScene().getStylesheets().add(getClass().getResource("/styles/commonNew.css").toExternalForm());
primaryStage.setTitle("详情信息");
primaryStage.show();
}
}
package cn.csbr.app.gui.component.New.table;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.app.gui.page.query.UseQueryDetailPage;
import cn.csbr.app.gui.util.DialogUtils;
import cn.csbr.app.model.TableModelTest;
import cn.csbr.springboot.dao.model.Mfcubestockstatement;
import com.alibaba.fastjson.JSON;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.util.List;
import static cn.csbr.app.FxApp.applicationContext;
import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
/**
* 操作记录表
*/
public class DomeButtonTable extends TableView<TableModelTest> {
private final TableColumn<TableModelTest, String> index = new TableColumn<>("列1");
private final TableColumn<TableModelTest, String> checkType = new TableColumn<>("列2");
private final TableColumn<TableModelTest, String> traceCode = new TableColumn<>("列3");
private String txt="详情";
public void setBtnTxt(String txt){
this.txt=txt;
}
public ObservableList<TableModelTest> items;
public DomeButtonTable() {
index.setPrefWidth(200);
items = FXCollections.observableArrayList();
setItems(items);
index.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getLeft()));
index.setPrefWidth(230);
index.setCellFactory(p -> {
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(false,null,null);
return hBox;
});
checkType.setCellValueFactory(p -> {
return new SimpleStringProperty(p.getValue().getCentre());
});
checkType.setCellFactory(e->{
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(false,null,null);
return hBox;
});
checkType.setPrefWidth(240);
traceCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getRight()));
traceCode.setCellFactory(p -> {
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(true,txt,e->{
UseQueryDetailPage useQueryDetailPage = applicationContext.getBean(UseQueryDetailPage.class);
String barcode= ((Button)e.getSource()).getUserData().toString();
// Mfcubestockstatement mfcubestockstatement = JSON.parseObject(JSON.toJSONString(value),Mfcubestockstatement.class);
pop(useQueryDetailPage);
useQueryDetailPage.queryDetailUseData(barcode);
});
return hBox;
});
traceCode.setPrefWidth(230);
getColumns().setAll(index, checkType,traceCode);
this.setMinHeight(getDataTableMinHeight(60));
this.getStylesheets().add("styles/inboundtableNew.css");
this.setId("#tableView_memory");
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
this.setWidth(getScreenWidth()+30);
this.setMinWidth(getScreenWidth()+30);
this.setEditable(false);
this.setStyle("-fx-font-size: 1.2em;");
this.getStyleClass().add("remove-scroll");
ObservableList<TableColumn<TableModelTest,?>> columns= getColumns();
for(TableColumn column:columns){
column.setStyle("-fx-wrap-text:true;-fx-text-alignment: center;-fx-alignment: baseline-center;");
}
}
public synchronized ObservableList<TableModelTest> generateData(List<TableModelTest> datas) {
items.addAll(datas);
return items;
}
public void updateDatas(List<TableModelTest> datas) {
generateData(datas);
}
//清除原有数据的更新
public void clearUpdateDatas(List<TableModelTest> datas) {
items.clear();
generateData(datas);
}
public void pop(UseQueryDetailPage useQueryDetailPage) {
Stage primaryStage = new Stage();
GUIContext guiContext = applicationContext.getBean(GUIContext.class);
primaryStage.initModality(Modality.APPLICATION_MODAL);
primaryStage.initOwner(guiContext.getPrimaryStage());
BorderPane root = new BorderPane();
AnchorPane anchor = new AnchorPane();
anchor.getChildren().addAll(useQueryDetailPage.createContent());
//anchor.getChildren().add(new Button("test"));
root.setCenter(anchor);
Scene scene = new Scene(root, 720, 800);
primaryStage.resizableProperty().setValue(Boolean.FALSE);
primaryStage.setScene(scene);
primaryStage.getScene().getStylesheets().add(getClass().getResource("/styles/commonNew.css").toExternalForm());
primaryStage.setTitle("详情信息");
primaryStage.show();
}
}
package cn.csbr.app.gui.component.New.table;
import cn.csbr.app.gui.component.common.RowIndexCell;
import cn.csbr.app.model.InboundItem;
import cn.csbr.app.model.TableModelTest;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.layout.Border;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
/**
* 盘点表
*/
public class DomeTable extends TableView<TableModelTest> {
private final TableColumn<TableModelTest, String> index = new TableColumn<>("列1");
private final TableColumn<TableModelTest, String> checkType = new TableColumn<>("列2");
private final TableColumn<TableModelTest, String> traceCode = new TableColumn<>("列3");
public ObservableList<TableModelTest> items;
public DomeTable() {
index.setPrefWidth(200);
items = FXCollections.observableArrayList();
setItems(items);
index.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getLeft()));
index.setPrefWidth(230);
index.setCellFactory(p -> {
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(false,null,null);
return hBox;
});
checkType.setCellValueFactory(p -> {
return new SimpleStringProperty(p.getValue().getCentre());
});
checkType.setCellFactory(e->{
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(false,null,null);
return hBox;
});
checkType.setPrefWidth(240);
traceCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getRight()));
traceCode.setCellFactory(p -> {
ActionHboxRow1 hBox=new ActionHboxRow1<TableModelTest, String>(false,null,null);
return hBox;
});
traceCode.setPrefWidth(230);
getColumns().setAll(index, checkType,traceCode);
this.setMinHeight(getDataTableMinHeight(60));
this.getStylesheets().add("styles/inboundtableNew.css");
this.setId("#tableView_memory");
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
this.setWidth(getScreenWidth()+30);
this.setMinWidth(getScreenWidth()+30);
this.setEditable(false);
this.setStyle("-fx-font-size: 1.2em;");
this.getStyleClass().add("remove-scroll");
ObservableList<TableColumn<TableModelTest,?>> columns= getColumns();
for(TableColumn column:columns){
column.setStyle("-fx-wrap-text:true;-fx-text-alignment: center;-fx-alignment: baseline-center;");
}
}
public synchronized ObservableList<TableModelTest> generateData(List<TableModelTest> datas) {
items.addAll(datas);
return items;
}
public void updateDatas(List<TableModelTest> datas) {
generateData(datas);
}
//清除原有数据的更新
public void clearUpdateDatas(List<TableModelTest> datas) {
items.clear();
generateData(datas);
}
}
package cn.csbr.app.gui.component.New.table;
import cn.csbr.app.gui.util.CsButtonGroup;
import cn.csbr.app.gui.util.DialogUtils;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.*;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
public class WaitFrm {
Stage primaryStage;
Thread thread=null;
private volatile boolean loadflag=false;
public void start(Stage stage,int x,int y,int w,int h) {
start(stage,x,y,w,h,-1);
}
public void start(Stage stage,int x,int y,int w,int h,int timeout) {
primaryStage = new Stage();
primaryStage.centerOnScreen();
primaryStage.initOwner(stage);
StackPane root = new StackPane();
Scene scene = new Scene(root, w,h );
primaryStage.initStyle(StageStyle.UNDECORATED);
ImageView imageView=new ImageView("images/New/jz.png");
imageView.setFitWidth(50);
imageView.setFitHeight(50);
root.getChildren().add(imageView);
primaryStage.setX(0);
primaryStage.setY(0);
root.setStyle("-fx-background-color: a0a29f");
primaryStage.setScene(scene);
primaryStage.setOpacity(0.5);
primaryStage.show();
loadflag=true;
if(timeout>0){
thread=new Thread(()->{
try {
Thread.sleep(timeout);
} catch (InterruptedException e) {
e.printStackTrace();
}
Platform.runLater(()->{
if(loadflag) {
closeFrm();
DialogUtils.showAlert("数据加载超时", e -> {
}, stage);
}
});
});
thread.start();
}
}
public void closeFrm(){
if(loadflag) {
primaryStage.close();
loadflag=false;
}
// new Thread(()->{
// //看弹框效果
//// try {
//// Thread.sleep(2000);
//// } catch (InterruptedException e) {
//// e.printStackTrace();
//// }
// Platform.runLater(()->{
// if(loadflag) {
// primaryStage.close();
// loadflag=false;
// }
// });
// }).start();
}
}
package cn.csbr.app.gui.component.back;
import cn.csbr.app.gui.page.back.BackMainPage;
import cn.csbr.app.gui.util.ButtonSize;
import cn.csbr.app.gui.util.ButtonUtils;
import cn.csbr.app.gui.util.DialogUtils;
import cn.csbr.app.model.InboundItem;
import cn.csbr.springboot.dao.model.Cabinet;
import javafx.scene.control.*;
import java.util.ArrayList;
import java.util.List;
public class BackButtonCell extends TableCell<InboundItem, InboundItem> {
final Button addButton = ButtonUtils.createButton("确认入库", ButtonBar.ButtonData.OK_DONE, new ButtonSize(100, 40), null);
final Label label = new Label("已确认");
private BackMainPage page;
public BackButtonCell(BackMainPage page) {
this.page = page;
}
@Override
protected void updateItem(InboundItem item, boolean empty) {
if (item == null||empty) {
return;
}
super.updateItem(item, empty);
if (!empty && item.getIfInCabinet() != null) {
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(label);
} else {
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(addButton);
List<String> titles = new ArrayList();
List<Cabinet> cabinets = page.getCabinets();
for (Cabinet cabinet : cabinets) {
titles.add(cabinet.getCabinetcode());
}
addButton.setOnAction(e -> {
//要弹出个窗体选择耗材柜
DialogUtils.showCommand("请选择耗材柜!", p -> {
item.setIfInCabinet((byte) 1);
for (Cabinet cabinet : cabinets) {
if (cabinet.getCabinetcode().equals(p)) {
item.setAllocationGuid(cabinet.getGuid());
item.setAllocation(cabinet.getCabinetcode());
break;
}
}
}, titles, page.getCabinets(),null);
});
}
}
}
package cn.csbr.app.gui.component.back;
import cn.csbr.app.gui.component.common.RowIndexCell;
import cn.csbr.app.gui.page.back.BackMainPage;
import cn.csbr.app.model.InboundItem;
import cn.hutool.core.date.DateUtil;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.util.StringConverter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
public class BackTable extends TableView<InboundItem> {
private final TableColumn<InboundItem, String> ifInCabinet = new TableColumn<>("入柜状态");
private final TableColumn<InboundItem, Integer> index = new TableColumn<>("行号");
private final TableColumn<InboundItem, Date> srcInboundDate = new TableColumn<>("入库时间");
private final TableColumn<InboundItem, String> srcOrderCode = new TableColumn<>("入库单号");
private final TableColumn<InboundItem, String> traceCode = new TableColumn<>("追溯码");
private final TableColumn<InboundItem, String> supplierName = new TableColumn<>("供应商");
private final TableColumn<InboundItem, String> goods = new TableColumn<>("商品信息");
private final TableColumn<InboundItem, String> batchNo = new TableColumn<>("批号");
private final TableColumn<InboundItem, String> allocation = new TableColumn<>("货柜号");
private final TableColumn<InboundItem, Integer> scanQty = new TableColumn<>("数量");
private final TableColumn<InboundItem, InboundItem> action = new TableColumn<>("操作");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
ObservableList<InboundItem> items;
private BackMainPage page;
public BackTable(BackMainPage page) {
items = FXCollections.observableArrayList();
setItems(items);
this.page = page;
srcOrderCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getSrcOrderCode()));
srcOrderCode.setCellFactory(TextFieldTableCell.forTableColumn());
srcOrderCode.setPrefWidth(180);
traceCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getTraceCode()));
traceCode.setCellFactory(TextFieldTableCell.forTableColumn());
traceCode.setPrefWidth(110);
supplierName.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getSupplierName()));
supplierName.setCellFactory(TextFieldTableCell.forTableColumn());
supplierName.setPrefWidth(110);
goods.setCellValueFactory(p -> {
SimpleStringProperty goodsString = new SimpleStringProperty();
InboundItem item = p.getValue();
StringBuilder content = new StringBuilder();
content.append(item.getGoodscode() == null ? "" : item.getGoodscode()).append("\n").append(item.getGoodsname() == null ? "" : item.getGoodsname())
.append("\n").append(item.getGoodsspec() == null ? "" : item.getGoodsspec()).append("\n").append(item.getUnit() == null ? "" : item.getUnit()).append("\n")
.append(item.getManufacturer() == null ? "" : item.getManufacturer()).append("\n").append(item.getRegistkey() == null ? "" : item.getRegistkey());
goodsString.set(content.toString());
return goodsString;
});
goods.setCellFactory(TextFieldTableCell.forTableColumn());
goods.setPrefWidth(190);
batchNo.setCellValueFactory(p -> {
String str = p.getValue().getBacthCode() + "\n" + df.format(p.getValue().getProductiondate()) + "\n" + df.format(p.getValue().getExpiredate());
return new SimpleStringProperty(str);
}
);
batchNo.setCellFactory(TextFieldTableCell.forTableColumn());
batchNo.setPrefWidth(120);
allocation.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getAllocation()));
allocation.setCellFactory(TextFieldTableCell.forTableColumn());
allocation.setPrefWidth(110);
index.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
index.setPrefWidth(50);
index.setCellFactory(p -> {
return new RowIndexCell();
});
//index.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
scanQty.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
scanQty.setPrefWidth(50);
scanQty.setCellFactory(TextFieldTableCell.forTableColumn(new StringConverter<Integer>() {
@Override
public String toString(Integer object) {
return String.valueOf(object);
}
@Override
public Integer fromString(String string) {
return Integer.parseInt(string);
}
}));
// scanQty.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
srcInboundDate.setCellValueFactory(p -> new SimpleObjectProperty<Date>(p.getValue().getSrcInboundDate()));
srcInboundDate.setPrefWidth(100);
srcInboundDate.setCellFactory(TextFieldTableCell.forTableColumn(new StringConverter<Date>() {
@Override
public String toString(Date date) {
if (date == null) {
return "";
}
return DateUtil.formatDate(date);
}
@Override
public Date fromString(String string) {
return DateUtil.parse(string);
}
}));
//srcInboundDate.setStyle("-fx-text-alignment:center;-fx-alignment:center;");
ifInCabinet.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getIfInCabinet() == null ? "未入柜" : "已入柜"));
// ifInCabinet.setCellFactory(CheckBoxTableCell.forTableColumn(ifInCabinet));
ifInCabinet.setCellFactory(TextFieldTableCell.forTableColumn());
ifInCabinet.setStyle("-fx-text-alignment:center;-fx-alignment:center;");
ifInCabinet.setPrefWidth(100);
action.setPrefWidth(150);
action.setCellValueFactory(p -> new SimpleObjectProperty<InboundItem>(p.getValue()));
action.setCellFactory(p -> {
return new BackButtonCell(page);
});
// action.setStyle("-fx-text-alignment:center;-fx-alignment:center;");
getColumns().setAll(index, ifInCabinet, srcInboundDate, srcOrderCode, traceCode, supplierName, goods, batchNo, allocation, scanQty, action);
ObservableList<TableColumn<InboundItem, ?>> columns = getColumns();
for (TableColumn column : columns) {
column.setStyle("-fx-wrap-text:true;-fx-text-alignment:center;-fx-alignment: baseline-center;");
}
// this.rowHeaderVisibleProperty().setValue(true);
// this.setPadding(new Insets(0,50,0,50));
// this.setFixedCellSize(300);
// getFixedColumns().setAll(ifInCabinet,srcInboundDate, srcOrderCode, traceCode, supplierName,goods);
// this.setStyle("-fx-fixed-cell-size:5em");
this.getStylesheets().add("styles/inboundtable.css");
// this.columnResizePolicyProperty().setValue(TableView.CONSTRAINED_RESIZE_POLICY);
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
// this.setManaged(true);
this.setWidth(getScreenWidth());
this.setMinWidth(getScreenWidth());
this.setMinHeight(getDataTableMinHeight(65));
this.setEditable(false);
// this.setSelectionModel();
this.setStyle("-fx-font-size: 1.2em;");
}
private synchronized ObservableList<InboundItem> generateData(List<InboundItem> datas) {
if (datas != null) {
items.addAll(datas);
}
return items;
}
public synchronized void updateDatas(String cabeName, List<InboundItem> datas) {
int icount = items.size();
List<InboundItem> removes = new ArrayList<>();
for (int i = 0; i < icount; i++) {
if (items.get(i).getAllocation().equals(cabeName)) {
removes.add(items.get(i));
}
}
if (!removes.isEmpty()) {
items.removeAll(removes);
}
generateData(datas);
// setItems(generateData(datas));
this.refresh();
}
public void updateDatas(List<InboundItem> datas) {
generateData(datas);
this.refresh();
}
}
//package cn.csbr.app.gui.component.banlance;
//
//import cn.csbr.app.gui.component.common.ActionButton;
//import cn.csbr.app.gui.component.common.RowIndexCell;
//import cn.csbr.app.gui.page.banlance.BanlanceMainPage;
//import cn.csbr.app.model.InboundItem;
//import javafx.beans.property.SimpleObjectProperty;
//import javafx.beans.property.SimpleStringProperty;
//import javafx.collections.FXCollections;
//import javafx.collections.ObservableList;
//import javafx.scene.control.TableColumn;
//import javafx.scene.control.TableView;
//import javafx.scene.control.cell.TextFieldTableCell;
//import javafx.util.StringConverter;
//
//import java.text.DateFormat;
//import java.text.SimpleDateFormat;
//import java.util.List;
//
//import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
//import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
//
//public class BanlanceTable extends TableView<InboundItem> {
// private final TableColumn<InboundItem, Integer> index = new TableColumn<>("行号");
// private final TableColumn<InboundItem, String> checkType = new TableColumn<>("类型");
// private final TableColumn<InboundItem, String> traceCode = new TableColumn<>("追溯码");
// private final TableColumn<InboundItem, String> supplierName = new TableColumn<>("供应商");
// private final TableColumn<InboundItem, String> goods = new TableColumn<>("商品信息");
// private final TableColumn<InboundItem, String> batchNo = new TableColumn<>("批号");
// private final TableColumn<InboundItem, String> allocation = new TableColumn<>("货柜号");
// private final TableColumn<InboundItem, Integer> scanQty = new TableColumn<>("数量");
// private final TableColumn<InboundItem, InboundItem> action = new TableColumn<>("操作");
// DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
// ObservableList<InboundItem> items;
// private BanlanceMainPage page;
//
// public BanlanceTable(BanlanceMainPage page) {
// items = FXCollections.observableArrayList();
// setItems(items);
// this.page = page;
//
// checkType.setCellValueFactory(p -> {
// String value = p.getValue().getCheckType();
// String title = "无误";
// if ("2".equals(value)) {
// title = "报损";
// } else if ("3".equals(value)) {
// title = "报溢";
// } //4 he5 的状态也算作无误
// return new SimpleStringProperty(title);
// });
//
// checkType.setCellFactory(TextFieldTableCell.forTableColumn());
// checkType.setPrefWidth(110);
//
// traceCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getTraceCode()));
// traceCode.setCellFactory(TextFieldTableCell.forTableColumn());
// traceCode.setPrefWidth(180);
//
// supplierName.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getSupplierName()));
// supplierName.setCellFactory(TextFieldTableCell.forTableColumn());
// supplierName.setPrefWidth(180);
//
// goods.setCellValueFactory(p -> {
// SimpleStringProperty goodsString = new SimpleStringProperty();
// InboundItem item = p.getValue();
// StringBuilder content = new StringBuilder();
// content.append(item.getGoodsname())
// .append("\n").append(item.getUnit()).append("\n");
// goodsString.set(content.toString());
// return goodsString;
// });
// goods.setCellFactory(TextFieldTableCell.forTableColumn());
// goods.setPrefWidth(220);
//
// batchNo.setCellValueFactory(p -> {
// String str = p.getValue().getBacthCode() + "\n" + df.format(p.getValue().getProductiondate()) + "\n" + df.format(p.getValue().getExpiredate());
// return new SimpleStringProperty(str);
// }
// );
// batchNo.setCellFactory(TextFieldTableCell.forTableColumn());
// batchNo.setPrefWidth(180);
//
// allocation.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getAllocation()));
// allocation.setCellFactory(TextFieldTableCell.forTableColumn());
// allocation.setPrefWidth(150);
//
// index.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
// index.setPrefWidth(50);
// index.setCellFactory(p -> {
// return new RowIndexCell();
// });
// //index.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
//
// scanQty.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
// scanQty.setPrefWidth(50);
// scanQty.setCellFactory(TextFieldTableCell.forTableColumn(new StringConverter<Integer>() {
// @Override
// public String toString(Integer object) {
// return String.valueOf(object);
// }
//
// @Override
// public Integer fromString(String string) {
// return Integer.parseInt(string);
// }
// }));
// // scanQty.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
//
// action.setPrefWidth(150);
// action.setCellValueFactory(p -> new SimpleObjectProperty<InboundItem>(p.getValue()));
// action.setCellFactory(p -> {
// return new ActionButton<InboundItem, InboundItem>("删除", e -> {
// page.deleteItem(e);
// });
// });
// //action.setStyle("-fx-text-alignment:center;-fx-alignment:center;");
// getColumns().setAll(index, checkType, traceCode, supplierName, goods, batchNo, allocation, scanQty, action);
//
// this.getStylesheets().add("styles/inboundtable.css");
// this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
// this.setWidth(getScreenWidth());
// this.setMinWidth(getScreenWidth());
// this.setMinHeight(getDataTableMinHeight());
// this.setEditable(false);
//
// this.setStyle("-fx-font-size: 1.2em;");
// ObservableList<TableColumn<InboundItem, ?>> columns = getColumns();
// for (TableColumn column : columns) {
// column.setStyle("-fx-wrap-text:true;");
// }
// }
//
// private ObservableList<InboundItem> generateData(List<InboundItem> datas) {
// items.clear();
// items.addAll(datas);
// return items;
// }
//
// public void updateDatas(List<InboundItem> datas) {
// generateData(datas);
// this.refresh();
// }
//}
package cn.csbr.app.gui.component.callback;
/**
* 分页查询设置回调.
*
* @author fenglinz
* @since 2018-10-17
*/
public interface PagedQuerySettingCallback {
/**
* 获取当前页码.
*
* @return 当前页码
*/
int getCurrentPage();
/**
* 获取每页显示的数据大小.
*
* @return 每页显示数据大小
*/
int getPageSize();
}
package cn.csbr.app.gui.component.check;
import cn.csbr.app.gui.page.check.CheckMainPage;
import cn.csbr.app.gui.util.ButtonSize;
import cn.csbr.app.gui.util.ButtonUtils;
import cn.csbr.app.gui.util.DialogUtils;
import cn.csbr.app.model.InboundItem;
import cn.csbr.app.service.BackService;
import cn.csbr.app.service.CheckService;
import cn.csbr.app.util.Convertor;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class CheckButtonCell extends TableCell<InboundItem, InboundItem> {
final Button loseButton = ButtonUtils.createButton("登记报损", ButtonBar.ButtonData.OK_DONE, new ButtonSize(100, 40), null);
final Button bfullButton = ButtonUtils.createButton("登记报溢", ButtonBar.ButtonData.OK_DONE, new ButtonSize(100, 40), null);
final Button rightButton = ButtonUtils.createButton("确认正确", ButtonBar.ButtonData.OK_DONE, new ButtonSize(100, 40), null);
final Label label = new Label("已确认");
private CheckMainPage page;
public CheckButtonCell(CheckMainPage page) {
this.page = page;
}
@Override
protected void updateItem(InboundItem item, boolean empty) {
if (item == null || empty) {
return;
}
super.updateItem(item, empty);
rightButton.setOnAction(e -> {
item.setConfirmFlag("1");
if (item.getCheckType().equals("2")) {
item.setCheckType("4");
} else if (item.getCheckType().equals("3")) {
item.setCheckType("5");
}
page.updateTable();
});
loseButton.setOnAction(e -> {
item.setConfirmFlag("1");
page.updateTable();
// //报损删除detail库存,更新cubestock表,记录mfcubestockstatement表状态7
// DialogUtils.showConfirm("确定则删除该药品库存,是否继续?", v -> {
// page.checkDeleteCabinetInfo(item);
// page.updatecheckdeleteData(item);
// page.updateTable();
// }, page.getGuiContext().getPrimaryStage());
});
bfullButton.setOnAction(e -> {
item.setConfirmFlag("1");
// //报溢执行还货操作
// List<InboundItem> items = new ArrayList<InboundItem>();
// items.add(item);
// page.saveInCabinetInfo(items);
page.updateTable();
});
if (item.getConfirmFlag().equals("1")) {
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(label);
} else {
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
VBox vBox = new VBox();
if (item.getCheckType().equals("2")) {
vBox.getChildren().addAll(rightButton, loseButton);
} else {
vBox.getChildren().addAll(rightButton, bfullButton);
}
vBox.setSpacing(4);
setGraphic(vBox);
//需要添加button的业务逻辑
}
}
}
package cn.csbr.app.gui.component.check;
import cn.csbr.app.gui.component.common.RowIndexCell;
import cn.csbr.app.gui.page.check.CheckMainPage;
import cn.csbr.app.model.InboundItem;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.paint.Color;
import javafx.util.Callback;
import javafx.util.StringConverter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
/**
* 盘点表
*/
public class CheckTable extends TableView<InboundItem> {
private final TableColumn<InboundItem, Integer> index = new TableColumn<>("行号");
private final TableColumn<InboundItem, String> checkType = new TableColumn<>("盘点状态");
private final TableColumn<InboundItem, String> traceCode = new TableColumn<>("追溯码");
private final TableColumn<InboundItem, String> supplierName1 = new TableColumn<>("生产厂商");
private final TableColumn<InboundItem, String> supplierName = new TableColumn<>("供应商");
private final TableColumn<InboundItem, String> goods = new TableColumn<>("商品信息");
private final TableColumn<InboundItem, String> batchNo = new TableColumn<>("批号");
private final TableColumn<InboundItem, String> allocation = new TableColumn<>("货柜号");
private final TableColumn<InboundItem, String> goodscode = new TableColumn<>("货柜号");
// private final TableColumn<InboundItem, String> model = new TableColumn<>("规格型号");
//private final TableColumn<InboundItem, Integer> scanQty = new TableColumn<>("数量");
// private final TableColumn<InboundItem, InboundItem> action = new TableColumn<>("操作");
public ObservableList<InboundItem> items;
DateFormat df=new SimpleDateFormat("yyyy-MM-dd");
private CheckMainPage page;
public CheckTable(CheckMainPage page) {
index.setPrefWidth(30);
checkType.setMinWidth(100);
traceCode.setMinWidth(250);
supplierName.setMinWidth(170);
goods.setMinWidth(250);
batchNo.setMinWidth(180);
allocation.setMinWidth(170);
// action.setMinWidth(150);
// model.setMinWidth(100);
// scanQty.setMinWidth(100);
// action.setMinWidth(150);
items = FXCollections.observableArrayList();
setItems(items);
this.page = page;
checkType.setCellValueFactory(p -> {
String value = p.getValue().getCheckType();
String title = "无误";
if ("2".equals(value)) {
title = "报损";
} else if ("3".equals(value)) {
title = "报溢";
} //4 he5 的状态也算作无误
return new SimpleStringProperty(title);
});
checkType.setCellFactory(new Callback<TableColumn<InboundItem, String>, TableCell<InboundItem, String>>() {
@Override
public TableCell<InboundItem, String> call(TableColumn<InboundItem, String> param) {
return new TableCell<InboundItem, String>() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (!isEmpty()) {
ObservableValue<String> vo = getTableColumn().getCellObservableValue(getIndex());
if (this.getTableRow() != null) {
if ("报损".equalsIgnoreCase(vo.getValue())) {
this.setTextFill(Color.RED);
} else if("报溢".equalsIgnoreCase(vo.getValue())) {
this.setTextFill(Color.YELLOW);
} else if ("无误".equalsIgnoreCase(vo.getValue())){
this.setTextFill(Color.DARKGREEN);
}
}
setText(item);
}
}
};
}
});;
checkType.setPrefWidth(100);
traceCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getTraceCode()));
traceCode.setCellFactory(TextFieldTableCell.forTableColumn());
traceCode.setPrefWidth(110);
supplierName.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getSupplierName()));
supplierName.setCellFactory(TextFieldTableCell.forTableColumn());
supplierName.setPrefWidth(110);
supplierName1.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getProducer()));
supplierName1.setCellFactory(TextFieldTableCell.forTableColumn());
supplierName1.setPrefWidth(110);
goods.setCellValueFactory(p -> {
SimpleStringProperty goodsString = new SimpleStringProperty();
InboundItem item = p.getValue();
StringBuilder content = new StringBuilder();
content.append(item.getGoodsname())
.append("\n").append(item.getModel()+"\n").append(item.getUnit()).append("\n");
goodsString.set(content.toString());
return goodsString;
});
goods.setCellFactory(TextFieldTableCell.forTableColumn());
goods.setPrefWidth(180);
// model.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getModel()));
// model.setCellFactory(TextFieldTableCell.forTableColumn());
// model.setPrefWidth(110);
batchNo.setCellValueFactory(p -> {
InboundItem value = p.getValue();
String proDate = "";
String expDate = "";
if (value.getProductiondate() != null) {
proDate = df.format(value.getProductiondate());
}
if (value.getExpiredate() != null) {
expDate = df.format(value.getExpiredate());
}
String str=value.getBacthCode()+"\n"+proDate+"\n"+expDate;
return new SimpleStringProperty(str);
}
);
batchNo.setCellFactory(TextFieldTableCell.forTableColumn());
batchNo.setPrefWidth(110);
goodscode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getGoodscode()));
goodscode.setCellFactory(TextFieldTableCell.forTableColumn());
goodscode.setPrefWidth(0);
allocation.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getAllocation()));
allocation.setCellFactory(TextFieldTableCell.forTableColumn());
allocation.setPrefWidth(110);
index.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
index.setPrefWidth(50);
index.setCellFactory(p -> {
return new RowIndexCell();
});
//index.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
/* scanQty.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
scanQty.setPrefWidth(50);
scanQty.setCellFactory(TextFieldTableCell.forTableColumn(new StringConverter<Integer>() {
@Override
public String toString(Integer object) {
return String.valueOf(object);
}
@Override
public Integer fromString(String string) {
return Integer.parseInt(string);
}
}));*/
// action.setPrefWidth(150);
// action.setCellValueFactory(p -> new SimpleObjectProperty<InboundItem>(p.getValue()));
// action.setCellFactory(p -> {
// return new CheckButtonCell(page);
// });
// action.setStyle("-fx-text-alignment:center;-fx-alignment:center;");
// getColumns().setAll(index, checkType, traceCode, supplierName, goods, batchNo, allocation, scanQty,action);
getColumns().setAll(index, checkType,supplierName1, supplierName, goods, batchNo, allocation,traceCode,goodscode);
this.setMinHeight(getDataTableMinHeight(60));
this.getStylesheets().add("styles/inboundtable.css");
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
this.setWidth(getScreenWidth());
this.setMinWidth(getScreenWidth());
this.setEditable(false);
this.setStyle("-fx-font-size: 1.2em;");
ObservableList<TableColumn<InboundItem,?>> columns= getColumns();
for(TableColumn column:columns){
column.setStyle("-fx-wrap-text:true;-fx-text-alignment: center;-fx-alignment: baseline-center;");
}
}
public synchronized ObservableList<InboundItem> generateData(List<InboundItem> datas) {
// items.clear();
items.addAll(datas);
return items;
}
public void updateDatas(List<InboundItem> datas) {
generateData(datas);
}
//清除原有数据的更新
public void clearUpdateDatas(List<InboundItem> datas) {
items.clear();
generateData(datas);
}
public synchronized void updateDatas(String cabeName,List<InboundItem> datas) {
int icount=items.size();
List<InboundItem> removes = new ArrayList<>();
for (int i = 0; i <icount; i++) {
if (items.get(i).getAllocation().equals(cabeName)) {
removes.add(items.get(i));
}
}
if(!removes.isEmpty()){
items.removeAll(removes);
}
generateData(datas);
this.refresh();
}
}
package cn.csbr.app.gui.component.common;
import cn.csbr.app.gui.util.ButtonSize;
import cn.csbr.app.gui.util.ButtonUtils;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.TableCell;
/**
* 单按钮的通过操作单元格
* @param <T>
* @param <Y>
*/
public class ActionButton<T, Y> extends TableCell<T, Y> {
final Button actionBtn = ButtonUtils.createButton("按钮", ButtonBar.ButtonData.OK_DONE, new ButtonSize(100, 40), null);
private ActionCallBack callBack;
public ActionButton(String title, ActionCallBack<Y> callBack) {
actionBtn.setText(title);
this.callBack = callBack;
}
@Override
protected void updateItem(Y item, boolean empty) {
if (item != null) {
super.updateItem(item, empty);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(actionBtn);
actionBtn.setOnAction(e -> {
//需要写个异步事件要不可是不好搞了
if (callBack != null) {
try {
callBack.callback(item);
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
}
}
}
package cn.csbr.app.gui.component.common;
/**
* 自定义按钮操作回调类
* @param <T>
*/
public interface ActionCallBack<T> {
public void callback(T value) throws Exception;
}
package cn.csbr.app.gui.component.common;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import java.time.LocalDate;
import java.util.Locale;
public class BeginEndDatePicker extends HBox {
private DatePicker bp=new DatePicker();
private DatePicker ep=new DatePicker();
public BeginEndDatePicker(String text, Integer MinWidth, Integer MinHeight, EventHandler<ActionEvent> value){
setAlignment(Pos.CENTER);
setStyle("-fx-border-color: #E1E1E1; -fx-border-radius: 5;");
setPadding(new Insets(0,0,0,20));
Label label = new Label();
label.setText(text);
label.setStyle("-fx-font-size:1.4em;");
Region labelspacer = new Region();
labelspacer.setMinWidth(5);
Region lastspacer = new Region();
lastspacer.setMinWidth(5);
Label spacer = new Label();
spacer.setText("-");
// DatePicker start = new cn.csbr.app.gui.util.datecontrol.DatePicker(Locale.CHINA);
// start.getTextField().setEditable(false);
// start.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
// start.getCalendarView().todayButtonTextProperty().set("今天");
// start.getCalendarView().setShowWeeks(false);
bp.getStylesheets().add("styles/DatePicker.css");
bp.setMaxWidth(180);
bp.setPrefWidth(180);
//起始时间设置默认值为当前时间的前一个星期
bp.setValue(LocalDate.now().minusWeeks(100L));
// start.setAlignment(Pos.CENTER);
// DatePicker end = new cn.csbr.app.gui.util.datecontrol.DatePicker(Locale.CHINA);
// end.getTextField().setEditable(false);
// end.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
// end.getCalendarView().todayButtonTextProperty().set("今天");
// end.getCalendarView().setShowWeeks(false);
ep.getStylesheets().add("styles/DatePicker.css");
ep.setMaxWidth(180);
ep.setPrefWidth(180);
//结束时间是当前时间
ep.setValue(LocalDate.now());
// end.setAlignment(Pos.CENTER);
if (MinWidth != null) {
bp.setMinWidth(MinWidth);
ep.setMinWidth(MinWidth);
}
if (MinHeight != null) {
setMinHeight(MinHeight);
}
getChildren().addAll(label, labelspacer,bp,spacer, ep,lastspacer);
if (value != null) {
ep.setOnAction(value);
bp.setOnAction(value);
}
}
public void clear(){
bp.setValue(null);
ep.setValue(null);
}
public LocalDate getBeginDate(){
return bp.getValue();
}
public LocalDate getEndDate(){
return ep.getValue().plusDays(1);
}
}
package cn.csbr.app.gui.component.common;
import cn.csbr.springboot.dao.model.HisGoods;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import java.util.List;
/**
* 通用表格工具类
*
* @param <T>
*/
public class CommTable<T> extends TableView<T> {
private ObservableList<T> datas;
private CommTableDataLoader dataLoader;
private List<CommTableColumn> columns;
private List<TableColumn> tableColumns;
public CommTable(List<CommTableColumn> columns) {
super();
this.columns = columns;
init();
}
public CommTable(List<CommTableColumn> columns, List<TableColumn> tableColumns) {
super();
this.columns = columns;
this.tableColumns = tableColumns;
init();
}
public CommTable(List<CommTableColumn> columns, CommTableDataLoader<T> dataLoader) {
super();
this.columns = columns;
this.dataLoader = dataLoader;
this.getStylesheets().add("styles/inboundtable.css");
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
init();
}
private void init() {
if (columns == null) {
return;
}
datas = FXCollections.observableArrayList();
setItems(datas);
for (CommTableColumn column : columns) {
getColumns().add(column.createColum());
}
if (tableColumns != null) {
for (TableColumn column : tableColumns) {
getColumns().add(column);
}
}
this.scrollTo(0);
}
private void generateData(List<T> datas) {
this.datas.clear();
if (datas != null) {
this.datas.addAll(datas);
}
this.refresh();
this.scrollTo(0);
}
public void updateDatas() {
if (dataLoader != null) {
generateData(dataLoader.loadData());
}
}
}
package cn.csbr.app.gui.component.common;
import java.util.List;
/**
* 通用表格类使用的数据加载回调类
* @param <T>
*/
public interface CommTableDataLoader<T> {
public List<T> loadData();
}
package cn.csbr.app.gui.component.common;
import cn.csbr.app.gui.page.Page;
import cn.csbr.springboot.dao.model.Cabinet;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.SingleSelectionModel;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.util.StringConverter;
public class CssComBox<T> extends HBox{
private ComboBox comboBox = new ComboBox<T>();
public CssComBox(String text, Integer MinWidth, Integer MinHeight, EventHandler<ActionEvent> value) {
setAlignment(Pos.CENTER);
setStyle("-fx-border-color: #E1E1E1; -fx-border-radius: 5;");
setPadding(new Insets(0,0,0,20));
Label label = new Label();
label.setText(text);
label.setStyle("-fx-font-size:1.4em;");
comboBox.setStyle("-fx-background-color: transparent;-fx-font-size:1.4em;");
if (MinWidth != null) {
comboBox.setMinWidth(MinWidth);
}
if (MinHeight != null) {
comboBox.setMinHeight(MinHeight);
}
if (value != null) {
comboBox.setOnAction(value);
}
// comboBox.setMinHeight(50);
// comboBox.setMaxHeight(50);
this.getChildren().addAll(label, comboBox);
}
//下边暴露出必要的combox方法
public ObservableList getItems(){
return comboBox.getItems();
}
public void setItems(ObservableList values){
comboBox.setItems(values);
}
public void setConverter(StringConverter converter){
comboBox.setConverter(converter);
}
public final SingleSelectionModel getSelectionModel() {
return comboBox.getSelectionModel();
}
public void clear(){
comboBox.getSelectionModel().clearSelection();
comboBox.setItems(null); }
}
package cn.csbr.app.gui.component.common;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.SingleSelectionModel;
import javafx.scene.layout.HBox;
import javafx.util.StringConverter;
public class CssComBoxn<T> extends HBox{
private ComboBox comboBox = new ComboBox<T>();
public CssComBoxn(String text, Integer MinWidth, Integer MinHeight, EventHandler<ActionEvent> value) {
setAlignment(Pos.CENTER);
setStyle("-fx-border-color: #b3bcb9; -fx-border-radius: 5;");
setPadding(new Insets(0,0,0,20));
Label label = new Label();
label.setText(text);
label.setMinWidth(80);
label.setStyle("-fx-font-size:1.4em;");
label.setStyle("-fx-text-fill: #b3bcb9");
comboBox.setStyle("-fx-background-color: transparent;-fx-font-size:1.2em ");
//comboBox.setMaxWidth(10);
if (MinWidth != null) {
comboBox.setMinWidth(MinWidth);
comboBox.setMaxWidth(MinWidth);
}
if (MinHeight != null) {
comboBox.setMinHeight(MinHeight);
comboBox.setMaxHeight(MinWidth);
}
if (value != null) {
comboBox.setOnAction(value);
}
// comboBox.setMinHeight(50);
// comboBox.setMaxHeight(50);
this.getChildren().addAll(label, comboBox);
}
//下边暴露出必要的combox方法
public ObservableList getItems(){
return comboBox.getItems();
}
public void setItems(ObservableList values){
comboBox.setItems(values);
comboBox.getSelectionModel().select(0);
}
public void setConverter(StringConverter converter){
comboBox.setConverter(converter);
}
public final SingleSelectionModel getSelectionModel() {
return comboBox.getSelectionModel();
}
public void clear(){
comboBox.getSelectionModel().clearSelection();
comboBox.getItems().clear();
comboBox.setItems(null); }
}
package cn.csbr.app.gui.component.common;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
public class CssTextfield extends HBox {
private TextField textField = new TextField();
private Label label = new Label();
public CssTextfield(String text, String promp, Integer MinWidth, Integer MinHeight, EventHandler<ActionEvent> value){
this.setAlignment(Pos.CENTER);
this.setStyle("-fx-border-color: #E1E1E1; -fx-border-radius: 5;");
this.setPadding(new Insets(0,0,0,20));
label.setText(text);
label.setStyle("-fx-font-size:1.4em;");
textField.setPromptText(promp);
textField.setStyle("-fx-background-color: transparent;-fx-font-size:1.2em;");
if (MinWidth != null) {
textField.setMinWidth(MinWidth);
}
if (MinHeight != null) {
textField.setMinHeight(MinHeight);
}
if (value != null) {
textField.setOnAction(value);
}
this.getChildren().addAll(label, textField);
}
public void clear(){
textField.setText("");
}
public String getText(){
return textField.getText();
}
}
package cn.csbr.app.gui.component.common;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
public class CssTextfieldn extends HBox {
private TextField textField = new TextField();
private Label label = new Label();
public CssTextfieldn(String text, String promp, Integer MinWidth, Integer MinHeight, EventHandler<ActionEvent> value){
this.setAlignment(Pos.CENTER);
this.setStyle("-fx-border-color: #b3bcb9; -fx-border-radius: 5;");
//this.setPadding(new Insets(0,0,0,20));
label.setText(text);
label.setStyle("-fx-font-size:1.4em;");
this.maxHeight(40);
textField.setMaxHeight(40);
textField.setPromptText(promp);
textField.setStyle("-fx-background-color: transparent;-fx-font-size:1.2em;");
if (MinWidth != null) {
textField.setMinWidth(MinWidth);
}
if (MinHeight != null) {
textField.setMinHeight(MinHeight);
}
if (value != null) {
textField.setOnAction(value);
}
this.getChildren().addAll(label, textField);
}
public void clear(){
textField.setText("");
}
public String getText(){
return textField.getText();
}
}
package cn.csbr.app.gui.component.common;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public class ImageButton extends ImageView {
public ImageButton(EventHandler handler,String id){
super();
this.setId(id);
this.setOnMouseClicked(handler);
this.setMouseTransparent(false);
this.setPickOnBounds(true);
this.setCursor(Cursor.HAND);
}
public ImageButton(EventHandler handler,String id,String imageUrl){
super();
this.setId(id);
Image image=new Image(ImageButton.class.getResourceAsStream(imageUrl));
this.setImage(image);
this.setCursor(Cursor.HAND);
this.setOnMouseClicked(handler);
this.setMouseTransparent(false);
this.setPickOnBounds(true);
}
}
package cn.csbr.app.gui.component.common;
import javafx.scene.Node;
import javafx.scene.control.Dialog;
import javafx.scene.layout.HBox;
/**
* 自定义会话面板
*/
public class MyDialogPane extends Dialog {
private HBox box;
public MyDialogPane() {
super();
box = new HBox();
this.getDialogPane().setContent(box);
}
public void addElement(Node element) {
box.getChildren().add(element);
}
}
package cn.csbr.app.gui.component.common;
import cn.csbr.app.gui.util.CsButtonGroup;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import java.util.List;
/**
* 分页栏
*/
public class PageBar extends HBox {
private Button pre = CsButtonGroup.createSingleButton("上翻页", null);
private Button next = CsButtonGroup.createSingleButton("下翻页", null);
private Label pageInfo = new Label();
private int currentPage = 1;
private int totalPages;
public int getNewPage() {
return newPage;
}
public void setNewPage(int newPage) {
this.newPage = newPage;
}
private int newPage;
private int pageSize = 20;
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getTotalPages() {
return totalPages;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public PageBar(List<Node> nodes) {
Region spacer1 = new Region();
spacer1.setMinWidth(460);
Region spacer2 = new Region();
spacer2.setMinWidth(160);
Region spacer3 = new Region();
spacer3.setMinWidth(20);
Region spacer4 = new Region();
spacer4.setMinWidth(20);
// pre.setText("上翻页");
pre.setMinHeight(54);
pre.setMinWidth(88);
// next.setText("下翻页");
next.setMinHeight(54);
next.setMinWidth(88);
intPageInfo();
this.setPadding(new Insets(20, 0, 5, 0));
// this.setStyle("-fx-font-size: 1.4em;");
pageInfo.setPadding(new Insets(15, 0, 0, 0));
this.getChildren().addAll(spacer1, pre, spacer3, next, spacer4, pageInfo, spacer2);
for (Node node : nodes) {
this.getChildren().add(node);
}
}
public PageBar(Button backbtn) {
Region spacer1 = new Region();
spacer1.setMinWidth(460);
Region spacer2 = new Region();
spacer2.setMinWidth(160);
Region spacer3 = new Region();
spacer3.setMinWidth(20);
Region spacer4 = new Region();
spacer4.setMinWidth(20);
// pre.setText("上翻页");
pre.setMinHeight(54);
pre.setMinWidth(88);
// next.setText("下翻页");
next.setMinHeight(54);
next.setMinWidth(88);
intPageInfo();
this.setPadding(new Insets(20, 0, 5, 0));
// this.setStyle("-fx-font-size: 1.4em;");
pageInfo.setPadding(new Insets(15, 0, 0, 0));
this.getChildren().addAll(spacer1, pre, spacer3, next, spacer4, pageInfo, spacer2, backbtn);
}
public PageBar() {
Region spacer1 = new Region();
spacer1.setMinWidth(460);
Region spacer2 = new Region();
spacer2.setMinWidth(160);
Region spacer3 = new Region();
spacer3.setMinWidth(20);
Region spacer4 = new Region();
spacer4.setMinWidth(20);
// pre.setText("上翻页");
pre.setMinHeight(54);
pre.setMinWidth(88);
// next.setText("下翻页");
next.setMinHeight(54);
next.setMinWidth(88);
intPageInfo();
this.setPadding(new Insets(20, 0, 5, 0));
// this.setStyle("-fx-font-size: 1.4em;");
pageInfo.setPadding(new Insets(15, 0, 0, 0));
this.getChildren().addAll(spacer1, pre, spacer3, next, spacer4, pageInfo, spacer2);
}
// private void intPageInfo() {
// pageInfo.setText("第"+currentPage+"页 共"+totalPages+"页 每页显示"+pageSize+"条记录");
// }
private void intPageInfo() {
pageInfo.setText("第" + currentPage + "页 共" + totalPages + "页");
}
public void setNextCallBack(EventHandler<ActionEvent> pageEvent) {
next.setOnAction((e) -> {
newPage = getCurrentPage() + 1;
if (newPage > getTotalPages()) {
newPage = getTotalPages();
}
currentPage = newPage;
pageEvent.handle(e);
});
}
public void setPreCallBack(EventHandler<ActionEvent> pageEvent) {
pre.setOnAction((e) -> {
newPage = getCurrentPage() - 1;
if (newPage <= 0) {
newPage = 1;
}
currentPage = newPage;
pageEvent.handle(e);
});
}
public void refresh(int currentPage, int totalPages) {
this.currentPage = currentPage;
this.totalPages = totalPages;
intPageInfo();
}
}
package cn.csbr.app.gui.component.common;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import java.util.Collection;
import java.util.List;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
/**
* 带分页栏的表格组件
* header 是查询条件栏 外部定义好传入后
* 显示在表格上部,
* pagebox是表格下部的分页栏。
* 此组件基于commtable 和commtablecolumn
*
* @param <T>
*/
public class PageTableBox<T> extends VBox {
private CommTable<Page<T>> commTable;
private HBox header = new HBox(); //水平条件的
private PageBar pagebox = new PageBar();
private EventHandler<ActionEvent> queryHandler;
/**
* @param headerNodes 查询条件栏的组件 按照从左至右顺序排列
* @param columns 表格列定义也是从左至右排列
* @param dataLoader 表格数据加载器
*/
public PageTableBox(Collection<Node> headerNodes, List<CommTableColumn> columns, CommTableDataLoader<T> dataLoader) {
initHeader(headerNodes, columns, dataLoader);
buildTable(columns, dataLoader);
this.getChildren().addAll(header, commTable, pagebox);
setMaxHeight(getDataTableMinHeight() - 100);
setMinWidth(getScreenWidth());
setPrefHeight(getScreenWidth());
setFillWidth(true);
setAlignment(Pos.TOP_CENTER);
queryHandler = (e) -> {
Platform.runLater(() -> search());
};
pagebox.setNextCallBack(queryHandler);
pagebox.setPreCallBack(queryHandler);
}
private void initHeader(Collection<Node> headerNodes, List<CommTableColumn> columns, CommTableDataLoader<T> dataLoader) {
header.setSpacing(10);
header.setPadding(new Insets(30, 0, 30, 0));
if (headerNodes != null && headerNodes.size() > 0) {
header.getChildren().addAll(headerNodes);
}
header.setMinHeight(90);
header.setMaxHeight(90);
header.setPrefHeight(90);
}
private void buildTable(List<CommTableColumn> columns, CommTableDataLoader<T> dataLoader) {
commTable = new CommTable(columns, () -> {//后边把 dataloader的查询方法包了一层 。前后处理分页相关事件
int pageSize = pagebox.getPageSize();
int pageNo = pagebox.getNewPage();
PageHelper.startPage(pageNo, pageSize);
Page<T> results = (Page<T>) dataLoader.loadData();
pagebox.refresh(results.getPageNum(), results.getPages());
return results;
});
}
private void search() {
commTable.updateDatas();
}
public synchronized EventHandler<ActionEvent> getQueryHandler() {
return queryHandler;
}
public CommTable<Page<T>> getCommTable() {
return commTable;
}
public void setCommTable(CommTable<Page<T>> commTable) {
this.commTable = commTable;
}
public HBox getHeader() {
return header;
}
public void setHeader(HBox header) {
this.header = header;
}
public PageBar getPagebox() {
return pagebox;
}
public void setPagebox(PageBar pagebox) {
this.pagebox = pagebox;
}
}
package cn.csbr.app.gui.component.common;
import cn.csbr.app.config.FxConfigure;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.app.gui.page.AbstractPage;
import cn.csbr.app.gui.page.MainPage;
import cn.csbr.app.gui.page.query.*;
import cn.csbr.app.gui.util.CsButtonGroup;
import cn.csbr.app.gui.util.ImageButtonGroup;
import cn.csbr.app.service.CabinetService;
import cn.csbr.app.service.QueryService;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.image.Image;
import javafx.scene.input.KeyCombination;
import javafx.scene.layout.*;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.csbr.app.gui.util.SystemUtils.getScreenHeight;
public class QueryButtons extends AbstractPage {
ImageButton expButton =null;
private TabPane tabPane;
private HBox contentBox = null;
private List<TabContent> tabs = null;
private Map<TabContent, Node> tabMap = null;
private ImageButtonGroup buttonGroup = new ImageButtonGroup();
Stage primaryStage;
private int x;
public QueryButtons(List<TabContent> tabs,HBox contentBox, Map<TabContent, Node> tabMap,ImageButtonGroup buttonGroup){
this.tabs=tabs;
this.contentBox=contentBox;
this.tabMap=tabMap;
this.buttonGroup=buttonGroup;
}
public void start(Stage stage) {
// 展示内容放置在置中
primaryStage = new Stage();
primaryStage.centerOnScreen();
primaryStage.initOwner(stage);
primaryStage.setAlwaysOnTop(true);
StackPane root = new StackPane();
Scene scene = new Scene(root, 200,1366 );
primaryStage.initStyle(StageStyle.UNDECORATED);
x=568;
primaryStage.setX(x);
primaryStage.setY(0);
HBox hBoxr=new HBox();
hBoxr.setMinWidth(200);
hBoxr.setMaxWidth(200);
hBoxr.setMinHeight(1366);
hBoxr.setMinHeight(1366);
//hBoxr.setTranslateX(487);
hBoxr.setStyle("-fx-background-color: white");
root.getChildren().addAll(hBoxr);
hBoxr.getChildren().add(appContent());
// hBoxl.setOnMouseClicked(e->{
// primaryStage.close();
//});
//hBoxl.setOpacity(1);
primaryStage.setScene(scene);
primaryStage.setOpacity(0.9);
// primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);//去掉esc提示
primaryStage.show();
// pup();
}
public void
close(){
try {
primaryStage.close();
}catch (Exception ex)
{
}
}
private void pup() {
Thread thread=new Thread(()->{
while (primaryStage.getX()!=x)
{
primaryStage.setX( primaryStage.getX()-2);
try {
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
thread.start();
}
@Override
protected Node constructNode() {
return null;
}
@Override
public void refresh() {
}
protected Node appContent() {
//tabs = initTabs();
VBox buttoBox = new VBox();
buttonGroup.clear();
int jl=20;
// 库存查询
ImageButton stockButton = new ImageButton((e) -> {
toggleImageButtonStyle(e);
ObservableList<Node> nodes = contentBox.getChildren();
nodes.clear();
nodes.add(tabMap.get(tabs.get(0)));
tabs.get(0).refresh();
}, "stockButton", "/images/search/btn_o1.png");
buttonGroup.addItem(stockButton, "/images/search/btn_o1.png");
Region spacer = new Region();
spacer.setMinHeight(jl);
// 近效期查询
expButton = new ImageButton((e) -> {
toggleImageButtonStyle(e);
ObservableList<Node> nodes = contentBox.getChildren();
nodes.clear();
nodes.add(tabMap.get(tabs.get(1)));
tabs.get(1).refresh();
}, "stockButton", "/images/search/btn_o2.png");
buttonGroup.addItem(expButton, "/images/search/btn_o2.png");
Region spacer1 = new Region();
spacer1.setMinHeight(jl);
// 入库记录
ImageButton inButton = new ImageButton((e) -> {
toggleImageButtonStyle(e);
ObservableList<Node> nodes = contentBox.getChildren();
nodes.clear();
nodes.add(tabMap.get(tabs.get(2)));
tabs.get(2).refresh();
// ((ImageButton) e.getTarget()).setImage(new Image("/images/search/btn_s3.png"));
}, "stockButton", "/images/search/btn_o3.png");
buttonGroup.addItem(inButton, "/images/search/btn_o3.png");
Region spacer2 = new Region();
spacer2.setMinHeight(jl);
// 使用记录
ImageButton useButton = new ImageButton((e) -> {
toggleImageButtonStyle(e);
toggleImageButtonStyle(e);
ObservableList<Node> nodes = contentBox.getChildren();
nodes.clear();
nodes.add(tabMap.get(tabs.get(3)));
tabs.get(3).refresh();
}, "stockButton", "/images/search/btn_o4.png");
buttonGroup.addItem(useButton, "/images/search/btn_o4.png");
Region spacer3 = new Region();
spacer3.setMinHeight(jl);
// 计费查询
ImageButton feeButton = new ImageButton((e) -> {
toggleImageButtonStyle(e);
toggleImageButtonStyle(e);
ObservableList<Node> nodes = contentBox.getChildren();
nodes.clear();
nodes.add(tabMap.get(tabs.get(4)));
tabs.get(4).refresh();
}, "stockButton", "/images/search/btn_o5.png");
buttonGroup.addItem(feeButton, "/images/search/btn_o5.png");
Region spacer4 = new Region();
spacer4.setMinHeight(jl);
// 退货记录
ImageButton rejectButton = new ImageButton((e) -> {
toggleImageButtonStyle(e);
toggleImageButtonStyle(e);
ObservableList<Node> nodes = contentBox.getChildren();
nodes.clear();
nodes.add(tabMap.get(tabs.get(5)));
tabs.get(5).refresh();
}, "stockButton", "/images/search/btn_o6.png");
buttonGroup.addItem(rejectButton, "/images/search/btn_o6.png");
Region spacer5 = new Region();
spacer5.setMinHeight(jl);
// 损益纪录
ImageButton banlanceButton = new ImageButton((e) -> {
toggleImageButtonStyle(e);
toggleImageButtonStyle(e);
ObservableList<Node> nodes = contentBox.getChildren();
nodes.clear();
nodes.add(tabMap.get(tabs.get(6)));
tabs.get(6).refresh();
}, "stockButton", "/images/search/btn_o7.png");
buttonGroup.addItem(banlanceButton, "/images/search/btn_o7.png");
Region spacer6 = new Region();
spacer6.setMinHeight(jl);
// 异常查询
ImageButton execptionButton = new ImageButton((e) -> {
toggleImageButtonStyle(e);
toggleImageButtonStyle(e);
ObservableList<Node> nodes = contentBox.getChildren();
nodes.clear();
nodes.add(tabMap.get(tabs.get(7)));
tabs.get(7).refresh();
}, "execptionButton", "/images/search/btn_o8.png");
buttonGroup.addItem(execptionButton, "/images/search/btn_o8.png");
buttoBox.getChildren().addAll(stockButton,
spacer, expButton, spacer1, inButton, spacer2,
useButton, spacer3, feeButton, spacer4, rejectButton, spacer5, banlanceButton,spacer6);
buttonGroup.highlightCurrentItem(stockButton);
//contentBox.getChildren().add(tabMap.get(tabs.get(0)));
buttoBox.setTranslateX(25);
buttoBox.setTranslateY(150);
return buttoBox;
}
private void toggleImageButtonStyle(Object object) {
ImageButton current;
if (object instanceof Event) {
current = (ImageButton) ((Event) object).getTarget();
} else {
current = (ImageButton) object;
}
buttonGroup.highlightCurrentItem(current);
}
private int page=0;
public void GoExp(){
//this.page=page;
tabs.get(1).refresh();
expButton.getOnMouseClicked().handle(null);
}
// private List<TabContent> initTabs() {
//
// tabs = new ArrayList();
// TabContent stockQuery = createStockQueryTab();
// tabs.add(stockQuery);
// tabs.add(createExpQueryTab());
// tabs.add(createInQueryTab());
// tabs.add(createUseQueryTab());
// tabs.add(createFeeQueryTab());
// tabs.add(createRejcetQueryTab());
// tabs.add(createBanlanceQueryTab());
// tabs.add(createExectionkQueryTab());
// for (TabContent tab : tabs) {
// Node node= tab.createContent();
// //node.setStyle("-fx-background-color: red");
// //node.minHeight(1000);
// tabMap.put(tab, node);
//
// }
// // 比设计多了一个还货 待确认
// // tabs.add(createBackQueryTab());
//
// return tabs;
// }
}
package cn.csbr.app.gui.component.common;
import cn.csbr.app.gui.component.callback.PagedQuerySettingCallback;
import javafx.scene.control.TableCell;
/**
* 显示当前页行号的表格单元
*/
public class RowIndexCell extends TableCell {
private PagedQuerySettingCallback callback;
public RowIndexCell() {
}
public RowIndexCell(PagedQuerySettingCallback callback) {
this.callback = callback;
}
@Override
protected void updateItem(Object item, boolean empty) {
if (item != null) {
super.updateItem(item, empty);
int rowIndex = 0;
if (this.callback == null) {
rowIndex = this.getIndex() + 1;
} else {
// rowIndex = this.getIndex() + 1;
rowIndex = (callback.getCurrentPage() - 1) * callback.getPageSize() + this.getIndex() + 1;
}
this.setText(String.valueOf(rowIndex));
}
}
}
package cn.csbr.app.gui.component.inbound;
import cn.csbr.app.gui.page.inboud.InboundPage;
import cn.csbr.app.gui.util.ButtonSize;
import cn.csbr.app.gui.util.ButtonUtils;
import cn.csbr.app.gui.util.DialogUtils;
import cn.csbr.app.model.InboundItem;
import cn.csbr.springboot.dao.model.Cabinet;
import javafx.scene.control.*;
import java.util.ArrayList;
import java.util.List;
public class InboundButtonCell extends TableCell<InboundItem, InboundItem> {
final Button addButton = ButtonUtils.createButton("确认入库", ButtonBar.ButtonData.OK_DONE, new ButtonSize(100, 34), null);
final Label label = new Label("已确认");
private InboundPage page;
public InboundButtonCell(InboundPage page) {
this.page = page;
}
@Override
protected void updateItem(InboundItem item, boolean empty) {
if (item == null) {
return;
}
super.updateItem(item, empty);
if (!empty && item.getIfInCabinet() != null) {
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(label);
} else {
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(addButton);
List<String> titles = new ArrayList();
List<Cabinet> cabinets = page.getCabinets();
for (Cabinet cabinet : cabinets) {
titles.add(cabinet.getCabinetcode());
}
addButton.setOnAction(e -> {
//要弹出个窗体选择耗材柜
DialogUtils.showCommand("请选择耗材柜!", p -> {
System.out.println("-------------------------PPPP:" + p);
item.setIfInCabinet((byte) 1);
for (Cabinet cabinet : cabinets) {
if (cabinet.getCabinetcode().equals(p)) {
System.out.println("==========================mark cabinet info");
item.setAllocationGuid(cabinet.getGuid());
item.setAllocation(cabinet.getCabinetcode());
break;
}
}
}, titles, page.getCabinets(),page.getGuiContext().getPrimaryStage());
});
}
}
}
package cn.csbr.app.gui.component.reject;
import cn.csbr.app.gui.component.common.ActionButton;
import cn.csbr.app.gui.component.common.RowIndexCell;
import cn.csbr.app.gui.page.reject.RejectAddPage;
import cn.csbr.app.model.InboundItem;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.util.StringConverter;
import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
@Component
public class RejectAddTable extends TableView<InboundItem> {
private final TableColumn<InboundItem, Integer> index = new TableColumn<>("行号");
private final TableColumn<InboundItem, String> traceCode = new TableColumn<>("追溯码");
private final TableColumn<InboundItem, String> supplierName = new TableColumn<>("供应商");
private final TableColumn<InboundItem, String> goods = new TableColumn<>("商品信息");
private final TableColumn<InboundItem, String> batchNo = new TableColumn<>("批号");
private final TableColumn<InboundItem, String> allocation = new TableColumn<>("货柜号");
private final TableColumn<InboundItem, Integer> scanQty = new TableColumn<>("数量");
private final TableColumn<InboundItem, InboundItem> action = new TableColumn<>("操作");
DateFormat df=new SimpleDateFormat("yyyy-MM-dd");
ObservableList<InboundItem> items;
private RejectAddPage page;
public RejectAddTable(RejectAddPage page) {
index.setMinWidth(50);
traceCode.setMinWidth(200);
supplierName.setMinWidth(200);
goods.setMinWidth(230);
batchNo.setMinWidth(180);
allocation.setMinWidth(157);
scanQty.setMinWidth(100);
action .setMinWidth(150);
items = FXCollections.observableArrayList();
setItems(items);
this.page = page;
traceCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getTraceCode()));
traceCode.setCellFactory(TextFieldTableCell.forTableColumn());
traceCode.setPrefWidth(110);
supplierName.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getSupplierName()));
supplierName.setCellFactory(TextFieldTableCell.forTableColumn());
supplierName.setPrefWidth(110);
goods.setCellValueFactory(p -> {
SimpleStringProperty goodsString = new SimpleStringProperty();
InboundItem item = p.getValue();
StringBuilder content = new StringBuilder();
content.append(item.getGoodscode()).append("\n").append(item.getGoodsname())
.append("\n").append(item.getGoodsspec()).append("\n").append(item.getUnit()).append("\n").append(item.getManufacturer()).append("\n").append(item.getRegistkey());
goodsString.set(content.toString());
return goodsString;
});
goods.setCellFactory(TextFieldTableCell.forTableColumn());
goods.setPrefWidth(180);
batchNo.setCellValueFactory(p -> {
String str=p.getValue().getBacthCode()+"\n"+df.format(p.getValue().getProductiondate())+"\n"+df.format(p.getValue().getExpiredate());
return new SimpleStringProperty(str);
});
batchNo.setCellFactory(TextFieldTableCell.forTableColumn());
batchNo.setPrefWidth(110);
allocation.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getAllocation()));
allocation.setCellFactory(TextFieldTableCell.forTableColumn());
allocation.setPrefWidth(110);
index.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
index.setPrefWidth(50);
index.setCellFactory(p -> {
return new RowIndexCell();
});
index.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
scanQty.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
scanQty.setPrefWidth(50);
scanQty.setCellFactory(TextFieldTableCell.forTableColumn(new StringConverter<Integer>() {
@Override
public String toString(Integer object) {
return String.valueOf(object);
}
@Override
public Integer fromString(String string) {
return Integer.parseInt(string);
}
}));
scanQty.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
action.setPrefWidth(150);
action.setCellValueFactory(p -> new SimpleObjectProperty<InboundItem>(p.getValue()));
action.setCellFactory(p -> {
return new ActionButton<InboundItem, InboundItem>("添加", e -> {
//page.deleteItem(e);
//page.addItem(e);
});
});
action.setStyle("-fx-text-alignment:center;-fx-alignment:center;");
getColumns().setAll(index, traceCode, supplierName, goods, batchNo, allocation, scanQty, action);
this.setMinHeight(700);
this.getStylesheets().add("styles/inboundtable.css");
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
this.setWidth(1280);
this.setMinWidth(1280);
this.setEditable(false);
}
private ObservableList<InboundItem> generateData(List<InboundItem> datas) {
items.clear();
items.addAll(datas);
return items;
}
public void updateDatas(List<InboundItem> datas) {
generateData(datas);
}
}
package cn.csbr.app.gui.component.reject;
import cn.csbr.app.gui.component.common.ActionButton;
import cn.csbr.app.gui.component.common.RowIndexCell;
import cn.csbr.app.gui.page.reject.RejectMainPage;
import cn.csbr.app.model.InboundItem;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.util.StringConverter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
public class RejectTable extends TableView<InboundItem> {
private final TableColumn<InboundItem, Integer> index = new TableColumn<>("行号");
private final TableColumn<InboundItem, String> traceCode = new TableColumn<>("追溯码");
private final TableColumn<InboundItem, String> supplierName = new TableColumn<>("供应商");
private final TableColumn<InboundItem, String> goods = new TableColumn<>("商品信息");
private final TableColumn<InboundItem, String> batchNo = new TableColumn<>("批号");
private final TableColumn<InboundItem, String> allocation = new TableColumn<>("货柜号");
private final TableColumn<InboundItem, Integer> scanQty = new TableColumn<>("数量");
private final TableColumn<InboundItem, InboundItem> action = new TableColumn<>("操作");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
ObservableList<InboundItem> items;
private RejectMainPage page;
public RejectTable(RejectMainPage page) {
traceCode.setMinWidth(200);
supplierName.setMinWidth(200);
goods.setMinWidth(220);
batchNo.setMinWidth(150);
allocation.setMinWidth(150);
scanQty.setMinWidth(150);
action.setMinWidth(150);
items = FXCollections.observableArrayList();
setItems(items);
this.page = page;
traceCode.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getTraceCode()));
traceCode.setCellFactory(TextFieldTableCell.forTableColumn());
traceCode.setPrefWidth(110);
supplierName.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getSupplierName()));
supplierName.setCellFactory(TextFieldTableCell.forTableColumn());
supplierName.setPrefWidth(110);
goods.setCellValueFactory(p -> {
SimpleStringProperty goodsString = new SimpleStringProperty();
InboundItem item = p.getValue();
StringBuilder content = new StringBuilder();
content.append(item.getGoodsname())
.append("\n").append(item.getUnit()).append("\n");
goodsString.set(content.toString());
return goodsString;
});
goods.setCellFactory(TextFieldTableCell.forTableColumn());
goods.setPrefWidth(200);
batchNo.setCellValueFactory(p -> {
String str = p.getValue().getBacthCode() + "\n" + df.format(p.getValue().getProductiondate()) + "\n" + df.format(p.getValue().getExpiredate());
return new SimpleStringProperty(str);
}
);
batchNo.setCellFactory(TextFieldTableCell.forTableColumn());
batchNo.setPrefWidth(110);
allocation.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getAllocation()));
allocation.setCellFactory(TextFieldTableCell.forTableColumn());
allocation.setPrefWidth(110);
index.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
index.setPrefWidth(50);
index.setCellFactory(p -> {
return new RowIndexCell();
});
//index.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
scanQty.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(p.getValue().getScanQty()));
scanQty.setPrefWidth(50);
scanQty.setCellFactory(TextFieldTableCell.forTableColumn(new StringConverter<Integer>() {
@Override
public String toString(Integer object) {
return String.valueOf(object);
}
@Override
public Integer fromString(String string) {
return Integer.parseInt(string);
}
}));
// scanQty.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
action.setPrefWidth(150);
action.setCellValueFactory(p -> new SimpleObjectProperty<InboundItem>(p.getValue()));
action.setCellFactory(p -> {
return new ActionButton<InboundItem, InboundItem>("删除", e -> {
page.deleteItem(e);
});
});
// action.setStyle("-fx-text-alignment:center;-fx-alignment:center;");
getColumns().setAll(index, traceCode, supplierName, goods, batchNo, allocation, scanQty, action);
this.setMinHeight(getDataTableMinHeight(65));
this.getStylesheets().add("styles/inboundtable.css");
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
this.setWidth(getScreenWidth());
this.setMinWidth(getScreenWidth());
this.setEditable(false);
ObservableList<TableColumn<InboundItem, ?>> columns = getColumns();
for (TableColumn column : columns) {
column.setStyle("-fx-wrap-text:true;-fx-text-alignment:center;-fx-alignment: baseline-center;");
}
}
private synchronized ObservableList<InboundItem> generateData(List<InboundItem> datas) {
if (datas != null) {
items.addAll(datas);
}
return items;
}
public void updateDatas(List<InboundItem> datas) {
generateData(datas);
this.refresh();
}
public synchronized void updateDatas(String cubeName, List<InboundItem> datas) {
int icount = items.size();
List<InboundItem> removes = new ArrayList<>();
for (int i = 0; i < icount; i++) {
if (items.get(i).getAllocation().equals(cubeName)) {
removes.add(items.get(i));
}
}
if (!removes.isEmpty()) {
items.removeAll(removes);
}
generateData(datas);
this.refresh();
}
}
package cn.csbr.app.gui.component.setting;
import cn.csbr.app.gui.component.common.RowIndexCell;
import cn.csbr.app.gui.util.DialogUtils;
import cn.csbr.app.hardware.HFbwcabinet.HFbwcabinetApi;
import cn.csbr.springboot.dao.mapper.SysUserFingerMapper;
import cn.csbr.springboot.dao.model.SysUserFinger;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.TextFieldTableCell;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import static cn.csbr.app.gui.util.SystemUtils.getDataTableMinHeight;
import static cn.csbr.app.gui.util.SystemUtils.getScreenWidth;
public class DeleteFingerTable extends TableView<SysUserFinger> {
private final TableColumn<SysUserFinger, Integer> index = new TableColumn<>("行号");
private final TableColumn<SysUserFinger, String> userName = new TableColumn<>("科室");
private final TableColumn<SysUserFinger, String> realName = new TableColumn<>("指纹号");
private final TableColumn<SysUserFinger, String> ifFingerPrint = new TableColumn<>("录入时间");
private final TableColumn<SysUserFinger, Button> action = new TableColumn<>("操作");
ObservableList<SysUserFinger> items;
public DeleteFingerTable(HFbwcabinetApi hFbwcabinetApi, SysUserFingerMapper sysUserFingerMapper, int lockControlNum) {
items = FXCollections.observableArrayList();
setItems(items);
userName.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getOrgname()));
userName.setCellFactory(TextFieldTableCell.forTableColumn());
userName.setPrefWidth(230);
userName.setMinWidth(230);
realName.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getFingercd()));
realName.setCellFactory(TextFieldTableCell.forTableColumn());
realName.setPrefWidth(100);
realName.setMinWidth(100);
ifFingerPrint.setCellValueFactory(p ->{
Date date = p.getValue().getCreatetime();
String dateinfo="未记录";
if(date!=null){
SimpleDateFormat sdf = new SimpleDateFormat( " yyyy-MM-dd HH:mm:ss " );
dateinfo=sdf.format(date);
}
return new SimpleStringProperty(dateinfo);
});
ifFingerPrint.setCellFactory(TextFieldTableCell.forTableColumn());
ifFingerPrint.setPrefWidth(350);
ifFingerPrint.setMinWidth(350);
//ifFingerPrint.setStyle("-fx-text-alignment:center;-fx-alignment:center");
action.setPrefWidth(200);
action.setMinWidth(200);
action.setCellValueFactory(p -> {
Button button = new Button("删除");
button.setStyle("-fx-background-color: transparent;-fx-border-style: solid inside;-fx-border-width: 2;-fx-border-insets: 5;-fx-border-radius: 5;-fx-border-color: blue;");
button.setMinWidth(100);
button.setMinHeight(50);
button.setOnAction(event -> {
DialogUtils.showConfirm("确认删除这个指纹吗?",value -> {
try {
System.out.println("指纹删除结果:"+hFbwcabinetApi.delFinger(Integer.parseInt(p.getValue().getFingercd()), lockControlNum));
if (sysUserFingerMapper.deleteByPrimaryKey(p.getValue().getGuid()) == 0) {
DialogUtils.showAlert("指纹" + p.getValue().getFingercd() + "删除失败", e -> {
});
return;
}
}catch (Exception ex) {
DialogUtils.showAlert("系统异常" + ex.getMessage() + "删除失败", e -> {
});
return;
}
for(int i=0;i<this.items.size();i++){
if(this.items.get(i).getGuid()==p.getValue().getGuid()){
this.items.remove(i);
break;
}
}
this.refresh();
DialogUtils.showAlert("指纹"+p.getValue().getFingercd()+"删除成功",e->{});
},null);
});
return new SimpleObjectProperty<Button>(button);
});
index.setCellValueFactory(p -> new SimpleObjectProperty<Integer>(0));
index.setPrefWidth(50);
index.setMinWidth(50);
index.setCellFactory(p -> {
return new RowIndexCell();
});
// index.setStyle("-fx-text-alignment:right;-fx-alignment:center-right; -fx-padding: 0 5 0 0");
getColumns().setAll(index, userName, realName, ifFingerPrint, action);
this.setMinHeight(getDataTableMinHeight(100));
this.columnResizePolicyProperty().setValue(TableView.UNCONSTRAINED_RESIZE_POLICY);
this.setWidth(getScreenWidth());
this.setMinWidth(getScreenWidth());
this.setEditable(false);
this.getStylesheets().add("styles/common.css");
this.setStyle(" -fx-border-color: transparent;\n" +
" -fx-border-width: 0;\n" +
" -fx-background-radius: 0;\n" +
" -fx-background-color: transparent;-fx-max-height: 780px");
ObservableList<TableColumn<SysUserFinger, ?>> columns = getColumns();
for (TableColumn column : columns) {
column.setStyle("-fx-wrap-text:true;-fx-text-alignment:center;-fx-alignment: baseline-center;");
}
}
private void generateData(List<SysUserFinger> datas) {
items.clear();
items.addAll(datas);
}
private void refData(){
//generateData(datas);
this.refresh();
}
public void updateDatas(List<SysUserFinger> datas) {
generateData(datas);
this.refresh();
}
}
No preview for this file type
No preview for this file type
No preview for this file type
This file is too large to display.
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!