Commit 93794b42 zshaohui

1.增加退料接口

1 个父辈 68c37e9b
...@@ -1194,6 +1194,27 @@ public class LiteOrderCache { ...@@ -1194,6 +1194,27 @@ public class LiteOrderCache {
//得到库存信息 //得到库存信息
Map<String, InventoryItem> inventoryMap = dataCache.getAllInventory(storageIds, null); Map<String, InventoryItem> inventoryMap = dataCache.getAllInventory(storageIds, null);
if (inventoryMap != null) { if (inventoryMap != null) {
Map<String,InventoryItem> newInventoryMap = new HashMap<>();
for (String key : inventoryMap.keySet()) {
InventoryItem inventoryItem = inventoryMap.get(key);
String partNumber = inventoryItem.getPartNumber();
InventoryItem newInventoryItem = newInventoryMap.get(partNumber);
if (newInventoryItem == null) {
newInventoryItem = new InventoryItem();
}
newInventoryItem.setPartNumber(partNumber);
newInventoryItem.setStockReel(newInventoryItem.getStockReel() + inventoryItem.getStockReel());
newInventoryItem.setBindReel(newInventoryItem.getBindReel() + inventoryItem.getBindReel());
newInventoryMap.put(partNumber,newInventoryItem);
}
for (LiteOrder liteOrder : liteOrders) { for (LiteOrder liteOrder : liteOrders) {
//状态是未关闭的,未出库的 //状态是未关闭的,未出库的
if (!liteOrder.isClosed()) { if (!liteOrder.isClosed()) {
...@@ -1205,7 +1226,7 @@ public class LiteOrderCache { ...@@ -1205,7 +1226,7 @@ public class LiteOrderCache {
} }
} }
if (orderItem.getOutReelCount() < orderItem.getNeedReelCount()) { if (orderItem.getOutReelCount() < orderItem.getNeedReelCount()) {
InventoryItem inventoryItem = inventoryMap.get(orderItem.getPn()); InventoryItem inventoryItem = newInventoryMap.get(orderItem.getPn());
if (inventoryItem != null) { if (inventoryItem != null) {
if (inventoryItem.getStockReel() /*- inventoryItem.getLockReel()*/ - inventoryItem.getBindReel() > 0) { if (inventoryItem.getStockReel() /*- inventoryItem.getLockReel()*/ - inventoryItem.getBindReel() > 0) {
inventoryItem.setBindReel(inventoryItem.getBindReel() + 1); inventoryItem.setBindReel(inventoryItem.getBindReel() + 1);
......
...@@ -471,11 +471,13 @@ public class StoragePosController { ...@@ -471,11 +471,13 @@ public class StoragePosController {
List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent()); List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
for (StoragePosDto storagePosDto : StoragePosDtos) { for (StoragePosDto storagePosDto : StoragePosDtos) {
BarcodeDto barcode = storagePosDto.getBarcode(); BarcodeDto barcode = storagePosDto.getBarcode();
if (barcode.getPutInTime() == -1){ if (barcode != null) {
if (barcode.getPutInTime() == -1) {
barcode.setFirstPutInDate(barcode.getCreateDate()); barcode.setFirstPutInDate(barcode.getCreateDate());
//storagePosDto.setBarcode(barcode); //storagePosDto.setBarcode(barcode);
} }
} }
}
// for (StoragePosDto storagePosDto : StoragePosDtos) { // for (StoragePosDto storagePosDto : StoragePosDtos) {
// BarcodeDto barcode = storagePosDto.getBarcode(); // BarcodeDto barcode = storagePosDto.getBarcode();
// List<BarcodeDto> subCodes = Lists.newArrayList(barcode); // List<BarcodeDto> subCodes = Lists.newArrayList(barcode);
...@@ -705,7 +707,7 @@ public class StoragePosController { ...@@ -705,7 +707,7 @@ public class StoragePosController {
checkOutDto.setSingleOut(true + ""); checkOutDto.setSingleOut(true + "");
} }
// 判断线体是否为空 // 判断线体是否为空
if (StringUtils.isNotEmpty(checkOutDto.getLine())) { if (StringUtils.isEmpty(checkOutDto.getLine())) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"线体"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"线体"});
} }
String isSingleOutStr = checkOutDto.getSingleOut(); String isSingleOutStr = checkOutDto.getSingleOut();
......
...@@ -45,8 +45,11 @@ public class DataLog extends BasePo implements Serializable { ...@@ -45,8 +45,11 @@ public class DataLog extends BasePo implements Serializable {
setPosId(pos.getId()); setPosId(pos.getId());
setPosName(pos.getPosName()); setPosName(pos.getPosName());
setStatus(OP_STATUS.WAIT.name()); setStatus(OP_STATUS.WAIT.name());
if (barcode != null) {
setW(barcode.getPlateSize()); setW(barcode.getPlateSize());
setH(barcode.getHeight()); setH(barcode.getHeight());
}
} }
......
...@@ -330,9 +330,19 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -330,9 +330,19 @@ public class LizhenApi extends DefaultSmfApiListener {
if (!task.isFinished()) { if (!task.isFinished()) {
return; return;
} }
DataLog oldTask = dataLogManager.findOne(new Query(Criteria.where("barcode").is(task.getBarcode()).is(OP.CHECKOUT).and("createDate") DataLog oldTask = dataLogManager.findOne(new Query(Criteria.where("barcode").is(task.getBarcode()).and("type").is(OP.CHECKOUT)
.and("status").is(OP_STATUS.FINISHED.name()).lte(new Date())).with(Sort.by(Sort.Direction.DESC, "createDate"))); .and("status").is(OP_STATUS.FINISHED.name()).and("createDate").lte(new Date())).with(Sort.by(Sort.Direction.DESC, "createDate")));
if (oldTask == null) { if (oldTask == null) {
log.info(task.getBarcode()+"为退料,调用退料接口");
reelInToTower(inNotifyUrl, task);
} else {
log.info(task.getBarcode()+"为新料,调用保存物料接口");
reelReturnTower(oldTask);
}
}
private void reelInToTower(String inNotifyUrl, DataLog task) {
Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
dataMap.put("pickingid", ""); dataMap.put("pickingid", "");
dataMap.put("wo", ""); dataMap.put("wo", "");
...@@ -350,15 +360,17 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -350,15 +360,17 @@ public class LizhenApi extends DefaultSmfApiListener {
dataMap.put("werks", werks); dataMap.put("werks", werks);
dataMap.put("reelid", ""); dataMap.put("reelid", "");
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap)); String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info("保存物料入参为:" + param); log.info(barcode.getBarcode()+"保存物料入参为:" + param+"地址为:"+ inNotifyUrl);
try { try {
String result = HttpHelper.postJson(inNotifyUrl, Arrays.asList(dataMap)); String result = HttpHelper.postJson(inNotifyUrl, Arrays.asList(dataMap));
log.info("保存物料出参为:" + result); log.info(barcode.getBarcode()+"保存物料出参为:" + result);
} catch (ApiException e) { } catch (ApiException e) {
e.printStackTrace(); e.printStackTrace();
log.info(barcode.getBarcode() + "保存物料异常:" + e.getMessage()); log.info(barcode.getBarcode() + "保存物料异常:" + e.getMessage());
} }
} else { }
private void reelReturnTower(DataLog oldTask) {
Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
dataMap.put("line", oldTask.getLine()); dataMap.put("line", oldTask.getLine());
dataMap.put("reel_id", oldTask.getBarcode()); dataMap.put("reel_id", oldTask.getBarcode());
...@@ -373,17 +385,16 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -373,17 +385,16 @@ public class LizhenApi extends DefaultSmfApiListener {
format.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置为UTC时间 format.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置为UTC时间
String nowDateStr = format.format(date); String nowDateStr = format.format(date);
dataMap.put("create_time", nowDateStr); dataMap.put("create_time", nowDateStr);
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap)); String param = JsonUtil.toJsonStr(Arrays.asList(dataMap) + "地址为:" + CommonGIRecordUrl);
log.info("退料:" + param); log.info(oldTask.getBarcode()+"调用退料接口:" + param);
try { try {
String result = HttpHelper.postJson(CommonGIRecordUrl, Arrays.asList(dataMap)); String result = HttpHelper.postJson(CommonGIRecordUrl, Arrays.asList(dataMap));
log.info("退料出参为:" + result); log.info(oldTask.getBarcode()+"退料出参为:" + result);
} catch (ApiException e) { } catch (ApiException e) {
e.printStackTrace(); e.printStackTrace();
log.info(oldTask.getBarcode() + "退料异常:" + e.getMessage()); log.info(oldTask.getBarcode() + "退料异常:" + e.getMessage());
} }
} }
}
/** /**
* 保存物料接口 * 保存物料接口
...@@ -636,4 +647,9 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -636,4 +647,9 @@ public class LizhenApi extends DefaultSmfApiListener {
return false; return false;
} }
} }
@Override
public boolean isForThisApi(String apiName) {
return apiName != null && apiName.equalsIgnoreCase("Lizhen");
}
} }
...@@ -14,7 +14,7 @@ api: ...@@ -14,7 +14,7 @@ api:
brandQtyUrl: #http://172.30.170.199:8082/api/wcs/brandQty #gr标签满卷数 brandQtyUrl: #http://172.30.170.199:8082/api/wcs/brandQty #gr标签满卷数
importUrl: #http://10.42.222.52:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据 importUrl: #http://10.42.222.52:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据
checkReelMeasure: #http://10.190.25.124:8001/Sct/CheckReelMeasure #散料量测接口 checkReelMeasure: #http://10.190.25.124:8001/Sct/CheckReelMeasure #散料量测接口
CommonGIRecord: http://localhost:4000/Sct/CommonRMRecord CommonGIRecord: http://10.190.25.149:8082/Sct/CommonRMRecord
plant: 2810 plant: 2810
werks: 2810 werks: 2810
outerFactory: outerFactory:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!