Commit 488766e9 LN

NG箱物料信息上传并保存。x800历史记录显示时间。

1 个父辈 b23370b2
......@@ -229,4 +229,9 @@ public class Constants {
*API010自动retry的间隔(seconds)
*/
public static final String CACHE_API_RetryInterval ="CACHE_API_RetryInterval";
/**
* NG料信息
*/
public static final String CACHE_ML_NGREELMAP ="CACHE_ML_NGREELMAP";
}
......@@ -3,6 +3,8 @@ package com.neotel.smfcore.core.xRay.rest.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class CountingHistoryDto {
......@@ -42,5 +44,7 @@ public class CountingHistoryDto {
private String resultFile;
@ApiModelProperty("点料时间 ")
private Date countingTime;
}
......@@ -24,6 +24,7 @@ import com.neotel.smfcore.custom.micron1053.bean.ML5NgReelInfo;
import com.neotel.smfcore.custom.micron1053.loading.Bean.LoadingInfo;
import com.neotel.smfcore.custom.micron1053.loading.dto.MaterialLoadingDto;
import com.neotel.smfcore.custom.micron1053.util.MicronDataCache;
import com.neotel.smfcore.custom.micron1551.bean.MLNgReelInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -223,6 +224,50 @@ public class LoadingUtil {
return false;
}
public Boolean updateNgReel(MLNgReelInfo reelInfo){
try{
InList inList = getInlist();
if (inList == null) {
return false;
}
if(ObjectUtil.isEmpty(reelInfo.getBarcode())||ObjectUtil.isEmpty(reelInfo.getNgMsg())){
return false;}
//如果条形码可以找到就更新
Barcode barcode = codeResolve.resolveOneValideBarcode(reelInfo.getBarcode());
if(barcode!=null){
boolean update = false;
List<InListItem> inListItems = new ArrayList<>();
for (InListItem item :
inList.getInListItems()) {
if (item.getRi().equals(barcode)&&item.isCancel()) {
if (ObjectUtil.isEmpty(item.getNgMsg()) || item.getNgMsg().contains("canceled")) {
update=true;
item.setNgMsg(reelInfo.getNgMsg());
item = inListItemManager.save(item);
log.info(" 更新入库单[" + inList.getName() + "]:条码 [" + item.getRi() + "]库位[" + item.getPosName() + "]的 ngmsg=" + reelInfo.getNgMsg());
EnLog.info("Update in-list [" + inList.getName() + "]: barcode[" + item.getRi() + "] pos[" + item.getPosName() + "] ngMsg=" + reelInfo.getNgMsg());
}
}
inListItems.add(item);
}
if (update) {
inList.setInListItems(inListItems);
inList = inListManager.save(inList);
inListCache.addInListToMap(inList);
}
return true;
}
}
catch (Exception exception){
log.error("updateNgReel "+reelInfo.getBarcode()+", "+reelInfo.getNgMsg()+" error :" ,exception);
}
return false;
}
public void xRayEndUpdateItem(String barcode,int count,String s) {
updateItemState(barcode, "", s);
......
package com.neotel.smfcore.custom.micron1551.bean;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MLNgReelInfo implements Serializable {
@ApiModelProperty("NG口位置,ML5S1,ML5S2, ML5O1,ML5O2")
private String ngPos="";
@ApiModelProperty("物料类型:pizzaBox,pcb,tray,reel")
private String mType;
@ApiModelProperty("条码")
private String barcode;
@ApiModelProperty("物料编号")
private String pn;
@ApiModelProperty("唯一码")
private String reelId;
@ApiModelProperty("库位号")
private String posName;
@ApiModelProperty("出入库类型,1=入库,2=出库")
private String type;
@ApiModelProperty("NG原因")
private String ngMsg;
@ApiModelProperty("更新时间")
private Date updateTime;
}
......@@ -13,6 +13,7 @@ import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.micron1053.api.MicronApi;
import com.neotel.smfcore.custom.micron1551.bean.dto.InOutReelDto;
import com.neotel.smfcore.custom.micron1551.bean.dto.ML5OViewDto;
import com.neotel.smfcore.custom.micron1551.util.Micron1551DataCache;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -38,6 +39,9 @@ public class ML5ODeviceController {
@Autowired
private TaskService taskService;
@Autowired
private Micron1551DataCache micron1551DataCache;
@ApiOperation("获取ML5O信息")
@GetMapping("ml5oView")
@PreAuthorize("@el.check('equipmentView:info')")
......@@ -71,6 +75,8 @@ private TaskService taskService;
}
}
dto.getData().put(Micron1551DataCache.NgType_ML5S1,micron1551DataCache.getNgDetials(Micron1551DataCache.NgType_ML5S1));
dto.getData().put(Micron1551DataCache.NgType_ML5S2,micron1551DataCache.getNgDetials(Micron1551DataCache.NgType_ML5S2));
return dto;
}
......
......@@ -14,6 +14,7 @@ import com.neotel.smfcore.custom.micron1053.api.MicronApi;
import com.neotel.smfcore.custom.micron1053.loading.util.LoadingUtil;
import com.neotel.smfcore.custom.micron1551.bean.dto.InOutReelDto;
import com.neotel.smfcore.custom.micron1551.bean.dto.ML5SViewDto;
import com.neotel.smfcore.custom.micron1551.util.Micron1551DataCache;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -34,7 +35,7 @@ public class ML5SDeviceController {
private EquipmentCache equipmentCache;
@Autowired
private DataCache dataCache;
private Micron1551DataCache micron1551DataCache;
@Autowired
private LoadingUtil loadingUtil;
......@@ -70,6 +71,9 @@ public class ML5SDeviceController {
dto.setShowLogs(bean.getShowLogs());
}
}
dto.getData().put(Micron1551DataCache.NgType_ML5S1,micron1551DataCache.getNgDetials(Micron1551DataCache.NgType_ML5S1));
dto.getData().put(Micron1551DataCache.NgType_ML5S2,micron1551DataCache.getNgDetials(Micron1551DataCache.NgType_ML5S2));
InList inList = loadingUtil.getInlist();
if (inList == null) {
......
......@@ -10,6 +10,7 @@ import com.neotel.smfcore.common.enlog.EnLog;
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.JsonUtil;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
......@@ -36,6 +37,8 @@ import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.micron1053.api.MicronApi;
import com.neotel.smfcore.custom.micron1053.loading.util.LoadingUtil;
import com.neotel.smfcore.custom.micron1053.util.MicronDataCache;
import com.neotel.smfcore.custom.micron1551.bean.MLNgReelInfo;
import com.neotel.smfcore.custom.micron1551.util.Micron1551DataCache;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -48,7 +51,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Api(tags = "1551 设备接口")
@RestController
@RestController("/rest/micron1551")
@Slf4j
public class Micron1551DeviceController {
......@@ -75,9 +78,11 @@ public class Micron1551DeviceController {
@Autowired
private LiteOrderCache liteOrderCache;
@Autowired
private Micron1551DataCache micron1551DataCache;
@ApiOperation("ML5S扫码后获取库位号")
@PostMapping(value = "/rest/micron1551/emptyPosForPutin")
@PostMapping(value = "/emptyPosForPutin")
@ResponseBody
@AnonymousAccess
public Map<String, Object> ml5sEmptyPosForPutin(HttpServletRequest request) {
......@@ -733,7 +738,7 @@ public class Micron1551DeviceController {
// code=其他值时错误,尺寸也没有
@ApiOperation("ML5O获取料盘目的地")
@PostMapping(value = "/rest/micron1551/getTargetLine")
@PostMapping(value = "/getTargetLine")
@ResponseBody
@AnonymousAccess
public ResultBean getTargetLine(HttpServletRequest request) {
......@@ -816,7 +821,7 @@ public class Micron1551DeviceController {
@ApiOperation("获取条码尺寸")
@PostMapping(value = "/service/micron1551/getSize")
@PostMapping(value = "/getSize")
@ResponseBody
@AnonymousAccess
public ResultBean getSize(HttpServletRequest request) {
......@@ -864,4 +869,34 @@ public class Micron1551DeviceController {
}
@ApiOperation("上传一个NG料 ")
@PostMapping(value = "/uploadNgReel")
@ResponseBody
@AnonymousAccess
public ResultBean uploadNgReel(@RequestBody Object param, HttpServletRequest request) {
MLNgReelInfo info = JsonUtil.toObj(param.toString(), MLNgReelInfo.class);
if (info == null) {
return ResultBean.newOkResult("fail");
}
log.info("1551 uploadNgReel : [" + info.getNgPos() + "],barcode:[" + info.getBarcode() + "],posName:[" + info.getPosName() + "]type:[" + info.getMType() + "]inout:[" + info.getType() + "],msg[" + info.getNgMsg() + "]");
micron1551DataCache.uploadNgReel(info);
loadingUtil.updateNgReel(info);
return ResultBean.newOkResult("ok");
}
@ApiOperation("清空指定NG的NG料,参数 ngPos:1=左侧,2=右侧 ")
@PostMapping(value = "/clearNgPos")
@ResponseBody
@AnonymousAccess
public ResultBean clearNgPos( HttpServletRequest request) {
String ngPos = request.getParameter("ngPos").toString();
log.info("1551 clearNgPos : ngPos=" + ngPos);
micron1551DataCache.clearNgPos(ngPos);
return ResultBean.newOkResult("clearNgPos " + ngPos + " ok");
}
}
package com.neotel.smfcore.custom.micron1551.util;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.message.enums.MessageType;
import com.neotel.smfcore.core.message.service.bean.DataContent;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.custom.micron1551.bean.MLNgReelInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Slf4j
@Service
public class Micron1551DataCache {
@Autowired
private DataCache dataCache;
public Map<String, List<MLNgReelInfo>> mlNgReelMap =null;
public void uploadNgReel(MLNgReelInfo info) {
if (mlNgReelMap == null) {
//第一次获取,从数据库加载
mlNgReelMap = dataCache.getCache(Constants.CACHE_ML_NGREELMAP);
if (mlNgReelMap == null) {
mlNgReelMap = new HashMap<>();
}
}
info.setUpdateTime(new Date());
List<MLNgReelInfo> list = mlNgReelMap.getOrDefault(info.getNgPos(), new ArrayList<>());
list.add(info);
mlNgReelMap.put(info.getNgPos(), list);
//更新到数据库
dataCache.updateCache(Constants.CACHE_ML_NGREELMAP, mlNgReelMap);
//NG物料保存到错误日志
List<DataContent> dataList = new ArrayList<>();
dataList.add(new DataContent("barcode", info.getBarcode()));
dataList.add(new DataContent("inoutType", info.getType()));
dataList.add(new DataContent("MType", info.getMType()));
String msg = info.getNgMsg();
if (ObjectUtil.isNotEmpty(info.getBarcode())) {
msg = info.getNgMsg() + ":" + info.getBarcode();
}
DeviceMessageUtil.addMessage(MessageType.ERROR.name(), "ML5", info.getPosName(), "", msg, null, dataList);
}
public void clearNgPos(String ngPos) {
if(mlNgReelMap==null){
return;
}
mlNgReelMap.remove(ngPos);
}
public List<MLNgReelInfo> getNgDetials(String ngPos){
if(mlNgReelMap==null){
return new ArrayList<>();
}
List<MLNgReelInfo> list= mlNgReelMap.getOrDefault(ngPos,new ArrayList<>());
return list;
}
public static String NgType_ML5S1="ML5SNG1";
public static String NgType_ML5S2="ML5SNG2";
public static String NgType_ML5O1="ML5ONG1";
public static String NgType_ML5O2="ML5ONG2";
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!