|
|
|
|
@ -273,23 +273,34 @@ public class StockService {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<StockExportExcel> exportExcels(Integer streetId) {
|
|
|
|
|
String[] status = {"未盘点","盘点异常","盘点正确","人工盘点正确","待人工盘点"};
|
|
|
|
|
List<Stock> stocks = list(streetId);
|
|
|
|
|
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.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.setLotnum(stock.getLotnum());
|
|
|
|
|
stockExportExcel.setDirection((stock.getDirection() == 1 ? "左侧" : "右侧")+"-"+(stock.getSide()==1?"浅货位":"深货位")+"-"+stock.getRow()+"层"+"-"+stock.getColumn()+"列");
|
|
|
|
|
stockExportExcel.setWmsCategory(stock.getWmsCategory());
|
|
|
|
|
stockExportExcel.setCategory((stock.getCategory() == null||stock.getWmsCategory() == null) ? "无" : (stock.getWmsCategory().equals(stock.getCategory())?"一致":"不一致"));
|
|
|
|
|
|
|
|
|
|
stockExportExcel.setWmsCount(stock.getWmsCount());
|
|
|
|
|
stockExportExcel.setCount(stock.getCount()+stock.getCountTop());
|
|
|
|
|
stockExportExcel.setStatus(status[stock.getStatus()]);
|
|
|
|
|
stockExportExcel.setExportTime(stock.getFormattedExportTime());
|
|
|
|
|
// stockExportExcel.setCode(stock.getTrayCode());
|
|
|
|
|
// stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
// stockExportExcel.setColumn(stock.getColumn());
|
|
|
|
|
// 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);
|
|
|
|
|
});
|
|
|
|
|
return stockExportExcels;
|
|
|
|
|
@ -297,6 +308,7 @@ public class StockService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<StockExportExcel> exportAllExcels() {
|
|
|
|
|
String[] status = {"未盘点","盘点异常","盘点正确","人工盘点正确","待人工盘点"};
|
|
|
|
|
List<Stock> stocks = stockMapper.selectByMap(new HashMap<>());
|
|
|
|
|
List<Street> streets = streetMapper.selectByMap(new HashMap<>());
|
|
|
|
|
Map<Integer,String> streetMap = new HashMap<>();
|
|
|
|
|
@ -307,16 +319,27 @@ public class StockService {
|
|
|
|
|
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.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());
|
|
|
|
|
stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
stockExportExcel.setDirection((stock.getDirection() == 1 ? "左侧" : "右侧")+"-"+(stock.getSide()==1?"浅货位":"深货位")+"-"+stock.getRow()+"层"+"-"+stock.getColumn()+"列");
|
|
|
|
|
stockExportExcel.setWmsCategory(stock.getWmsCategory());
|
|
|
|
|
stockExportExcel.setCategory((stock.getCategory() == null||stock.getWmsCategory() == null) ? "无" : (stock.getWmsCategory().equals(stock.getCategory())?"一致":"不一致"));
|
|
|
|
|
stockExportExcel.setWmsCount(stock.getWmsCount());
|
|
|
|
|
stockExportExcel.setCount(stock.getCount()+stock.getCountTop());
|
|
|
|
|
stockExportExcel.setStatus(status[stock.getStatus()]);
|
|
|
|
|
stockExportExcel.setExportTime(stock.getFormattedExportTime());
|
|
|
|
|
// stockExportExcel.setCode(stock.getTrayCode());
|
|
|
|
|
// stockExportExcel.setLotnum(stock.getLotnum());
|
|
|
|
|
// stockExportExcel.setColumn(stock.getColumn());
|
|
|
|
|
// 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);
|
|
|
|
|
});
|
|
|
|
|
return stockExportExcels;
|
|
|
|
|
@ -342,8 +365,6 @@ public class StockService {
|
|
|
|
|
}else {
|
|
|
|
|
stock.setStreetName(street.getName());
|
|
|
|
|
}
|
|
|
|
|
//不再需要操作照片
|
|
|
|
|
List<StockLog> stockLogs = stockLogMapper.selectList(new QueryWrapper<StockLog>().eq("`row`",stockCheck.getRow()).eq("`column`",stockCheck.getColumn()).eq("street_id",stockCheck.getStreetId()).eq("direction",stockCheck.getDirection()).eq("side",stockCheck.getSide()).orderByDesc("create_time").last(" limit 2"));
|
|
|
|
|
// if(stockLogs.size() == 1){
|
|
|
|
|
// stock.setOveroperationPic(stockLogs.get(0).getPic());
|
|
|
|
|
// }else if(stockLogs.size() == 2){
|
|
|
|
|
@ -417,7 +438,7 @@ public class StockService {
|
|
|
|
|
|
|
|
|
|
log.info("check stock correct, street_id:{},direction:{},side:{},row:{},column:{}", stockCheck.getStreetId(),stockCheck.getDirection(),stockCheck.getSide(), stockCheck.getRow(), stockCheck.getColumn());
|
|
|
|
|
int count =(stock.getCount() != null) ? stock.getCount() : 0;
|
|
|
|
|
if(stockCheck.getCountTop()+ count == stock.getWmsCount() && stock.getWmsCategory().equals(stockCheck.getCategory())){
|
|
|
|
|
if(stockCheck.getCountTop()+ count == stock.getWmsCount() ){
|
|
|
|
|
|
|
|
|
|
stock.setStatus(StockStatus.MANUAL.getStatus());
|
|
|
|
|
}else {
|
|
|
|
|
@ -483,26 +504,12 @@ public class StockService {
|
|
|
|
|
public Stock nextOne(Long id) {
|
|
|
|
|
QueryWrapper<Stock> stockQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
|
|
stockQueryWrapper.eq("status","0").or().eq("status","1")
|
|
|
|
|
stockQueryWrapper.eq("status","0").or().eq("status","1").or().eq("status","4")
|
|
|
|
|
.ne(ToolUtil.isNotEmpty(id),"id",id)
|
|
|
|
|
.orderByDesc("export_time").last("limit 1");
|
|
|
|
|
Stock stock =stockMapper.selectOne(stockQueryWrapper);
|
|
|
|
|
if (stock != null) {
|
|
|
|
|
Street street = streetMapper.selectById(stock.getStreetId());
|
|
|
|
|
stock.setStreetName(street.getName());
|
|
|
|
|
List<StockLog> stockLogs = stockLogMapper.selectList(new QueryWrapper<StockLog>()
|
|
|
|
|
.eq("`row`",stock.getRow())
|
|
|
|
|
.eq("`column`",stock.getColumn())
|
|
|
|
|
.eq("street_id",stock.getStreetId())
|
|
|
|
|
.eq("direction",stock.getDirection())
|
|
|
|
|
.eq("side",stock.getSide())
|
|
|
|
|
.orderByDesc("create_time").last(" limit 2"));
|
|
|
|
|
if(stockLogs.size() == 1){
|
|
|
|
|
stock.setOveroperationPic(stockLogs.get(0).getPic());
|
|
|
|
|
}else if(stockLogs.size() == 2){
|
|
|
|
|
stock.setOveroperationPic(stockLogs.get(0).getPic());
|
|
|
|
|
stock.setPreoperationPic(stockLogs.get(1).getPic());
|
|
|
|
|
}
|
|
|
|
|
Street street = streetService.getById(stock.getStreetId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String ip ="http://"+ street.getPlcIp()+":9002/pic/";
|
|
|
|
|
if (stock.getPreoperationPic() != null&& stock.getPreoperationPic().length() > 0) {
|
|
|
|
|
@ -518,8 +525,6 @@ public class StockService {
|
|
|
|
|
stock.setTopPic1(String.format("%s%s", ip, pics[0]));
|
|
|
|
|
if (pics.length>1)
|
|
|
|
|
stock.setTopPic2(String.format("%s%s", ip, pics[1]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stock;
|
|
|
|
|
|