Commit 56a1190f zshaohui

1.功能优化提交

1 个父辈 4e0d6aca
...@@ -231,6 +231,8 @@ public class Barcode extends BasePo implements Serializable { ...@@ -231,6 +231,8 @@ public class Barcode extends BasePo implements Serializable {
*/ */
private Date sluggishTime; private Date sluggishTime;
private String countType;
/** /**
* 自定义的附加信息 * 自定义的附加信息
*/ */
......
...@@ -208,7 +208,7 @@ public class CodeResolve { ...@@ -208,7 +208,7 @@ public class CodeResolve {
int lastLabelAmount = barcode.getLabelAmount(); int lastLabelAmount = barcode.getLabelAmount();
if(type!= COMPONENT_TYPE.SOLDERPASTE) { if(type!= COMPONENT_TYPE.SOLDERPASTE) {
int currentLabelAmount = barcodeFromRule.getAmount(); int currentLabelAmount = barcodeFromRule.getAmount();
if (currentLabelAmount != lastLabelAmount) { if (currentLabelAmount != lastLabelAmount && currentLabelAmount > 1) {
//本次解析出来的数量与上次条码解析出来的数量不一样,重新设置数量 //本次解析出来的数量与上次条码解析出来的数量不一样,重新设置数量
log.info("重新设置" + codeBeanFromRule.getCodeStr() + "数量为:" + currentLabelAmount); log.info("重新设置" + codeBeanFromRule.getCodeStr() + "数量为:" + currentLabelAmount);
barcode.setAmount(currentLabelAmount); barcode.setAmount(currentLabelAmount);
......
...@@ -750,6 +750,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -750,6 +750,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
barcode.setInOpor(task.getOperator()); barcode.setInOpor(task.getOperator());
barcode.setCheckOutDate(null, ""); barcode.setCheckOutDate(null, "");
barcode.setPosName(task.getPosName()); barcode.setPosName(task.getPosName());
barcode.setCountType("");
if (barcode.isSolder()) { if (barcode.isSolder()) {
if (storagePos.isWarmPos()) { if (storagePos.isWarmPos()) {
//回温仓位 //回温仓位
......
...@@ -21,6 +21,8 @@ import com.neotel.smfcore.core.system.util.DevicesStatusUtil; ...@@ -21,6 +21,8 @@ import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.websocket.MsgType; import com.neotel.smfcore.core.system.websocket.MsgType;
import com.neotel.smfcore.core.system.websocket.SocketMsg; import com.neotel.smfcore.core.system.websocket.SocketMsg;
import com.neotel.smfcore.core.system.websocket.WebSocketServer; import com.neotel.smfcore.core.system.websocket.WebSocketServer;
import com.neotel.smfcore.custom.zhongche1568.ZhongcheApi;
import com.neotel.smfcore.custom.zhongche1568.bean.api.MaterialCountResult;
import com.neotel.smfcore.security.TokenProvider; import com.neotel.smfcore.security.TokenProvider;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.service.manager.IUserManager; import com.neotel.smfcore.security.service.manager.IUserManager;
...@@ -48,6 +50,9 @@ public class NLPShelfHandler extends BaseDeviceHandler { ...@@ -48,6 +50,9 @@ public class NLPShelfHandler extends BaseDeviceHandler {
@Autowired @Autowired
private IUserManager userManager; private IUserManager userManager;
@Autowired
private ZhongcheApi zhongcheApi;
/** /**
* 扫码 * 扫码
*/ */
...@@ -143,6 +148,23 @@ public class NLPShelfHandler extends BaseDeviceHandler { ...@@ -143,6 +148,23 @@ public class NLPShelfHandler extends BaseDeviceHandler {
} }
} }
/*try {
MaterialCountResult count = zhongcheApi.materialCount(barcode.getBarcode(), barcode.getFullCode());
String materialType = count.getMaterialType();
if (!"NOT_COUNT_IN".equals(materialType)) {
return ResultBean.newErrorResult(-1, "", "");
}
int qty = count.getQty();
barcode.setCountType(count.getMaterialType());
if (qty != 0) {
barcode.setAmount(qty);
barcodeManager.save(barcode);
}
} catch (ValidateException e) {
return ResultBean.newErrorResult(-1, e.getMsgKey(), e.getDefaultMsg(), e.getMsgParam());
}*/
String pn = barcode.getPartNumber(); String pn = barcode.getPartNumber();
String reelId = barcode.getBarcode(); String reelId = barcode.getBarcode();
String num = barcode.getAmount() + ""; String num = barcode.getAmount() + "";
......
...@@ -863,6 +863,12 @@ public class LiteOrderCache { ...@@ -863,6 +863,12 @@ public class LiteOrderCache {
return ResultBean.newErrorResult(-1, "smfcore.order.out.notFound", "未找到工单"); return ResultBean.newErrorResult(-1, "smfcore.order.out.notFound", "未找到工单");
} }
} }
if (!cacheOrder.isTaskFinished() && !cacheOrder.isNew()) {
log.info("工单[" + orderNo + "]正在执行");
return ResultBean.newErrorResult(-1, "smfcore.order.out.executing", "工单正在执行");
}
if(cacheOrder.isClosed()){ if(cacheOrder.isClosed()){
return ResultBean.newErrorResult(-1, "smfcore.order.hasClose", "工单已关闭"); return ResultBean.newErrorResult(-1, "smfcore.order.hasClose", "工单已关闭");
} }
......
...@@ -2,13 +2,17 @@ package com.neotel.smfcore.core.order.service.po; ...@@ -2,13 +2,17 @@ package com.neotel.smfcore.core.order.service.po;
import com.neotel.smfcore.common.base.BasePo; import com.neotel.smfcore.common.base.BasePo;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.system.service.po.DataLog;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed; import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Data @Data
...@@ -100,6 +104,8 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li ...@@ -100,6 +104,8 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li
private String orderType = ""; private String orderType = "";
private List<DataLog> outTaskList;
/** /**
* 自定义的附加字段,key=字段名,value=值 * 自定义的附加字段,key=字段名,value=值
*/ */
...@@ -145,4 +151,14 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li ...@@ -145,4 +151,14 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li
this.barcodeStr = barcodeStr + " (" + amount+")"; this.barcodeStr = barcodeStr + " (" + amount+")";
} }
} }
public void setOutTaskList(DataLog dataLog) {
if (this.outTaskList == null){
this.outTaskList = new ArrayList<>();
}
DataLog newTask = new DataLog();
newTask.setBarcode(dataLog.getBarcode());
newTask.setPosName(dataLog.getPosName());
this.outTaskList.add(newTask);
}
} }
package com.neotel.smfcore.custom.zhongche1568; package com.neotel.smfcore.custom.zhongche1568;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.neotel.smfcore.common.exception.ApiException; import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.HttpHelper; import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.listener.BaseSmfApiListener; import com.neotel.smfcore.core.api.listener.BaseSmfApiListener;
import com.neotel.smfcore.core.order.service.po.LiteOrder; import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.zhongche1568.bean.api.MaterialCountResult; import com.neotel.smfcore.custom.zhongche1568.bean.api.MaterialCountResult;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfInfo; import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfInfo;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfLocInfo; import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfLocInfo;
import com.neotel.smfcore.custom.zhongche1568.enums.ZhongCheOrderType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -62,6 +65,14 @@ public class ZhongcheApi extends BaseSmfApiListener { ...@@ -62,6 +65,14 @@ public class ZhongcheApi extends BaseSmfApiListener {
} }
public MaterialCountResult materialCount(String reelId, String fullCode) { public MaterialCountResult materialCount(String reelId, String fullCode) {
if (StringUtils.isEmpty(materialCountUrl)){
MaterialCountResult reuslt = new MaterialCountResult();
reuslt.setMaterialType("COUNT_IN");
reuslt.setReelId(reelId);
reuslt.setQty(1);
return reuslt;
}
log.info("判断是否点料,reelId为:" + reelId + ",fullCode为:" + fullCode + ",地址为:" + materialCountUrl); log.info("判断是否点料,reelId为:" + reelId + ",fullCode为:" + fullCode + ",地址为:" + materialCountUrl);
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("reelId", reelId); paramMap.put("reelId", reelId);
...@@ -82,6 +93,9 @@ public class ZhongcheApi extends BaseSmfApiListener { ...@@ -82,6 +93,9 @@ public class ZhongcheApi extends BaseSmfApiListener {
public void postCountData(String reelId, int countQty) { public void postCountData(String reelId, int countQty) {
if (StringUtils.isEmpty(postCountDataUrl)){
return;
}
log.info("判断是否点料,reelId为:" + reelId + ",数量为:" + countQty + ",地址为:" + postCountDataUrl); log.info("判断是否点料,reelId为:" + reelId + ",数量为:" + countQty + ",地址为:" + postCountDataUrl);
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("reelId", reelId); paramMap.put("reelId", reelId);
...@@ -118,7 +132,9 @@ public class ZhongcheApi extends BaseSmfApiListener { ...@@ -118,7 +132,9 @@ public class ZhongcheApi extends BaseSmfApiListener {
} }
paramMap.put("outItems", itemList); paramMap.put("outItems", itemList);
try { try {
log.info("S0005出到货架上,通知wms请求参数为:" + JSON.toJSONString(paramMap));
String result = HttpHelper.postJson(shelfFullNotificationUrl, paramMap); String result = HttpHelper.postJson(shelfFullNotificationUrl, paramMap);
log.info("S0005出到货架上,通知wms返回结果为:" + result);
JSONObject resultObj = JSONObject.parseObject(result); JSONObject resultObj = JSONObject.parseObject(result);
Integer code = resultObj.getInteger("code"); Integer code = resultObj.getInteger("code");
if (code != 0) { if (code != 0) {
...@@ -130,4 +146,22 @@ public class ZhongcheApi extends BaseSmfApiListener { ...@@ -130,4 +146,22 @@ public class ZhongcheApi extends BaseSmfApiListener {
} }
} }
@Override
public void onOrderStatusChange(String orderNotifyUrl, LiteOrder liteOrder) {
/*if (liteOrder.isClosed() || liteOrder.isTaskFinished()) {
if (ZhongCheOrderType.FIRST.equals(liteOrder.getType())) {
ShelfInfo shelfInfo = new ShelfInfo();
shelfInfo.setOrderNo(liteOrder.getOrderNo());
shelfInfo.setShelfNo("Box");
shelfInfo.setLine(liteOrder.getLine());
shelfInfo.setSo(liteOrder.getSo());
List<>
this.shelfFullNotification(, true);
}
}*/
}
} }
...@@ -13,4 +13,6 @@ public class MaterialCountResult { ...@@ -13,4 +13,6 @@ public class MaterialCountResult {
private String materialType; private String materialType;
private String reelId; private String reelId;
private int qty;
} }
...@@ -43,8 +43,19 @@ public class ZhongCheController { ...@@ -43,8 +43,19 @@ public class ZhongCheController {
if (!ZhongCheOrderType.FIRST.equals(type) && !ZhongCheOrderType.REMAINING.equals(type)) { if (!ZhongCheOrderType.FIRST.equals(type) && !ZhongCheOrderType.REMAINING.equals(type)) {
return ResultBean.newErrorResult(-1, "smfcore.valueInvalid", "[{0}]不是有效的参数", new String[]{"type"}); return ResultBean.newErrorResult(-1, "smfcore.valueInvalid", "[{0}]不是有效的参数", new String[]{"type"});
} }
String line = request.getLine();
if (StringUtils.isEmpty(line)){
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"line"});
}
//判断工单号是否存在 //判断工单号是否存在
String hSerial = request.getHSerial(); String hSerial = request.getHSerial();
if (StringUtils.isEmpty(hSerial)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"hSerial"});
}
String so = request.getSo();
if (StringUtils.isEmpty(so)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"so"});
}
LiteOrder liteOrder = liteOrderManager.findOneByOrderNo(hSerial); LiteOrder liteOrder = liteOrderManager.findOneByOrderNo(hSerial);
if (liteOrder != null) { if (liteOrder != null) {
return ResultBean.newErrorResult(-1, "smfcore.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"hSerial", hSerial}); return ResultBean.newErrorResult(-1, "smfcore.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"hSerial", hSerial});
......
...@@ -82,13 +82,28 @@ public class ZhongCheDeviceController { ...@@ -82,13 +82,28 @@ public class ZhongCheDeviceController {
@AnonymousAccess @AnonymousAccess
public ResultBean materialCount(@RequestBody Map<String, String> paramMap) { public ResultBean materialCount(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("code"); String code = paramMap.get("code");
log.info("收到物料点料信息:" + code); String fullCode = paramMap.get("fullCode");
log.info("收到物料点料信息:" + code + ",完整条码信息为:" + fullCode);
Barcode barcode = codeResolve.resolveOneValideBarcode(code); Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode == null) { if (barcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{code}); return ResultBean.newErrorResult(-1, "smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{code});
} }
//判断有没有存在库位中
String posName = barcode.getPosName();
if (StringUtils.isNotEmpty(posName)) {
return ResultBean.newErrorResult(-1, "smfcore.materialBox.inPos", "物料已在库位{0}中", new String[]{posName});
}
log.info(code + "重新设置物料的完整条码信息:" + fullCode);
barcode.setFullCode(fullCode);
barcodeManager.save(barcode);
try { try {
MaterialCountResult count = zhongcheApi.materialCount(barcode.getBarcode(), barcode.getFullCode()); MaterialCountResult count = zhongcheApi.materialCount(barcode.getBarcode(), barcode.getFullCode());
int qty = count.getQty();
barcode.setCountType(count.getMaterialType());
if (qty != 0) {
barcode.setAmount(qty);
barcodeManager.save(barcode);
}
return ResultBean.newOkResult(count); return ResultBean.newOkResult(count);
} catch (ValidateException e) { } catch (ValidateException e) {
return ResultBean.newErrorResult(-1, e.getMsgKey(), e.getDefaultMsg(), e.getMsgParam()); return ResultBean.newErrorResult(-1, e.getMsgKey(), e.getDefaultMsg(), e.getMsgParam());
...@@ -110,23 +125,19 @@ public class ZhongCheDeviceController { ...@@ -110,23 +125,19 @@ public class ZhongCheDeviceController {
if (barcode == null) { if (barcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{code}); return ResultBean.newErrorResult(-1, "smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{code});
} }
String posName = barcode.getPosName();
if (StringUtils.isNotEmpty(posName)) {
return ResultBean.newErrorResult(-1, "smfcore.materialBox.inPos", "物料已在库位{0}中", new String[]{posName});
}
int countQty = Integer.parseInt(countQtyStr); int countQty = Integer.parseInt(countQtyStr);
try { try {
zhongcheApi.postCountData(barcode.getBarcode(), countQty); zhongcheApi.postCountData(barcode.getBarcode(), countQty);
} catch (ValidateException e) { } catch (ValidateException e) {
return ResultBean.newErrorResult(-1, e.getMsgKey(), e.getDefaultMsg(), e.getMsgParam()); return ResultBean.newErrorResult(-1, e.getMsgKey(), e.getDefaultMsg(), e.getMsgParam());
} }
//同时更新库位的信息
StoragePos pos = storagePosManager.getByBarcode(barcode.getBarcode());
if (pos != null) {
barcode = pos.getBarcode();
}
barcode.setAmount(countQty); barcode.setAmount(countQty);
barcodeManager.saveBarcode(barcode); barcodeManager.save(barcode);
if (pos != null) {
pos.setBarcode(barcode);
storagePosManager.save(pos);
}
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
...@@ -472,6 +483,25 @@ public class ZhongCheDeviceController { ...@@ -472,6 +483,25 @@ public class ZhongCheDeviceController {
} }
} }
if (opTask == null) { if (opTask == null) {
//如果没找到对应的任务,判断是否在库位中
StoragePos pos = storagePosManager.getByBarcode(barcode.getBarcode());
if (pos != null) {
Barcode posBarcode = pos.getBarcode();
if (posBarcode != null) {
log.info(barcode.getBarcode()+"存在库位中,实际在流水线上,库位:"+pos.getPosName()+"清空,变成可用");
pos.setBarcode(null);
pos.setUsed(false);
pos.setEnabled(true);
storagePosManager.save(pos);
//二维码状态
barcode.setUsed(true);
barcode.setUsedDate(new Date());
//仓位状态
barcode.setCheckOutDate(new Date(), "");
barcode.setPosName("");
barcodeManager.save(barcode);
}
}
return ResultBean.newErrorResult(303, "smfcore.task.notExist", "任务不存在"); return ResultBean.newErrorResult(303, "smfcore.task.notExist", "任务不存在");
} }
if (opTask.isFinished()) { if (opTask.isFinished()) {
...@@ -492,6 +522,28 @@ public class ZhongCheDeviceController { ...@@ -492,6 +522,28 @@ public class ZhongCheDeviceController {
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
@ApiOperation("根据物料条码获取厚度")
@RequestMapping("/zhongChe/getHeightByBarcode")
@AnonymousAccess
public ResultBean getHeightByBarcode(HttpServletRequest request) {
int height = 12;
try {
String code = request.getParameter("barcode");
if (StringUtils.isNotEmpty(code)){
Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode != null) {
height = barcode.getHeight();
if (barcode.getPlateSize() == 7){
height = height / 2;
}
}
}
} catch (ValidateException e) {
e.printStackTrace();
}
return ResultBean.newOkResult(height);
}
/** /**
* 物料取出 * 物料取出
*/ */
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!