Commit 93794b42 zshaohui

1.增加退料接口

1 个父辈 68c37e9b
......@@ -1194,6 +1194,27 @@ public class LiteOrderCache {
//得到库存信息
Map<String, InventoryItem> inventoryMap = dataCache.getAllInventory(storageIds, 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) {
//状态是未关闭的,未出库的
if (!liteOrder.isClosed()) {
......@@ -1205,7 +1226,7 @@ public class LiteOrderCache {
}
}
if (orderItem.getOutReelCount() < orderItem.getNeedReelCount()) {
InventoryItem inventoryItem = inventoryMap.get(orderItem.getPn());
InventoryItem inventoryItem = newInventoryMap.get(orderItem.getPn());
if (inventoryItem != null) {
if (inventoryItem.getStockReel() /*- inventoryItem.getLockReel()*/ - inventoryItem.getBindReel() > 0) {
inventoryItem.setBindReel(inventoryItem.getBindReel() + 1);
......
......@@ -471,9 +471,11 @@ public class StoragePosController {
List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
for (StoragePosDto storagePosDto : StoragePosDtos) {
BarcodeDto barcode = storagePosDto.getBarcode();
if (barcode.getPutInTime() == -1){
barcode.setFirstPutInDate(barcode.getCreateDate());
//storagePosDto.setBarcode(barcode);
if (barcode != null) {
if (barcode.getPutInTime() == -1) {
barcode.setFirstPutInDate(barcode.getCreateDate());
//storagePosDto.setBarcode(barcode);
}
}
}
// for (StoragePosDto storagePosDto : StoragePosDtos) {
......@@ -705,7 +707,7 @@ public class StoragePosController {
checkOutDto.setSingleOut(true + "");
}
// 判断线体是否为空
if (StringUtils.isNotEmpty(checkOutDto.getLine())) {
if (StringUtils.isEmpty(checkOutDto.getLine())) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"线体"});
}
String isSingleOutStr = checkOutDto.getSingleOut();
......
......@@ -45,8 +45,11 @@ public class DataLog extends BasePo implements Serializable {
setPosId(pos.getId());
setPosName(pos.getPosName());
setStatus(OP_STATUS.WAIT.name());
setW(barcode.getPlateSize());
setH(barcode.getHeight());
if (barcode != null) {
setW(barcode.getPlateSize());
setH(barcode.getHeight());
}
}
......
......@@ -330,58 +330,69 @@ public class LizhenApi extends DefaultSmfApiListener {
if (!task.isFinished()) {
return;
}
DataLog oldTask = dataLogManager.findOne(new Query(Criteria.where("barcode").is(task.getBarcode()).is(OP.CHECKOUT).and("createDate")
.and("status").is(OP_STATUS.FINISHED.name()).lte(new Date())).with(Sort.by(Sort.Direction.DESC, "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()).and("createDate").lte(new Date())).with(Sort.by(Sort.Direction.DESC, "createDate")));
if (oldTask == null) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("pickingid", "");
dataMap.put("wo", "");
dataMap.put("reelno", task.getBarcode());
dataMap.put("ipn", task.getPartNumber());
Barcode barcode = barcodeManager.findByBarcode(task.getBarcode());
if (barcode != null) {
dataMap.put("qty", barcode.getAmount());
dataMap.put("datecode", barcode.getDateCode());
dataMap.put("lot", barcode.getBatch());
dataMap.put("vendor", barcode.getProvider());
dataMap.put("batch", "");
dataMap.put("vendorcode", barcode.getProviderNumber());
}
dataMap.put("werks", werks);
dataMap.put("reelid", "");
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info("保存物料入参为:" + param);
try {
String result = HttpHelper.postJson(inNotifyUrl, Arrays.asList(dataMap));
log.info("保存物料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(barcode.getBarcode() + "保存物料异常:" + e.getMessage());
}
log.info(task.getBarcode()+"为退料,调用退料接口");
reelInToTower(inNotifyUrl, task);
} else {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("line", oldTask.getLine());
dataMap.put("reel_id", oldTask.getBarcode());
dataMap.put("rm_type", 2);
Storage storage = dataCache.getStorageById(oldTask.getStorageId());
if (storage.isVirtual()) {
dataMap.put("rm_type", 1);
}
dataMap.put("create_empno", SecurityUtils.getLoginUsername());
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
format.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置为UTC时间
String nowDateStr = format.format(date);
dataMap.put("create_time", nowDateStr);
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info("退料:" + param);
try {
String result = HttpHelper.postJson(CommonGIRecordUrl, Arrays.asList(dataMap));
log.info("退料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(oldTask.getBarcode() + "退料异常:" + e.getMessage());
}
log.info(task.getBarcode()+"为新料,调用保存物料接口");
reelReturnTower(oldTask);
}
}
private void reelInToTower(String inNotifyUrl, DataLog task) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("pickingid", "");
dataMap.put("wo", "");
dataMap.put("reelno", task.getBarcode());
dataMap.put("ipn", task.getPartNumber());
Barcode barcode = barcodeManager.findByBarcode(task.getBarcode());
if (barcode != null) {
dataMap.put("qty", barcode.getAmount());
dataMap.put("datecode", barcode.getDateCode());
dataMap.put("lot", barcode.getBatch());
dataMap.put("vendor", barcode.getProvider());
dataMap.put("batch", "");
dataMap.put("vendorcode", barcode.getProviderNumber());
}
dataMap.put("werks", werks);
dataMap.put("reelid", "");
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info(barcode.getBarcode()+"保存物料入参为:" + param+"地址为:"+ inNotifyUrl);
try {
String result = HttpHelper.postJson(inNotifyUrl, Arrays.asList(dataMap));
log.info(barcode.getBarcode()+"保存物料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(barcode.getBarcode() + "保存物料异常:" + e.getMessage());
}
}
private void reelReturnTower(DataLog oldTask) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("line", oldTask.getLine());
dataMap.put("reel_id", oldTask.getBarcode());
dataMap.put("rm_type", 2);
Storage storage = dataCache.getStorageById(oldTask.getStorageId());
if (storage.isVirtual()) {
dataMap.put("rm_type", 1);
}
dataMap.put("create_empno", SecurityUtils.getLoginUsername());
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
format.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置为UTC时间
String nowDateStr = format.format(date);
dataMap.put("create_time", nowDateStr);
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap) + "地址为:" + CommonGIRecordUrl);
log.info(oldTask.getBarcode()+"调用退料接口:" + param);
try {
String result = HttpHelper.postJson(CommonGIRecordUrl, Arrays.asList(dataMap));
log.info(oldTask.getBarcode()+"退料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(oldTask.getBarcode() + "退料异常:" + e.getMessage());
}
}
......@@ -636,4 +647,9 @@ public class LizhenApi extends DefaultSmfApiListener {
return false;
}
}
@Override
public boolean isForThisApi(String apiName) {
return apiName != null && apiName.equalsIgnoreCase("Lizhen");
}
}
......@@ -14,7 +14,7 @@ api:
brandQtyUrl: #http://172.30.170.199:8082/api/wcs/brandQty #gr标签满卷数
importUrl: #http://10.42.222.52:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据
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
werks: 2810
outerFactory:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!