From a2c10587b4621e1bf9ef928dc043cf71ad84bbcf Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期二, 18 四月 2023 09:30:18 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/BarcodeThread.java | 6 ++
src/main/java/com/zy/asrs/service/WrkMastService.java | 2 +
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 59 +++++++++++++++++++++++------
src/main/java/com/zy/asrs/service/impl/WrkMastServiceImpl.java | 6 +++
src/main/java/com/zy/asrs/mapper/WrkMastMapper.java | 5 ++
src/main/resources/mapper/WrkMastMapper.xml | 3 +
6 files changed, 67 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
index 87c2dcb..90bba5e 100644
--- a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
@@ -114,5 +114,8 @@
WrkMast selectPakoutEmpty(@Param("staNo")Integer outSite);
-
+ /**
+ * 鏌ヨ鏄惁鏄洏鐐瑰嚭搴擄紝妫�鏂欏嚭搴�
+ */
+ WrkMast selectpj(@Param("staNo")Integer staNo,@Param("barcode")String barcode);
}
diff --git a/src/main/java/com/zy/asrs/service/WrkMastService.java b/src/main/java/com/zy/asrs/service/WrkMastService.java
index 67469f8..bd2be23 100644
--- a/src/main/java/com/zy/asrs/service/WrkMastService.java
+++ b/src/main/java/com/zy/asrs/service/WrkMastService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.service.IService;
import com.zy.asrs.entity.WrkMast;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -15,4 +16,5 @@
int getOutToStn182(Integer devpNo);
+ WrkMast selectpj(Integer staNo,String barcode);
}
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 0ee1274..0bf23b6 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -102,29 +102,58 @@
for (DevpSlave.Sta inSta : devp.getInSta()) {
// 鑾峰彇鏉$爜鎵弿浠俊鎭�
BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
-
+ BarcodeThread barcodeThread1 = null;
+ BarcodeThread barcodeThread2 = null;
if (barcodeThread == null) {
continue;
}
String barcode = barcodeThread.getBarcode();
-
+ String barcode1 = "";
+ String barcode2 = "";
//101绔欐湁3涓壂鐮佸櫒锛屽綋0鎵爜鍣ㄦ病鏈夋暟鎹椂锛岃幏鍙�9銆�10涓や釜鎵爜鍣ㄦ暟鎹�
- if((inSta.getStaNo().equals(101) || inSta.getStaNo().equals(104)) && ( "NoRead".equals(barcode) || Cools.isEmpty(barcode) )){
- BarcodeThread barcodeThread1 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode1());
+ if((inSta.getStaNo().equals(101) || inSta.getStaNo().equals(104))){
+ barcodeThread1 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode1());
if (barcodeThread1 != null) {
- barcode = barcodeThread1.getBarcode();
+ barcode1 = barcodeThread1.getBarcode();
}
- if("NoRead".equals(barcode) || Cools.isEmpty(barcode)) {
- BarcodeThread barcodeThread2 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode2());
- if (barcodeThread2 != null) {
- barcode = barcodeThread2.getBarcode();
+ barcodeThread2 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode2());
+ if (barcodeThread2 != null) {
+ barcode2 = barcodeThread2.getBarcode();
- }
}
+
+ Integer len1=0 , len2=0, len3=0;
+ if(barcode != null) {
+ String b[]=barcode.split(";");
+ barcode=b[b.length-1];
+ len1 = barcode.length();
+ }
+ if(barcode1 != null) {
+ String b[]=barcode1.split(";");
+ barcode1=b[b.length-1];
+ len2 = barcode1.length();
+ }
+ if(barcode2 != null) {
+ String b[]=barcode2.split(";");
+ barcode2=b[b.length-1];
+ len3 = barcode2.length();
+ }
+
+ if(len2 > len1 && len2 >= len3){
+ barcode = barcode1;
+ } else if (len3 > len1 && len3 >= len2){
+ barcode = barcode2;
+ }
+
}
-
+ //鍒ゆ柇101鍜�104鏄惁鏄嫞鏂欍�佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱
+ WrkMast wrkMast1=wrkMastMapper.selectpj(inSta.getStaNo(),barcode);
+ if((inSta.getStaNo().equals(101) || inSta.getStaNo().equals(104)) &&!Cools.isEmpty(barcode)&&!Cools.isEmpty(wrkMast1)){
+ log.error("101鎴�104鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱", wrkMast1.getWrkNo());
+ continue;
+ }
if (!Cools.isEmpty(barcode)) {
log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
@@ -224,7 +253,7 @@
param.setFull(staProtocol.isFull());
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
- .setPath("/rpc/pakin/loc/v1")
+ .setPath("/rpc/ ")
.setJson(JSON.toJSONString(param))
.build()
.doPost();
@@ -235,6 +264,12 @@
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
barcodeThread.setBarcode("");
+ if(barcodeThread1 !=null){
+ barcodeThread1.setBarcode("");
+ }
+ if(barcodeThread2 !=null){
+ barcodeThread2.setBarcode("");
+ }
staProtocol.setWorkNo(dto.getWorkNo().shortValue());
staProtocol.setStaNo(dto.getStaNo().shortValue());
devpThread.setPakMk(staProtocol.getSiteId(), false);
diff --git a/src/main/java/com/zy/asrs/service/impl/WrkMastServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WrkMastServiceImpl.java
index 8c0b9e9..d5b6da9 100644
--- a/src/main/java/com/zy/asrs/service/impl/WrkMastServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WrkMastServiceImpl.java
@@ -31,4 +31,10 @@
public int getOutToStn182(Integer devpNo) {
return selectCount(new EntityWrapper<WrkMast>().eq("sta_no", devpNo).in("wrk_sts",11,12));
}
+
+ @Override
+ public WrkMast selectpj(Integer staNo, String barcode) {
+ return this.baseMapper.selectpj(staNo,barcode);
+ }
+
}
diff --git a/src/main/java/com/zy/core/thread/BarcodeThread.java b/src/main/java/com/zy/core/thread/BarcodeThread.java
index d0b775e..2bca652 100644
--- a/src/main/java/com/zy/core/thread/BarcodeThread.java
+++ b/src/main/java/com/zy/core/thread/BarcodeThread.java
@@ -65,7 +65,7 @@
connect();
while (true) {
try {
- byte[] read = read(16, 200);
+ byte[] read = read(50, 200);
if (null != read) {
String s = new String(read);
if (!Cools.isEmpty(s)) {
@@ -79,10 +79,14 @@
}
OutputQueue.BARCODE.offer(jsonObject);
}
+ }else{
+ barcode = "";
}
Thread.sleep(50);
} catch (SocketTimeoutException ignore) {
+// barcode="";
} catch (Exception e) {
+ barcode="";
// e.printStackTrace();
}
}
diff --git a/src/main/resources/mapper/WrkMastMapper.xml b/src/main/resources/mapper/WrkMastMapper.xml
index b920bb5..187e23f 100644
--- a/src/main/resources/mapper/WrkMastMapper.xml
+++ b/src/main/resources/mapper/WrkMastMapper.xml
@@ -192,4 +192,7 @@
<select id="selectPakoutEmpty" resultMap="BaseResultMap">
select top 1 * from dbo.asr_wrk_mast where io_type = 110 and sta_no = #{staNo} order by io_time,wrk_no
</select>
+ <select id="selectpj" resultMap="BaseResultMap">
+ select * from dbo.asr_wrk_mast where sta_no=#{staNo} and wrk_sts =14 and barcode=#{barcode}
+ </select>
</mapper>
--
Gitblit v1.9.1