Commit 8eabae17 hc

fix:手动入库,手动出库

1 个父辈 5b78e07e
...@@ -113,26 +113,32 @@ public class SpBoxCheckOutController { ...@@ -113,26 +113,32 @@ public class SpBoxCheckOutController {
return ResultBean.newErrorResult(-1, "", codeStr + "不是有效的条码"); return ResultBean.newErrorResult(-1, "", codeStr + "不是有效的条码");
} }
//3.判断当前需不需要出库 //3.获取当前预约单
String itemId = binBarcode.getOrderItemId();
if (StringUtils.isEmpty(itemId)){
return ResultBean.newErrorResult(-1,"",codeStr+"没有要出库的任务");
}
//4.获取当前预约单
String orderId = binBarcode.getOrderId(); String orderId = binBarcode.getOrderId();
LiteOrder liteOrder = liteOrderManager.get(orderId); // 判断是不是工单出库
LiteOrder newLiteOrder = liteOrderCache.getLiteOrder(liteOrder.getOrderNo()); boolean isOrderCheckout = StringUtils.isNotBlank(orderId);
LiteOrder liteOrder = null;
LiteOrder newLiteOrder = null;
if (isOrderCheckout) {
liteOrder = liteOrderManager.get(orderId);
newLiteOrder = liteOrderCache.getLiteOrder(liteOrder.getOrderNo());
if (newLiteOrder == null){ if (newLiteOrder == null){
newLiteOrder = liteOrderManager.findByOrderNo(liteOrder.getOrderNo()); newLiteOrder = liteOrderManager.findByOrderNo(liteOrder.getOrderNo());
} }
//4.判断当前需不需要出库
String itemId = binBarcode.getOrderItemId();
if (StringUtils.isEmpty(itemId)){
return ResultBean.newErrorResult(-1,"",codeStr+"没有要出库的任务");
}
//判断所属的工单任务是否完成 //判断所属的工单任务是否完成
String result = handleOrderNo(newLiteOrder, itemId, codeBarcode.getQty()); String result = handleOrderNo(newLiteOrder, itemId, codeBarcode.getQty());
if (StringUtils.isNotEmpty(result)){ if (StringUtils.isNotEmpty(result)){
return ResultBean.newErrorResult(-1,"",result); return ResultBean.newErrorResult(-1,"",result);
} }
}
//4.开始拿出料箱 //4.开始拿出料箱
binBarcode.setAmount(binBarcode.getAmount()-codeBarcode.getQty()); binBarcode.setAmount(binBarcode.getAmount()-codeBarcode.getQty());
......
package com.neotel.smfcore.custom.luxsan_sp.controller; package com.neotel.smfcore.custom.luxsan_sp.controller;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
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.common.utils.StringUtils;
...@@ -22,7 +21,6 @@ import com.neotel.smfcore.custom.luxsan_sp.api.LuxsanSpApi; ...@@ -22,7 +21,6 @@ import com.neotel.smfcore.custom.luxsan_sp.api.LuxsanSpApi;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.request.SpareInHourseRequest; import com.neotel.smfcore.custom.luxsan_sp.api.bean.request.SpareInHourseRequest;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.result.SpareInHourseDetail; import com.neotel.smfcore.custom.luxsan_sp.api.bean.result.SpareInHourseDetail;
import com.neotel.smfcore.custom.luxsan_sp.bean.*; import com.neotel.smfcore.custom.luxsan_sp.bean.*;
import com.neotel.smfcore.custom.luxsan_sp.enums.SpareNostatus;
import com.neotel.smfcore.custom.luxsan_sp.service.manager.IReturnNoManager; import com.neotel.smfcore.custom.luxsan_sp.service.manager.IReturnNoManager;
import com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager; import com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager;
import com.neotel.smfcore.custom.luxsan_sp.util.*; import com.neotel.smfcore.custom.luxsan_sp.util.*;
...@@ -37,6 +35,9 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -37,6 +35,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
@Api(tags = "备件仓 料箱入库") @Api(tags = "备件仓 料箱入库")
@RestController @RestController
...@@ -142,6 +143,22 @@ public class SpBoxPutInController { ...@@ -142,6 +143,22 @@ public class SpBoxPutInController {
if (!binBarcode.getBarcode().startsWith(boxBarcode.getBarcode())) { if (!binBarcode.getBarcode().startsWith(boxBarcode.getBarcode())) {
return ResultBean.newErrorResult(-1, "", binCodeStr + "不是当前料箱:" + boxStr + "的隔口"); return ResultBean.newErrorResult(-1, "", binCodeStr + "不是当前料箱:" + boxStr + "的隔口");
} }
// 匹配是否存在该料格
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
if (ObjectUtil.isNull(subCodeList)) {
boxBarcode.setSubCodeList(new ArrayList<>());
subCodeList = boxBarcode.getSubCodeList();
subCodeList.add(binBarcode);
}else {
if (! (subCodeList.stream()
.map(Barcode::getBarcode)
.collect(Collectors.toList())
.contains(binCodeStr))
) {
subCodeList.add(binBarcode);
}
}
//2.解析条码信息 //2.解析条码信息
CodeBarcode codeBarcode = CodeUtil.getCodeBarcode(codeStr); CodeBarcode codeBarcode = CodeUtil.getCodeBarcode(codeStr);
...@@ -152,10 +169,14 @@ public class SpBoxPutInController { ...@@ -152,10 +169,14 @@ public class SpBoxPutInController {
//判断有没有正在执行入库单 //判断有没有正在执行入库单
SpareNo spareNo = spareNoCache.getExecutIngSpareNo(); SpareNo spareNo = spareNoCache.getExecutIngSpareNo();
ReturnInventoryNo returnInventoryNo = returnNoCache.getExecutingOrderNo(); ReturnInventoryNo returnInventoryNo = returnNoCache.getExecutingOrderNo();
BaseNo baseNo = null;
boolean isOrderPutIn = false;
if (ObjectUtil.isAllEmpty(spareNo, returnInventoryNo)) { if (ObjectUtil.isAllEmpty(spareNo, returnInventoryNo)) {
return ResultBean.newErrorResult(-1,"","没有找到正在执行的入库单或者退库单"); // return ResultBean.newErrorResult(-1,"","没有找到正在执行的入库单或者退库单");
}else {
baseNo = ObjectUtil.isEmpty(spareNo) ? returnInventoryNo : spareNo;
isOrderPutIn = true;
} }
BaseNo baseNo = ObjectUtil.isEmpty(spareNo) ? returnInventoryNo : spareNo;
//3.判断与当前隔口的料号是否匹配 //3.判断与当前隔口的料号是否匹配
...@@ -164,13 +185,25 @@ public class SpBoxPutInController { ...@@ -164,13 +185,25 @@ public class SpBoxPutInController {
// binPartNumber = ""; // binPartNumber = "";
// } // }
boolean isOk = false; boolean isMatch = false;
int binCodeNum = Integer.parseInt(binCodeStr.split("-")[1]);
String codePartNumber = codeBarcode.getPartNumber(); String codePartNumber = codeBarcode.getPartNumber();
for (Barcode barcode : boxBarcode.getSubCodeList()) { for (Barcode barcode : boxBarcode.getSubCodeList()) {
String pn = barcode.getPartNumber(); String pn = barcode.getPartNumber();
int binNum = Integer.parseInt(barcode.getBarcode().split("-")[1]); int binNum = Integer.parseInt(barcode.getBarcode().split("-")[1]);
if (pn.equals(codePartNumber) && (binNum == Integer.parseInt(binCodeStr.split("-")[1]))) { if ((binNum == binCodeNum)) {
isOk = true; // 要入的料格找到了
if (StringUtils.isNotBlank(barcode.getPartNumber())) {
if (pn.equals(codePartNumber)) {
isMatch = true;
}
}else {
if (isOrderPutIn) {
}else {
barcode.setPartNumber(codePartNumber);
}
}
break; break;
} }
} }
...@@ -181,15 +214,15 @@ public class SpBoxPutInController { ...@@ -181,15 +214,15 @@ public class SpBoxPutInController {
// return ResultBean.newErrorResult(-1, "", codeStr + "与隔口:" + binCodeStr + "的料号不匹配"); // return ResultBean.newErrorResult(-1, "", codeStr + "与隔口:" + binCodeStr + "的料号不匹配");
// } // }
// } // }
if (!isOk) { if (!isMatch) {
return ResultBean.newErrorResult(-1, "", codeStr + "与隔口:" + binCodeStr + "的料号不匹配"); return ResultBean.newErrorResult(-1, "", codeStr + "的料号["+codePartNumber+"]与隔口:" + binCodeStr + "的料号["+binBarcode.getPartNumber()+"]不匹配");
} }
//判断是否已经完成了 //判断是否已经完成了
boolean finish = true; boolean finish = true;
//判断当前入库的是否和入库单一样 //判断当前入库的是否和入库单一样
if (baseNo != null) { if (isOrderPutIn) {
List<SpareNoDetail> detailList = baseNo.getDetailList(); List<SpareNoDetail> detailList = baseNo.getDetailList();
SpareNoDetail spareNoDetail = null; SpareNoDetail spareNoDetail = null;
...@@ -256,7 +289,7 @@ public class SpBoxPutInController { ...@@ -256,7 +289,7 @@ public class SpBoxPutInController {
pos.setBarcode(boxBarcode); pos.setBarcode(boxBarcode);
pos.setUsed(true); pos.setUsed(true);
if (finish){ if (finish && isOrderPutIn){
// 调用入库接口 // 调用入库接口
if (baseNo.getClass().equals(SpareNo.class)) { if (baseNo.getClass().equals(SpareNo.class)) {
List<SpareInHourseDetail> details = new ArrayList<>(); List<SpareInHourseDetail> details = new ArrayList<>();
...@@ -274,13 +307,15 @@ public class SpBoxPutInController { ...@@ -274,13 +307,15 @@ public class SpBoxPutInController {
} }
} }
if (baseNo.getClass().equals(SpareNo.class)) { if (isOrderPutIn) {
if ( baseNo.getClass().equals(SpareNo.class)) {
spareNoCache.addToMap(spareNo); spareNoCache.addToMap(spareNo);
spareNoManager.save(spareNo); spareNoManager.save(spareNo);
}else { }else {
returnNoCache.addToMap(returnInventoryNo); returnNoCache.addToMap(returnInventoryNo);
returnNoManager.save(returnInventoryNo); returnNoManager.save(returnInventoryNo);
} }
}
storagePosManager.save(pos); storagePosManager.save(pos);
barcodeManager.save(binBarcode); barcodeManager.save(binBarcode);
barcodeManager.save(boxBarcode); barcodeManager.save(boxBarcode);
......
...@@ -23,6 +23,7 @@ import java.util.Arrays; ...@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -86,7 +87,9 @@ public class SpBoxUtil { ...@@ -86,7 +87,9 @@ public class SpBoxUtil {
if (ObjectUtil.isNull(no)) { if (ObjectUtil.isNull(no)) {
no = returnNoCache.getExecutingOrderNo(); no = returnNoCache.getExecutingOrderNo();
} }
if (ObjectUtil.isNotNull(no)) {
spareNoDetails = no.getDetailList(); spareNoDetails = no.getDetailList();
}
} else if (type == 2) { } else if (type == 2) {
LiteOrder executingOrder = liteOrderCache.getExecutingOrder(); LiteOrder executingOrder = liteOrderCache.getExecutingOrder();
if (executingOrder == null) { if (executingOrder == null) {
...@@ -126,28 +129,31 @@ public class SpBoxUtil { ...@@ -126,28 +129,31 @@ public class SpBoxUtil {
// 正在执行的任务的details // 正在执行的任务的details
List<SpareNoDetail> activeDetails = getActiveDetails(type); List<SpareNoDetail> activeDetails = getActiveDetails(type);
if (ObjectUtil.isEmpty(activeDetails)) { if (ObjectUtil.isEmpty(activeDetails)) {
return null;
} }
for (int i = 1; i <= 6; i++) { for (int i = 1; i <= 6; i++) {
List<Object> par = new ArrayList<>(); List<Object> par = new ArrayList<>();
String materialBarcode = boxStr + "-0" + i; String materialBarcode = boxStr + "-0" + i;
String partNumber = getPartNumber(subCodeList, materialBarcode); String partNumber = getPartNumber(subCodeList, materialBarcode);
for (SpareNoDetail activeDetail : activeDetails) { SpareNoDetail activeDetail = null;
if (activeDetail.getPartno().equals(partNumber)) { if (ObjectUtil.isNotNull(activeDetails)) {
par.add(activeDetail.getInQty()); // 该pn总共需要的数量 activeDetail = activeDetails.stream()
}else { .filter(spareNoDetail -> spareNoDetail.getPartno().equals(partNumber))
.limit(1)
.collect(Collectors.toList()).get(0);
}
if (ObjectUtil.isNull(activeDetail)) {
par.add(0); par.add(0);
} }else {
par.add(activeDetail.getInQty()); // 该pn总共需要的数量
} }
par.add(getAmount(subCodeList, materialBarcode)); //数量 par.add(getAmount(subCodeList, materialBarcode)); //数量
par.add(i); //隔口号 par.add(i); //隔口号
par.add(partNumber); //料号 par.add(partNumber); //料号
for (SpareNoDetail activeDetail : activeDetails) { if (ObjectUtil.isNull(activeDetail)) {
if (activeDetail.getPartno().equals(partNumber)) {
par.add(activeDetail.getAlrInQty()); // 该pn已完成数量
}else {
par.add(0); par.add(0);
} }else {
par.add(activeDetail.getAlrInQty()); // 该pn已完成数量
} }
pars.add(par); pars.add(par);
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!