Commit 045487b8 zshaohui

1.日志监控功能

2.接口地址不加入缓存
1 个父辈 de1aac41
正在显示 43 个修改的文件 包含 890 行增加282 行删除
......@@ -15,8 +15,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.RestController;
//@EnableAsync
@EnableScheduling
@EnableKafka
//@EnableScheduling
//@EnableKafka
@RestController
@SpringBootApplication
public class SmfCoreApplication extends SpringBootServletInitializer {
......
......@@ -213,7 +213,7 @@ public class DataInitManager {
addNewFunctionMenu(61, pMenuLog, "taskLog", "物料日志", "taskLog", "neolight/taskLog/index", "education",functionMenuMap);
addNewFunctionMenu(62, pMenuLog, "message", "消息查询", "message", "neolight/message/index", "messagefind",functionMenuMap);
addNewFunctionMenu(63, pMenuLog, "interfaceException", "接口异常", "interfaceException", "neolight/interfaceException/index", "messagefind",functionMenuMap);
addNewFunctionMenu(64, pMenuLog, "logMonitor", "日志监控", "logMonitor", "neolight/logMonitor/index","logMonitor",functionMenuMap);
//报表:出入库、库存
Menu pMenuReport = Menu.CreatePMenu("报表", 7, "report", 2, "inOutData",null);
addNewFunctionMenu(71, pMenuReport, "inOutData", "出入库", "inOutData", "neolight/inOutData/index", "outPut",functionMenuMap);
......
......@@ -69,14 +69,14 @@ public class SmfApi {
public void init(){
apiName = dataCache.getConfigCache("api.name",apiName);
log.info("apiName:" + apiName);
inCheckUrl = dataCache.getConfigCache("api.inCheckUrl",inCheckUrl);
/*inCheckUrl = dataCache.getConfigCache("api.inCheckUrl",inCheckUrl);
inNotifyUrl = dataCache.getConfigCache("api.inNotifyUrl",inNotifyUrl);
outNotifyUrl = dataCache.getConfigCache("api.outNotifyUrl",outNotifyUrl);
orderNotifyUrl = dataCache.getConfigCache("api.orderNotifyUrl",orderNotifyUrl);
fetchInListUrl = dataCache.getConfigCache("api.fetchInListUrl",fetchInListUrl);
fetchOrderUrl = dataCache.getConfigCache("api.fetchOrderUrl",fetchOrderUrl);
barcodeInfoUrl = dataCache.getConfigCache("api.barcodeInfoUrl",barcodeInfoUrl);
importUrl = dataCache.getConfigCache("api.importUrl",importUrl);
importUrl = dataCache.getConfigCache("api.importUrl",importUrl);*/
}
/**
......
......@@ -154,9 +154,9 @@ public class CodeResolve {
if(validDay > 0){
log.info("重新设置"+codeBeanFromRule.getCodeStr()+"生产日期和过期日期");
Date expireDate = DateUtil.addDays(produceDate, validDay);
barcode.setExpireDate(expireDate);
barcode.setProduceDate(produceDate);
needUpdate = true;
//barcode.setExpireDate(expireDate);
//barcode.setProduceDate(produceDate);
//needUpdate = true;
}
}
}
......@@ -187,8 +187,8 @@ public class CodeResolve {
}
//判断是否为空
if (barcodeFromRule.getProduceDate() != null) {
barcode.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),12));
needUpdate = true;
//barcode.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),12));
//needUpdate = true;
} else {
barcode.setExpireDate(null);
}
......@@ -292,7 +292,7 @@ public class CodeResolve {
if (expiredSetting != null){
barcodeFromRule.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),expiredSetting.getMonth()));
}*/
barcodeFromRule.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),12));
//barcodeFromRule.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),12));
}
......
......@@ -24,6 +24,8 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.lizhen.innerBox.rest.InnerBoxRestController;
import com.neotel.smfcore.security.TokenProvider;
......@@ -426,8 +428,8 @@ public class NLShelfHandler extends BaseDeviceHandler {
}
//校验是否可以入库
Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (brandQty == null || brandQty.isEmpty()) {
BrandQtyResult brandQtyResult = lizhenApi.brandQty(new BrandQtyRequest(barcode.getPartNumber(), barcode.getProvider()));
if (brandQtyResult == null) {
throw new ValidateException("smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
}
......
......@@ -26,6 +26,8 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.lizhen.virtual.service.manager.IVirInventoryManager;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
......@@ -209,8 +211,8 @@ public class DeviceController {
}
}
//校验是否可以入库
Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (brandQty == null || brandQty.isEmpty()) {
BrandQtyResult brandQtyResult = lizhenApi.brandQty(new BrandQtyRequest(barcode.getPartNumber(), barcode.getProvider().toUpperCase(Locale.ROOT)));
if (brandQtyResult == null) {
throw new ValidateException("smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
}
Barcode barcodeCanPutIn = smfApi.canPutInAfterResolve(barcode);
......@@ -218,6 +220,8 @@ public class DeviceController {
barcode = barcodeCanPutIn;
}
barcode = lizhenApi.getInDate(barcode);
Barcode barcodeApi = lizhenApi.barcodeInfo(barcode);
//如果是L开头的去量测
......@@ -247,7 +251,7 @@ public class DeviceController {
//已经在任务当中,返回对应的信息
if (dataLog.getBarcode().equals(barcode.getBarcode())) {
//如果有任务,直接ng
if (!dataLog.isFinished()) {
if (!dataLog.isFinished() && !dataLog.isCancel()) {
throw new ValidateException("smfcore.error.barcode.executing", "条码[{0}}]任务正在执行", new String[]{barcode.getBarcode()});
}
/* if (dataLog.isPutInTask()) {
......
......@@ -676,10 +676,10 @@ public class DataCache {
public List<String> getAvailableStorageIds(){
List<String> availableStorageIds = new ArrayList<>();
for (Storage storage : getAllStorage().values()) {
/*StatusBean bean = DevicesStatusUtil.getStatusBean(storage.getCid());
StatusBean bean = DevicesStatusUtil.getStatusBean(storage.getCid());
if (bean == null || bean.timeOut() || !bean.isAvailable()) {
continue;
}*/
}
availableStorageIds.add(storage.getId());
}
return availableStorageIds;
......
......@@ -5,6 +5,7 @@ import com.neotel.smfcore.core.language.util.MessageUtils;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.util.Locale;
@ToString
......@@ -38,6 +39,8 @@ public class EquipMsg {
*/
private String[] msgParams;
private Date createDate = new Date();
public String getShowMsg(Locale locale) {
//提示信息国际化
if (ObjectUtil.isEmpty(getMsgCode())) {
......
package com.neotel.smfcore.core.equipment.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.equipment.bean.EquipMsg;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.core.equipment.enums.EquipmentType;
import com.neotel.smfcore.core.equipment.handler.IEquipmentHandler;
import com.neotel.smfcore.core.message.enums.MessageType;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.system.util.EquipStatusUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class BaseEquipHandler implements IEquipmentHandler {
......@@ -21,6 +29,9 @@ public class BaseEquipHandler implements IEquipmentHandler {
return statusBean;
}
private static Map<String, List<EquipMsg>> cacheMsgMap = Maps.newConcurrentMap();
/**
* 处理客户端发送上来的消息(保存故障信息,并显示界面)
*
......@@ -49,16 +60,45 @@ public class BaseEquipHandler implements IEquipmentHandler {
boolean newMsg = true;
//和上个消息是否一样
if (preBean != null) {
/*if (preBean != null) {
EquipMsg preMsg = preBean.getMsgByType(msg.getType());
if (preMsg != null) {
if (msg.getMsgCode().equals(preMsg.getMsgCode()) && msg.getMsg().equals(preMsg.getMsg())) {
newMsg = false;
}
}
}*/
if (newMsg) {
//判断近5分钟以内,有没有相同的报错信息
List<EquipMsg> cacheMsgList = cacheMsgMap.get(statusBean.getCid());
if (cacheMsgList == null || cacheMsgList.isEmpty()) {
cacheMsgList = new ArrayList<>();
}
List<EquipMsg> newCacheList = new ArrayList<>();
for (EquipMsg equipMsg : cacheMsgList) {
if (System.currentTimeMillis() - equipMsg.getCreateDate().getTime() > 1000 * 60 * 5) {
continue;
}
String msgStr = msg.getMsg();
if (StringUtils.isNotEmpty(msgStr)) {
if (msgStr.equals(equipMsg.getMsg())) {
newMsg = false;
equipMsg.setCreateDate(new Date());
}
}
}
if (newMsg){
newCacheList.add(msg);
}
cacheMsgMap.put(statusBean.getCid(), newCacheList);
}
if (newMsg) {
DeviceMessageUtil.addDeviceMessage(statusBean.getCid(), msg.getType(), msg.getModule(), msg.getMsgCode(), msg.getMsg(), msg.getMsgParams(),"");
String msgType= msg.getType();
if(ObjectUtil.isEmpty(msgType)){
msgType= MessageType.ERROR.name();
}
DeviceMessageUtil.addDeviceMessage(statusBean.getCid(), msgType, msg.getModule(), msg.getMsgCode(), msg.getMsg(), msg.getMsgParams(), "");
}
}
}
......
......@@ -21,4 +21,10 @@ public enum MessageType {
* 3 设备操作数据
*/
DATA,
/**
* 4 需要人员立即操作的
*/
CRITICAL
}
package com.neotel.smfcore.core.message.rest;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.BetweenData;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.message.rest.bean.dto.MessageDto;
......@@ -9,6 +13,7 @@ import com.neotel.smfcore.core.message.rest.bean.mapstruct.MessageMapper;
import com.neotel.smfcore.core.message.rest.bean.query.MessageCriteria;
import com.neotel.smfcore.core.message.service.manager.IMessageManager;
import com.neotel.smfcore.core.message.service.po.Message;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
......@@ -24,7 +29,10 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
......@@ -70,4 +78,52 @@ public class MessageController {
List<String> typeList=messageManager.findDeviceNameList();
return typeList;
}
@ApiOperation("根据type汇总总数量")
@GetMapping("/typeTotalByDate")
@AnonymousAccess
public ResultBean typeTotalByDate(MessageCriteria criteria, HttpServletRequest request) {
//默认取7天的,如果客户端传的有,就用客户端的
Date endDate = new Date();
Date startDate = DateUtil.offsetDay(endDate, -7);
BetweenData<Date> updateDate = criteria.getUpdateDate();
if (updateDate != null && !updateDate.isEmpty()) {
Date from = updateDate.getFrom();
Date to = updateDate.getTo();
if (from != null) {
startDate = from;
}
if (to != null) {
endDate = to;
}
}
String[] fileds = {"createDate","type","msg","deviceName"};
List<Message> messageList = messageManager.findByUpdateAndFileds(startDate, endDate, fileds);
Map<String, Integer> resultMap = Maps.newConcurrentMap();
resultMap.put("INFO", 0);
resultMap.put("WARNING", 0);
resultMap.put("ERROR", 0);
resultMap.put("CRITICAL", 0);
if (messageList != null && !messageList.isEmpty()) {
for (Message message : messageList) {
MessageDto dto = messageMapper.toDto(message);
String type = message.getType();
if (ObjectUtil.isNotEmpty(dto.getMsgCode())) {
dto.setMsg(MessageUtils.getText(dto.getMsgCode(), dto.getMsgParams(), request.getLocale(), dto.getMsg()));
}
Integer num = resultMap.get(type);
if (num == null) {
num = 0;
}
num = num + 1;
resultMap.put(type, num);
}
}
return ResultBean.newOkResult(resultMap);
}
}
......@@ -7,6 +7,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
@Data
public class MessageCriteria {
......@@ -17,6 +18,9 @@ public class MessageCriteria {
@DateTimeFormat(pattern = "yyyy-MM-dd")
private BetweenData<Date> createDate;
@QueryCondition(type = QueryCondition.Type.BETWEEN, propName = "updateDate")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private BetweenData<Date> updateDate;
@QueryCondition
@ApiModelProperty("设备")
......@@ -33,4 +37,9 @@ public class MessageCriteria {
@QueryCondition
@ApiModelProperty("类型")
private String type;
@QueryCondition(type = QueryCondition.Type.IN,propName = "type")
@ApiModelProperty("多个类型")
private List<String> typeList;
}
......@@ -4,6 +4,7 @@ import com.neotel.smfcore.common.base.IBaseManager;
import com.neotel.smfcore.core.message.service.po.Message;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Locale;
......@@ -11,4 +12,6 @@ public interface IMessageManager extends IBaseManager<Message> {
void download(List<Message> list, HttpServletResponse response, Locale locale);
List<String> findDeviceNameList();
List<Message> findByUpdateAndFileds(Date startDate, Date endDate, String[] s);
}
......@@ -5,6 +5,7 @@ import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.language.service.nanager.impl.LanguageMsgManagerImpl;
import com.neotel.smfcore.core.language.service.po.LanguageMsg;
import com.neotel.smfcore.core.language.util.MessageUtils;
......@@ -121,6 +122,17 @@ public class MessageManagerImpl implements IMessageManager {
return result;
}
@Override
public List<Message> findByUpdateAndFileds(Date startDate, Date endDate, String[] field) {
Query q = new Query();
Criteria c = Criteria.where("updateDate").gte(startDate).lt(endDate);
q.addCriteria(c);
if (field != null && field.length > 0) {
q.fields().include(field);
}
return messageDao.findByQuery(q);
}
@Data
private class MsgDeviceName {
private String deviceName;
......
......@@ -478,7 +478,11 @@ public class LiteOrderCache {
if (StringUtils.isNotBlank(export)){
exportStr = export;
} else {
exportStr = StorageExportUtil.getExportByOrderNo(cacheOrder.getOrderNo(),true,cacheOrder.isMaiZheng(),cacheOrder.getRecvIndex(),cacheOrder.getLine());
boolean specialOrder = false;
if (cacheOrder.isMaiZheng() || cacheOrder.isRobot()){
specialOrder = true;
}
exportStr = StorageExportUtil.getExportByOrderNo(cacheOrder.getOrderNo(),true,specialOrder,cacheOrder.getRecvIndex(),cacheOrder.getLine());
}
if (StringUtils.isBlank(exportStr)) {
//log.info(cacheOrder.getOrderNo() + "没有空闲的出料口");
......@@ -604,7 +608,11 @@ public class LiteOrderCache {
task.setKeeperCode(pos.getBarcode().getKeeperCode());
task.setExport(exportStr);
// task = dataLogDao.save(task);
try {
taskService.addTaskToExecute(task);
} catch (ValidateException e) {
e.printStackTrace();
}
}
//如果是RI出库,只有一盘,出完就结束
if (cacheOrder.getType() == 2) {
......@@ -936,7 +944,7 @@ public class LiteOrderCache {
//调用批量禁用料接口
List<String> batchCheckList = new ArrayList<>();
try {
batchCheckList = lizhenApi.batchCheck(subCodeList);
batchCheckList = lizhenApi.batchCheckReel(subCodeList,"","");
}catch (Exception e){
e.printStackTrace();
}
......
......@@ -86,7 +86,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
}
}
liteOrder.setLine(lineStr);
liteOrder.setSource(LITEORDER_SOURCE.OUTTER.name());
liteOrder.setSource(LITEORDER_SOURCE.INNER.name());
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
return true;
......
......@@ -169,6 +169,7 @@ public class LiteOrder extends BasePo implements Serializable {
private boolean transReelBox = false;
private boolean differenceReq = false;
//迈征额外参数
private String guid;
......
......@@ -110,6 +110,14 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li
*/
private String batchCode;
private String pickingId;
private String rowId;
private int itemNo;
private String model;
/**
* 库别
*/
......
......@@ -654,6 +654,9 @@ public class StoragePosController {
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.partNumber",locale,"物料编号")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.proDate",locale,"生产日期")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.expireDate",locale,"过期时间")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.dc",locale,"DC")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.batch",locale,"批次")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.provider",locale,"供应商")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.posName",locale,"库位号")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.lockName",locale,"工单号")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.amount",locale,"数量")));
......@@ -684,6 +687,9 @@ public class StoragePosController {
data.add(pos.getBarcode().getPartNumber());
data.add(proDate);
data.add(expireDate);
data.add(pos.getBarcode().getDateCode());
data.add(pos.getBarcode().getBatch());
data.add(pos.getBarcode().getProvider());
data.add(pos.getPosName());
data.add(pos.getBarcode().getLockName());
data.add(pos.getBarcode().getAmount());
......
......@@ -70,22 +70,46 @@ public class DevicesStatusUtil {
clientMsg="";
}
//判断消息是否有内容
if(ObjectUtil.isNotEmpty(msgCode)||ObjectUtil.isNotEmpty(clientMsg)){
boolean newMsg=true;
if(ObjectUtil.isNotEmpty(msgCode)||ObjectUtil.isNotEmpty(clientMsg)) {
boolean newMsg = true;
//和上个消息是否一样
StatusBean msgBean=clientMsgs.get(cid);
if(msgBean!=null) {
StatusBean msgBean = clientMsgs.get(cid);
if (msgBean != null) {
if (msgBean.msgTimeOut()) {
newMsg = true;
} else if (msgBean.getMsgCode().equals(msgCode) && msgBean.getMsg().equals(clientMsg)) {
} else if (/*msgBean.getMsgCode().equals(msgCode) &&*/ msgBean.getMsg().equals(clientMsg)) {
newMsg = false;
}
}
if(newMsg){
DeviceMessageUtil.addDeviceMessage(cid, MessageType.ERROR.name(),"",msgCode,clientMsg,msgParam,errorCode);
if (newMsg) {
//判断是否有换行
String[] msgArray = clientMsg.split("\r\n");
if (msgArray != null && msgArray.length > 0) {
for (String msg :
msgArray) {
msg = msg.trim();
String msgType = MessageType.ERROR.name();
if (msg.startsWith("A=")) {
msgType = MessageType.ERROR.name();
msg = msg.substring(2);
} else if (msg.startsWith("I=")) {
msgType = MessageType.INFO.name();
msg = msg.substring(2);
} else if (msg.startsWith("W=")) {
msgType = MessageType.WARNING.name();
msg = msg.substring(2);
} else if (msg.startsWith("C=")) {
msgType = MessageType.CRITICAL.name();
msg = msg.substring(2);
}
DeviceMessageUtil.addDeviceMessage(cid, msgType, "", msgCode, msg, msgParam, errorCode);
}
} else {
DeviceMessageUtil.addDeviceMessage(cid, MessageType.ERROR.name(), "", msgCode, clientMsg, msgParam, errorCode);
}
}
}
StatusBean statusBean = new StatusBean();
statusBean.setCid(cid);
statusBean.setLastSaveTime(System.currentTimeMillis());
......
......@@ -354,7 +354,7 @@ public class TaskService {
storagePos.setMsg("任务取消,屏蔽库位");
storagePosManager.save(storagePos);
log.info("任务取消,屏蔽库位:库位号[" + storagePos.getId() + "][" + storagePos.getPosName() + "]barcode[" + barcode + "]");
DeviceMessageUtil.addEnabledPosMessage(storagePos, SecurityUtils.getCurrentUsername());
DeviceMessageUtil.addEnabledPosMessage(storagePos, SecurityUtils.getLoginUsername());
}
......@@ -679,6 +679,7 @@ public class TaskService {
log.warn("出库无料仓位" + storage.getName() + "[" + posName + "]");
}
statusBean.addPosInfo(task.getBarcode(), posName, plateW, plateH, isSingleOut);
statusBean.addData("export",task.getExport());
log.info("出库" + storage.getName() + "[" + posName + "]物料[" + task.getBarcode() + "]" + isSingleOut + "发送到客户端" + cid+",出料口为:"+task.getExport());
}
// }
......
package com.neotel.smfcore.custom.lizhen;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class CommonUtil {
public static String plantCode;
@Value("${api.plantCode}")
private void setPlantCode(String code){
CommonUtil.plantCode = code;
}
}
package com.neotel.smfcore.custom.lizhen;
import com.alibaba.fastjson.JSONObject;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.DifferentMaterial;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@RestController
public class DifferenceReelController {
@Autowired
private ILiteOrderManager liteOrderManager;
@Autowired
private LiteOrderCache liteOrderCache;
@ApiOperation("工单差异料上传")
@RequestMapping("/api/Mes/differenceReel")
@AnonymousAccess
public synchronized String differenceReel(@RequestBody List<DifferentMaterial> differentMaterialList) {
log.info("收到mes的差异料数据为:" + JSONObject.toJSONString(differentMaterialList));
List<LiteOrderItem> itemList = new ArrayList<>();
for (DifferentMaterial differentMaterial : differentMaterialList) {
String wo = differentMaterial.getWo();
String mc = differentMaterial.getMc();
String ipn = differentMaterial.getIpn();
if (StringUtils.isEmpty(ipn)){
continue;
}
String zone = differentMaterial.getZone();
String gidLineSide = differentMaterial.getGidLineSide();
String[] gidLineSideS = gidLineSide.split("_");
if (gidLineSideS.length < 3){
return gidLineSide+"格式不正确";
}
String line = gidLineSideS[0];
String side = gidLineSideS[2];
LiteOrderItem item = new LiteOrderItem();
item.setMo(wo);
item.setMachineName(mc);
item.setPn(ipn);
item.setStation(zone);
item.setTableNo(zone);
item.setLine(line);
item.setSide(side);
item.setNeedNum(1);
item.setNeedReelCount(1);
itemList.add(item);
}
if (itemList != null && !itemList.isEmpty()){
Map<String, List<LiteOrderItem>> itemMap = itemList.stream().collect(Collectors.groupingBy(LiteOrderItem::getLine));
for (String line : itemMap.keySet()) {
List<LiteOrderItem> item = itemMap.get(line);
LiteOrder liteOrder = new LiteOrder();
liteOrder.setOrderNo(System.currentTimeMillis()+"差异料");
liteOrder.setLine(line);
liteOrder.setTotalTaskReelCount(item.size());
liteOrder.setOrderItems(item);
liteOrder.setDifferenceReq(true);
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
}
}
return "";
}
}
package com.neotel.smfcore.custom.lizhen;
import cn.hutool.json.JSONUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -10,44 +10,27 @@ import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.listener.BaseSmfApiListener;
import com.neotel.smfcore.core.api.listener.DefaultSmfApiListener;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.dao.impl.DataLogDaoImpl;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.service.manager.impl.DataLogManagerImpl;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.lizhen.agvBox.bean.GrLabel;
import com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.LuxsanApiResult;
import com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem;
import com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.PostConstruct;
import java.security.Security;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
......@@ -59,13 +42,10 @@ public class LizhenApi extends DefaultSmfApiListener {
private IBarcodeManager barcodeManager;
@Autowired
private IStoragePosManager storagePosManager;
@Autowired
private DataCache dataCache;
@Autowired
private IDataLogManager dataLogManager;
private IStoragePosManager storagePosManager;
@Value("${api.fetchGRUrl}")
private String fetchGRUrl;
......@@ -85,25 +65,23 @@ public class LizhenApi extends DefaultSmfApiListener {
@Value("${api.outNotifyUrlPK}")
private String outNotifyUrlPK = "";
@Value("${api.batchCheckUrl}")
private String batchCheckUrl = "";
@Value("${api.batchCheckReel}")
private String batchCheckReel = "";
@Value("${api.checkReelMeasure}")
private String checkReelMeasureUrl = "";
@Value("${api.CommonGIRecord}")
private String CommonGIRecordUrl = "";
@PostConstruct
public void init(){
fetchGRUrl = dataCache.getConfigCache("fetchGRUrl",fetchGRUrl);
brandQtyUrl = dataCache.getConfigCache("brandQtyUrl",brandQtyUrl);
plant = dataCache.getConfigCache("plant",plant);
barcodeInfoUrl = dataCache.getConfigCache("barcodeInfoUrl",barcodeInfoUrl);
werks = dataCache.getConfigCache("werks",werks);
outNotifyUrlPK = dataCache.getConfigCache("api.outNotifyUrlPK",outNotifyUrlPK);
batchCheckUrl = dataCache.getConfigCache("api.batchCheckUrl",batchCheckUrl);
//checkReelMeasureUrl = dataCache.getConfigCache("api.checkReelMeasure",checkReelMeasureUrl);
}
@Value("${api.getInDateUrl}")
private String getInDateUrl = "";
@Value("${api.commonGIRecordUrl}")
private String commonGIRecordUrl = "";
@Value("${api.commonRMRecordUrl}")
private String commonRMRecordUrl = "";
@Value("${api.save2DReelInfoUrl}")
private String save2DReelInfoUrl = "";
/**
* 根据partnumber和brand获取满卷数
......@@ -112,41 +90,34 @@ public class LizhenApi extends DefaultSmfApiListener {
* @param brand
* @return
*/
public Map<String,Object> brandQty(String partnumber, String brand) {
log.info("brandQty--material_code:" + partnumber + ",brand:" + brand);
Map<String, Object> resultMap = new HashMap<>();
if (StringUtils.isBlank(brandQtyUrl)){
resultMap.put("qty", 0);
resultMap.put("reelSize", 0);
return resultMap;
/**
* 获取尺寸和满卷数信息
*
* @param request
* @return
*/
public BrandQtyResult brandQty(BrandQtyRequest request) {
if (StringUtils.isEmpty(brandQtyUrl)){
return new BrandQtyResult();
}
int qty = 0;
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("material_code", partnumber);
paramMap.put("brand", brand);
log.info("brandQtyUrl接口请求参数为:" + JSON.toJSONString(request));
try {
String result = HttpHelper.postJson(brandQtyUrl, paramMap);
log.info("brandQty-" + partnumber + ":请求结果为:" + result);
JSONObject jsonObject = JsonUtil.toObj(result, JSONObject.class);
String msgtx = jsonObject.getString("MSGTX");
if ("S".equals(msgtx)) {
JSONObject dataObject = jsonObject.getJSONObject("DATA");
if (dataObject != null) {
if (dataObject.getInteger("qty") != null) {
qty = dataObject.getInteger("qty");
resultMap.put("qty", qty);
}
String reelSize = dataObject.getString("reel_size");
if (StringUtils.isNotBlank(reelSize)) {
resultMap.put("reelSize", reelSize);
}
String resultStr = HttpHelper.postJson(brandQtyUrl, request);
log.info("brandQtyUrl接口返回为:" + resultStr);
LuxsanApiResult apiResult = JSONObject.parseObject(resultStr, LuxsanApiResult.class);
if ("E".equals(apiResult.getMSGTY())) {
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{apiResult.getMSGTX()});
}
if (apiResult.getDATA() != null) {
return JSONObject.parseObject(apiResult.getDATA(), BrandQtyResult.class);
}
} catch (ApiException e) {
e.printStackTrace();
log.info("brandQty--" + partnumber + ":异常:" + e.getMessage());
}
return resultMap;
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{"未找到料号信息"});
}
......@@ -174,8 +145,8 @@ public class LizhenApi extends DefaultSmfApiListener {
JSONObject dataObject = dataArrray.getJSONObject(0);
String brand = dataObject.getString("brand");
resultMap.put("brand", brand);
resultMap.put("keeperCode",dataObject.getString("keeper_code"));
resultMap.put("warehouseCode",dataObject.getString("warehouse_code"));
resultMap.put("keeperCode", dataObject.getString("keeper_code"));
resultMap.put("warehouseCode", dataObject.getString("warehouse_code"));
}
}
} catch (ApiException e) {
......@@ -192,24 +163,24 @@ public class LizhenApi extends DefaultSmfApiListener {
* @return
*/
public Barcode barcodeInfo(Barcode barcode) {
if (barcodeInfoUrl == null) {
if (StringUtils.isEmpty(barcodeInfoUrl)) {
return null;
}
log.info("获取MES物料数量入参为:" + barcode.getBarcode());
log.info(barcode.getBarcode() + "获取MES物料数量入参为:" + barcode.getBarcode() + "地址为:" + barcodeInfoUrl);
String result = "";
try {
result = HttpHelper.postJson(barcodeInfoUrl, barcode.getBarcode());
} catch (ApiException e) {
e.printStackTrace();
}
log.info("获取MES物料数量出参为:" + result);
log.info(barcode.getBarcode() + "获取MES物料数量出参为:" + result);
JSONObject resultJson = JsonUtil.toObj(result, JSONObject.class);
Integer status = resultJson.getInteger("status");
if (status != null) {
if (status == 200) {
JSONObject dataJson = resultJson.getJSONObject("data");
String reelID = dataJson.get("reelID") == null ? "" : dataJson.get("reelID").toString();
//String partNum = dataJson.get("partNum") == null ? "" : dataJson.get("partNum").toString();
String partNum = dataJson.get("partNum") == null ? "" : dataJson.get("partNum").toString();
String partSpec = dataJson.get("partSpec") == null ? "" : dataJson.get("partSpec").toString();
int qty = dataJson.get("qty") == null ? 0 : Integer.valueOf(dataJson.get("qty").toString());
//String vendor = dataJson.get("vendor") == null ? "" : dataJson.get("vendor").toString();
......@@ -221,10 +192,14 @@ public class LizhenApi extends DefaultSmfApiListener {
}
if (StringUtils.isNotBlank(reelID)){
barcode.setBarcode(reelID);
}
if (StringUtils.isNotBlank(partNum)){
barcode.setPartNumber(partNum);
}*/
if (StringUtils.isNotBlank(partNum)) {
if (!partNum.equals(barcode.getPartNumber())) {
throw new ValidateException("smfcore.mesApi.inCheck.ng", reelID + "对应的料号为:" + barcode.getPartNumber() + "与mes返回的料号:" + partNum
+ "不一致,请检查物料的唯一码是否重复");
}
//barcode.setPartNumber(partNum);
}
if (StringUtils.isNotBlank(reelID)) {
if (qty == 0) {
throw new ValidateException("smfcore.mesApi.inCheck.ng", reelID + "mes数量返回为0,不允许进行入库");
......@@ -273,6 +248,8 @@ public class LizhenApi extends DefaultSmfApiListener {
paramMap.put("datecode", barcode.getDateCode());
paramMap.put("lot", barcode.getBatch());
paramMap.put("vendor", barcode.getProvider());
paramMap.put("werks", CommonUtil.plantCode);
paramMap.put("model", "ALL");
String param = JsonUtil.toJsonStr(paramMap);
log.info("禁用料接口wmsCheckReelfob入参为:" + param);
try {
......@@ -297,24 +274,22 @@ public class LizhenApi extends DefaultSmfApiListener {
}
//保存禁用料记录
//if (StringUtils.isNotBlank(resultStr)) {
Barcode barcodeOri = barcodeManager.findByBarcode(barcode.getBarcode());
if (barcodeOri != null) {
barcodeOri.setExpireDate(barcode.getExpireDate());
barcodeOri.setDisableMsg(resultStr);
barcodeOri.setPlateSize(barcode.getPlateSize());
barcodeOri.setHeight(barcode.getHeight());
barcode = barcodeManager.save(barcodeOri);
StoragePos storagePos = storagePosManager.getByBarcode(barcode.getBarcode());
if (storagePos != null) {
storagePos.setBarcode(barcode);
storagePosManager.save(storagePos);
}
//}
}
if (StringUtils.isNotBlank(resultStr)) {
throw new ValidateException("smfcore.mesApi.inCheck.ng", /*"MES验证失败:" + */barcode.getBarcode() + "验证失败:" + resultStr);
}
return barcode;
}
......@@ -327,72 +302,9 @@ public class LizhenApi extends DefaultSmfApiListener {
*/
@Override
public void inTaskStatusChange(String inNotifyUrl, DataLog task) {
if (!task.isFinished()) {
return;
}
DataLog oldTask = dataLogManager.findOne(new Query(Criteria.where("barcode").is(task.getBarcode()).and("type").is(OP.CHECKOUT)
.and("status").is(OP_STATUS.FINISHED.name()).and("createDate").lte(new Date())).with(Sort.by(Sort.Direction.DESC, "createDate")));
if (oldTask == null) {
log.info(task.getBarcode()+"为退料,调用退料接口");
reelInToTower(inNotifyUrl, task);
} else {
log.info(task.getBarcode()+"为新料,调用保存物料接口");
reelReturnTower(oldTask);
}
}
private void reelInToTower(String inNotifyUrl, DataLog task) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("pickingid", "");
dataMap.put("wo", "");
dataMap.put("reelno", task.getBarcode());
dataMap.put("ipn", task.getPartNumber());
Barcode barcode = barcodeManager.findByBarcode(task.getBarcode());
if (barcode != null) {
dataMap.put("qty", barcode.getAmount());
dataMap.put("datecode", barcode.getDateCode());
dataMap.put("lot", barcode.getBatch());
dataMap.put("vendor", barcode.getProvider());
dataMap.put("batch", "");
dataMap.put("vendorcode", barcode.getProviderNumber());
}
dataMap.put("werks", werks);
dataMap.put("reelid", "");
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info(barcode.getBarcode()+"保存物料入参为:" + param+"地址为:"+ inNotifyUrl);
try {
String result = HttpHelper.postJson(inNotifyUrl, Arrays.asList(dataMap));
log.info(barcode.getBarcode()+"保存物料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(barcode.getBarcode() + "保存物料异常:" + e.getMessage());
}
}
private void reelReturnTower(DataLog oldTask) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("line", oldTask.getLine());
dataMap.put("reel_id", oldTask.getBarcode());
dataMap.put("rm_type", 2);
Storage storage = dataCache.getStorageById(oldTask.getStorageId());
if (storage.isVirtual()) {
dataMap.put("rm_type", 1);
}
dataMap.put("create_empno", SecurityUtils.getLoginUsername());
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
format.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置为UTC时间
String nowDateStr = format.format(date);
dataMap.put("create_time", nowDateStr);
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap) + "地址为:" + CommonGIRecordUrl);
log.info(oldTask.getBarcode()+"调用退料接口:" + param);
try {
String result = HttpHelper.postJson(CommonGIRecordUrl, Arrays.asList(dataMap));
log.info(oldTask.getBarcode()+"退料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(oldTask.getBarcode() + "退料异常:" + e.getMessage());
if (task.isFinished()) {
reelInToTower(task);
reelReturnTower(task);
}
}
......@@ -404,46 +316,8 @@ public class LizhenApi extends DefaultSmfApiListener {
*/
@Override
public void outTaskStatusChange(String outNotifyUrl, DataLog task) {
if (task.isFinished()) {
List<Map<String, Object>> paramList = new ArrayList<>();
Storage storage = dataCache.getStorage(task.getCid());
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("line",task.getLine());
paramMap.put("mc_id",storage.getMachineId());
paramMap.put("reel_id",task.getBarcode());
paramMap.put("ipn",task.getPartNumber());
paramMap.put("qty",task.getNum());
//发料类型(0:智能仓1:虚拟仓2:物料预警3:手动发料)
int type = 0;
if (StringUtils.isNotEmpty(task.getSourceId())) {
type = 2;
} else {
if (storage.isVirtual()) {
type = 1;
} else {
type = 3;
}
}
paramMap.put("gi_type",type);
paramMap.put("create_empno",StringUtils.isEmpty(task.getCreator()) ? "System" : task.getCreator());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
paramMap.put("create_time",sdf.format(task.getCreateDate()));
paramList.add(paramMap);
log.info("出库通知入参为:" + JSON.toJSONString(paramList));
try {
String result = HttpHelper.postJson(outNotifyUrl, paramList);
log.info(task.getBarcode() + "出入库通知返回结果为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.error(task.getBarcode() + "出入库通知异常:" + e.getMessage());
}
reelOutFromTower(task);
}
}
......@@ -515,7 +389,7 @@ public class LizhenApi extends DefaultSmfApiListener {
return StringUtils.isBlank(pickingid);
}).collect(Collectors.toList());
if (noPickingidList != null && !noPickingidList.isEmpty()){
if (noPickingidList != null && !noPickingidList.isEmpty()) {
String param = JsonUtil.toJsonStr(paramList);
log.info("保存物料入参为:" + param + "地址为:" + outNotifyUrl);
try {
......@@ -566,7 +440,7 @@ public class LizhenApi extends DefaultSmfApiListener {
}
}
if (items != null && !items.isEmpty()) {
return PreWarningItemCache.createAndExecuteLiteOrder(items,false);
return PreWarningItemCache.createAndExecuteLiteOrder(items, false);
}
}
return null;
......@@ -578,8 +452,7 @@ public class LizhenApi extends DefaultSmfApiListener {
* @param barcodeList
* @return
*/
public List<String> batchCheck(List<Barcode> barcodeList) {
List<String> resultList = new ArrayList<>();
public List<String> batchCheckReel(List<Barcode> barcodeList, String pickingId, String model) {
List<Map<String, Object>> paramList = new ArrayList<>();
for (Barcode barcode : barcodeList) {
Map<String, Object> paramMap = new HashMap<>();
......@@ -589,28 +462,67 @@ public class LizhenApi extends DefaultSmfApiListener {
paramMap.put("datecode", barcode.getDateCode());
paramMap.put("lot", barcode.getBatch());
paramMap.put("vendor", barcode.getProvider());
paramMap.put("remark", "");
paramMap.put("remark", "ALL");
paramMap.put("werks", "ALL");
paramMap.put("model", "ALL");
if (StringUtils.isNotEmpty(model)) {
paramMap.put("model", model);
}
paramMap.put("picking", "ALL");
if (StringUtils.isNotEmpty(pickingId)) {
paramMap.put("picking", pickingId);
}
paramList.add(paramMap);
}
String paramStr = JSON.toJSONString(paramList);
log.info("批量禁用料,入参为:" + paramStr+",地址为:"+batchCheckUrl);
log.info("批量禁用入参为:" + JSON.toJSONString(paramList));
List<String> reelList = new ArrayList<>();
try {
String result = HttpHelper.postJson(batchCheckUrl, paramList);
log.info("批量禁用料,出参为:" + result);
JSONObject jsonObject = JSON.parseObject(result);
if (jsonObject.getInteger("status") == 200) {
JSONArray data = jsonObject.getJSONArray("data");
if (data != null && !data.isEmpty()) {
for (int i = 0; i < data.size(); i++) {
JSONObject item = data.getJSONObject(i);
resultList.add(item.getString("reelNo"));
String resultStr = HttpHelper.postJson(batchCheckReel, paramList);
log.info("批量禁用接口返回结果为:" + resultStr);
JSONObject resultObj = JSONObject.parseObject(resultStr);
String status = resultObj.getString("status");
if ("200".equals(status)) {
JSONArray dataArr = resultObj.getJSONArray("data");
if (dataArr != null && !dataArr.isEmpty()) {
for (int i = 0; i < dataArr.size(); i++) {
JSONObject data = dataArr.getJSONObject(i);
JSONArray resultList = data.getJSONArray("resultList");
if (resultList != null && !resultList.isEmpty()) {
for (int j = 0; j < resultList.size(); j++) {
JSONObject result = resultList.getJSONObject(j);
String reelId = result.getString("reelId");
if (StringUtils.isNotBlank(reelId)) {
reelList.add(reelId);
}
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
log.info("批量禁用接口调用失败:" + e.getMessage());
}
return resultList;
//添加禁用料信息
for (Barcode barcode : barcodeList) {
if (reelList.contains(barcode.getBarcode())) {
barcode.setDisableMsg("禁用料");
} else {
barcode.setDisableMsg("");
}
barcode = barcodeManager.save(barcode);
StoragePos storagePos = storagePosManager.getByBarcode(barcode.getBarcode());
if (storagePos != null) {
storagePos.setBarcode(barcode);
storagePosManager.save(storagePos);
}
}
return reelList;
}
......@@ -625,14 +537,17 @@ public class LizhenApi extends DefaultSmfApiListener {
return true;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("reelID", barcode.getBarcode());
paramMap.put("ipn", barcode.getPartNumber());
paramMap.put("model", "EVEREST");
paramMap.put("reelid", barcode.getBarcode());
paramMap.put("data", "");
paramMap.put("emp", "smf");
paramMap.put("cmd", "AUTOWH");
try {
log.info(barcode.getBarcode() + "散料量测接口入参为-----" + JSON.toJSONString(paramMap)+",接口地址为:"+checkReelMeasureUrl);
log.info(barcode.getBarcode() + "散料量测接口入参为-----" + JSON.toJSONString(paramMap) + ",接口地址为:" + checkReelMeasureUrl);
String result = HttpHelper.postJson(checkReelMeasureUrl, paramMap);
log.info(barcode.getBarcode() + "散料量测接口出参为-----" + result);
JSONObject jsonObject = JSON.parseObject(result);
if (jsonObject.getInteger("status") == 200) {
if (jsonObject.getInteger("code") == 1) {
JSONObject data = jsonObject.getJSONObject("data");
if (data.getBoolean("result")) {
return true;
......@@ -648,6 +563,177 @@ 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", CommonUtil.plantCode);
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());
}
}
private void reelInToTower(DataLog task) {
if (StringUtils.isEmpty(save2DReelInfoUrl)){
return;
}
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("pickingid", "");
dataMap.put("wo", "");
dataMap.put("reelno", task.getBarcode());
dataMap.put("ipn", task.getPartNumber());
Barcode barcode = barcodeManager.findByBarcode(task.getBarcode());
if (barcode != null) {
dataMap.put("qty", barcode.getAmount());
dataMap.put("datecode", barcode.getDateCode());
dataMap.put("lot", barcode.getBatch());
dataMap.put("vendor", barcode.getProvider());
dataMap.put("batch", "");
dataMap.put("vendorcode", barcode.getProviderNumber());
}
dataMap.put("werks", "W339");
dataMap.put("reelid", "");
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info(barcode.getBarcode() + "保存物料入参为:" + param + "地址为:" + save2DReelInfoUrl);
try {
String result = HttpHelper.postJson(save2DReelInfoUrl, Arrays.asList(dataMap));
log.info(barcode.getBarcode() + "保存物料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(barcode.getBarcode() + "保存物料异常:" + e.getMessage());
}
}
private void reelReturnTower(DataLog oldTask) {
if (StringUtils.isEmpty(commonRMRecordUrl)){
return;
}
Map<String, Object> dataMap = new HashMap<>();
String line = oldTask.getLine();
if (StringUtils.isNotEmpty(line)) {
if (line.contains("_")) {
line = line.substring(0, line.indexOf("_"));
}
}
dataMap.put("line", line);
dataMap.put("reel_id", oldTask.getBarcode());
dataMap.put("ipn", oldTask.getPartNumber());
dataMap.put("rm_type", 2);
Storage storage = dataCache.getStorageById(oldTask.getStorageId());
if (storage.isVirtual()) {
dataMap.put("rm_type", 1);
}
Barcode barcode = barcodeManager.findByBarcode(oldTask.getBarcode());
if (barcode != null) {
dataMap.put("qty", barcode.getAmount());
dataMap.put("date_code", barcode.getDateCode());
dataMap.put("lot", barcode.getBatch());
dataMap.put("vendor_name", barcode.getProvider());
dataMap.put("batch_id", "");
//dataMap.put("vendorcode", barcode.getProviderNumber());
}
dataMap.put("create_empno", StringUtils.isEmpty(SecurityUtils.getLoginUsername()) ? storage.getName() : SecurityUtils.getLoginUsername());
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
format.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置为UTC时间
String nowDateStr = format.format(date);
dataMap.put("create_time", nowDateStr);
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap) + "地址为:" + commonRMRecordUrl);
log.info(oldTask.getBarcode() + "调用退料接口:" + param);
try {
String result = HttpHelper.postJson(commonRMRecordUrl, Arrays.asList(dataMap));
log.info(oldTask.getBarcode() + "退料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(oldTask.getBarcode() + "退料异常:" + e.getMessage());
}
}
private void reelOutFromTower(DataLog task) {
if (StringUtils.isEmpty(commonGIRecordUrl)){
return;
}
List<Map<String, Object>> paramList = new ArrayList<>();
Storage storage = dataCache.getStorage(task.getCid());
Map<String, Object> paramMap = new HashMap<>();
String line = task.getLine();
if (StringUtils.isNotEmpty(line)) {
if (line.contains("_")) {
line = line.substring(0, line.indexOf("_"));
}
}
paramMap.put("line", line);
paramMap.put("mc_id", storage.getName());
paramMap.put("reel_id", task.getBarcode());
paramMap.put("ipn", task.getPartNumber());
paramMap.put("qty", task.getNum());
String tableNo = task.getTableNo();
if (StringUtils.isNotEmpty(tableNo)) {
paramMap.put("stationInfo", task.getLine() + "," + task.getSide() + "," + task.getTableNo() + "," + task.getSlot() + "," + task.getSubSlot());
} else {
paramMap.put("stationInfo", task.getLine());
}
//发料类型(0:智能仓1:虚拟仓2:物料预警3:手动发料)
int type = 0;
if (StringUtils.isNotEmpty(task.getSourceId())) {
type = 2;
} else {
if (storage.isVirtual()) {
type = 1;
} else {
type = 3;
}
}
paramMap.put("gi_type", type);
paramMap.put("create_empno", StringUtils.isEmpty(task.getCreator()) ? "System" : task.getCreator());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
paramMap.put("create_time", sdf.format(task.getCreateDate()));
paramList.add(paramMap);
log.info("出库通知入参为:" + JSON.toJSONString(paramList) + "地址为:" + commonGIRecordUrl);
try {
String result = HttpHelper.postJson(commonGIRecordUrl, paramList);
log.info(task.getBarcode() + "出入库通知返回结果为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.error(task.getBarcode() + "出入库通知异常:" + e.getMessage());
}
}
@Override
public boolean isForThisApi(String apiName) {
return apiName != null && apiName.equalsIgnoreCase("Lizhen");
......
package com.neotel.smfcore.custom.lizhen;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean;
......@@ -20,6 +22,7 @@ import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.ManualTower;
import com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem;
import com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
......@@ -270,22 +273,31 @@ public class LizhenController {
}
//log.info("Mes缺料预警---" + JSONObject.toJSONString(data));
PreWarningItem item = new PreWarningItem();
item.setMachinename(data.get("MACHINENAME"));
item.setStation(data.get("STATION"));
item.setSide(data.get("SIDE"));
item.setMachinename(data.get("MACHINE_NAME"));
item.setStation(data.get("MACHINE"));
item.setSide(data.get("FACE"));
item.setSlot(data.get("SLOT"));
item.setSubslot(data.get("SUBSLOT"));
item.setPartnumber(data.get("PARTNUMBER"));
item.setPartnumber(data.get("MATERIAL_CODE"));
item.setLine(data.get("LINE"));
item.setItemId(data.get("ID"));
item.setPickingId(data.get("PICKING_ID"));
String mo = data.get("MO");
item.setMo(mo);
try {
item.setItemNo(Integer.valueOf(data.get("ITEM_NO")));
item.setPriority(Integer.valueOf(data.get("PRIORITY")));
} catch (NumberFormatException e) {
e.printStackTrace();
item.setPriority(0);
item.setItemNo(1);
}
item.setReel(data.get("REEL"));
item.setBrand(data.get("VENDOR"));
String brand = data.get("VENDOR");
if (StringUtils.isEmpty(brand)){
brand = data.get("BRAND");
}
item.setBrand(brand);
if (StringUtils.isBlank(item.getSide())){
log.info("缺料预警id:"+item.getItemId()+"面别为空,忽略");
......@@ -296,6 +308,72 @@ public class LizhenController {
return ResultBean.newOkResult("");
}
@ApiOperation("Tower接收手动发料信息")
@RequestMapping("/manualTower")
@AnonymousAccess
public Map<String, String> manualTower(@RequestBody JSONObject jsonObject) {
log.info("收到WMS手动发料数据为:" + JSON.toJSONString(jsonObject));
Map<String, String> resultMap = new HashMap<>();
String pickingId = jsonObject.getString("PICKING_ID");
String data = jsonObject.getString("DATA");
List<ManualTower> manualTowerList = JSONArray.parseArray(data, ManualTower.class);
if (StringUtils.isEmpty(pickingId) || manualTowerList == null || manualTowerList.isEmpty()){
resultMap.put("MSGTY", "E");
resultMap.put("MSGTX", "请核实参数是否为空");
return resultMap;
}
LiteOrder liteOrder = liteOrderManager.findByOrderNo(pickingId);
if (liteOrder == null){
String line = "";
List<LiteOrderItem> itemList = new ArrayList<>();
for (ManualTower manualTower : manualTowerList) {
LiteOrderItem item = new LiteOrderItem();
item.setPn(manualTower.getMATERIAL_CODE());
item.setNeedReelCount(manualTower.getREQ_REEL() == 0 ? 1 : manualTower.getREQ_REEL());
item.setNeedNum(manualTower.getREQ_QTY());
item.setSide(manualTower.getFACE());
item.setBrand(manualTower.getBRAND());
item.setLine(manualTower.getLINE());
if (StringUtils.isEmpty(line)){
line = manualTower.getLINE();
}
item.setPickingId(pickingId);
item.setRowId(manualTower.getROW_ID());
item.setItemNo(manualTower.getITEM_NO());
item.setTableNo(manualTower.getMACHINE());
item.setMo(manualTower.getMO());
item.setSlot(manualTower.getSLOT());
item.setSubSlot(manualTower.getSUBSLOT());
item.setBatchCode(manualTower.getBATCH_CODE());
item.setModel(manualTower.getMODEL());
item.setWarningItemId(manualTower.getITEM_NO()+"");
item.setMachineName(manualTower.getMACHINE_NAME());
itemList.add(item);
}
liteOrder = new LiteOrder();
liteOrder.setOrderNo(pickingId);
liteOrder.setLine(line);
liteOrder.setOrderItems(itemList);
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
resultMap.put("MSGTY", "S");
resultMap.put("MSGTX", "接收成功");
} else {
resultMap.put("MSGTY", "E");
resultMap.put("MSGTX", pickingId+"已经存在");
}
return resultMap;
}
/**
* 根据唯一码,查找最近的一次工单信息
......@@ -332,7 +410,7 @@ public class LizhenController {
}
@ApiOperation("工单差异料上传")
/*@ApiOperation("工单差异料上传")
@RequestMapping("/differenceReel")
@AnonymousAccess
public synchronized ResultBean differenceReel(@RequestBody List<Map<String, String>> paramList) {
......@@ -383,7 +461,7 @@ public class LizhenController {
return ResultBean.newOkResult("");
}
*/
private String getForwardUrl(String line) {
String url = "";
......
......@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.BetweenData;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.*;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
......@@ -30,6 +31,8 @@ import com.neotel.smfcore.custom.lizhen.agvBox.bean.query.InventoryQuery;
import com.neotel.smfcore.custom.lizhen.agvBox.service.manager.InventoryDataManager;
import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil;
import com.neotel.smfcore.custom.lizhen.agvBox.util.StationCacheUtil;
import com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import lombok.extern.slf4j.Slf4j;
......@@ -625,9 +628,9 @@ public class InventoryController {
return barcode.getBarcode() + "存在料箱中:" + barcode.getPosName() + "与当前工位上的料箱:" + boxStr + "不一致";
}
//判断料号是否正确
Map<String, Object> barandMap = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (barandMap.get("qty") == null) {
return barcode.getPartNumber() + "MES未返回料卷数量,未找到对应的料卷数量";
BrandQtyResult brandQtyResult = lizhenApi.brandQty(new BrandQtyRequest(barcode.getPartNumber(), barcode.getProvider()));
if (brandQtyResult == null) {
throw new ValidateException("smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
}
log.info(barcode.getBarcode() + "隔口信息:" + barcode.getPosName());
//开始查询盘点数据
......
......@@ -27,6 +27,8 @@ import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.agvBox.enums.INOUT_TYPE;
import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil;
import com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
......@@ -237,9 +239,9 @@ public class OutLineController {
}
//校验是否可以入库
Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (brandQty == null || brandQty.isEmpty()) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
BrandQtyResult brandQtyResult = lizhenApi.brandQty(new BrandQtyRequest(barcode.getPartNumber(), barcode.getProvider()));
if (brandQtyResult == null) {
throw new ValidateException("smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
}
//获取mes数量
......
......@@ -28,6 +28,8 @@ import com.neotel.smfcore.custom.lizhen.agvBox.enums.INOUT_TYPE;
import com.neotel.smfcore.custom.lizhen.agvBox.service.manager.GrLabelManager;
import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil;
import com.neotel.smfcore.custom.lizhen.agvBox.util.StationCacheUtil;
import com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
......@@ -115,18 +117,18 @@ public class WarehouseController {
return ResultBean.newErrorResult(-1, "", "Gr:" + grLabel.getLabelId() + "已经失效");
}
//得到料卷总数量与尺寸
Map<String, Object> barandMap = lizhenApi.brandQty(grLabel.getPartNumber(), grLabel.getProvider());
if (barandMap.get("qty") == null) {
return ResultBean.newErrorResult(-1, "", grLabel.getPartNumber() + "MES未返回料卷数量,未找到对应的料卷数量");
BrandQtyResult brandQtyResult = lizhenApi.brandQty(new BrandQtyRequest(grLabel.getPartNumber(), grLabel.getProvider()));
if (brandQtyResult == null) {
throw new ValidateException("smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{grLabel.getPartNumber()});
}
num = (grLabel.getRemainingAmount() / Integer.valueOf(barandMap.get("qty").toString())) + "";
num = (grLabel.getRemainingAmount() / Integer.valueOf(brandQtyResult.getQty())) + "";
//校验尺寸,如果没有返回也没有手输,返回错误
if (barandMap.get("reelSize") == null) {
if (brandQtyResult.getReel_size() == 0) {
if (StringUtils.isBlank(size)) {
return ResultBean.newErrorResult(-1, "", grLabel.getPartNumber() + "MES未返回物料规格,请选择对应的物料规格");
}
} else {
String reelSize = barandMap.get("reelSize").toString();
String reelSize = brandQtyResult.getReel_size()+"";
if ("7".equals(reelSize)) {
size = "7X8";
} /*else if ("13".equals(reelSize)) {
......@@ -407,9 +409,9 @@ public class WarehouseController {
}
//校验是否可以入库
Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (brandQty == null || brandQty.isEmpty()) {
return ResultBean.newErrorResult(-1,"smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
BrandQtyResult brandQtyResult = lizhenApi.brandQty(new BrandQtyRequest(barcode.getPartNumber(), barcode.getProvider()));
if (brandQtyResult == null) {
throw new ValidateException("smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
}
//获取mes数量
......
package com.neotel.smfcore.custom.lizhen.bean.apirequest;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class BrandQtyRequest {
private String material_code;
private String brand;
}
\ No newline at end of file
package com.neotel.smfcore.custom.lizhen.bean.apiresult;
import lombok.Data;
@Data
public class BrandQtyResult {
private String id;
private String material_code;
private String brand;
private int qty;
private int reel_size;
private String create_by;
private String create_at;
private String update_by;
private String update_at;
}
package com.neotel.smfcore.custom.lizhen.bean.apiresult;
import lombok.Data;
@Data
public class DifferentMaterial {
/**
* wo;//工单
* mc;//机台
* ipn;//物料
* zone;//站位
* gidLineSide;//线_Line_面
*/
private String wo;
private String mc;
private String ipn;
private String zone;
private String gidLineSide;
/*
[
{
"wo": "030000248583",
"mc": "NPM-2",
"ipn": "377S00070",
"zone": "1-07-L",
"gidLineSide": "A05-5FRF-01_1A_B"
},
{
"wo": "030000248583",
"mc": "NPM-2",
"ipn": "117S00069$YA0A01B5",
"zone": "1-08-L",
"gidLineSide": "A05-5FRF-01_1A_B"
},
{
"wo": "030000248583",
"mc": "NPM-2",
"ipn": "N/A",
"zone": "1-10",
"gidLineSide": "A05-5FRF-01_1B_T"
}
]
*/
}
package com.neotel.smfcore.custom.lizhen.bean.apiresult;
import lombok.Data;
@Data
public class LuxsanApiResult {
private String MSGTY;
private String MSGTX;
private String DATA;
}
package com.neotel.smfcore.custom.lizhen.bean.apiresult;
import lombok.Data;
@Data
public class ManualTower {
private String ROW_ID; // 假设这是一个唯一标识符,可以使用String
private int ITEM_NO; // 项目号,使用int,如果可能超出int范围,则使用long
private String PLANT_CODE; // 工厂代码
private String MATERIAL_CODE; // 料号
private String LINE; // 线别
private String MACHINE_NAME; // 机台名
private String MACHINE; // 机台(可能与MACHINE_NAME重复,但保持原样)
private String FACE; // 面别
private String SLOT; // 料站
private String SUBSLOT; // 左右料站
private String MO; // 工单
private String BRAND; // 制造商
private String BATCH_CODE; // 批次号
private int LEFT_QTY; // 剩余数量,使用int,根据需求调整
private int LEFT_PCBS; // 剩余板数
private int LEFT_TIMES; // 剩余时间,根据时间单位可能需要调整为long或特定时间类型
private int PRIORITY; // 优先级
private int PRODUCT_BOARDS; // 主板数
private String STATUS; // 状态,如果状态值很多且有具体含义,考虑使用枚举
private String MACHINE_TYPE; // 机台类型
private String RECIEVE_TYPE; // 接收类型,注意拼写错误,应为RECEIVE_TYPE
private String PITCH; // 摊位
private double TAP_LENGTH; // 料盘长度,假设需要较高的精度
private int REQ_REEL; // 需求卷数
private int REQ_QTY; // 需求数量
private String MODEL; // 机种
}
......@@ -30,6 +30,9 @@ public class PreWarningItem extends BasePo {
private String itemId;
private String reel;
private String brand;
private String pickingId;
private String mo;
private int itemNo;
/**
* 优先级,1:人工 0:机器
*/
......
......@@ -25,16 +25,13 @@ public class FloorRestController {
*/
@RequestMapping("/getF4Line")
@AnonymousAccess
public List<String> getF4Line(){
public List<String> getF4Line() {
String line = dataCache.getCache(cacheFloorKey);
List<String> lineList = new ArrayList<>();
String[] split = line.split(",");
for (String lineStr : split) {
lineList.add(lineStr);
}
lineList.add("退WH");
lineList.add("B03-4FSMT-11");
lineList.add("B03-4FSMT-01");
return lineList;
}
......
......@@ -120,6 +120,7 @@ public class RobotController {
item.setLine(box.getLINE());
item.setMachineName(box.getMACHINENAME());
item.setStation(box.getSTATION());
item.setTableNo(box.getSTATION());
item.setSide(box.getSIDE());
item.setSlot(box.getSLOT());
item.setSubSlot(box.getSUBSLOT());
......
......@@ -25,6 +25,8 @@ import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest;
import com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult;
import com.neotel.smfcore.custom.lizhen.innerBox.bean.VirImportLog;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.lizhen.innerBox.service.manager.IVirImportLogManager;
......@@ -128,9 +130,9 @@ public class VirtualRestController {
}
//校验是否可以入库
Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (brandQty == null || brandQty.isEmpty()) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
BrandQtyResult brandQtyResult = lizhenApi.brandQty(new BrandQtyRequest(barcode.getPartNumber(), barcode.getProvider()));
if (brandQtyResult == null) {
throw new ValidateException("smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
}
Barcode barcodeApi = lizhenApi.barcodeInfo(barcode);
......
......@@ -3,21 +3,28 @@ server:
api:
name: Lizhen
inCheckUrl: #http://10.190.25.124:8001/Npm/WmsCheckReelfob #禁用料
batchCheckUrl: #http://172.30.60.117:8001/Npm/WmsCheckReelfob_Batch #批量禁用料
outNotifyUrl: http://10.190.25.149:8082/Sct/CommonGIRecord
inCheckUrl: http://10.68.24.25:8001/Npm/WmsCheckReelfob
batchCheckReel: http://10.68.30.22:8082/api/mes/GetInDat
outNotifyUrl: 1
outNotifyUrlPK: #http://172.30.170.148:8001/Sct/SaveReelInfo #PK发料保存(外仓配置)
inNotifyUrl: #http://10.190.25.124:8082/SmtAutoWH/Save2DReelInfo #保存物料(内仓配置)
inNotifyUrl: 1 #保存物料(内仓配置)
fetchOrderUrl: #http://172.30.170.148:8082/SmtAutoWH/GetWoPickingList #获取工单
barcodeInfoUrl: #http://10.190.25.124:8001/Sct/GetReelInfo #mes数量
barcodeInfoUrl: #http://10.68.24.25:8001/Sct/GetReelInfo #mes数量
fetchGRUrl: #http://10.42.25.199:8082/api/wcs/fetchGR #gr标签
brandQtyUrl: #http://172.30.170.199:8082/api/wcs/brandQty #gr标签满卷数
importUrl: #http://10.42.222.52:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据
checkReelMeasure: #http://10.190.25.124:8001/Sct/CheckReelMeasure #散料量测接口
CommonGIRecord: http://10.190.25.149:8082/Sct/CommonRMRecord
plant: 2810
werks: 2810
outerFactory:
brandQtyUrl: http://10.68.30.22:8082/api/wcs/brandQty
importUrl: #http://172.30.150.83:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据
checkReelMeasure: #http://10.68.24.25:8001/Sct/CheckReelMeasure #外仓散料仓量测接口
getInDateUrl: http://10.68.30.22:8082/api/mes/GetInDate
#发料
commonGIRecordUrl: http://10.68.27.109:8082/API/SendMaterial
#退料
commonRMRecordUrl: #http://10.68.24.25:8002/Sct/CommonRMRecord
#入库
save2DReelInfoUrl: http://10.68.27.109:8082/API/Save2DReelInfo
plant: W339
werks: W339
outerFactory: B15
plantCode: W339
bc:
......@@ -41,7 +48,7 @@ lizhen:
url: http://172.30.97.63:8001/smf-core/api/Mes/machineCallMaterial
F4:
name: 4F
line: B03-4FSMT-12,B03-4FSMT-02,B03-4FSMT-13,B03-4FSMT-03,B03-4FSMT-01,B03-4FSMT-11
line: BG02T,BG02B,CG20B1,CG02B2,CG02T1,CG02T2,AS02T1,AS02T2,AS02T3,AS02B1,AS02B2,BG03T1,BG03T2,BG03B1,BG03B2,BG04B,BG04T,CG03T1,CG03T2,CG03B
url: http://172.25.254.49:8001/smf-core/api/Mes/machineCallMaterial
......
......@@ -283,3 +283,4 @@ smfcore.virtual.hasReelError=\u865A\u62DF\u4ED3\u4E2D\u6CA1\u6709\u7269\u6599,\u
smfcore.inventory.noBatch=\u5F53\u524D\u6CA1\u6709\u8981\u76D8\u70B9\u7684\u6279\u6B21,\u8BF7\u70B9\u51FB\u5F00\u59CB\u76D8\u70B9
smfcore.inventory.noReel=\u7269\u6599[{0}]\u4E0D\u5728\u5F53\u524D\u76D8\u70B9\u7684\u6279\u6B21{1}\u4E2D,\u8BF7\u68C0\u67E5
smfcore.inventory.finish=\u7269\u6599[{0}]\u5DF2\u76D8\u70B9\u5B8C\u6210,\u6279\u6B21\u4E3A{1},\u8BF7\u68C0\u67E5
smfcore.logMonitor=\u65E5\u5FD7\u76D1\u63A7
\ No newline at end of file
......@@ -256,4 +256,5 @@ smfcore.equipmentView=Equipment connected
smfcore.greaterThanZero=Amount Must be greater than 0
smfcore.error.virtualOut.num=The number cannot exceed {0}
smfcore.error.virtualOut.noItem=The corresponding material is not found in work order {0}
smfcore.logMonitor=Log Monitoring
......@@ -255,4 +255,5 @@ smfcore.equipmentView=\u8BBE\u5907\u4E92\u8054
smfcore.greaterThanZero=\u6570\u91CF\u5FC5\u987B\u5927\u4E8E0
smfcore.error.virtualOut.num=\u6570\u91CF\u4E0D\u80FD\u8D85\u8FC7{0}
smfcore.error.virtualOut.noItem=\u5DE5\u5355{0}\u4E2D\u672A\u627E\u5230\u5BF9\u5E94\u7684PN\u6216\u7269\u6599\u7F16\u53F7
smfcore.logMonitor=\u30ED\u30B0\u76E3\u8996
......@@ -262,3 +262,4 @@ smfcore.virtual.hasReelError=\u865A\u62DF\u4ED3\u4E2D\u6CA1\u6709\u7269\u6599,\u
smfcore.inventory.noBatch=\u5F53\u524D\u6CA1\u6709\u8981\u76D8\u70B9\u7684\u6279\u6B21,\u8BF7\u70B9\u51FB\u5F00\u59CB\u76D8\u70B9
smfcore.inventory.noReel=\u7269\u6599[{0}]\u4E0D\u5728\u5F53\u524D\u76D8\u70B9\u7684\u6279\u6B21{1}\u4E2D,\u8BF7\u68C0\u67E5
smfcore.inventory.finish=\u7269\u6599[{0}]\u5DF2\u76D8\u70B9\u5B8C\u6210,\u6279\u6B21\u4E3A{1},\u8BF7\u68C0\u67E5
smfcore.logMonitor=\u65E5\u5FD7\u76D1\u63A7
\ No newline at end of file
......@@ -255,3 +255,4 @@ smfcore.equipmentView=\u8A2D\u5099\u4E92\u806F
smfcore.greaterThanZero=\u6578\u91CF\u5FC5\u9808\u5927\u65BC0
smfcore.error.virtualOut.num=\u6578\u91CF\u4E0D\u80FD\u8D85\u904E{0}
smfcore.error.virtualOut.noItem=\u5DE5\u55AE{0}\u4E2D\u672A\u627E\u5230\u5C0D\u61C9\u7684PN\u7269\u6599\u7DE8\u865F
smfcore.logMonitor=\u65E5\u8A8C\u76E3\u63A7
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!