@ -429,10 +429,7 @@ public class PlcService {
* @return
* /
public Boolean check ( PlcCmdInfo plcCmdInfo , String cmdCode , String wmsCode , String wmsTrayCode ) {
long startTime = System . currentTimeMillis ( ) ;
long end = System . currentTimeMillis ( ) ;
long s = end - startTime ;
log . info ( "time:{}millisecond" , s ) ;
@ -447,10 +444,10 @@ public class PlcService {
public Stock checkStart ( TMTransmission tmTransmission ) {
log . info ( "【开始盘点货位】save stock info ,taskId:{},SRMNumber:{}, goodsLocation:{}" , tmTransmission . getTaskNo ( ) , tmTransmission . getSRMNumber ( ) , tmTransmission . getGoodsLocation ( ) ) ;
Street street = streetService . getStreetByPlcId ( tmTransmission . getSRMNumber ( ) ) ;
Integer row = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 5, 8 ) ) ;
Integer column = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 8, 10 ) ) ;
Integer row = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 8, 10 ) ) ;
Integer column = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 5, 8 ) ) ;
Integer leftRight = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 4 , 5 ) ) ;
Integer inout = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 1 0 , 12 ) ) ;
Integer inout = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 1 1 , 12 ) ) ;
Stock old = stockMapper . getByStreetAndDirectionAndSideAndRowColumn ( street . getId ( ) , leftRight , inout , row , column ) ;
if ( old = = null ) {
old = new Stock ( ) ;
@ -463,7 +460,8 @@ public class PlcService {
old . setColumn ( column ) ;
old . setDirection ( leftRight ) ;
old . setSide ( inout ) ;
old . setWmsCode ( tmTransmission . getCode ( ) ) ;
old . setWmsCode ( tmTransmission . getGoodsLocation ( ) ) ;
old . setWmsCategory ( tmTransmission . getCategory ( ) ) ;
old . setWmsCount ( tmTransmission . getCount ( ) ) ;
old . setStreetId ( street . getId ( ) ) ;
old . setExportTime ( LocalDateTime . now ( ) ) ;
@ -472,7 +470,7 @@ public class PlcService {
} else {
old . setLotnum ( tmTransmission . getTaskNo ( ) ) ;
old . setExportTime ( LocalDateTime . now ( ) ) ;
old . setWmsCode ( tmTransmission . get Code ( ) ) ;
old . setWmsCode ( tmTransmission . get GoodsLocation ( ) ) ;
old . setWmsCount ( tmTransmission . getCount ( ) ) ;
old . setCheckNum ( tmTransmission . getTaskNo ( ) ) ;
old . setWmsTrayCode ( "" ) ;
@ -489,21 +487,23 @@ public class PlcService {
public Stock checkEnd ( TMTransmission tmTransmission ) {
log . info ( "【盘点货位结果返回】update stock info ,taskId:{},SRMNumber:{},goodsLocation:{}" , tmTransmission . getTaskNo ( ) , tmTransmission . getSRMNumber ( ) , tmTransmission . getGoodsLocation ( ) ) ;
Street street = streetService . getStreetByPlcId ( tmTransmission . getSRMNumber ( ) ) ;
Integer row = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 5, 8 ) ) ;
Integer column = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 8, 10 ) ) ;
Integer row = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 8, 10 ) ) ;
Integer column = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 5, 8 ) ) ;
Integer leftRight = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 4 , 5 ) ) ;
Integer inout = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 1 0 , 12 ) ) ;
Integer inout = Integer . valueOf ( tmTransmission . getGoodsLocation ( ) . substring ( 1 1 , 12 ) ) ;
Stock stock = stockMapper . getByStreetAndDirectionAndSideAndRowColumn ( street . getId ( ) , leftRight , inout , row , column ) ;
if ( stock ! = null ) {
stock . setCount ( tmTransmission . getCount ( ) ) ;
stock . setCode ( tmTransmission . getCode ( ) ) ;
stock . setCount ( tmTransmission . getRstCount ( ) ) ;
stock . setCategory ( tmTransmission . getRstCategory ( ) ) ;
stock . setCode ( tmTransmission . getGoodsLocation ( ) ) ;
stock . setWmsCategory ( tmTransmission . getCategory ( ) ) ;
//盘点正确 : 2
//盘点异常 : 1
Integer status = tmTransmission . get Count( ) . equals ( stock . getWmsCount ( ) ) & & tmTransmission . get Code( ) . equals ( stock . getWmsCode ( ) ) ? 2 : 1 ;
Integer status = tmTransmission . get Rst Count( ) . equals ( stock . getWmsCount ( ) ) & & tmTransmission . get RstCategory( ) . equals ( stock . getWmsCategory ( ) ) ? 2 : 1 ;
stock . setStatus ( status ) ;
stock . setTrayCode ( tmTransmission . getTrayNo ( ) ) ;
stockMapper . updateById ( stock ) ;
log . info ( "update check info,taskId:{},SRMNumber:{}, count:{},code :{}", stock . getCheckNum ( ) , tmTransmission . getSRMNumber ( ) , tmTransmission . get Count( ) , tmTransmission . getCode ( ) ) ;
log . info ( "update check info,taskId:{},SRMNumber:{}, goodsLocation :{}", stock . getCheckNum ( ) , tmTransmission . getSRMNumber ( ) , tmTransmission . get GoodsLocation ( ) ) ;
} else {
log . info ( "check end,but no stock info ,taskId:{},SRMNumber:{},goodsLocation:{}" , tmTransmission . getTaskNo ( ) , tmTransmission . getSRMNumber ( ) , tmTransmission . getGoodsLocation ( ) ) ;
stock = new Stock ( ) ;
@ -511,11 +511,10 @@ public class PlcService {
stock . setCode ( tmTransmission . getCode ( ) ) ;
stock . setStatus ( 1 ) ;
}
checkLog ( stock ) ;
// checkLog(stock);
return stock ;
}
public void checkLog ( Stock stock ) {
CheckLog checkLog = new CheckLog ( ) ;
checkLog . setCheckNum ( stock . getCheckNum ( ) ) ;
@ -528,11 +527,12 @@ public class PlcService {
checkLog . setStatus ( stock . getStatus ( ) ) ;
checkLog . setRow ( stock . getRow ( ) ) ;
checkLog . setColumn ( stock . getColumn ( ) ) ;
checkLog . setCreateTime ( LocalDateTime . now ( ) ) ;
checkLog . setTrayCode ( stock . getTrayCode ( ) ) ;
checkLog . setWmsTrayCode ( stock . getWmsTrayCode ( ) ) ;
checkLog . setLotnum ( stock . getLotnum ( ) ) ;
checkLog . setCreateTime ( LocalDateTime . now ( ) ) ;
checkLogMapper . insert ( checkLog ) ;
log . info ( "checkLogMapper insert" ) ;
}
public void truncateStock ( ) {
stockMapper . truncate ( ) ;
@ -567,12 +567,10 @@ public class PlcService {
}
return tags ;
}
public ConfigProperties getConfigProperties ( ) {
return configProperties ;
}
/ * *
* 相 机 转 动 , 拍 照 , 并 返 回 图 片 地 址
* 顶 部 拍 照 C1
@ -582,7 +580,7 @@ public class PlcService {
public String IntoStock ( String SRMNumber , String taskId , String goodsLocation ) {
Street street = streetService . getStreetByPlcId ( SRMNumber ) ;
if ( street = = null ) {
log . error ( "SRMNum: {} 对应的巷道不存在" );
log . error ( "SRMNum: {} 对应的巷道不存在" , SRMNumber );
}
//南京烟草物流只有一个相机
Integer cameraId = street . getCamera1Id ( ) = = null ? street . getCamera2Id ( ) : street . getCamera1Id ( ) ;