Commit 73d5141b LN

转储入库功能

1 个父辈 1af098dd
...@@ -8,6 +8,8 @@ import com.neotel.smfcore.core.message.service.manager.IMessageManager; ...@@ -8,6 +8,8 @@ import com.neotel.smfcore.core.message.service.manager.IMessageManager;
import com.neotel.smfcore.core.message.service.po.Message; import com.neotel.smfcore.core.message.service.po.Message;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil; import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.order.util.OrderFileWatch; import com.neotel.smfcore.core.order.util.OrderFileWatch;
import com.neotel.smfcore.hikvision.bean.api.ResponseParam;
import com.neotel.smfcore.hikvision.util.JsonUtil;
import com.neotel.smfcore.security.service.manager.IMenuManager; import com.neotel.smfcore.security.service.manager.IMenuManager;
import com.neotel.smfcore.security.service.manager.IRoleManager; import com.neotel.smfcore.security.service.manager.IRoleManager;
import com.neotel.smfcore.security.service.manager.IUserManager; import com.neotel.smfcore.security.service.manager.IUserManager;
......
...@@ -15,6 +15,7 @@ import com.neotel.smfcore.core.device.enums.OP; ...@@ -15,6 +15,7 @@ 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.hik.bean.ShelfPosInfo; import com.neotel.smfcore.core.hik.bean.ShelfPosInfo;
import com.neotel.smfcore.core.inList.util.InListCache;
import com.neotel.smfcore.core.kanban.rest.bean.dto.BoxStatusDto; import com.neotel.smfcore.core.kanban.rest.bean.dto.BoxStatusDto;
import com.neotel.smfcore.core.kanban.rest.bean.dto.GroupStatusDto; import com.neotel.smfcore.core.kanban.rest.bean.dto.GroupStatusDto;
import com.neotel.smfcore.core.storage.bean.UsageItem; import com.neotel.smfcore.core.storage.bean.UsageItem;
...@@ -66,6 +67,8 @@ public class SingleInController { ...@@ -66,6 +67,8 @@ public class SingleInController {
@Autowired @Autowired
private final IUserManager userManager; private final IUserManager userManager;
@Autowired
private InListCache inListCache;
@ApiOperation("输入二维码后根据尺寸获取料架列表") @ApiOperation("输入二维码后根据尺寸获取料架列表")
...@@ -153,12 +156,16 @@ public class SingleInController { ...@@ -153,12 +156,16 @@ public class SingleInController {
@PostMapping("/codeIn") @PostMapping("/codeIn")
public ResultBean codeIn( @RequestBody Map<String, String> mapValues,HttpServletRequest request) { public ResultBean codeIn( @RequestBody Map<String, String> mapValues,HttpServletRequest request) {
//参数:code:条形码,storageId:料架ID,inType:入库类型(1=普通入库,2=并盘入库,3=截料入库,4=退料入库) //参数:code:条形码,
// storageId:料架ID,
// inType:入库类型(1=普通入库,2=并盘入库,3=截料入库,4=退料入库,5=转储入库)
//docName: 单据号(只有转储入库时才需要)
String token = tokenProvider.getToken(request); String token = tokenProvider.getToken(request);
String code = mapValues.get("code"); String code = mapValues.get("code");
String storageId = mapValues.get("storageId"); String storageId = mapValues.get("storageId");
Integer inType = Integer.parseInt(mapValues.get("inType"));//1=普通入库,2=并盘入库,3=截料入库,4=退料入库 Integer inType = Integer.parseInt(mapValues.get("inType"));//1=普通入库,2=并盘入库,3=截料入库,4=退料入库,5=转储入库
String docName=mapValues.get("docName");//5 单据号
if (ObjectUtils.isEmpty(code)) { if (ObjectUtils.isEmpty(code)) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
} }
...@@ -167,6 +174,7 @@ public class SingleInController { ...@@ -167,6 +174,7 @@ public class SingleInController {
return ResultBean.newErrorResult(-1, "smfcore.shelfNotExist", "{0}对应的料架不存在", new String[]{storageId}); return ResultBean.newErrorResult(-1, "smfcore.shelfNotExist", "{0}对应的料架不存在", new String[]{storageId});
} }
// WebSocketServer.sendMsg("", new SocketMsg("{0}未找到库位:{1}"+code, MsgType.INFO,"smfclient.nlp.cannotFindPos",new String[]{"消息测试","库位号"})); // WebSocketServer.sendMsg("", new SocketMsg("{0}未找到库位:{1}"+code, MsgType.INFO,"smfclient.nlp.cannotFindPos",new String[]{"消息测试","库位号"}));
String loginUser = SecurityUtils.getLoginUsername(); String loginUser = SecurityUtils.getLoginUsername();
Collection<DataLog> queueTasks = taskService.getQueueTasks(); Collection<DataLog> queueTasks = taskService.getQueueTasks();
...@@ -182,6 +190,31 @@ public class SingleInController { ...@@ -182,6 +190,31 @@ public class SingleInController {
Barcode barcode = resolveBarcode(code); Barcode barcode = resolveBarcode(code);
//判断料架是否有空位
for (UsageItem item :
storage.getUsageMap().values()) {
if (item.getH() == barcode.getHeight() && item.getW() == barcode.getPlateSize()) {
int emptyCount = item.getTotalCount() - item.getUsedCount();
if(emptyCount<=0){
log.info("codeIn [" + code + "][" + storageId + "]入库失败:"+barcode.getPlateSize()+"X"+barcode.getHeight()+"未找到可用库位 ");
throw new ValidateException("smfcore.noValidPos", "未找到可用仓位");
}
}
}
//存储入库需要先验证入库单
if(inType.equals(5)) {
if(ObjectUtil.isEmpty(docName)){
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"docName"});
}
//入库单验证
resultBean = inListCache.inListValidate(docName, barcode.getPartNumber());
if (!resultBean.isOkResult()) {
return resultBean;
}
}
//判断如果是退料入库,需要获取数量 //判断如果是退料入库,需要获取数量
if (inType.equals(4)) { if (inType.equals(4)) {
int num = HikApi.returnMaterialApi(SecurityUtils.getCurrentUsername(), barcode.getBarcode()); int num = HikApi.returnMaterialApi(SecurityUtils.getCurrentUsername(), barcode.getBarcode());
...@@ -199,9 +232,12 @@ public class SingleInController { ...@@ -199,9 +232,12 @@ public class SingleInController {
if (ObjectUtil.isNotEmpty(param)) { if (ObjectUtil.isNotEmpty(param)) {
if (param.getCode().equals(HikApi.CODE_OK)) { if (param.getCode().equals(HikApi.CODE_OK)) {
//唯一码验证成功 //唯一码验证成功
log.info("唯一码[" + barcode.getBarcode() + "]验证成功");
} else { } else {
log.info("唯一码[" + barcode.getBarcode() + "]验证失败:" + param.getCode() + "=" + param.getMessage());
throw new ValidateException("smfcore.riCheckApi.error", "唯一码[" + barcode.getBarcode() + "]验证失败:" + param.getCode() + "=" + param.getMessage() + "" throw new ValidateException("smfcore.riCheckApi.error", "唯一码[" + barcode.getBarcode() + "]验证失败:" + param.getCode() + "=" + param.getMessage() + ""
, new String[]{param.getCode(), param.getMessage()}); , new String[]{param.getCode().toString(), param.getMessage()});
} }
} }
} }
...@@ -219,6 +255,9 @@ public class SingleInController { ...@@ -219,6 +255,9 @@ public class SingleInController {
dataLog.setPartNumber(pn); dataLog.setPartNumber(pn);
dataLog.setType(OP.PUT_IN); dataLog.setType(OP.PUT_IN);
dataLog.setInType(inType); dataLog.setInType(inType);
if(inType.equals(5)){
dataLog.setSourceName(docName);
}
barcode.setPutInTime(System.currentTimeMillis()); barcode.setPutInTime(System.currentTimeMillis());
barcode.updateSluggishTime(dataCache.getPNsluggishDay(barcode.getPartNumber())); barcode.updateSluggishTime(dataCache.getPNsluggishDay(barcode.getPartNumber()));
......
...@@ -9,6 +9,7 @@ import com.neotel.smfcore.common.csv.CsvReader; ...@@ -9,6 +9,7 @@ import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.inList.enums.INLIST_STATUS; import com.neotel.smfcore.core.inList.enums.INLIST_STATUS;
import com.neotel.smfcore.core.inList.rest.bean.dto.InListDto; import com.neotel.smfcore.core.inList.rest.bean.dto.InListDto;
...@@ -25,6 +26,8 @@ import com.neotel.smfcore.core.storage.enums.DeviceType; ...@@ -25,6 +26,8 @@ import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.manager.IStorageManager; import com.neotel.smfcore.core.storage.service.manager.IStorageManager;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.bean.OrderSetting; import com.neotel.smfcore.core.system.bean.OrderSetting;
import com.neotel.smfcore.hikvision.HikApi;
import com.neotel.smfcore.hikvision.bean.TransferOrderInfo;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.bean.FileProperties; import com.neotel.smfcore.security.bean.FileProperties;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -99,7 +102,7 @@ public class InListController { ...@@ -99,7 +102,7 @@ public class InListController {
if (inListItems.size() <= 0) { if (inListItems.size() <= 0) {
continue; continue;
} }
InList inList = new InList(name, INLIST_STATUS.WAIT, inListItems); InList inList = new InList(name, INLIST_STATUS.WAIT,-1, inListItems);
InList dbList = inListManager.findByName(name); InList dbList = inListManager.findByName(name);
if (dbList != null) { if (dbList != null) {
...@@ -236,6 +239,44 @@ public class InListController { ...@@ -236,6 +239,44 @@ public class InListController {
downloadInListModel(response); downloadInListModel(response);
} }
@ApiOperation("获取转储单接口")
@PostMapping(value = "/updateInList")
@PreAuthorize("@el.check('inList')")
public ResultBean updateInList(@RequestBody Map<String,String> params ) {
String name = params.get("docName");
Integer type = Convert.toInt(params.get("docType"));
//先从已存在的入库单查询是否存在
InList inList = inListCache.getInList(name);
if (inList == null) {
//从接口获取入库单
List<TransferOrderInfo> inOrderLists = HikApi.transferOrderApi(SecurityUtils.getCurrentUsername(), name, type.toString());
if (inOrderLists == null || inOrderLists.size() <= 0) {
return ResultBean.newErrorResult(1, "smfcore.inlist.notFound", "未找到单据号[{0}]", new String[]{name});
}
//新建入库单
List<InListItem> inListItems = new ArrayList<>();
for (TransferOrderInfo obj :
inOrderLists) {
InListItem item = obj.creatInListItem();
item.setName(name);
inListItems.add(item);
}
inList = new InList(name, INLIST_STATUS.WAIT, type, inListItems);
log.info("获取到转储单,新增加入库单:" + inList.getName() + ",共" + inListItems.size() + "条工单详情");
inList = inListManager.createWithItems(inList);
inListCache.addInListToMap(inList);
return ResultBean.newOkResult(name);
} else {
//入库单已存在,直接返回OK
return ResultBean.newOkResult(name);
}
}
public void downloadInListModel( HttpServletResponse response) throws IOException { public void downloadInListModel( HttpServletResponse response) throws IOException {
try { try {
List<Map<String, Object>> maps = new ArrayList<>(); List<Map<String, Object>> maps = new ArrayList<>();
...@@ -281,7 +322,7 @@ public class InListController { ...@@ -281,7 +322,7 @@ public class InListController {
String pn = lineValues[pnIndex]; String pn = lineValues[pnIndex];
Integer num= Convert.toInt(lineValues[numIndex]); Integer num= Convert.toInt(lineValues[numIndex]);
if(ObjectUtil.isNotEmpty(pn)&&num>0){ if(ObjectUtil.isNotEmpty(pn)&&num>0){
items.add(new InListItem("",pn, num, 0, 0, Lists.newArrayList() )); items.add(new InListItem("",pn, num ));
} }
}catch (Exception ex){ }catch (Exception ex){
......
...@@ -24,6 +24,11 @@ public class InList extends BasePo implements Serializable { ...@@ -24,6 +24,11 @@ public class InList extends BasePo implements Serializable {
*/ */
private int status= INLIST_STATUS.WAIT; private int status= INLIST_STATUS.WAIT;
/**
* 单据类型(0物料凭证,1交货单,2预留单、3AGV任务单)
*/
private Integer docType=-1;
private List<InListItem> inListItems; private List<InListItem> inListItems;
} }
...@@ -15,15 +15,42 @@ import java.util.List; ...@@ -15,15 +15,42 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class InListItem extends BasePo implements Serializable { public class InListItem extends BasePo implements Serializable {
public InListItem (String name,String pn,Integer num){
this.name=name;
this.materialNo=pn;
this.dumpQty=num;
this.num=num;
}
/** /**
* 入库单名称 * 入库单名称
*/ */
private String name; private String name;
/** /**
* 物料编号 * 转出库位
*/
private String outLgort="";
/**
* 转入库位
*/
private String inLgort="";
/**
* 物料号
*/
private String materialNo;
/**
*基地编号
*/
private String baseCode="";
/**
*转出数量
*/ */
private String PN; private Integer dumpQty;
//
// /**
// * 物料编号
// */
// private String PN;
/** /**
* 目标入库数量 * 目标入库数量
...@@ -32,12 +59,12 @@ public class InListItem extends BasePo implements Serializable { ...@@ -32,12 +59,12 @@ public class InListItem extends BasePo implements Serializable {
/** /**
* 已入库数量 * 已入库数量
*/ */
private Integer inNum; private Integer inNum=0;
/** /**
* 已入库盘数 * 已入库盘数
*/ */
private Integer inReelCount; private Integer inReelCount=0;
/** /**
* 入库详情 * 入库详情
......
...@@ -71,9 +71,10 @@ public class InListCache { ...@@ -71,9 +71,10 @@ public class InListCache {
return inList; return inList;
} }
public void UpdateInList(String inListName, StoragePos pos, Barcode barcode) { public InListItem UpdateInList(String inListName, StoragePos pos, Barcode barcode) {
InListItem returnItem = null;
if (ObjectUtil.isEmpty(inListName)) { if (ObjectUtil.isEmpty(inListName)) {
return; return returnItem;
} }
InList inList = getInList(inListName); InList inList = getInList(inListName);
if (inList == null) { if (inList == null) {
...@@ -87,12 +88,13 @@ public class InListCache { ...@@ -87,12 +88,13 @@ public class InListCache {
for (InListItem item : inList.getInListItems() for (InListItem item : inList.getInListItems()
) { ) {
if (item.getPN().equals(barcode.getPartNumber())) { if (item.getMaterialNo().equals(barcode.getPartNumber())) {
updateOk = true; updateOk = true;
item.addReelInfo(new ItemReelInfo(barcode.getBarcode(), barcode.getAmount(), new Date(), pos.getPosName())); item.addReelInfo(new ItemReelInfo(barcode.getBarcode(), barcode.getAmount(), new Date(), pos.getPosName()));
listItemManager.save(item); listItemManager.save(item);
log.info("UpdateInList 成功: 入库单[" + inListName + "]posName[" + pos.getPosName() + "]PN[" + barcode.getPartNumber() + "]RI[" + barcode.getBarcode() + "]num[" + barcode.getAmount() + "]"); log.info("UpdateInList 成功: 入库单[" + inListName + "]posName[" + pos.getPosName() + "]PN[" + barcode.getPartNumber() + "]RI[" + barcode.getBarcode() + "]num[" + barcode.getAmount() + "]");
updateOk = true; updateOk = true;
returnItem = item;
break; break;
} }
} }
...@@ -115,7 +117,7 @@ public class InListCache { ...@@ -115,7 +117,7 @@ public class InListCache {
} }
listManager.save(inList); listManager.save(inList);
addInListToMap(inList); addInListToMap(inList);
return returnItem;
} }
...@@ -133,7 +135,7 @@ public class InListCache { ...@@ -133,7 +135,7 @@ public class InListCache {
for (InListItem item : inList.getInListItems() for (InListItem item : inList.getInListItems()
) { ) {
if (item.getPN().equals(pn) ) { if (item.getMaterialNo().equals(pn) ) {
if( item.getNum() > item.getInNum()){ if( item.getNum() > item.getInNum()){
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
......
...@@ -42,5 +42,5 @@ public class TransferOrderInInfo { ...@@ -42,5 +42,5 @@ public class TransferOrderInInfo {
/** /**
* 数量 * 数量
*/ */
private String qty; private Integer qty;
} }
package com.neotel.smfcore.hikvision.bean; package com.neotel.smfcore.hikvision.bean;
import com.neotel.smfcore.core.inList.service.po.InListItem;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.ArrayList;
/** /**
* 转储单 ,7.1 转储单接口 * 转储单 ,7.1 转储单接口
*/ */
...@@ -46,5 +49,12 @@ public class TransferOrderInfo { ...@@ -46,5 +49,12 @@ public class TransferOrderInfo {
/** /**
*转出数量 *转出数量
*/ */
private String dumpQty; private Integer dumpQty;
public InListItem creatInListItem(){
InListItem inListItem=new InListItem(docNo,outLgort,inLgort,materialNo,baseCode,dumpQty,dumpQty,0,0,new ArrayList<>());
return inListItem;
}
} }
...@@ -21,7 +21,7 @@ public class ResponseParam implements Serializable { ...@@ -21,7 +21,7 @@ public class ResponseParam implements Serializable {
/** /**
* code 是 String 结果码:0-成功,1~N-失败 * code 是 String 结果码:0-成功,1~N-失败
*/ */
private String code="-1"; private Integer code=-1;
/** /**
* message 是 String 0:成功 1~N:失败原因 * message 是 String 0:成功 1~N:失败原因
......
...@@ -252,6 +252,8 @@ smfcore.safetyInventory.supplementReel=\u8865\u5145\u76D8\u6570 ...@@ -252,6 +252,8 @@ smfcore.safetyInventory.supplementReel=\u8865\u5145\u76D8\u6570
smfcore.safetyInventory.amount=\u6700\u5C0F\u5305\u88C5 smfcore.safetyInventory.amount=\u6700\u5C0F\u5305\u88C5
smfcore.component.storeError=\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5E93\u5B58\uFF0C\u6700\u5C0F\u5E93\u5B58<=\u5B89\u5168\u5E93\u5B58<=\u6700\u5927\u5E93\u5B58 smfcore.component.storeError=\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5E93\u5B58\uFF0C\u6700\u5C0F\u5E93\u5B58<=\u5B89\u5168\u5E93\u5B58<=\u6700\u5927\u5E93\u5B58
smfcore.user.group.error=\u7EC4[{0}]\u5DF2\u7ECF\u5206\u914D\u7ED9\u64CD\u4F5C\u5458[{1}] smfcore.user.group.error=\u7EC4[{0}]\u5DF2\u7ECF\u5206\u914D\u7ED9\u64CD\u4F5C\u5458[{1}]
smfcore.noValidPos=\u672A\u627E\u5230\u5355\u636E\u53F7
#smfcore.order.out.short=\u5DE5\u5355\u51FA\u5E93\u5931\u8D25\uFF0C\u5DE5\u5355\u7F3A\u6599 #smfcore.order.out.short=\u5DE5\u5355\u51FA\u5E93\u5931\u8D25\uFF0C\u5DE5\u5355\u7F3A\u6599
#smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0} #smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!