Commit 075d6826 张少辉

1.成品仓入库功能提交

1 个父辈 b869b98a
...@@ -268,6 +268,9 @@ public class Barcode extends BasePo implements Serializable { ...@@ -268,6 +268,9 @@ public class Barcode extends BasePo implements Serializable {
private String rowNumber; private String rowNumber;
//是否为遏制料
private boolean hold = false;
/** /**
* 自定义的附加信息 * 自定义的附加信息
*/ */
......
...@@ -183,7 +183,7 @@ public class AgvElecDeviceController { ...@@ -183,7 +183,7 @@ public class AgvElecDeviceController {
return ResultBean.newErrorResult(-1,"","未找到对应的料仓信息"); return ResultBean.newErrorResult(-1,"","未找到对应的料仓信息");
} }
if (storage.getCorrespondingWarehouse() != CORRESPONDING_WAREHOUSE.ELECTRONIC_WAREHOUSE_BOX){ if (storage.getCorrespondingWarehouse() != CORRESPONDING_WAREHOUSE.ELECTRONIC_WAREHOUSE_BOX){
return ResultBean.newErrorResult(-1, "", "请在设备管理里,配置成品仓信息"); return ResultBean.newErrorResult(-1, "", "请在设备管理里,配置电子仓CTU信息");
} }
DataLog opTask = null; DataLog opTask = null;
......
...@@ -80,7 +80,7 @@ public class ScanInBoxController { ...@@ -80,7 +80,7 @@ public class ScanInBoxController {
Barcode barcode = codeBean.getBarcode(); Barcode barcode = codeBean.getBarcode();
//此处需要判断是否是料盒 //此处需要判断是否是料盒
Component component=componentManager.findOneByPN(barcode.getPartNumber() ); Component component=componentManager.findOneByPN(barcode.getPartNumber() );
if(component==null||(component.getType()!=COMPONENT_TYPE.FIXTURE)){ if(component==null/*||(component.getType()!=COMPONENT_TYPE.FIXTURE)*/){
throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code}); throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
} }
//判断是否有任务,有任务直接完成,不清空库存信息 //判断是否有任务,有任务直接完成,不清空库存信息
......
...@@ -80,7 +80,7 @@ public class ScanOutBoxController { ...@@ -80,7 +80,7 @@ public class ScanOutBoxController {
Barcode barcode = codeBean.getBarcode(); Barcode barcode = codeBean.getBarcode();
//此处需要判断是否是料盒 //此处需要判断是否是料盒
Component component = componentManager.findOneByPN(barcode.getPartNumber()); Component component = componentManager.findOneByPN(barcode.getPartNumber());
if (component == null || (component.getType() != COMPONENT_TYPE.FIXTURE)) { if (component == null /*|| (component.getType() != COMPONENT_TYPE.FIXTURE)*/) {
throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code}); throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
} }
//判断是否有任务,有任务直接完成,不清空库存信息 //判断是否有任务,有任务直接完成,不清空库存信息
......
package com.neotel.smfcore.custom.aiqingzhiyin1643.finishedGoodsWarehouse.controller; package com.neotel.smfcore.custom.aiqingzhiyin1643.finishedGoodsWarehouse.controller;
import com.alibaba.excel.util.StringUtils;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.ReelLockPosUtil; import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.SecurityUtils; import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve; import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
...@@ -17,7 +18,8 @@ import com.neotel.smfcore.core.system.service.po.DataLog; ...@@ -17,7 +18,8 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.aiqingzhiyin1643.finishedGoodsWarehouse.bean.PutAwayLocInfo; import com.neotel.smfcore.custom.aiqingzhiyin1643.finishedGoodsWarehouse.bean.PutAwayLocInfo;
import com.neotel.smfcore.custom.aiqingzhiyin1643.finishedGoodsWarehouse.enums.PutAwayLocEnum; import com.neotel.smfcore.custom.aiqingzhiyin1643.finishedGoodsWarehouse.enums.PutAwayLocEnum;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.MomoApi;
import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.FgGetPalletInfoResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -26,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -26,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -43,12 +46,19 @@ public class PutAwayController { ...@@ -43,12 +46,19 @@ public class PutAwayController {
@Autowired @Autowired
private CodeResolve codeResolve; private CodeResolve codeResolve;
@Autowired @Autowired
private DataCache dataCache; private DataCache dataCache;
@Autowired
private MomoApi momoApi;
@Autowired
private IBarcodeManager barcodeManager;
@ApiOperation("获取入库位置及限高信息") @ApiOperation("获取入库位置及限高信息")
@RequestMapping("/getLocHeightLimitInfo") @RequestMapping("/getLocHeightLimitInfo")
@AnonymousAccess //@AnonymousAccess
public ResultBean getLocHeightLimitInfo() { public ResultBean getLocHeightLimitInfo() {
// 1. 调用枚举方法,获取封装好的「实际位置+是否限高」列表 // 1. 调用枚举方法,获取封装好的「实际位置+是否限高」列表
List<PutAwayLocInfo> locInfoList = PutAwayLocEnum.getAllLocInfo(); List<PutAwayLocInfo> locInfoList = PutAwayLocEnum.getAllLocInfo();
...@@ -58,7 +68,7 @@ public class PutAwayController { ...@@ -58,7 +68,7 @@ public class PutAwayController {
// 确保Controller类添加@Slf4j(无Lombok则替换为LoggerFactory) // 确保Controller类添加@Slf4j(无Lombok则替换为LoggerFactory)
@ApiOperation("扫描码拖条码进行入库") @ApiOperation("扫描码拖条码进行入库")
@RequestMapping("/scanDragBarcodePutaway") @RequestMapping("/scanDragBarcodePutaway")
@AnonymousAccess //@AnonymousAccess
public ResultBean scanDragBarcodePutaway(@RequestBody Map<String, String> paramMap) { public ResultBean scanDragBarcodePutaway(@RequestBody Map<String, String> paramMap) {
String barcodeStr = paramMap.get("barcode"); String barcodeStr = paramMap.get("barcode");
String actualPosition = paramMap.get("actualPosition"); String actualPosition = paramMap.get("actualPosition");
...@@ -130,6 +140,61 @@ public class PutAwayController { ...@@ -130,6 +140,61 @@ public class PutAwayController {
// 4. 核心:找到的库位信息(仅ID+名称) // 4. 核心:找到的库位信息(仅ID+名称)
log.info("找到可用库位:条码=" + barcodeStr + ",库位ID=" + pos.getId() + ",库位名称=" + pos.getPosName() + ",限高=" + heightLimited); log.info("找到可用库位:条码=" + barcodeStr + ",库位ID=" + pos.getId() + ",库位名称=" + pos.getPosName() + ",限高=" + heightLimited);
//5.获取码拖信息
FgGetPalletInfoResponse palletInfo = momoApi.getFgPalletInfo(barcode.getBarcode());
if (!palletInfo.getIsSuccess()){
return ResultBean.newErrorResult(-1,"smfcore.error.palletInfo","获取码拖信息失败",new String[]{palletInfo.getMessage()});
}
List<FgGetPalletInfoResponse.PalletProductInfo> infoList = palletInfo.getData();
if (infoList == null || infoList.isEmpty()){
return ResultBean.newErrorResult(-1,"smfcore.error.palletInfo.empty","获取到码拖数据为空");
}
//每次入库的时候,先更新一下barcode信息
barcode.setAmount(0);
List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()){
for (Barcode subCode : subCodeList) {
subCode.setPosName("");
subCode.setHostBarcodeId("");
barcodeManager.save(subCode);
}
}
barcode.setSubCodeList(new ArrayList<>());
barcode = barcodeManager.save(barcode);
//构造barcode信息
int amount = 0;
for (FgGetPalletInfoResponse.PalletProductInfo palletProductInfo : infoList) {
String container = palletProductInfo.getContainer();
String productNo = palletProductInfo.getProductNo();
String productName = palletProductInfo.getProductName();
String lotNo = palletProductInfo.getLotNo();
Integer quantity = palletProductInfo.getQuantity();
Integer hold = palletProductInfo.getHold();
Barcode subCode = barcodeManager.findByBarcode(container);
if (subCode != null){
if (StringUtils.isNotEmpty(subCode.getPosName())){
return ResultBean.newErrorResult(-1,"smfcore.error.barcode.inPos","[{0}]已在库位{1}中",new String[]{container,subCode.getPosName()});
}
} else {
subCode = new Barcode();
}
subCode.setBarcode(container);
subCode.setPartNumber(productNo);
subCode.setDescribe(productName);
subCode.setBatch(lotNo);
subCode.setAmount(quantity);
subCode.setHold(hold==1);
subCode.setPosName(barcode.getBarcode());
subCode.setHostBarcodeId(barcode.getId());
subCode = barcodeManager.save(subCode);
barcode.UpdateSubCode(subCode);
amount = amount + subCode.getAmount();
}
barcode.setAmount(amount);
barcode = barcodeManager.save(barcode);
// 生成任务 // 生成任务
DataLog dataLog = new DataLog(fgWarehouseStorage, barcode, pos); DataLog dataLog = new DataLog(fgWarehouseStorage, barcode, pos);
dataLog.setType(OP.PUT_IN); dataLog.setType(OP.PUT_IN);
......
...@@ -11,6 +11,7 @@ import com.neotel.smfcore.core.barcode.service.po.Barcode; ...@@ -11,6 +11,7 @@ import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.storage.enums.CORRESPONDING_WAREHOUSE; import com.neotel.smfcore.core.storage.enums.CORRESPONDING_WAREHOUSE;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.FgStockInRequest;
import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.GetNewContainerNoRequest; import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.GetNewContainerNoRequest;
import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.MergeContainerRequest; import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.MergeContainerRequest;
import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.SplitContainerRequest; import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.SplitContainerRequest;
...@@ -19,6 +20,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -19,6 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import springfox.documentation.spring.web.json.Json;
import java.util.*; import java.util.*;
...@@ -44,6 +46,15 @@ public class MomoApi extends BaseSmfApiListener { ...@@ -44,6 +46,15 @@ public class MomoApi extends BaseSmfApiListener {
@Value("${api.mergeContainerUrl}") @Value("${api.mergeContainerUrl}")
private String mergeContainerUrl; private String mergeContainerUrl;
//成品仓相关的接口
@Value("${api.fgGetPalletInfoUrl}")
private String fgGetPalletInfoUrl;
@Value("${api.fGStockINUrl}")
private String fGStockINUrl;
@Autowired @Autowired
private IBarcodeManager barcodeManager; private IBarcodeManager barcodeManager;
...@@ -74,6 +85,8 @@ public class MomoApi extends BaseSmfApiListener { ...@@ -74,6 +85,8 @@ public class MomoApi extends BaseSmfApiListener {
} }
} }
} }
}else if (storage.getCorrespondingWarehouse() == CORRESPONDING_WAREHOUSE.FINISHED_GOODS_WAREHOUSE) {
fgStockIn(barcode);
} }
} }
} }
...@@ -295,6 +308,73 @@ public class MomoApi extends BaseSmfApiListener { ...@@ -295,6 +308,73 @@ public class MomoApi extends BaseSmfApiListener {
} }
public FgGetPalletInfoResponse getFgPalletInfo(String inContainer) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("InContainer", inContainer);
paramMap.put("Account", "smf");
log.info("接口13:MOM获取成品仓托盘信息,请求参数为:{},地址为:{}", JSON.toJSONString(paramMap), fgGetPalletInfoUrl);
try {
String resultStr = HttpHelper.postJson(fgGetPalletInfoUrl, paramMap);
log.info("接口13:MOM获取成品仓托盘信息,返回参数为:{}", resultStr);
return JSON.parseObject(resultStr, FgGetPalletInfoResponse.class);
} catch (Exception e) {
log.error("接口13:MOM获取成品仓托盘信息,请求异常:{}", e.getMessage());
FgGetPalletInfoResponse response
= new FgGetPalletInfoResponse();
response.setIsSuccess(false);
response.setMessage(e.getMessage());
return response;
}
}
/**
* {
* "Account":"查询人,仅记录,无权限控制逻辑",
* "WarehouseLocation":”上架库位”,(可以不传,MOM使用默认值)
* "PalletInfoModels":[
* {
* "InContainer":”托盘号”,
* "Container":”箱号”,
* “ProductNo”:”产品代码”,
* “ProductName“:”产品名称”,
* “LotNo”:批次号,
* “Quantity”:”箱中产品数量”
* }
* ]
* }
* @param barcode
*/
public void fgStockIn(Barcode barcode) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("Account", "SMF");
paramMap.put("WarehouseLocation", "");
List<Map<String, Object>> palletInfoModels = new ArrayList<>();
List<Barcode> subCodeList = barcode.getSubCodeList();
for (Barcode subCode : subCodeList) {
Map<String, Object> subMap = new HashMap<>();
subMap.put("InContainer", barcode.getBarcode());
subMap.put("Container", subCode.getBarcode());
subMap.put("ProductNo", subCode.getPartNumber());
subMap.put("ProductName", subCode.getDescribe());
subMap.put("LotNo", subCode.getBatch());
subMap.put("Quantity", subCode.getAmount());
palletInfoModels.add(subMap);
}
paramMap.put("PalletInfoModels", palletInfoModels);
log.info("接口14:MOM接收WMS的成品入库请求,请求参数为:{}", JSON.toJSONString(paramMap));
try {
String resultStr = HttpHelper.postJson(fGStockINUrl, paramMap);
log.info("接口14:MOM接收WMS的成品入库请求,返回参数为:{}", resultStr);
} catch (ApiException e) {
log.error("接口14:MOM接收WMS的成品入库请求,请求异常:{}", e.getMessage());
}
}
@Override @Override
public boolean isForThisApi(String apiName) { public boolean isForThisApi(String apiName) {
return apiName != null && apiName.equalsIgnoreCase("1643"); return apiName != null && apiName.equalsIgnoreCase("1643");
......
package com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request;
import lombok.Data;
import java.util.List;
/**
* 成品入库请求入参类
* 封装入库接口的请求数据结构(移除Get/Set方法)
*/
@Data
public class FgStockInRequest {
/**
* 查询人:仅记录,无权限控制逻辑
*/
private String account;
/**
* 上架库位:可选字段,不传则MOM使用默认值
*/
private String warehouseLocation;
/**
* 托盘信息模型列表
*/
private List<PalletInfoModel> palletInfoModels;
@Data
public static class PalletInfoModel {
/**
* 托盘号
*/
private String inContainer;
/**
* 箱号
*/
private String container;
/**
* 产品代码
*/
private String productNo;
/**
* 产品名称
*/
private String productName;
/**
* 批次号
*/
private String lotNo;
/**
* 箱中产品数量
*/
private Integer quantity;
}
}
\ No newline at end of file \ No newline at end of file
package com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response;
import lombok.Data;
import java.util.List;
/**
* 托盘信息查询响应类
* 封装接口返回的完整响应数据结构(移除Get/Set方法)
*/
@Data
public class FgGetPalletInfoResponse {
/**
* 错误码(为空表示无错误)
*/
private String errorCode;
/**
* 请求是否成功(true=成功,false=失败)
*/
private Boolean isSuccess;
/**
* 响应消息(如"OK")
*/
private String message;
/**
* 响应结果码:"200"=成功,"403"=失败
*/
private String result;
/**
* 调试信息(为空表示无调试内容)
*/
private String debugInfo;
/**
* 核心数据:托盘-产品关联信息列表
*/
private List<PalletProductInfo> data;
/**
* 托盘-产品关联信息(Data列表的元素类型)
*/
@Data
public static class PalletProductInfo {
/**
* 托盘号
*/
private String inContainer;
/**
* 箱号
*/
private String container;
/**
* 产品代码
*/
private String productNo;
/**
* 产品名称
*/
private String productName;
/**
* 批次号
*/
private String lotNo;
/**
* 箱中产品数量
*/
private Integer quantity;
/**
* 遏制状态:1=在遏制中,0=未被遏制
*/
private Integer hold;
}
}
\ No newline at end of file \ No newline at end of file
...@@ -27,6 +27,12 @@ api: ...@@ -27,6 +27,12 @@ api:
#出库通知 #出库通知
stockOutUrl: http://10.42.49.150/Apriso/HttpServices/api/extensions/1/Storage/StockOut stockOutUrl: http://10.42.49.150/Apriso/HttpServices/api/extensions/1/Storage/StockOut
#成品仓相关的接口
#获取成品仓托盘信息
fgGetPalletInfoUrl: http://10.42.49.150/Apriso/HttpServices/api/extensions/1/Storage/FGGetPalletInfo
#成品仓入库
fGStockINUrl: http://10.42.49.150/Apriso/HttpServices/api/extensions/1/Storage/FGStockIN
hella: hella:
#host: 127.0.0.1 #host: 127.0.0.1
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!