Commit 900175f7 zshaohui

1.入库单校验bug修改

2.返回给客户端ExposureStartDate,StabilizationEndDate,ExpiredDate
1 个父辈 0d2ed7d2
...@@ -231,6 +231,9 @@ public class Barcode extends BasePo implements Serializable { ...@@ -231,6 +231,9 @@ public class Barcode extends BasePo implements Serializable {
*/ */
private Date sluggishTime; private Date sluggishTime;
private Date stabilizationEndDate;
/** /**
* 自定义的附加信息 * 自定义的附加信息
*/ */
...@@ -404,6 +407,20 @@ public class Barcode extends BasePo implements Serializable { ...@@ -404,6 +407,20 @@ public class Barcode extends BasePo implements Serializable {
return ""; return "";
} }
public String getOpenTimeStr() {
if (openTime != null) {
return DateUtil.toDateString(openTime);
}
return "";
}
public String getStabilizationEndDateStr() {
if (stabilizationEndDate != null) {
return DateUtil.toDateString(stabilizationEndDate);
}
return "";
}
/** /**
* 是否已过期 * 是否已过期
*/ */
......
...@@ -215,6 +215,13 @@ public class CodeResolve { ...@@ -215,6 +215,13 @@ public class CodeResolve {
needUpdate = true; needUpdate = true;
} }
Date expireDate = barcodeFromRule.getExpireDate();
if (expireDate != null){
barcode.setExpireDate(expireDate);
log.info("重新设置"+codeBeanFromRule.getCodeStr()+"的过期日期");
needUpdate = true;
}
if(needUpdate){ if(needUpdate){
try { try {
barcodeManager.save(barcode); barcodeManager.save(barcode);
......
...@@ -322,6 +322,9 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -322,6 +322,9 @@ public class BaseDeviceHandler implements IDeviceHandler {
int plateH = barcodeSave.getHeight(); int plateH = barcodeSave.getHeight();
statusBean.addPosInfo(barcodeSave.getBarcode(), posId, plateW, plateH, false,false,barcodeSave.getUsedCount()); statusBean.addPosInfo(barcodeSave.getBarcode(), posId, plateW, plateH, false,false,barcodeSave.getUsedCount());
statusBean.addData("inOutType",putInTask.getInOutType()); statusBean.addData("inOutType",putInTask.getInOutType());
statusBean.addData("expiredDate",barcodeSave.getExpireDateStr());
statusBean.addData("stabilizationEndDate",barcodeSave.getStabilizationEndDateStr());
statusBean.addData("exposureStartDate",barcodeSave.getOpenTimeStr());
log.info(barcodeSave.getBarcode() + "[" + plateW + "x" + plateH + "]开始入库到" + storage.getCid() + "[" + posId + "]"); log.info(barcodeSave.getBarcode() + "[" + plateW + "x" + plateH + "]开始入库到" + storage.getCid() + "[" + posId + "]");
//清空展示的消息 //清空展示的消息
......
...@@ -459,50 +459,60 @@ public class Micron20031Api { ...@@ -459,50 +459,60 @@ public class Micron20031Api {
public static Barcode depositCreateMA(Barcode barcode,String username) throws ApiException { public static Barcode depositCreateMA(Barcode barcode,String username) throws ApiException {
//pnMap的key为pn, value为库存数量 //pnMap的key为pn, value为库存数量
String depositCreateMAUrl = getUrl(api_DepositCreateMA); String depositCreateMAUrl = getUrl(api_DepositCreateMA);
if (StringUtils.isBlank(depositCreateMAUrl)){ if (StringUtils.isBlank(depositCreateMAUrl)) {
return barcode; return barcode;
} }
String auth = getAuthToken(); String auth = getAuthToken();
Map<String,Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
dataMap.put("MicronPN",barcode.getPartNumber()); dataMap.put("MicronPN", barcode.getPartNumber());
dataMap.put("LotNo",barcode.getBarcode()); dataMap.put("LotNo", barcode.getBarcode());
dataMap.put("Quantity",barcode.getAmount()); dataMap.put("Quantity", barcode.getAmount());
String dateStr = ""; String dateStr = "";
Date expireDate = barcode.getExpireDate(); Date expireDate = barcode.getExpireDate();
if (expireDate != null){ if (expireDate != null) {
dateStr = cn.hutool.core.date.DateUtil.format(expireDate,"MM-dd-yyyy"); dateStr = cn.hutool.core.date.DateUtil.format(expireDate, "MM-dd-yyyy");
} }
dataMap.put("ExpiredDate",dateStr); dataMap.put("ExpiredDate", dateStr);
dataMap.put("SystemID","SPMMS"); dataMap.put("SystemID", "SPMMS");
dataMap.put("MaterialType",MATERIAL_TYPE); dataMap.put("MaterialType", MATERIAL_TYPE);
dataMap.put("Username",username); dataMap.put("Username", username);
dataMap.put("supplier",barcode.getProvider()); dataMap.put("supplier", barcode.getProvider());
dataMap.put("manufacturerLotNo",barcode.getBatch()); dataMap.put("manufacturerLotNo", barcode.getBatch());
log.info("调用MES接口 depositCreateMA,参数:"+JsonUtil.toJsonStr(dataMap)); log.info("调用MES接口 depositCreateMA,参数:" + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(depositCreateMAUrl, dataMap, auth); String resultStr = HttpHelper.postJsonWithAuth(depositCreateMAUrl, dataMap, auth);
log.info("调用MES接口 depositCreateMA 返回:" + resultStr); log.info("调用MES接口 depositCreateMA 返回:" + resultStr);
Map<String, Object> resultMap = JsonUtil.toMap(resultStr); Map<String, Object> resultMap = JsonUtil.toMap(resultStr);
Object resultStatus = resultMap.get("status"); Object resultStatus = resultMap.get("status");
if (ObjectUtil.isEmpty(resultStr) ||ObjectUtil.isEmpty(resultStatus)) { if (ObjectUtil.isEmpty(resultStr) || ObjectUtil.isEmpty(resultStatus)) {
throw new ApiException("smfcore.api.returnNoData", "depositCreateMA Failed to get data", new String[]{"depositCreateMA"}); throw new ApiException("smfcore.api.returnNoData", "depositCreateMA Failed to get data", new String[]{"depositCreateMA"});
} }
if(resultStatus != null && !resultStatus.toString().equalsIgnoreCase("PASS")){ if (resultStatus != null && !resultStatus.toString().equalsIgnoreCase("PASS")) {
String msg = resultMap.get("message").toString(); String msg = resultMap.get("message").toString();
throw new ApiException(msg); throw new ApiException(msg);
} }
Object stabilizationEndDateObj = resultMap.get( "stabilizationEndDate"); Object stabilizationEndDateObj = resultMap.get("stabilizationEndDate");
Date stabilizationEndDate = DateUtil.toDate(stabilizationEndDateObj.toString(),"MM-dd-yyyy"); if (stabilizationEndDateObj != null){
barcode.updateAppendData("stabilizationEndDate",stabilizationEndDate); Date stabilizationEndDate = DateUtil.toDate(stabilizationEndDateObj.toString(), "MM-dd-yyyy");
barcode.updateAppendData("opUsername",username); barcode.setStabilizationEndDate(stabilizationEndDate);
barcode.updateAppendData("maTrackOut",false); barcode.updateAppendData("stabilizationEndDate", stabilizationEndDate);
}
barcode.updateAppendData("opUsername", username);
barcode.updateAppendData("maTrackOut", false);
try { try {
Object exposureStartDateObj = resultMap.get("exposureStartDate"); Object exposureStartDateObj = resultMap.get("exposureStartDate");
Date exposureStartDate = DateUtil.toDate(exposureStartDateObj.toString(),"MM-dd-yyyy"); Date exposureStartDate = DateUtil.toDate(exposureStartDateObj.toString(), "MM-dd-yyyy");
barcode.setOpenTime(exposureStartDate); barcode.setOpenTime(exposureStartDate);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
Object expiredDateObj = resultMap.get("expiredDate");
if (expiredDateObj != null) {
Date expiredDate = DateUtil.toDate(expiredDateObj.toString(), "MM-dd-yyyy");
log.info("重新设置镁光的过期时间为:" + expiredDate);
barcode.setExpireDate(expiredDate);
}
return barcode; return barcode;
} }
......
...@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -57,7 +58,7 @@ public class MicronSpApiListener extends BaseSmfApiListener { ...@@ -57,7 +58,7 @@ public class MicronSpApiListener extends BaseSmfApiListener {
boolean hasBarcode = false; boolean hasBarcode = false;
List<InListItem> inListItems = inList.getInListItems(); List<InListItem> inListItems = inList.getInListItems();
for (InListItem inListItem : inListItems) { for (InListItem inListItem : inListItems) {
if (barcode.getPartNumber().equals(inListItem.getPN()) && barcode.getBatch().equals(barcode.getBatch())) { if (barcode.getPartNumber().equals(inListItem.getPN()) && barcode.getBatch().equals(inListItem.getBatch())) {
hasBarcode = true; hasBarcode = true;
if (inListItem.getInNum() >= inListItem.getNum()) { if (inListItem.getInNum() >= inListItem.getNum()) {
throw new ValidateException("smfcore.inlist.pnItemOk", "入库单[{0}]的物料[{1}]已入库完成", new String[]{inList.getName(), inListItem.getPN()}); throw new ValidateException("smfcore.inlist.pnItemOk", "入库单[{0}]的物料[{1}]已入库完成", new String[]{inList.getName(), inListItem.getPN()});
...@@ -67,6 +68,14 @@ public class MicronSpApiListener extends BaseSmfApiListener { ...@@ -67,6 +68,14 @@ public class MicronSpApiListener extends BaseSmfApiListener {
if (!hasBarcode){ if (!hasBarcode){
throw new ValidateException("smfcore.inlist.noPn", "入库单[{0}]没有物料[{1}]入库需求", new String[]{inList.getName(), barcode.getPartNumber()}); throw new ValidateException("smfcore.inlist.noPn", "入库单[{0}]没有物料[{1}]入库需求", new String[]{inList.getName(), barcode.getPartNumber()});
} }
Date expireDate = barcode.getExpireDate();
if (expireDate != null) {
if (System.currentTimeMillis() > expireDate.getTime()) {
throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库.");
}
}
Barcode resultBarcode = Micron20031Api.depositCreateMA(barcode, params.getLoginUser()); Barcode resultBarcode = Micron20031Api.depositCreateMA(barcode, params.getLoginUser());
if (resultBarcode != null) { if (resultBarcode != null) {
return resultBarcode; return resultBarcode;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!