盘点测试
parent
866c753932
commit
46928100de
Binary file not shown.
@ -1,21 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class com_aijiao_test_JNIDemo */
|
||||
|
||||
#ifndef _Included_com_aijiao_test_JNIDemo
|
||||
#define _Included_com_aijiao_test_JNIDemo
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: com_aijiao_test_JNIDemo
|
||||
* Method: detectBestBarCode
|
||||
* Signature: (Ljava/lang/String;)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_aijiao_test_JNIDemo_detectBestBarCode
|
||||
(JNIEnv *, jobject, jstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,112 @@
|
||||
package com.zhehekeji.web.service;
|
||||
|
||||
import codeDetector.BarcodeDetector;
|
||||
import com.zhehekeji.web.config.ConfigProperties;
|
||||
import com.zhehekeji.web.entity.CheckLog;
|
||||
import com.zhehekeji.web.entity.Stock;
|
||||
import com.zhehekeji.web.entity.Street;
|
||||
import com.zhehekeji.web.lib.OrderInfo;
|
||||
import com.zhehekeji.web.mapper.CheckLogMapper;
|
||||
import com.zhehekeji.web.mapper.StockMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Slf4j
|
||||
public class StockCheckRunnable implements Runnable {
|
||||
|
||||
private Street street;
|
||||
|
||||
private PlcCmdInfo plcCmdInfo;
|
||||
|
||||
private String cmdCode;
|
||||
private StockMapper stockMapper;
|
||||
private String path;
|
||||
private CheckLogMapper checkLogMapper;
|
||||
|
||||
private Integer goodsScanCodeMode;
|
||||
private String wmsCode;
|
||||
private String wmsTrayCode;
|
||||
private String trayCode;
|
||||
private Boolean trayCheck;
|
||||
|
||||
private ConfigProperties configProperties;
|
||||
|
||||
|
||||
public StockCheckRunnable(Street street, PlcCmdInfo plcCmdInfo, String cmdCode, StockMapper stockMapper,String path,CheckLogMapper checkLogMapper,Integer goodsActionTimes,String wmsCode,String wmsTrayCode,String trayCode,Boolean trayCheck,ConfigProperties configProperties){
|
||||
this.street = street;
|
||||
this.plcCmdInfo = plcCmdInfo;
|
||||
this.cmdCode = cmdCode;
|
||||
this.stockMapper = stockMapper;
|
||||
this.path = path;
|
||||
this.checkLogMapper = checkLogMapper;
|
||||
this.goodsScanCodeMode = goodsActionTimes;
|
||||
this.wmsCode = wmsCode;
|
||||
this.wmsTrayCode = wmsTrayCode;
|
||||
this.trayCode = trayCode;
|
||||
this.trayCheck = trayCheck;
|
||||
this.configProperties = configProperties;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
OrderInfo orderInfo = new OrderInfo(street,plcCmdInfo,1,cmdCode);
|
||||
Stock stock = stockMapper.getByShelveIdAndRowColumn(orderInfo.getShelveId(),orderInfo.getRow(),orderInfo.getColumn());
|
||||
String scanCode = null;
|
||||
Boolean codeCheck = Boolean.TRUE;
|
||||
//货物使用球机扫码
|
||||
if(goodsScanCodeMode == 1){
|
||||
scanCode = BarcodeDetector.detectBestCodeUntilOK(configProperties.getSavePath().getMediaPath()+path,configProperties.getScanCodeMode().getGoodsCodeTypes());
|
||||
if(StringUtils.isEmpty(scanCode)){
|
||||
log.error("row:{},cloumn:{}",plcCmdInfo.getRow1(),plcCmdInfo.getColumn1());
|
||||
log.error("detectBestBarCode:{}",scanCode);
|
||||
scanCode = "识别异常";
|
||||
codeCheck = Boolean.FALSE;
|
||||
}else {
|
||||
codeCheck = wmsCode.equals(scanCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log.info("code:{}",scanCode);
|
||||
//核对异常
|
||||
Integer status = 1;
|
||||
//托盘和货物都正确
|
||||
if(trayCheck && codeCheck){
|
||||
status = 2;
|
||||
}
|
||||
if(stock == null){
|
||||
stock = new Stock(null,null,plcCmdInfo.getOrderNum(),scanCode,null,null,wmsCode,null,null,wmsTrayCode,trayCode,orderInfo.getShelveId(),orderInfo.getRow(),orderInfo.getColumn(),status,null,null,path, LocalDateTime.now());
|
||||
stockMapper.insert(stock);
|
||||
}else {
|
||||
stock.setStatus(status);
|
||||
stock.setExportTime(LocalDateTime.now());
|
||||
stock.setCheckPic(path);
|
||||
stock.setCheckNum(plcCmdInfo.getOrderNum());
|
||||
stock.setTrayCode(trayCode);
|
||||
stock.setWmsTrayCode(wmsTrayCode);
|
||||
stock.setCode(scanCode);
|
||||
stock.setWmsCode(wmsCode);
|
||||
stockMapper.updateById(stock);
|
||||
}
|
||||
checkLog(stock);
|
||||
}
|
||||
|
||||
public void checkLog(Stock stock){
|
||||
CheckLog checkLog = new CheckLog();
|
||||
checkLog.setCheckNum(stock.getCheckNum());
|
||||
checkLog.setPic(stock.getCheckPic());
|
||||
checkLog.setShelveId(stock.getShelveId());
|
||||
checkLog.setCode(stock.getCode());
|
||||
checkLog.setWmsCode(stock.getWmsCode());
|
||||
checkLog.setStatus(stock.getStatus());
|
||||
checkLog.setRow(stock.getRow());
|
||||
checkLog.setColumn(stock.getColumn());
|
||||
checkLog.setCreateTime(LocalDateTime.now());
|
||||
checkLog.setTrayCode(stock.getTrayCode());
|
||||
checkLog.setWmsTrayCode(stock.getWmsTrayCode());
|
||||
checkLogMapper.insert(checkLog);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue