Commit 4592f99c LN

增加MaxQuantity配置

1 个父辈 179519ac
......@@ -174,4 +174,9 @@ public class Constants {
*/
public static final String CACHE_Deposit_Exceed_Time = "CACHE_Deposit_Exceed_Time";
/**
* 镁光接口使用
*/
public static final String CACHE_MaxQuantity="CACHE_MaxQuantity";
}
......@@ -124,6 +124,10 @@ public class DataCache {
cacheMap = Maps.newConcurrentMap();
List<CacheItem> all = cacheItemDao.findAll();
for (CacheItem cacheItem : all) {
if(cacheItem==null||ObjectUtil.isEmpty(cacheItem.getCacheKey())||cacheItem.getCacheValue()==null){
log.error("cacheItem为空,跳过");
continue;
}
cacheMap.put(cacheItem.getCacheKey(), cacheItem.getCacheValue());
}
if (cacheMap.get(Constants.CACHE_StopOut) == null) {
......
......@@ -82,6 +82,10 @@ public class SettingsController {
Integer caWarn=dataCache.getCache(Constants.CACHE_CapacityWarn);
Integer backUpMonth = dataCache.getCache(Constants.BACKUP_MONTH_KEY);
Integer depositExceedTime = dataCache.getCache(Constants.CACHE_Deposit_Exceed_Time);
int MaxQuantity=dataCache.getCache(Constants.CACHE_MaxQuantity);
if( MaxQuantity<=0){
MaxQuantity=2;
}
SysSettingsDto dto = new SysSettingsDto();
dto.setStartJob(startJob);
dto.setStopOut(stopOut);
......@@ -90,6 +94,7 @@ public class SettingsController {
dto.setCapacityWarn(caWarn);
dto.setBackUpMonth(backUpMonth);
dto.setDepositExceedTime(depositExceedTime);
dto.setMaxQuantity(MaxQuantity);
return dto;
}
......@@ -104,9 +109,10 @@ public class SettingsController {
dataCache.updateCache(Constants.CACHE_CapacityWarn,sysSettingsDto.getCapacityWarn());
dataCache.updateCache(Constants.BACKUP_MONTH_KEY,sysSettingsDto.getBackUpMonth());
dataCache.updateCache(Constants.CACHE_Deposit_Exceed_Time,sysSettingsDto.getDepositExceedTime());
dataCache.updateCache(Constants.CACHE_MaxQuantity,sysSettingsDto.getMaxQuantity());
log.info("更改系统设置:stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob()+",sluggishDay="+sysSettingsDto.getSluggishDay()
+",expiresDay="+sysSettingsDto.getExpiresDay()+",capacityWarn="+sysSettingsDto.getCapacityWarn()+",backUpMonth="+sysSettingsDto.getBackUpMonth()
+",depositExceedTime="+sysSettingsDto.getDepositExceedTime());
+",depositExceedTime="+sysSettingsDto.getDepositExceedTime()+",maxQuantity="+sysSettingsDto.getMaxQuantity());
return ResultBean.newOkResult("保存成功");
}
......
......@@ -30,4 +30,7 @@ public class SysSettingsDto implements Serializable {
@ApiModelProperty("入库超时时间")
private Integer depositExceedTime = 0;
@ApiModelProperty("允许LineId数量")
private Integer maxQuantity=2;
}
......@@ -711,11 +711,14 @@ public class Micron20031Api {
* //Input: MicronPN, LotNo, BatchNo, SpoolStatus, Quantity, Username, Mode, MaterialType
* //Output: MicronPN, LotNo, BatchNo, SpoolStatus, Quantity, Username, Mode, MaterialType, MaterialDocumentNo, Message, Status
*/
public static void chkAuthoriseToDispatch(Barcode barcode, String mode, String username,String lineId) throws ApiException {
public static void chkAuthoriseToDispatch(Barcode barcode, String mode, String username,String lineId,int MaxQuantity) throws ApiException {
String checkStockAvailableUrl = getUrl(api_ChkAuthoriseToDispatch);
if (ObjectUtil.isEmpty(checkStockAvailableUrl)) {
return;
}
// 1) 在 SMF UI 中 - 提供用于更新 MaxQuantity 的设置
// 2) 在 API 期间:ChkAuthoriseToDispatch ==>消息结构以包含 MaxQuantity
// 3) 如果 Neotel 可以调度或不调度,MMSIL 将返回结果。
String auth = getAuthToken();
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("MicronPN", barcode.getPartNumber());
......@@ -728,6 +731,8 @@ public class Micron20031Api {
dataMap.put("MaterialType", MATERIAL_TYPE);
dataMap.put("EquipID",lineId);
dataMap.put("LineID",lineId);
dataMap.put("MaxQuantity",MaxQuantity);
log.info("调用MES接口 ChkAuthoriseToDispatch,参数:" + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
......
......@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -25,6 +26,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.math3.analysis.function.Max;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
......@@ -101,7 +103,11 @@ public class MicronSpUnloadController {
posList) {
try {
//验证
Micron20031Api.chkAuthoriseToDispatch(pos.getBarcode(), Micron20031Api.MODE_ENABLE_MAM_SAP, SecurityUtils.getCurrentUsername(),lineId);
int MaxQuantity=dataCache.getCache(Constants.CACHE_MaxQuantity);
if( MaxQuantity<=0){
MaxQuantity=2;
}
Micron20031Api.chkAuthoriseToDispatch(pos.getBarcode(), Micron20031Api.MODE_ENABLE_MAM_SAP, SecurityUtils.getCurrentUsername(),lineId, MaxQuantity);
log.info("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] chkAuthoriseToDispatch 成功");
Barcode barcode = pos.getBarcode();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!