Commit 328d68a9 zshaohui

入库时调用wms fetchReel接口

1 个父辈 b2a92376
...@@ -282,4 +282,6 @@ public class BarcodeDto implements Serializable { ...@@ -282,4 +282,6 @@ public class BarcodeDto implements Serializable {
@ApiModelProperty("Keeper") @ApiModelProperty("Keeper")
private String keeperCode; private String keeperCode;
private String labelId;
} }
...@@ -191,14 +191,14 @@ public class DeviceController { ...@@ -191,14 +191,14 @@ public class DeviceController {
} }
//判断库别是否为空 //判断库别是否为空
Barcode barcode1F = lizhenApi.getBarcode(barcode.getBarcode()); Barcode reelBarcode = lizhenApi.fetchReel(barcode);
if (barcode1F == null || StringUtils.isEmpty(barcode1F.getWarehouseCode())){ if (reelBarcode == null){
throw new ValidateException("", barcode.getBarcode()+"未找到对应的库别信息");
}
String warehouseCode = reelBarcode.getWarehouseCode();
if (StringUtils.isEmpty(warehouseCode)){
throw new ValidateException("", barcode.getBarcode()+"未找到对应的库别信息"); throw new ValidateException("", barcode.getBarcode()+"未找到对应的库别信息");
} }
String warhouseCode = barcode1F.getWarehouseCode();
log.info(barcode.getBarcode()+"从1F查出来的库别信息为:"+warhouseCode);
//判断虚拟仓有没有存在,如果有,把虚拟仓库位置空 //判断虚拟仓有没有存在,如果有,把虚拟仓库位置空
StoragePos storagePos = storagePosManager.getByBarcode(barcode.getBarcode()); StoragePos storagePos = storagePosManager.getByBarcode(barcode.getBarcode());
...@@ -323,12 +323,12 @@ public class DeviceController { ...@@ -323,12 +323,12 @@ public class DeviceController {
Storage theStorage = dataCache.getStorageById(pos.getStorageId()); Storage theStorage = dataCache.getStorageById(pos.getStorageId());
if (!barcode.isAskPutIn()) { if (!barcode.isAskPutIn()) {
BackToWarehouse back = lizhenApi.backToWarehouse(warhouseCode, theStorage.getName(), barcode.getBarcode()); BackToWarehouse back = lizhenApi.backToWarehouse(warehouseCode, theStorage.getName(), barcode.getBarcode());
barcode.setLabelId(back.getLABEL_ID()); barcode.setLabelId(back.getLABEL_ID());
barcode.setAmount(back.getLABEL_QTY()); barcode.setAmount(back.getLABEL_QTY());
} }
barcode.setWarehouseCode(warhouseCode); barcode.setWarehouseCode(warehouseCode);
barcode.setAskPutIn(true); barcode.setAskPutIn(true);
barcode = barcodeManager.save(barcode); barcode = barcodeManager.save(barcode);
......
...@@ -75,6 +75,9 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -75,6 +75,9 @@ public class LizhenApi extends DefaultSmfApiListener {
@Value("${api.outNotifyUrl}") @Value("${api.outNotifyUrl}")
private String towerIssueUrl = ""; private String towerIssueUrl = "";
@Value("${api.fetchReel}")
private String fetchReel = "";
@PostConstruct @PostConstruct
public void init(){ public void init(){
...@@ -519,72 +522,49 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -519,72 +522,49 @@ public class LizhenApi extends DefaultSmfApiListener {
} }
public Barcode fetchReel(Barcode barcode) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("reel_code", barcode.getBarcode());
log.info(barcode.getBarcode() + "fetchReel调用参数为:" + JSON.toJSONString(paramMap));
try {
String resultStr = HttpHelper.postJson(fetchReel, paramMap);
log.info(barcode.getBarcode() + "fetchReel调用结果为:" + resultStr);
JSONObject resultObj = JSONObject.parseObject(resultStr);
String msgty = resultObj.getString("MSGTY");
if ("S".equals(msgty)){
JSONObject dataObj = resultObj.getJSONObject("DATA");
String labelId = dataObj.getString("label_id");
int reelQty = dataObj.getIntValue("reel_qty");
String warehouseCode = dataObj.getString("warehouse_code");
if (StringUtils.isNotBlank(warehouseCode)){
barcode.setWarehouseCode(warehouseCode);
}
if (StringUtils.isNotBlank(labelId)){
barcode.setLabelId(labelId);
}
if (reelQty != 0){
barcode.setAmount(reelQty);
}
return barcode;
}
} catch (Exception e) {
log.info(barcode.getBarcode()+"fetchReel调用失败:"+e.getMessage());
}
return null;
}
@Override @Override
public boolean isForThisApi(String apiName) { public boolean isForThisApi(String apiName) {
return apiName != null && apiName.equalsIgnoreCase("Lizhen"); return apiName != null && apiName.equalsIgnoreCase("Lizhen");
} }
public static void main(String[] args) { public static void main(String[] args) {
String resultStr = "{\n" +
" \"MSGTY\": \"S\",\n" +
" \"MSGTX\": \"退回成功\",\n" +
" \"DETAIL\": null,\n" +
" \"DATA\": {\n" +
" \"inventory_id\": \"21438181639800001\",\n" +
" \"plant_code\": \"W339\",\n" +
" \"material_type\": \"ROH\",\n" +
" \"material_code\": \"138S1068\",\n" +
" \"warehouse_code\": \"W10B\",\n" +
" \"bin_code\": \"Tower1-RW10B\",\n" +
" \"keeper_code\": \"BR013\",\n" +
" \"label_id\": \"L2024072200003578\",\n" +
" \"group_id\": null,\n" +
" \"label_qty\": 10000.0,\n" +
" \"vendor_code\": \"0000017425\",\n" +
" \"vendor_name\": null,\n" +
" \"fl_code\": null,\n" +
" \"allocate_qty\": 0.0,\n" +
" \"ticket_type\": null,\n" +
" \"extend_days\": 0,\n" +
" \"extend_times\": 0,\n" +
" \"rohs\": null,\n" +
" \"order_no\": null,\n" +
" \"version\": null,\n" +
" \"os_version\": null,\n" +
" \"date_code\": null,\n" +
" \"week_code\": null,\n" +
" \"lot_code\": null,\n" +
" \"remark\": null,\n" +
" \"batch_code\": \"10000000NM\",\n" +
" \"expire_date\": null,\n" +
" \"gr_date\": \"2024-07-19 04:35:57\",\n" +
" \"tran_date\": \"2024-07-22 13:29:23\",\n" +
" \"status\": 0,\n" +
" \"reel_qty\": 1.0,\n" +
" \"pack_type\": null,\n" +
" \"brand\": \"MURATA\",\n" +
" \"mpn\": null,\n" +
" \"unit\": \"PC\",\n" +
" \"coo\": null,\n" +
" \"region\": null,\n" +
" \"cavity\": null,\n" +
" \"group_code\": null,\n" +
" \"create_at\": \"2024-07-22 13:29:23\",\n" +
" \"create_by\": \"MLB_API\",\n" +
" \"update_at\": null,\n" +
" \"update_by\": null\n" +
" }\n" +
"}";
//String resultStr = HttpHelper.postJson(inNotifyUrl, paramMap);
//log.info(barcode + "入库通知,调用电子料入退库,结果为:" + resultStr);
JSONObject jsonObject = JSONObject.parseObject(resultStr);
String msgty = jsonObject.getString("MSGTY");
if (!"S".equalsIgnoreCase(msgty)) {
//throw new ValidateException("", barcode + "调用电子料入退库失败:" + resultStr);
}
String data = jsonObject.getString("DATA");
BackToWarehouse backToWarehouse = JSONObject.parseObject(data, BackToWarehouse.class);
System.out.println(JSON.toJSONString(backToWarehouse));
} }
} }
...@@ -5,3 +5,4 @@ api: ...@@ -5,3 +5,4 @@ api:
outNotifyUrl: http://10.68.30.22:8082/api/mlb/TowerIssue outNotifyUrl: http://10.68.30.22:8082/api/mlb/TowerIssue
inNotifyUrl: http://10.68.30.22:8082/api/mlb/BackToWarehouse inNotifyUrl: http://10.68.30.22:8082/api/mlb/BackToWarehouse
getBarcode: http://10.68.27.83/smf-core/thirdBarcode/getBarcode getBarcode: http://10.68.27.83/smf-core/thirdBarcode/getBarcode
fetchReel: http://10.68.30.22:8082/api/mlb/FetchReel
\ No newline at end of file \ No newline at end of file
...@@ -5,3 +5,4 @@ api: ...@@ -5,3 +5,4 @@ api:
outNotifyUrl: http://10.42.220.171:8082/api/mlb/TowerIssue outNotifyUrl: http://10.42.220.171:8082/api/mlb/TowerIssue
inNotifyUrl: http://10.42.220.171:8082/api/mlb/BackToWarehouse inNotifyUrl: http://10.42.220.171:8082/api/mlb/BackToWarehouse
getBarcode: http://10.68.27.83/smf-core/thirdBarcode/getBarcode getBarcode: http://10.68.27.83/smf-core/thirdBarcode/getBarcode
fetchReel: http://10.42.220.171:8082/api/mlb/FetchReel
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!