Commit 10e307e5 zshaohui

过期时间根据mes返回 设置

1 个父辈 b4cd7d13
...@@ -671,7 +671,7 @@ public class BarcodeRule { ...@@ -671,7 +671,7 @@ public class BarcodeRule {
} }
b.setDateCode(dateCode); b.setDateCode(dateCode);
//设置生产日期 //设置生产日期
ExpiredSetting setting = ExpireDateUtil.getExpiredSetting(dateCode, supplier, partNumber); /*ExpiredSetting setting = ExpireDateUtil.getExpiredSetting(dateCode, supplier, partNumber);
if (setting != null) { if (setting != null) {
try { try {
produceDate = cn.hutool.core.date.DateUtil.parse(dateCode, setting.getExpFormat()); produceDate = cn.hutool.core.date.DateUtil.parse(dateCode, setting.getExpFormat());
...@@ -681,7 +681,7 @@ public class BarcodeRule { ...@@ -681,7 +681,7 @@ public class BarcodeRule {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }*/
} }
......
...@@ -425,6 +425,8 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -425,6 +425,8 @@ public class NLShelfHandler extends BaseDeviceHandler {
throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码",new String[]{code}); throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码",new String[]{code});
} }
barcode = lizhenApi.getInDate(barcode);
//校验是否可以入库 //校验是否可以入库
Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider()); Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (brandQty == null || brandQty.isEmpty()) { if (brandQty == null || brandQty.isEmpty()) {
......
...@@ -213,6 +213,11 @@ public class DeviceController { ...@@ -213,6 +213,11 @@ public class DeviceController {
barcode = barcodeCanPutIn; barcode = barcodeCanPutIn;
} }
Barcode barcodeDate = lizhenApi.getInDate(barcode);
if (barcodeDate != null){
barcode = barcodeDate;
}
Barcode barcodeApi = lizhenApi.barcodeInfo(barcode); Barcode barcodeApi = lizhenApi.barcodeInfo(barcode);
//如果是L开头的去量测 //如果是L开头的去量测
......
...@@ -590,6 +590,15 @@ public class LiteOrderCache { ...@@ -590,6 +590,15 @@ public class LiteOrderCache {
excludePosIds.add(pos.getId()); excludePosIds.add(pos.getId());
pos = null; pos = null;
} }
try {
lizhenApi.getInDate(pos.getBarcode());
} catch (Exception e) {
e.printStackTrace();
log.error(pos.getBarcode().getBarcode() + ":" + e.getMessage());
excludePosIds.add(pos.getId());
pos = null;
}
} while (pos == null); } while (pos == null);
} }
if (pos == null) { if (pos == null) {
......
package com.neotel.smfcore.custom.lizhen; package com.neotel.smfcore.custom.lizhen;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -67,6 +69,9 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -67,6 +69,9 @@ public class LizhenApi extends DefaultSmfApiListener {
@Value("${api.checkReelMeasure}") @Value("${api.checkReelMeasure}")
private String checkReelMeasureUrl = ""; private String checkReelMeasureUrl = "";
@Value("${api.getInDateUrl}")
private String getInDateUrl = "";
@PostConstruct @PostConstruct
public void init(){ public void init(){
fetchGRUrl = dataCache.getConfigCache("fetchGRUrl",fetchGRUrl); fetchGRUrl = dataCache.getConfigCache("fetchGRUrl",fetchGRUrl);
...@@ -77,6 +82,7 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -77,6 +82,7 @@ public class LizhenApi extends DefaultSmfApiListener {
outNotifyUrlPK = dataCache.getConfigCache("api.outNotifyUrlPK",outNotifyUrlPK); outNotifyUrlPK = dataCache.getConfigCache("api.outNotifyUrlPK",outNotifyUrlPK);
batchCheckUrl = dataCache.getConfigCache("api.batchCheckUrl",batchCheckUrl); batchCheckUrl = dataCache.getConfigCache("api.batchCheckUrl",batchCheckUrl);
checkReelMeasureUrl = dataCache.getConfigCache("api.checkReelMeasure",checkReelMeasureUrl); checkReelMeasureUrl = dataCache.getConfigCache("api.checkReelMeasure",checkReelMeasureUrl);
getInDateUrl = dataCache.getConfigCache("api.getInDate",getInDateUrl);
} }
/** /**
...@@ -590,6 +596,43 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -590,6 +596,43 @@ public class LizhenApi extends DefaultSmfApiListener {
} }
public Barcode getInDate(Barcode barcode) {
if (StringUtils.isBlank(getInDateUrl)) {
return barcode;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("material_code", barcode.getPartNumber());
paramMap.put("date_code", barcode.getDateCode());
paramMap.put("plant_code", plant);
paramMap.put("brand", barcode.getProvider());
try {
log.info(barcode.getBarcode() + ":getInDate入参为:" + JSON.toJSONString(paramMap));
String result = HttpHelper.postJson(getInDateUrl, paramMap);
log.info(barcode.getBarcode() + ":getInDate出参为:" + result);
JSONObject jsonObject = JSON.parseObject(result);
String msgty = jsonObject.getString("MSGTY");
if ("S".equalsIgnoreCase(msgty)) {
int data = jsonObject.getIntValue("DATA");
if (data < 0) {
throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库");
}
else if (data > 0){
Date expireDate = DateUtil.offsetDay(new Date(), data);
barcode.setExpireDate(expireDate);
} else {
barcode.setExpireDate(null);
}
return barcode;
} else {
throw new ValidateException("smfcore.mesApi.getInDate.ng", barcode.getBarcode() + "验证ng:" + jsonObject.getString("MSGTX"));
}
} catch (Exception e) {
e.printStackTrace();
throw new ValidateException("smfcore.mesApi.getInDate.ng", barcode.getBarcode() + "验证ng:" + e.getMessage());
}
}
@Override @Override
public boolean isForThisApi(String apiName) { public boolean isForThisApi(String apiName) {
return apiName != null && apiName.equalsIgnoreCase("Lizhen"); return apiName != null && apiName.equalsIgnoreCase("Lizhen");
......
...@@ -221,6 +221,15 @@ public class OutLineController { ...@@ -221,6 +221,15 @@ public class OutLineController {
} }
} }
try {
Barcode barcodeDate = lizhenApi.getInDate(barcode);
if (barcodeDate != null){
barcode = barcodeDate;
}
} catch (Exception e) {
return ResultBean.newErrorResult(-1,"",e.getMessage());
}
//判断物料是否过期 //判断物料是否过期
Date expireDate = barcode.getExpireDate(); Date expireDate = barcode.getExpireDate();
......
...@@ -1136,6 +1136,13 @@ public class WarehouseController { ...@@ -1136,6 +1136,13 @@ public class WarehouseController {
e.printStackTrace(); e.printStackTrace();
return ResultBean.newErrorResult(-1, "", e.getMessage()); return ResultBean.newErrorResult(-1, "", e.getMessage());
} }
try {
lizhenApi.getInDate(codeBean.getBarcode());
} catch (Exception e) {
return ResultBean.newErrorResult(-1, "", e.getMessage());
}
List<Barcode> subCodes = pidBarcode.getSubCodeList(); List<Barcode> subCodes = pidBarcode.getSubCodeList();
if (subCodes == null || subCodes.isEmpty()) { if (subCodes == null || subCodes.isEmpty()) {
return ResultBean.newErrorResult(-1, "", "料箱:" + boxStr + ",没有可出库的物料"); return ResultBean.newErrorResult(-1, "", "料箱:" + boxStr + ",没有可出库的物料");
......
...@@ -26,6 +26,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos; ...@@ -26,6 +26,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager; import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.innerBox.bean.OutLotInfo; import com.neotel.smfcore.custom.lizhen.innerBox.bean.OutLotInfo;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType; import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.lizhen.innerBox.util.OutLotInfoCache; import com.neotel.smfcore.custom.lizhen.innerBox.util.OutLotInfoCache;
...@@ -88,6 +89,9 @@ public class InnerBoxRestController { ...@@ -88,6 +89,9 @@ public class InnerBoxRestController {
@Autowired @Autowired
private SmfApi smfApi; private SmfApi smfApi;
@Autowired
private LizhenApi lizhenApi;
//料架缓存id //料架缓存id
private static Map<String,String> labelOrderItemMap = new ConcurrentHashMap<>(); private static Map<String,String> labelOrderItemMap = new ConcurrentHashMap<>();
...@@ -524,6 +528,15 @@ public class InnerBoxRestController { ...@@ -524,6 +528,15 @@ public class InnerBoxRestController {
return ResultBean.newErrorResult(-1, "", e.getMessage()); return ResultBean.newErrorResult(-1, "", e.getMessage());
} }
try {
Barcode barcodeDate = lizhenApi.getInDate(barcode);
if (barcodeDate != null){
barcode = barcodeDate;
}
} catch (Exception e) {
return ResultBean.newErrorResult(-1,"",e.getMessage());
}
//不在仓中,不允许出库 //不在仓中,不允许出库
StoragePos storagePos = storagePosManager.getByBarcode(barcode.getBarcode()); StoragePos storagePos = storagePosManager.getByBarcode(barcode.getBarcode());
if (storagePos == null){ if (storagePos == null){
......
...@@ -163,6 +163,16 @@ public class VirtualRestController { ...@@ -163,6 +163,16 @@ public class VirtualRestController {
return ResultBean.newErrorResult(-1,"",e.getMessage()); return ResultBean.newErrorResult(-1,"",e.getMessage());
} }
try {
Barcode barcodeDate = lizhenApi.getInDate(barcode);
if (barcodeDate != null){
barcode = barcodeDate;
}
} catch (Exception e) {
return ResultBean.newErrorResult(-1,"",e.getMessage());
}
//判断是否已经存在库位 //判断是否已经存在库位
StoragePos pos = storagePosManager.getByBarcode(barcode.getBarcode()); StoragePos pos = storagePosManager.getByBarcode(barcode.getBarcode());
if (pos != null) { if (pos != null) {
...@@ -350,7 +360,7 @@ public class VirtualRestController { ...@@ -350,7 +360,7 @@ public class VirtualRestController {
barcode.setAmount(dataLog.getNum()); barcode.setAmount(dataLog.getNum());
barcode.setDateCode(dataLog.getDateCode()); barcode.setDateCode(dataLog.getDateCode());
//设置生产日期 //设置生产日期
ExpiredSetting setting = ExpireDateUtil.getExpiredSetting(dataLog.getDateCode(), dataLog.getProvider(),dataLog.getPartNumber()); /* ExpiredSetting setting = ExpireDateUtil.getExpiredSetting(dataLog.getDateCode(), dataLog.getProvider(),dataLog.getPartNumber());
if (setting != null) { if (setting != null) {
try { try {
Date produceDate = cn.hutool.core.date.DateUtil.parse(dataLog.getDateCode(), setting.getExpFormat()); Date produceDate = cn.hutool.core.date.DateUtil.parse(dataLog.getDateCode(), setting.getExpFormat());
...@@ -360,7 +370,7 @@ public class VirtualRestController { ...@@ -360,7 +370,7 @@ public class VirtualRestController {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }*/
barcode.setPartNumber(dataLog.getPartNumber()); barcode.setPartNumber(dataLog.getPartNumber());
barcode.setBatch(dataLog.getBatchInfo()); barcode.setBatch(dataLog.getBatchInfo());
barcode.setProvider(dataLog.getProvider()); barcode.setProvider(dataLog.getProvider());
......
...@@ -14,6 +14,7 @@ api: ...@@ -14,6 +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://172.30.150.83:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据 importUrl: #http://172.30.150.83:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据
checkReelMeasure: #http://172.30.60.117:8001/Sct/CheckReelMeasure #外仓散料仓量测接口 checkReelMeasure: #http://172.30.60.117:8001/Sct/CheckReelMeasure #外仓散料仓量测接口
getInDateUrl: http://172.30.170.199:8082/api/Mes/GetInDate
plant: W337 plant: W337
werks: W337 werks: W337
outerFactory: B15 outerFactory: B15
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!