Commit e49d82c0 zshaohui

电子料入退库 重新设置数量

1 个父辈 01b69ecc
...@@ -75,6 +75,8 @@ public class Barcode extends BasePo implements Serializable { ...@@ -75,6 +75,8 @@ public class Barcode extends BasePo implements Serializable {
* 标签解析出来的数量,用于判断条码是否是重新打印的,重新打印的条码需要重新设置数量 * 标签解析出来的数量,用于判断条码是否是重新打印的,重新打印的条码需要重新设置数量
*/ */
private int labelAmount = 0; private int labelAmount = 0;
private String labelId;
/** /**
* 盘宽 * 盘宽
*/ */
......
...@@ -29,6 +29,7 @@ import com.neotel.smfcore.core.system.util.TaskService; ...@@ -29,6 +29,7 @@ import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.LizhenApi; import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType; import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.lizhen.virtual.service.manager.IVirInventoryManager; import com.neotel.smfcore.custom.lizhen.virtual.service.manager.IVirInventoryManager;
import com.neotel.smfcore.custom.lizhen.wcs.bean.BackToWarehouse;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.device.handler.IDeviceHandler; import com.neotel.smfcore.core.device.handler.IDeviceHandler;
...@@ -322,7 +323,9 @@ public class DeviceController { ...@@ -322,7 +323,9 @@ public class DeviceController {
Storage theStorage = dataCache.getStorageById(pos.getStorageId()); Storage theStorage = dataCache.getStorageById(pos.getStorageId());
if (!barcode.isAskPutIn()) { if (!barcode.isAskPutIn()) {
lizhenApi.backToWarehouse(warhouseCode, theStorage.getName(), barcode.getBarcode()); BackToWarehouse back = lizhenApi.backToWarehouse(warhouseCode, theStorage.getName(), barcode.getBarcode());
barcode.setLabelId(back.getLABEL_ID());
barcode.setAmount(back.getLABEL_QTY());
} }
barcode.setWarehouseCode(warhouseCode); barcode.setWarehouseCode(warhouseCode);
......
...@@ -20,6 +20,7 @@ import com.neotel.smfcore.core.system.service.po.DataLog; ...@@ -20,6 +20,7 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem; import com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem;
import com.neotel.smfcore.custom.lizhen.innerBox.util.CommonUtil; import com.neotel.smfcore.custom.lizhen.innerBox.util.CommonUtil;
import com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache; import com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache;
import com.neotel.smfcore.custom.lizhen.wcs.bean.BackToWarehouse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -467,7 +468,7 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -467,7 +468,7 @@ public class LizhenApi extends DefaultSmfApiListener {
} }
public void backToWarehouse(String warhouseCode, String machineName, String barcode) { public BackToWarehouse backToWarehouse(String warhouseCode, String machineName, String barcode) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("PLANT_CODE", CommonUtil.plantCode); paramMap.put("PLANT_CODE", CommonUtil.plantCode);
paramMap.put("RETURN_TYPE", "return_tower"); //退回大库: return 退回料塔: return_tower paramMap.put("RETURN_TYPE", "return_tower"); //退回大库: return 退回料塔: return_tower
...@@ -480,14 +481,17 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -480,14 +481,17 @@ public class LizhenApi extends DefaultSmfApiListener {
JSONObject jsonObject = JSONObject.parseObject(resultStr); JSONObject jsonObject = JSONObject.parseObject(resultStr);
String msgty = jsonObject.getString("MSGTY"); String msgty = jsonObject.getString("MSGTY");
if (!"S".equalsIgnoreCase(msgty)){ if (!"S".equalsIgnoreCase(msgty)) {
throw new ValidateException("",barcode+"调用电子料入退库失败:"+resultStr); throw new ValidateException("", barcode + "调用电子料入退库失败:" + resultStr);
} }
String data = jsonObject.getString("DATA");
return JSONObject.parseObject(data, BackToWarehouse.class);
} catch (ApiException e) { } catch (ApiException e) {
e.printStackTrace(); e.printStackTrace();
log.info(barcode + "入库通知,调用电子料入退库,异常为:" + e.getMessage()); log.info(barcode + "入库通知,调用电子料入退库,异常为:" + e.getMessage());
} }
throw new ValidateException("", barcode + "调用电子料入退库失败:未找到对应的信息");
} }
...@@ -497,11 +501,66 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -497,11 +501,66 @@ public class LizhenApi extends DefaultSmfApiListener {
} }
public static void main(String[] args) { public static void main(String[] args) {
String resultStr = "{\"code\":0,\"data\":{\"amount\":20000,\"barSource\":\"\",\"barcode\":\"A107970012824280LA\",\"batch\":\"TPA242000055\",\"createDate\":\"2024-07-18 15:57:41\",\"dateCode\":\"20240513\",\"expireDate\":\"2025-05-13 00:00:00\",\"expireDateStr\":\"05/13/2025\",\"expired\":false,\"extraDataMap\":{},\"firstPutInDate\":\"2024-07-18 15:57:52\",\"fullCode\":\"103S00558-797001|TPA242000055-20240513|20000|A107970012824280LA|CYNTEC|TPA242000055000280LA\",\"fullQty\":0,\"height\":8,\"heightMap\":{},\"hold\":0,\"id\":\"57798\",\"inStoreHour\":50,\"inStoreMiniute\":39,\"initialAmount\":0,\"inventory\":false,\"labelAmount\":20000,\"labelId\":\"L2024071800000931\",\"maxStorageTime\":0.0,\"mixTime\":0,\"needOutDateStr\":\"\",\"onlySingleOut\":false,\"orderId\":\"\",\"orderItemId\":\"\",\"out\":false,\"partNumber\":\"103S00558\",\"plateSize\":7,\"posName\":\"\",\"produceDate\":\"2024-07-17 11:29:44\",\"provider\":\"CYNTEC\",\"providerNumber\":\"797001\",\"putInDate\":\"2024-07-18 15:57:52\",\"putInDateStr\":\"07/18/2024 15:57:52\",\"putInTime\":1721289472118,\"qty\":0,\"reachWarmTime\":1721471816486,\"reachedWarmTime\":true,\"reelAmount\":1,\"relationCodes\":[],\"seq\":4,\"smallReel\":true,\"solder\":false,\"solderStatus\":0,\"startWarmTime\":-1,\"status\":0,\"thickness\":\"\",\"type\":0,\"updateDate\":\"2024-07-20 16:25:44\",\"used\":false,\"usedCount\":0,\"warehouseCode\":\"W10B\",\"warmTime\":0,\"willExpired\":false},\"msg\":\"ok\",\"msgKey\":\"smfcore.ok\",\"okResult\":true,\"params\":[]}"; 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); JSONObject jsonObject = JSONObject.parseObject(resultStr);
if (jsonObject.getInteger("code") != null && jsonObject.getInteger("code") == 0){ String msgty = jsonObject.getString("MSGTY");
Barcode barcode = JSONObject.parseObject(jsonObject.getString("data"), Barcode.class); if (!"S".equalsIgnoreCase(msgty)) {
System.out.println(123); //throw new ValidateException("", barcode + "调用电子料入退库失败:" + resultStr);
} }
String data = jsonObject.getString("DATA");
BackToWarehouse backToWarehouse = JSONObject.parseObject(data, BackToWarehouse.class);
System.out.println(JSON.toJSONString(backToWarehouse));
} }
} }
package com.neotel.smfcore.custom.lizhen.wcs.bean;
import lombok.Data;
@Data
public class BackToWarehouse {
// 厂区
private String PLANT_CODE;
// 标签码
private String LABEL_ID;
// 料号
private String MATERIAL_CODE;
// 库别
private String WAREHOUSE_CODE;
// 数量
private int LABEL_QTY;
// 厂商代码
private String VENDOR_CODE;
// 厂商名称
private String VENDOR_NAME;
// 版本
private String VERSION;
// 单据日期
private String GR_DATE; // 假设日期是字符串,如果需要使用日期类型,请改为LocalDate等
// 异动日期
private String TRAN_DATE; // 同上
// 状态
private int STATUS; // 假设状态是整数
// 仓管员
private String KEEPER_CODE;
// 制造商
private String BRAND;
// 单位
private String UNIT;
// 批次号
private String BATCH_CODE;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!