Commit 1eefd74f zshaohui

工单出库的时候 先调用接口 后边进行生成任务

1 个父辈 43689660
......@@ -565,9 +565,6 @@ public class LiteOrderCache {
// log.error("未找到可以出库的物料[" + partNumber + "]");
break;
} else {
assignReelCount = assignReelCount + 1;
taskReelCount = taskReelCount + 1;
log.info("工单[" + orderNo + "],任务数[" + taskReelCount + "]出库位置仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount());
DataLog task = newTask(pos);
task.setSourceId(cacheOrder.getId());
task.setSourceName(cacheOrder.getOrderNo());
......@@ -597,8 +594,21 @@ public class LiteOrderCache {
task.setKeeperCode(pos.getBarcode().getKeeperCode());
task.setExport(exportStr);
task.setPickingId(orderItem.getPickingId());
// task = dataLogDao.save(task);
taskService.addTaskToExecute(task);
//先调用tower发料
String result = lizhenApi.towerIssue(task);
if (StringUtils.isEmpty(result)){
assignReelCount = assignReelCount + 1;
taskReelCount = taskReelCount + 1;
log.info("工单[" + orderNo + "],任务数[" + taskReelCount + "]出库位置仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount());
taskService.addTaskToExecute(task);
Barcode barcode = pos.getBarcode();
barcode.setAskPutIn(false);
barcodeManager.save(barcode);
pos.setBarcode(barcode);
storagePosManager.save(pos);
}
}
//如果是RI出库,只有一盘,出完就结束
if (cacheOrder.getType() == 2) {
......
......@@ -71,6 +71,9 @@ public class LizhenApi extends DefaultSmfApiListener {
@Value("${api.inNotifyUrl}")
private String inNotifyUrl = "";
@Value("${api.outNotifyUrl}")
private String towerIssueUrl = "";
@PostConstruct
public void init(){
......@@ -281,23 +284,36 @@ public class LizhenApi extends DefaultSmfApiListener {
@Override
public void outTaskStatusChange(String outNotifyUrl, DataLog task) {
if (task.isFinished()) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("PLANT_CODE", CommonUtil.plantCode);
paramMap.put("PICKING_ID", task.getPickingId());
paramMap.put("MATERIAL_CODE", task.getPartNumber());
paramMap.put("WAREHOUSE_CODE", task.getWarehouseCode());
paramMap.put("BRAND", task.getProvider());
paramMap.put("FACE", task.getSide());
paramMap.put("BATCH_CODE", task.getBatchInfo());
paramMap.put("REEL_LIST", Arrays.asList(task.getBarcode()));
log.info(task.getBarcode() + "出库通知,调用Tower发料,请求参数为:" + JSON.toJSONString(paramMap));
try {
String resultStr = HttpHelper.postJson(outNotifyUrl, paramMap);
log.info(task.getBarcode() + "出库通知,调用Tower发料,结果为:" + resultStr);
} catch (ApiException e) {
e.printStackTrace();
log.info(task.getBarcode() + "出库通知,调用Tower发料,异常为:" + e.getMessage());
}
}
public String towerIssue(DataLog task) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("PLANT_CODE", CommonUtil.plantCode);
paramMap.put("PICKING_ID", task.getPickingId());
paramMap.put("MATERIAL_CODE", task.getPartNumber());
paramMap.put("WAREHOUSE_CODE", task.getWarehouseCode());
paramMap.put("BRAND", task.getProvider());
paramMap.put("FACE", task.getSide());
paramMap.put("BATCH_CODE", task.getBatchInfo());
paramMap.put("REEL_LIST", Arrays.asList(task.getBarcode()));
log.info(task.getBarcode() + "出库通知,调用Tower发料,请求参数为:" + JSON.toJSONString(paramMap));
try {
String resultStr = HttpHelper.postJson(towerIssueUrl, paramMap);
log.info(task.getBarcode() + "出库通知,调用Tower发料,结果为:" + resultStr);
JSONObject jsonObject = JSON.parseObject(resultStr);
if ("S".equalsIgnoreCase(jsonObject.getString("MSGTY")) || "S".equals(jsonObject.getString("msgty"))) {
return "";
} else {
return jsonObject.getString("MSGTX");
}
} catch (ApiException e) {
e.printStackTrace();
log.info(task.getBarcode() + "出库通知,调用Tower发料,异常为:" + e.getMessage());
return e.getMessage();
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!