盘点增加中文显示

chengdu-mxbc-qsl
LAPTOP-S9HJSOEB\昊天 3 years ago
parent 5af3a415ce
commit c7f04cd807

@ -629,8 +629,8 @@ public class PlcService {
stockMapper.insert(stock); stockMapper.insert(stock);
log.info("stockmapper insert new stock info."); log.info("stockmapper insert new stock info.");
}else { }else {
//stock.setStatus(status); stock.setStatus(0);
//stock.setLotnum(plcCmdInfo.getLotnum()); stock.setLotnum(plcCmdInfo.getLotnum());
stock.setExportTime(LocalDateTime.now()); stock.setExportTime(LocalDateTime.now());
stock.setCheckPic(path); stock.setCheckPic(path);
stock.setCheckNum(plcCmdInfo.getOrderNum()); stock.setCheckNum(plcCmdInfo.getOrderNum());

@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -70,8 +71,9 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
@Override @Override
public void run() { public void run() {
String body = in.toString(Charset.forName("UTF-8")); String body = in.toString(StandardCharsets.UTF_8);
tcpLogger.info("接收数据:"+body); tcpLogger.info("接收数据:"+body);
log.info("接收数据:"+body);
if (body.startsWith("<")){ if (body.startsWith("<")){
// 去掉首尾标识符 // 去掉首尾标识符
body = body.substring(1, body.length()); body = body.substring(1, body.length());
@ -174,7 +176,7 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
// }else { // }else {
// log.info("other D code :{}",code); // log.info("other D code :{}",code);
// } // }
} else if (Cmd.E.name().equals(ksecInfo.getType()) && !StringUtils.isEmpty(lotnum) && "1".equals(lotnum)) { } else if (Cmd.E.name().equals(ksecInfo.getType())) {
//成都蜜雪冰城 没有盘点批次号,把这一块注释 lotnum //成都蜜雪冰城 没有盘点批次号,把这一块注释 lotnum
// if(!StringUtils.isEmpty(lotnum) && !lotnum.equals(lastLotnum)){ // if(!StringUtils.isEmpty(lotnum) && !lotnum.equals(lastLotnum)){
// //需要把stock表truncate // //需要把stock表truncate
@ -195,6 +197,7 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
ksecInfo.getData().setAckStatus(0); ksecInfo.getData().setAckStatus(0);
} }
ctx.channel().writeAndFlush(ksecInfo); ctx.channel().writeAndFlush(ksecInfo);
log.info("盘点结束:"+ksecInfo.getData().toString());
} }
//找到该货位的最后一张照片与现在的照片比照 //找到该货位的最后一张照片与现在的照片比照
//plcService.recordStock(plcCmdInfo, dataInfo.getCode(), 0, 0); //plcService.recordStock(plcCmdInfo, dataInfo.getCode(), 0, 0);

@ -1,10 +1,18 @@
package com.zhehekeji.web.service.ksec; package com.zhehekeji.web.service.ksec;
import com.alibaba.excel.util.StringUtils;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.StringUtil;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
/** /**
* *
*/ */
@Data @Data
@Slf4j
public class LotnumConvert { public class LotnumConvert {
private static final String SPLIT1 = ","; private static final String SPLIT1 = ",";
private static final String SPLIT2 = "-"; private static final String SPLIT2 = "-";
@ -20,13 +28,15 @@ public class LotnumConvert {
private String Subtray; private String Subtray;
private String Dop; private String Dop;
private String Lotnum = ""; private String Lotnum = "";
private String categoryName = "";
public LotnumConvert(String lotnum) public LotnumConvert(String lotnum)
{ {
if(StringUtils.isEmpty(lotnum)){
Lotnum = "";
}else {
String[] strings = lotnum.split(SPLIT1); String[] strings = lotnum.split(SPLIT1);
if(strings.length == 5) if (strings.length == 5) {
{
Category = categoryConvert(CATEGORY, strings[0]); Category = categoryConvert(CATEGORY, strings[0]);
Quantity = subConvert(QUANTITY, strings[1]); Quantity = subConvert(QUANTITY, strings[1]);
Tray = subConvert(TRAY, strings[2]); Tray = subConvert(TRAY, strings[2]);
@ -36,22 +46,24 @@ public class LotnumConvert {
sbf.append(Category).append(SPLIT1).append(Quantity).append(SPLIT1).append(Tray).append(SPLIT1) sbf.append(Category).append(SPLIT1).append(Quantity).append(SPLIT1).append(Tray).append(SPLIT1)
.append(Subtray).append(SPLIT1).append(Dop); .append(Subtray).append(SPLIT1).append(Dop);
Lotnum = sbf.toString(); Lotnum = sbf.toString();
} } else {
else
{
Lotnum = lotnum; Lotnum = lotnum;
} }
} }
}
private String categoryConvert(String key, String string) private String categoryConvert(String key, String string)
{ {
String[] strings = string.split(SPLIT2); String[] strings = string.split(SPLIT2);
int index = strings[1].indexOf('('); String value = strings[1];
String value = strings[1].substring(0, index);
String category = key+SPLIT2+value ; String category = key+SPLIT2+value ;
return category; return category;
} }
public static void main(String[] args) {
LotnumConvert lotnumConvert = new LotnumConvert("lotnum\":\"物料-1020036(奶昔(原味)),??-40,???-81012641,???-TRA202303051162,????-2023-02-14\"");
System.out.println(lotnumConvert.getLotnum());
}
private String subConvert(String key, String string) private String subConvert(String key, String string)
{ {
String[] strings = string.split(SPLIT2); String[] strings = string.split(SPLIT2);

@ -34,10 +34,27 @@ cameraConfig:
videoServer: 127.0.0.1:8083 videoServer: 127.0.0.1:8083
#相机抓图延迟 毫秒,这个延迟是等待球机球机转动到位,然后拍照的 #相机抓图延迟 毫秒,这个延迟是等待球机球机转动到位,然后拍照的
delayCaptureTime: 3500 delayCaptureTime: 3500
#随行模式下的相机抓图延迟 毫秒,这个延迟是等待球机球机转动到位,然后拍照的
# 发了C1之后多久拍照
C1DelayCaptureTime: 1500
# 内侧货架 发了C2 之后多久拍照
C2DelayCaptureTime: 1500
# 外侧货架 发了C2 之后多久拍照
C2OutDelayCaptureTime: 2500
# 发了C3之后多久拍照
C3DelayCaptureTime: 1500
C4DelayCaptureTime: 1500
C4OutDelayCaptureTime: 1500
# 盘点延时多久拍照
EDelayCaptureTime: 2500
# 发了B2之后多久转原点位
B2DelayTime: 2000
# 外侧货架发了B2多久转原点位
B2OutDelayTime: 2000
# 下载mp4延迟 海康的下载mp4需要2分钟 # 下载mp4延迟 海康的下载mp4需要2分钟
# 利珀延迟10s就可 # 利珀延迟10s就可
# 单位毫秒 # 单位毫秒
delayDownloadMp4: 120000 delayDownloadMp4: 10000
# ------------ # ------------
# -----图片 mp4下载地址 # -----图片 mp4下载地址
savePath: savePath:

Loading…
Cancel
Save