|
|
|
|
@ -17,6 +17,9 @@ import com.zhehekeji.web.mapper.StockMapper;
|
|
|
|
|
import com.zhehekeji.web.mapper.StreetMapper;
|
|
|
|
|
import com.zhehekeji.web.pojo.category.PageSearch;
|
|
|
|
|
import com.zhehekeji.web.pojo.stock.*;
|
|
|
|
|
import com.zhehekeji.web.service.ksec.KsecDataInfo;
|
|
|
|
|
import com.zhehekeji.web.service.ksec.KsecInfo;
|
|
|
|
|
import com.zhehekeji.web.service.ksec.KsecNettyClient;
|
|
|
|
|
import io.swagger.models.auth.In;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
@ -340,21 +343,46 @@ public class StockService {
|
|
|
|
|
Street street = streetService.streetById(streetId);
|
|
|
|
|
List<StockExportExcel> stockExportExcels = new ArrayList<>(stocks.size());
|
|
|
|
|
stocks.forEach(stock -> {
|
|
|
|
|
StockExportExcel stockExportExcel = new StockExportExcel();
|
|
|
|
|
stockExportExcel.setCode(stock.getTrayCode());
|
|
|
|
|
stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
stockExportExcel.setColumn(stock.getColumn());
|
|
|
|
|
stockExportExcel.setCheckNum(stock.getCheckNum());
|
|
|
|
|
stockExportExcel.setWmsCode(stock.getWmsTrayCode());
|
|
|
|
|
//stockExportExcel.setCount(stock.getCount());
|
|
|
|
|
stockExportExcel.setRow(stock.getRow());
|
|
|
|
|
stockExportExcel.setStreetName(street.getName());
|
|
|
|
|
stockExportExcel.setExportTime(stock.getExportTime());
|
|
|
|
|
stockExportExcel.setDirection(stock.getDirection());
|
|
|
|
|
//stockExportExcel.setSide(stock.getSide());
|
|
|
|
|
//stockExportExcel.setShelveId(stock.getShelveId());
|
|
|
|
|
stockExportExcel.setStatus(stock.getStatus());
|
|
|
|
|
stockExportExcels.add(stockExportExcel);
|
|
|
|
|
|
|
|
|
|
if (stock.getCode().contains(",")){
|
|
|
|
|
String[] split = stock.getCode().split(",");
|
|
|
|
|
for (String s : split){
|
|
|
|
|
StockExportExcel stockExportExcel = new StockExportExcel();
|
|
|
|
|
stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
stockExportExcel.setColumn(stock.getColumn());
|
|
|
|
|
stockExportExcel.setCheckNum(stock.getCheckNum());
|
|
|
|
|
//stockExportExcel.setWmsCode(stock.getWmsTrayCode());
|
|
|
|
|
//stockExportExcel.setCount(stock.getCount());
|
|
|
|
|
stockExportExcel.setRow(stock.getRow());
|
|
|
|
|
stockExportExcel.setStreetName(street.getName());
|
|
|
|
|
stockExportExcel.setExportTime(stock.getExportTime());
|
|
|
|
|
stockExportExcel.setDirection(stock.getDirection());
|
|
|
|
|
//stockExportExcel.setSide(stock.getSide());
|
|
|
|
|
//stockExportExcel.setShelveId(stock.getShelveId());
|
|
|
|
|
stockExportExcel.setStatus(stock.getStatus());
|
|
|
|
|
stockExportExcel.setCode(s);
|
|
|
|
|
|
|
|
|
|
stockExportExcels.add(stockExportExcel);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
StockExportExcel stockExportExcel = new StockExportExcel();
|
|
|
|
|
stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
stockExportExcel.setColumn(stock.getColumn());
|
|
|
|
|
stockExportExcel.setCheckNum(stock.getCheckNum());
|
|
|
|
|
//stockExportExcel.setWmsCode(stock.getWmsTrayCode());
|
|
|
|
|
//stockExportExcel.setCount(stock.getCount());
|
|
|
|
|
stockExportExcel.setRow(stock.getRow());
|
|
|
|
|
stockExportExcel.setStreetName(street.getName());
|
|
|
|
|
stockExportExcel.setExportTime(stock.getExportTime());
|
|
|
|
|
stockExportExcel.setDirection(stock.getDirection());
|
|
|
|
|
//stockExportExcel.setSide(stock.getSide());
|
|
|
|
|
//stockExportExcel.setShelveId(stock.getShelveId());
|
|
|
|
|
stockExportExcel.setStatus(stock.getStatus());
|
|
|
|
|
|
|
|
|
|
stockExportExcel.setCode(stock.getCode());
|
|
|
|
|
stockExportExcels.add(stockExportExcel);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return stockExportExcels;
|
|
|
|
|
}
|
|
|
|
|
@ -370,19 +398,46 @@ public class StockService {
|
|
|
|
|
//Street street = streetService.streetById(streetId);
|
|
|
|
|
List<StockExportExcel> stockExportExcels = new ArrayList<>(stocks.size());
|
|
|
|
|
stocks.forEach(stock -> {
|
|
|
|
|
StockExportExcel stockExportExcel = new StockExportExcel();
|
|
|
|
|
stockExportExcel.setCode(stock.getTrayCode());
|
|
|
|
|
stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
stockExportExcel.setColumn(stock.getColumn());
|
|
|
|
|
stockExportExcel.setCheckNum(stock.getCheckNum());
|
|
|
|
|
//stockExportExcel.setCount(stock.getCount());
|
|
|
|
|
stockExportExcel.setRow(stock.getRow());
|
|
|
|
|
stockExportExcel.setStreetName(streetMap.get(stock.getStreetId()));
|
|
|
|
|
stockExportExcel.setExportTime(stock.getExportTime());
|
|
|
|
|
stockExportExcel.setDirection(stock.getDirection());
|
|
|
|
|
//stockExportExcel.setSide(stock.getSide());
|
|
|
|
|
stockExportExcel.setStatus(stock.getStatus());
|
|
|
|
|
stockExportExcels.add(stockExportExcel);
|
|
|
|
|
|
|
|
|
|
if (stock.getCode().contains(",")){
|
|
|
|
|
String[] split = stock.getCode().split(",");
|
|
|
|
|
for (String s : split){
|
|
|
|
|
StockExportExcel stockExportExcel = new StockExportExcel();
|
|
|
|
|
stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
stockExportExcel.setColumn(stock.getColumn());
|
|
|
|
|
stockExportExcel.setCheckNum(stock.getCheckNum());
|
|
|
|
|
//stockExportExcel.setWmsCode(stock.getWmsTrayCode());
|
|
|
|
|
//stockExportExcel.setCount(stock.getCount());
|
|
|
|
|
stockExportExcel.setRow(stock.getRow());
|
|
|
|
|
stockExportExcel.setStreetName(streetMap.get(stock.getStreetId()));
|
|
|
|
|
stockExportExcel.setExportTime(stock.getExportTime());
|
|
|
|
|
stockExportExcel.setDirection(stock.getDirection());
|
|
|
|
|
//stockExportExcel.setSide(stock.getSide());
|
|
|
|
|
//stockExportExcel.setShelveId(stock.getShelveId());
|
|
|
|
|
stockExportExcel.setStatus(stock.getStatus());
|
|
|
|
|
stockExportExcel.setCode(s);
|
|
|
|
|
|
|
|
|
|
stockExportExcels.add(stockExportExcel);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
StockExportExcel stockExportExcel = new StockExportExcel();
|
|
|
|
|
stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
stockExportExcel.setColumn(stock.getColumn());
|
|
|
|
|
stockExportExcel.setCheckNum(stock.getCheckNum());
|
|
|
|
|
//stockExportExcel.setWmsCode(stock.getWmsTrayCode());
|
|
|
|
|
//stockExportExcel.setCount(stock.getCount());
|
|
|
|
|
stockExportExcel.setRow(stock.getRow());
|
|
|
|
|
stockExportExcel.setStreetName(streetMap.get(stock.getStreetId()));
|
|
|
|
|
stockExportExcel.setExportTime(stock.getExportTime());
|
|
|
|
|
stockExportExcel.setDirection(stock.getDirection());
|
|
|
|
|
//stockExportExcel.setSide(stock.getSide());
|
|
|
|
|
//stockExportExcel.setShelveId(stock.getShelveId());
|
|
|
|
|
stockExportExcel.setStatus(stock.getStatus());
|
|
|
|
|
|
|
|
|
|
stockExportExcel.setCode(stock.getCode());
|
|
|
|
|
stockExportExcels.add(stockExportExcel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
return stockExportExcels;
|
|
|
|
|
}
|
|
|
|
|
@ -480,23 +535,33 @@ public class StockService {
|
|
|
|
|
log.info("check stock correct, street_id:{},direction:{},side:{},row:{},column:{}", stockCheck.getStreetId(), stockCheck.getDirection(), stockCheck.getSide(), stockCheck.getRow(), stockCheck.getColumn());
|
|
|
|
|
if (stockCheck.getOk() == 1) {
|
|
|
|
|
stock.setStatus(StockStatus.MANUAL.getStatus());
|
|
|
|
|
} else if(stockCheck.getOk() == -1) {
|
|
|
|
|
stock.setLength(stockCheck.getLength());
|
|
|
|
|
stock.setQrCode(stockCheck.getQrCode());
|
|
|
|
|
if(stockCheck.getLength()>600) {
|
|
|
|
|
stock.setCode(stock.getWmsCode());
|
|
|
|
|
KsecInfo ksecInfo = KsecInfo.heart();
|
|
|
|
|
KsecDataInfo ksecDataInfo = new KsecDataInfo();
|
|
|
|
|
ksecDataInfo.setTaskId(stock.getCheckNum().substring(stock.getCheckNum().lastIndexOf("_")+1));
|
|
|
|
|
|
|
|
|
|
ksecInfo.setData(ksecDataInfo);
|
|
|
|
|
ksecInfo.getData().setAckStatus(1);
|
|
|
|
|
|
|
|
|
|
stock.setStatus(StockStatus.SUCCESS.getStatus());
|
|
|
|
|
|
|
|
|
|
if (KsecNettyClient.channel!=null) {
|
|
|
|
|
KsecNettyClient.channel.writeAndFlush(ksecInfo);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
} else if(stockCheck.getOk() == -1) {
|
|
|
|
|
stock.setStatus(StockStatus.ERROR.getStatus());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stockMapper.updateById(stock);
|
|
|
|
|
checkLog(stock);
|
|
|
|
|
return stock;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
System.out.println("111_222".substring("111_222".lastIndexOf("_")+1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CheckLogMapper checkLogMapper;
|
|
|
|
|
|
|
|
|
|
@ -548,8 +613,8 @@ public class StockService {
|
|
|
|
|
public void allStockCheck() {
|
|
|
|
|
Stock stock = new Stock();
|
|
|
|
|
stock.setStatus(3);
|
|
|
|
|
List<Stock> stockList = stockMapper.selectList(new QueryWrapper<Stock>().eq("status", "0"));
|
|
|
|
|
stockMapper.update(stock, new QueryWrapper<Stock>().eq("status", "0"));
|
|
|
|
|
List<Stock> stockList = stockMapper.selectList(new QueryWrapper<Stock>().eq("status", "0").or().eq("status", "1"));
|
|
|
|
|
stockMapper.update(stock, new QueryWrapper<Stock>().eq("status", "0").or().eq("status", "1"));
|
|
|
|
|
for (Stock s:stockList){
|
|
|
|
|
StockCheck stockCheck = new StockCheck();
|
|
|
|
|
stockCheck.setColumn(s.getColumn());
|
|
|
|
|
|