Commit 353f6454 zshaohui

1.人工GR入库,卡控13/15寸料箱信息

2.提供接口给出库流水线,定时更新空箱/满箱数量
1 个父辈 22b0cedc
...@@ -13,6 +13,11 @@ import com.neotel.smfcore.core.barcode.utils.CodeResolve; ...@@ -13,6 +13,11 @@ import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.message.enums.MessageType;
import com.neotel.smfcore.core.message.service.manager.IMessageManager;
import com.neotel.smfcore.core.message.service.po.Message;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.order.LiteOrderCache; import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager; import com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager; import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager;
...@@ -22,6 +27,7 @@ import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; ...@@ -22,6 +27,7 @@ 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.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog; 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.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil; import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil;
import com.neotel.smfcore.custom.luxsan.api.LuxsanApi; import com.neotel.smfcore.custom.luxsan.api.LuxsanApi;
...@@ -97,6 +103,9 @@ public class CDeviceController { ...@@ -97,6 +103,9 @@ public class CDeviceController {
@Autowired @Autowired
private KafkaService kafkaService; private KafkaService kafkaService;
@Autowired
private IMessageManager messageManager;
@ApiOperation("获取料盘尺寸信息") @ApiOperation("获取料盘尺寸信息")
@RequestMapping("/partNumberComponent") @RequestMapping("/partNumberComponent")
...@@ -1119,6 +1128,275 @@ public class CDeviceController { ...@@ -1119,6 +1128,275 @@ public class CDeviceController {
} }
@ApiOperation("获取当前要出的物料信息")
@RequestMapping("/currentReelSize")
@AnonymousAccess
public ResultBean currentReelSize(@RequestParam(value = "boxStr", required = false) String boxStr,
@RequestParam(value = "isNormal", required = false) Boolean isNormal,
@RequestParam(value = "materialStr", required = false) String materialStr,
@RequestParam(value = "currentLoc", required = false) String currentLoc) {
//解析料箱信息
String box = BoxHandleUtil.getBoxStr(boxStr, true);
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(box);
StoragePos inPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (inPos != null) {
boxBarcode = inPos.getBarcode();
}
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
//2.获取要出库的code
int seq = BoxHandleUtil.getSeq(boxBarcode, boxStr);
Barcode barcode = null;
if (subCodeList != null && !subCodeList.isEmpty()) {
for (Barcode subCode : subCodeList) {
if (seq == subCode.getSeq() && boxStr.equals(subCode.getPosName())) {
barcode = subCode;
break;
}
}
}
//3.判断barcode是否为空
if (barcode == null) {
return ResultBean.newErrorResult(-1, "", "未找到可以出库的物料");
}
Map<String, String> resultMap = new HashMap<>();
resultMap.put("binCode", boxStr);
resultMap.put("seq", seq + "");
resultMap.put("barcode", barcode.getBarcode());
resultMap.put("pickingId", "");
resultMap.put("platSize", barcode.getPlateSize() + "");
resultMap.put("height", barcode.getHeight() + "");
return ResultBean.newOkResult(resultMap);
}
@ApiOperation("物料出库(新接口)")
@RequestMapping("/reelFromBox")
@AnonymousAccess
public synchronized ResultBean reelFromBox(@RequestBody Map<String, String> paramMap) {
String boxPar = paramMap.get("boxPar"); //隔口号
String code = paramMap.get("code"); //条码编号
String currentLoc = paramMap.get("currentLoc"); //当前位置
String stacker = paramMap.get("stacker");//条码编号
log.info("物料放到料串上,通知出库,隔口号为:" + boxPar + ",条码信息为:" + code + "当前位置为:" + currentLoc + "条码编号为:" + stacker);
//code为1,代表数据异常
if (StringUtils.isEmpty(boxPar)) {
saveMessage(MessageType.ERROR.name(), currentLoc, "料箱隔口号不能为空");
return ResultBean.newErrorResult(1, "", "料箱隔口号不能为空");
}
if (StringUtils.isEmpty(code)) {
saveMessage(MessageType.ERROR.name(), currentLoc, "条码信息不能为空");
return ResultBean.newErrorResult(1, "", "条码信息不能为空");
}
//code为2时,代表料箱解析错误或者barcode解析错误/未扫到条码
if ("noCode".equals(code)) {
return ResultBean.newErrorResult(2, "", "料箱隔口号:" + boxPar + "未扫到条码");
}
Barcode boxBarcode = null;
String box = BoxHandleUtil.getBoxStr(boxPar, false);
StoragePos pos = storagePosManager.getByBarcode(box);
if (pos != null) {
boxBarcode = pos.getBarcode();
} else {
boxBarcode = barcodeManager.findByBarcode(boxPar);
}
if (boxBarcode == null) {
saveMessage(MessageType.ERROR.name(), currentLoc, "料箱隔口号:" + boxPar + "对应的料箱信息不存在");
return ResultBean.newErrorResult(2, "", "料箱隔口号:" + boxPar + "对应的料箱信息不存在");
}
Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode == null) {
saveMessage(MessageType.ERROR.name(), currentLoc, "条码:" + code + "解析失败");
return ResultBean.newErrorResult(2, "", "条码:" + code + "解析失败");
}
//更新料串缓存信息
log.info("先清空:"+stacker+"位置缓存的信息");
MaterialLocUtil.updateStackerLoc(stacker,"",null);
//code为3时,代表不在此箱子中,直接出库/通知WMS失败
List<String> messageList = new ArrayList<>();
String posName = barcode.getPosName();
log.info("当前料箱是:"+boxPar+"要出库的料盘信息为:"+barcode.getBarcode()+"对应的库位为:"+posName);
if (!boxPar.equals(posName)) {
//先清空数据
if (StringUtils.isNotEmpty(posName)) {
Barcode newBoxBarcode = null;
String newBoxStr = BoxHandleUtil.getBoxStr(posName, false);
StoragePos newPos = storagePosManager.getByBarcode(newBoxStr);
if (newPos != null){
newBoxBarcode = newPos.getBarcode();
} else {
newBoxBarcode = barcodeManager.findByBarcode(newBoxStr);
}
if (newBoxBarcode != null){
newBoxBarcode.removeFromSubCodes(barcode);
barcodeManager.save(newBoxBarcode);
if (newPos != null){
newPos.setBarcode(newBoxBarcode);
storagePosManager.save(newPos);
}
}
}
messageList.add(barcode.getBarcode()+"对应的库位为:"+posName+"与当前要出库的料箱隔口号:"+boxPar+"不一致");
saveMessage(MessageType.WARNING.name(), currentLoc,barcode.getBarcode()+"对应的库位为:"+posName+"与当前要出库的料箱隔口号:"+boxPar+"不一致");
} else {
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
//找到对应的料箱隔口,判断是否有要出的物料信息
List<Barcode> barcodeList = new ArrayList<>();
for (Barcode subCode : subCodeList) {
if (boxPar.equals(subCode.getPosName())) {
barcodeList.add(subCode);
}
}
if (!barcode.isOut()) {
log.info(barcode.getBarcode() + "不是要出库的料盘,隔口号为:" + boxPar);
Barcode needOutBarcode = null;
for (Barcode subCode : barcodeList) {
if (subCode.isOut()) {
needOutBarcode = subCode;
break;
}
}
if (needOutBarcode != null) {
String orderItemId = needOutBarcode.getOrderItemId();
needOutBarcode.setOrderItemId("");
needOutBarcode.setOut(false);
log.info(needOutBarcode.getBarcode() + "需要改成不需要出库");
barcodeManager.save(needOutBarcode);
boxBarcode.updateSubCodes(needOutBarcode);
barcode.setOut(true);
barcode.setOrderItemId(orderItemId);
barcodeManager.save(barcode);
boxBarcode.updateSubCodes(barcode);
barcodeManager.save(boxBarcode);
if (pos != null){
pos.setBarcode(boxBarcode);
storagePosManager.save(pos);
}
log.info(barcode.getBarcode() + "改成要出库,orderItemId为:" + orderItemId);
}
}
}
log.info(barcode.getBarcode() + "从" + boxPar + "出库,位置为:" + currentLoc + "料串为:" + stacker);
String orderItemId = barcode.getOrderItemId();
String orderId = "";
String orderNo = "";
if (StringUtils.isNotEmpty(orderItemId)) {
int checkType = -1;
String pkItemId = "";
String face = "";
String brand = "";
String batchCode = "";
String targetLoc = "";
LiteOrderItem orderItem = liteOrderItemManager.get(orderItemId);
if(orderItem != null){
orderNo = orderItem.getOrderNo();
orderId = orderItem.getOrderId();
pkItemId = orderItem.getItemId();
face = orderItem.getFace();
brand = orderItem.getBrand();
if (!"N/A".equals(orderItem.getBatchCode())){
batchCode = orderItem.getBatchCode();
}
LiteOrder order = liteOrderManager.get(orderItem.getOrderId());
if (order != null){
targetLoc = order.getLoc();
checkType = order.getCheckType();
}
}
//同时 更新下 缓存目的地
if (StringUtils.isNotEmpty(targetLoc)){
if (targetLoc.endsWith("BG")){
log.info("自动绑定料串["+stacker+"]目的地:C2-3F-BG");
MaterialLocUtil.updateStackerLoc(stacker,"", "C2-3F-BG");
} else if (targetLoc.endsWith("CG")){
log.info("自动绑定料串["+stacker+"]目的地:C2-3F-CG");
MaterialLocUtil.updateStackerLoc(stacker,"", "C2-3F-CG");
}
}
if (checkType == LiteorderCheckType.PICKING_CHECKOUT){
try {
// LuxsanApi.pickingIssue(new PickingIssueRequest(CommonUtil.plantCode, orderNo, pkItemId, barcode.getPartNumber()
// , barcode.getWarehouseCode(), brand, face, batchCode, Arrays.asList(barcode.getBarcode())));
} catch (Exception e) {
saveMessage(MessageType.ERROR.name(),currentLoc,"通知WMS失败:"+e.getMessage()+"隔口号为"+boxPar);
log.info(barcode.getBarcode()+"通知WMS失败:"+e.getMessage()+"隔口号为"+boxPar);
}
}
} else {
//人工出库,
try {
//LuxsanApi.pickingIssue(new PickingIssueRequest(CommonUtil.plantCode, "SMFW" + System.currentTimeMillis(), "0", barcode.getPartNumber()
// , barcode.getWarehouseCode(), "", "", "", Arrays.asList(barcode.getBarcode())));
} catch (Exception e) {
saveMessage(MessageType.ERROR.name(),currentLoc,"通知WMS失败:"+e.getMessage()+"隔口号为"+boxPar);
log.info(barcode.getBarcode()+"通知WMS失败:"+e.getMessage()+"隔口号为"+boxPar);
}
}
DataLog dataLog = new DataLog(new Storage(), barcode, new StoragePos());
dataLog.setSubSourceId(orderItemId);
dataLog.setSourceId(orderId);
dataLog.setSourceName(orderNo);
dataLog.setType(OP.CHECKOUT);
dataLog.setStatus(OP_STATUS.FINISHED.name());
dataLog.setPosName(boxPar);
dataLog.setNormal(true);
dataLog.setDateCode(barcode.getDateCode());
dataLog.setBatchInfo(barcode.getBatch());
dataLog.setProvider(barcode.getProvider());
dataLog.setProviderNumber(barcode.getProviderNumber());
dataLog.setWarehouseCode(barcode.getWarehouseCode());
if (StringUtils.isNotEmpty(currentLoc)){
dataLog.setCurrentLoc(currentLoc);
}
taskService.updateFinishedTask(dataLog);
//有出库,此料格就去除满格标志
boxBarcode.updateExtraData(barcode.getPosName(),null);
boxBarcode.removeFromSubCodes(barcode);
barcodeManager.save(boxBarcode);
if(pos != null){
//为保证数据一致性, pos中的box barcode也需要更新
pos.setBarcode(boxBarcode);
storagePosManager.save(pos);
}
saveMessage(MessageType.INFO.name(), currentLoc,barcode.getBarcode()+"从料箱隔口号:"+barcode.getPosName()+"出库成功");
//清理条码档案信息
barcode.setPosName("");
barcode.setOut(false);
barcode.setOrderId("");
barcode.setOrderItemId("");
barcode.setBarSource("");
barcodeManager.save(barcode);
Map<String,String> resultMap = new HashMap<>();
resultMap.put("binCode",boxPar);
//resultMap.put("seq",seq+"");
resultMap.put("barcode",barcode.getBarcode());
resultMap.put("pickingId",orderNo);
resultMap.put("platSize",barcode.getPlateSize()+"");
resultMap.put("height",barcode.getHeight()+"");
//kafkaService.sendMachineParameterStackerAndBox(stacker,currentLoc,0,boxBarcode.getBarcode(),barcode.getAmount(),4);
return ResultBean.newOkResult(resultMap);
}
private void saveMessage(String type,String module,String message){
Message msg = Message.newMsg(type, module, "", module, "", message, new String[]{}, "");
messageManager.save(msg);
}
private void generatePutInTask(Barcode barcode, Barcode boxBarcode,String status,String currentLoc) { private void generatePutInTask(Barcode barcode, Barcode boxBarcode,String status,String currentLoc) {
DataLog dataLog = new DataLog(); DataLog dataLog = new DataLog();
......
...@@ -230,12 +230,20 @@ public class ManualGrPutInController { ...@@ -230,12 +230,20 @@ public class ManualGrPutInController {
} }
if (13 == w){ if (13 == w){
if (!binCode.startsWith("C13") && !binCode.endsWith("-01")){ if (!binCode.startsWith("C13")){
return ResultBean.newErrorResult(-1,"","13寸的物料,请放入C13的01号料格中"); return ResultBean.newErrorResult(-1,"","13寸的物料,请放入C13的01号料格中");
} else {
if (!binCode.endsWith("-01")){
return ResultBean.newErrorResult(-1,"","13寸的物料,请放入C13的01号料格中");
}
} }
} else if (15 == w){ } else if (15 == w){
if (!binCode.startsWith("C15") && !binCode.endsWith("-01")){ if (!binCode.startsWith("C15")){
return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中"); return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中");
} else {
if (!binCode.endsWith("-01")){
return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中");
}
} }
} else if (7 == w){ } else if (7 == w){
if (binCode.startsWith("C15")){ if (binCode.startsWith("C15")){
......
package com.neotel.smfcore.custom.luxsan.factory_c.third;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.custom.luxsan.factory_c.third.bean.OutLineBoxNum;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/rawOutLine")
public class RawOutLineController {
static Map<String, OutLineBoxNum> cacheBoxNumMap = Maps.newConcurrentMap();
@ApiOperation("修改出库分拣线上料箱数量")
@RequestMapping("/updateBoxNum")
@AnonymousAccess
public ResultBean updateBoxNum(@RequestBody OutLineBoxNum boxNum) {
log.info("收到出库流水线修改数量信息,编号为:"+boxNum.getLineNo()+"空箱子数量:"+boxNum.getEmptyBoxNum()+",满箱子数量:"+boxNum.getFullBoxNum());
String lineNo = boxNum.getLineNo();
if (StringUtils.isEmpty(lineNo)){
return ResultBean.newErrorResult(-1,"","线体编号不能为空");
}
cacheBoxNumMap.put(lineNo,boxNum);
return ResultBean.newOkResult("");
}
@ApiOperation("获取出库流水线的箱子数量详情")
@RequestMapping("/getLineBoxNum")
@AnonymousAccess
public ResultBean getLineBoxNum(String lineNo) {
if (StringUtils.isEmpty(lineNo)){
return ResultBean.newErrorResult(-1,"","线体编号不能为空");
}
OutLineBoxNum boxNum = cacheBoxNumMap.get(lineNo);
if (boxNum == null){
boxNum = new OutLineBoxNum(lineNo,0,0);
}
return ResultBean.newOkResult(boxNum);
}
}
package com.neotel.smfcore.custom.luxsan.factory_c.third.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class OutLineBoxNum {
//出库缓存线为outLine01到outLine06
private String lineNo;
//空箱子数量
private int emptyBoxNum;
//满箱子数量
private int fullBoxNum;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!