a479feb5 by white

first commit

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