Commit cfbf1646 张少辉

功能优化

1 个父辈 521e3849
......@@ -389,7 +389,13 @@ public class OutLineController {
}
boxStr = getBoxStrbyBoxPartition(boxStr);
//判断库位中 有没有
Barcode pidBarcode = barcodeManager.findByBarcode(boxStr);
StoragePos oriPos = storagePosManager.getByBarcode(pidBarcode.getBarcode());
if (oriPos != null) {
pidBarcode = oriPos.getBarcode();
}
List<Barcode> subCodes = pidBarcode.getSubCodeList();
if (subCodes == null || subCodes.isEmpty()) {
return ResultBean.newErrorResult(-1, "", "料箱:" + boxStr + ",没有可出库的物料");
......@@ -494,11 +500,9 @@ public class OutLineController {
}
pidBarcode = barcodeManager.save(pidBarcode);
StoragePos pos = BoxHandleUtil.locOnePos(pidBarcode);
if (pos != null) {
pos.setBarcode(pidBarcode);
storagePosManager.save(pos);
if (oriPos != null){
oriPos.setBarcode(pidBarcode);
storagePosManager.save(oriPos);
}
if (!isOut) {
......
......@@ -700,9 +700,12 @@ public class CDeviceController {
} else if (targetLoc.endsWith("2F")) {
log.info("自动绑定料串[" + materialStr + "]目的地:C1-2F");
MaterialLocUtil.updateStackerLoc(materialStr, "", "C1-2F", 1, orderItem.getOrderNo(), barcode);
} else if (targetLoc.endsWith("1F")) {
} else if (targetLoc.endsWith("C2/1F")) {
log.info("自动绑定料串[" + materialStr + "]目的地:C2-1F");
MaterialLocUtil.updateStackerLoc(materialStr, "", "C2-1F", 1, orderItem.getOrderNo(), barcode);
} else if (targetLoc.endsWith("W2/1F")) {
log.info("自动绑定料串[" + materialStr + "]目的地:W2-1F");
MaterialLocUtil.updateStackerLoc(materialStr, "", "W2-1F", 1, orderItem.getOrderNo(), barcode);
}
}
......@@ -1007,8 +1010,12 @@ public class CDeviceController {
if (boxBarcode != null) {
//判断隔口是否可以放入
if (BinCacheUtil.canPutInBinCode(binCodeStr, warhouseCode)) {
String canPutIn = BinCacheUtil.canMaterialPutInBin(barcode, boxBarcode, binCodeStr);
if (StringUtils.isEmpty(canPutIn)) {
return ResultBean.newOkResult("");
} else {
log.info(barcode.getBarcode() + "不可以放到料格:" + binCodeStr + ",原因为:" + canPutIn);
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不可以放到料格:" + binCodeStr + ",原因为:" + canPutIn);
}
}
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不可以放到料格:" + binCodeStr);
......@@ -1403,9 +1410,12 @@ public class CDeviceController {
} else if (targetLoc.endsWith("2F")) {
log.info("自动绑定料串[" + stacker + "]目的地:C1-2F");
MaterialLocUtil.updateStackerLoc(stacker, "", "C1-2F", 1, orderItem.getOrderNo(), barcode);
} else if (targetLoc.endsWith("1F")) {
} else if (targetLoc.endsWith("C2/1F")) {
log.info("自动绑定料串[" + stacker + "]目的地:C2-1F");
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-1F", 1, orderItem.getOrderNo(), barcode);
} else if (targetLoc.endsWith("W2/1F")) {
log.info("自动绑定料串[" + stacker + "]目的地:W2-1F");
MaterialLocUtil.updateStackerLoc(stacker, "", "W2-1F", 1, orderItem.getOrderNo(), barcode);
}
}
......@@ -1860,17 +1870,20 @@ public class CDeviceController {
String targetLoc = order.getLoc();
if (StringUtils.isNotEmpty(targetLoc)){
if (targetLoc.endsWith("BG")) {
log.info("自动绑定料串[" + stacker + "]目的地:C2-3F-BG");
log.info(barcode.getBarcode()+"自动绑定料串[" + stacker + "]目的地:C2-3F-BG");
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-BG", 1, orderItem.getOrderNo(),barcode);
} else if (targetLoc.endsWith("CG")) {
log.info("自动绑定料串[" + stacker + "]目的地:C2-3F-CG");
log.info(barcode.getBarcode()+"自动绑定料串[" + stacker + "]目的地:C2-3F-CG");
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-CG", 1, orderItem.getOrderNo(),barcode);
} else if (targetLoc.endsWith("2F")){
log.info("自动绑定料串["+stacker+"]目的地:C1-2F");
log.info(barcode.getBarcode()+"自动绑定料串["+stacker+"]目的地:C1-2F");
MaterialLocUtil.updateStackerLoc(stacker,"", "C1-2F",1,orderItem.getOrderNo(),barcode);
} else if (targetLoc.endsWith("1F")){
log.info("自动绑定料串["+stacker+"]目的地:C2-1F");
} else if (targetLoc.endsWith("C2/1F")){
log.info(barcode.getBarcode()+"自动绑定料串["+stacker+"]目的地:C2-1F");
MaterialLocUtil.updateStackerLoc(stacker,"", "C2-1F",1,orderItem.getOrderNo(),barcode);
} else if (targetLoc.endsWith("W2/1F")){
log.info(barcode.getBarcode()+"自动绑定料串["+stacker+"]目的地:W2-1F");
MaterialLocUtil.updateStackerLoc(stacker,"", "W2-1F",1,orderItem.getOrderNo(),barcode);
}
}
} catch (ValidateException e) {
......
......@@ -49,6 +49,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ApiOperation("手动GR入库")
@Slf4j
......@@ -164,11 +165,12 @@ public class ManualGrPutInController {
return ResultBean.newOkResult(BoxHandleUtil.getBoxInfo(boxStr));
}
private Map<String,String> cacheBoxMap = new ConcurrentHashMap<>();
@ApiOperation("GR料盘入到料格")
@RequestMapping("/reelToBox")
//@AnonymousAccess
public synchronized ResultBean reelToBox(@RequestBody Map<String, String> paramMap) {
public ResultBean reelToBox(@RequestBody Map<String, String> paramMap) {
String binCode = paramMap.get("binCode"); //料格信息
......@@ -204,6 +206,11 @@ public class ManualGrPutInController {
binCode = binCode.toUpperCase(Locale.ROOT);
boxStr = boxStr.toUpperCase(Locale.ROOT);
String value = cacheBoxMap.get(boxStr);
if (StringUtils.isEmpty(value)) {
cacheBoxMap.put(boxStr, boxStr);
}
synchronized (cacheBoxMap.get(boxStr)) {
Barcode noDbBarcode = codeResolve.resolveCode(codeStr);
if (noDbBarcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.noValidCode", "条码无效");
......@@ -230,27 +237,27 @@ public class ManualGrPutInController {
h = component.getHeight();
}
if (13 == w){
if (!binCode.startsWith("C13")){
return ResultBean.newErrorResult(-1,"","13寸的物料,请放入C13的01号料格中");
if (13 == w) {
if (!binCode.startsWith("C13")) {
return ResultBean.newErrorResult(-1, "", "13寸的物料,请放入C13的01号料格中");
} else {
if (!binCode.endsWith("-01")){
return ResultBean.newErrorResult(-1,"","13寸的物料,请放入C13的01号料格中");
if (!binCode.endsWith("-01")) {
return ResultBean.newErrorResult(-1, "", "13寸的物料,请放入C13的01号料格中");
}
}
} else if (15 == w){
if (!binCode.startsWith("C15")){
return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中");
} else if (15 == w) {
if (!binCode.startsWith("C15")) {
return ResultBean.newErrorResult(-1, "", "15寸的物料,请放入C15的01号料格中");
} else {
if (!binCode.endsWith("-01")){
return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中");
if (!binCode.endsWith("-01")) {
return ResultBean.newErrorResult(-1, "", "15寸的物料,请放入C15的01号料格中");
}
}
} else if (7 == w){
if (binCode.startsWith("C15")){
} else if (7 == w) {
if (binCode.startsWith("C15")) {
return ResultBean.newErrorResult(-1, "", "7寸的物料,不可以放入C15中,请选择其他料格");
}
if (binCode.startsWith("C13")){
if (binCode.startsWith("C13")) {
if (binCode.endsWith("01")) {
return ResultBean.newErrorResult(-1, "", "7寸的物料,不可以放入C13的料格01中,请选择其他料格");
}
......@@ -261,7 +268,7 @@ public class ManualGrPutInController {
Barcode barcode = null;
try {
barcode = codeResolve.resolveOneValideBarcode("="+w+"x"+h+"="+codeStr);
barcode = codeResolve.resolveOneValideBarcode("=" + w + "x" + h + "=" + codeStr);
} catch (ValidateException ve) {
return ResultBean.newErrorResult(-1, ve.getMsgKey(), ve.getDefaultMsg());
}
......@@ -276,19 +283,19 @@ public class ManualGrPutInController {
//找到box信息
Barcode boxBarcode = null;
StoragePos inPos = null;
try{
try {
boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
inPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if(inPos != null){
if (inPos != null) {
boxBarcode = inPos.getBarcode();
}
}catch (ValidateException ve){
} catch (ValidateException ve) {
return ResultBean.newErrorResult(-1, ve.getMsgKey(), "料箱条码不正确:" + boxStr);
}
//判断料格条码和料箱是否匹配
if (!binCode.startsWith(boxBarcode.getBarcode())){
return ResultBean.newErrorResult(-1,"","当前扫描的隔口"+binCode+"与料箱信息:"+boxStr+"不匹配");
if (!binCode.startsWith(boxBarcode.getBarcode())) {
return ResultBean.newErrorResult(-1, "", "当前扫描的隔口" + binCode + "与料箱信息:" + boxStr + "不匹配");
}
//判断是否为禁用料
......@@ -298,12 +305,12 @@ public class ManualGrPutInController {
int days = LuxsanApi.getInDate(new GetInDateRequest(CommonUtil.plantCode, barcode.getPartNumber(), barcode.getProvider(), barcode.getDateCode()));
log.info(barcode.getBarcode()+"的剩余过期时间为:"+days);
log.info(barcode.getBarcode() + "的剩余过期时间为:" + days);
if (days > 0) {
Date expireDate = cn.hutool.core.date.DateUtil.offsetDay(new Date(), days);
barcode.setExpireDate(expireDate);
}
if (barcode.getExpireDate() != null){
if (barcode.getExpireDate() != null) {
if (System.currentTimeMillis() > barcode.getExpireDate().getTime()) {
throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库.");
}
......@@ -311,7 +318,7 @@ public class ManualGrPutInController {
//判断隔口能否放入
if (boxBarcode != null){
if (boxBarcode != null) {
String canPutIn = BinCacheUtil.canMaterialPutInBin(barcode, boxBarcode, binCode);
......@@ -324,30 +331,31 @@ public class ManualGrPutInController {
barcode.setPosName(binCode);
barcode.setBarSource(grCode);
barcode.setWarehouseCode(warhouseCode);
barcode.setSeq(BoxHandleUtil.getSeq(boxBarcode,binCode)+1);
barcode.setSeq(BoxHandleUtil.getSeq(boxBarcode, binCode) + 1);
barcode.setPutInTime(System.currentTimeMillis());
// 刷新缓存中gr已过帐数量, 如果超出数量则报错
int amount = barcode.getAmount();
GrUtil.addQty(grCode, grItem, amount);
barcode = barcodeManager.save(barcode);
generatePutInTask(barcode, boxBarcode, OP_STATUS.FINISHED.name());
boxBarcode.updateSubCodes(barcode);
boxBarcode.UpdateSubCode(barcode);
boxBarcode.setWarehouseCode(warhouseCode);
boxBarcode.setAmount(boxBarcode.getAmount()+barcode.getAmount());
boxBarcode.setAmount(boxBarcode.getAmount() + barcode.getAmount());
barcodeManager.save(boxBarcode);
if(inPos != null){
if (inPos != null) {
//流程异常时,为保证数据一致性, pos中的box barcode也需要更新
inPos.setBarcode(boxBarcode);
storagePosManager.save(inPos);
}
return ResultBean.newOkResult(BoxHandleUtil.getBoxInfo(boxStr));
} else {
log.info(barcode.getBarcode() + "不可以放到料格:" + binCode+",原因为:"+canPutIn);
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不可以放到料格:" + binCode+",原因为:"+canPutIn);
log.info(barcode.getBarcode() + "不可以放到料格:" + binCode + ",原因为:" + canPutIn);
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不可以放到料格:" + binCode + ",原因为:" + canPutIn);
}
}
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不可以放到料格:" + binCode);
}
}
......
......@@ -38,6 +38,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Api(tags = "退料到1楼")
@Slf4j
......@@ -61,17 +62,19 @@ public class ManualReturnTowerController {
private TaskService taskService;
private Map<String,String> cacheBoxMap = new ConcurrentHashMap<>();
@ApiOperation("退库到料箱中")
@RequestMapping("/reelToBox")
//@AnonymousAccess
public synchronized ResultBean reelToBox(@RequestBody Map<String, String> paramMap) {
public ResultBean reelToBox(@RequestBody Map<String, String> paramMap) {
String wareHouseCode = paramMap.get("wareHouseCode");
String binCode = paramMap.get("binCode"); //料格信息
String codeStr = paramMap.get("codeStr"); //条码信息
String boxStr = paramMap.get("boxStr"); //料箱信息
log.info("人工手动退料,料格信息为:" + binCode + ",料箱信息为:" + boxStr + "条码信息为:" + codeStr+",库别为:"+wareHouseCode);
log.info("人工手动退料,料格信息为:" + binCode + ",料箱信息为:" + boxStr + "条码信息为:" + codeStr + ",库别为:" + wareHouseCode);
if (StringUtils.isEmpty(binCode)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料格信息"});
......@@ -90,8 +93,14 @@ public class ManualReturnTowerController {
binCode = binCode.toUpperCase(Locale.ROOT);
boxStr = boxStr.toUpperCase(Locale.ROOT);
String value = cacheBoxMap.get(boxStr);
if (StringUtils.isEmpty(value)) {
cacheBoxMap.put(boxStr, boxStr);
}
synchronized (cacheBoxMap.get(boxStr)) {
//先进行料卷注册
LuxsanApi.whRegister(codeStr,wareHouseCode);
LuxsanApi.whRegister(codeStr, wareHouseCode);
Barcode noDbBarcode = codeResolve.resolveCode(codeStr);
if (noDbBarcode == null) {
......@@ -119,27 +128,27 @@ public class ManualReturnTowerController {
h = component.getHeight();
}
if (13 == w){
if (!binCode.startsWith("C13")){
return ResultBean.newErrorResult(-1,"","13寸的物料,请放入C13的01号料格中");
if (13 == w) {
if (!binCode.startsWith("C13")) {
return ResultBean.newErrorResult(-1, "", "13寸的物料,请放入C13的01号料格中");
} else {
if (!binCode.endsWith("-01")){
return ResultBean.newErrorResult(-1,"","13寸的物料,请放入C13的01号料格中");
if (!binCode.endsWith("-01")) {
return ResultBean.newErrorResult(-1, "", "13寸的物料,请放入C13的01号料格中");
}
}
} else if (15 == w){
if (!binCode.startsWith("C15")){
return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中");
} else if (15 == w) {
if (!binCode.startsWith("C15")) {
return ResultBean.newErrorResult(-1, "", "15寸的物料,请放入C15的01号料格中");
} else {
if (!binCode.endsWith("-01")){
return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中");
if (!binCode.endsWith("-01")) {
return ResultBean.newErrorResult(-1, "", "15寸的物料,请放入C15的01号料格中");
}
}
} else if (7 == w){
if (binCode.startsWith("C15")){
} else if (7 == w) {
if (binCode.startsWith("C15")) {
return ResultBean.newErrorResult(-1, "", "7寸的物料,不可以放入C15中,请选择其他料格");
}
if (binCode.startsWith("C13")){
if (binCode.startsWith("C13")) {
if (binCode.endsWith("01")) {
return ResultBean.newErrorResult(-1, "", "7寸的物料,不可以放入C13的料格01中,请选择其他料格");
}
......@@ -150,7 +159,7 @@ public class ManualReturnTowerController {
Barcode barcode = null;
try {
barcode = codeResolve.resolveOneValideBarcode("="+w+"x"+h+"="+codeStr);
barcode = codeResolve.resolveOneValideBarcode("=" + w + "x" + h + "=" + codeStr);
} catch (ValidateException ve) {
return ResultBean.newErrorResult(-1, ve.getMsgKey(), ve.getDefaultMsg());
}
......@@ -166,12 +175,12 @@ public class ManualReturnTowerController {
int days = LuxsanApi.getInDate(new GetInDateRequest(CommonUtil.plantCode, barcode.getPartNumber(), barcode.getProvider(), barcode.getDateCode()));
log.info(barcode.getBarcode()+"的剩余过期时间为:"+days);
log.info(barcode.getBarcode() + "的剩余过期时间为:" + days);
if (days > 0) {
Date expireDate = cn.hutool.core.date.DateUtil.offsetDay(new Date(), days);
barcode.setExpireDate(expireDate);
}
if (barcode.getExpireDate() != null){
if (barcode.getExpireDate() != null) {
if (System.currentTimeMillis() > barcode.getExpireDate().getTime()) {
throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库.");
}
......@@ -180,19 +189,19 @@ public class ManualReturnTowerController {
//找到box信息
Barcode boxBarcode = null;
StoragePos inPos = null;
try{
try {
boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
inPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if(inPos != null){
if (inPos != null) {
boxBarcode = inPos.getBarcode();
}
}catch (ValidateException ve){
} catch (ValidateException ve) {
return ResultBean.newErrorResult(-1, ve.getMsgKey(), "料箱条码不正确:" + boxStr);
}
//判断料格条码和料箱是否匹配
if (!binCode.startsWith(boxBarcode.getBarcode())){
return ResultBean.newErrorResult(-1,"","当前扫描的隔口"+binCode+"与料箱信息:"+boxStr+"不匹配");
if (!binCode.startsWith(boxBarcode.getBarcode())) {
return ResultBean.newErrorResult(-1, "", "当前扫描的隔口" + binCode + "与料箱信息:" + boxStr + "不匹配");
}
//判断是否为禁用料
......@@ -200,36 +209,37 @@ public class ManualReturnTowerController {
//判断隔口能否放入
if (boxBarcode != null){
if (boxBarcode != null) {
String canPutIn = BinCacheUtil.canMaterialPutInBin(barcode, boxBarcode, binCode);
if (StringUtils.isEmpty(canPutIn)) {
BackToWarehouseResult result = LuxsanApi.backToWarehouse(new BackToWarehouseRequest(CommonUtil.plantCode,binCode,"return",Arrays.asList(barcode.getBarcode())));
BackToWarehouseResult result = LuxsanApi.backToWarehouse(new BackToWarehouseRequest(CommonUtil.plantCode, binCode, "return", Arrays.asList(barcode.getBarcode())));
//String label_id = result.getLABEL_ID();
barcode.setLabelId(result.getLABEL_ID());
barcode.setPosName(binCode);
barcode.setSeq(BoxHandleUtil.getSeq(boxBarcode,binCode)+1);
barcode.setSeq(BoxHandleUtil.getSeq(boxBarcode, binCode) + 1);
barcode.setPutInTime(System.currentTimeMillis());
barcode = barcodeManager.save(barcode);
generatePutInTask(barcode, boxBarcode, OP_STATUS.FINISHED.name());
boxBarcode.updateSubCodes(barcode);
boxBarcode.setAmount(boxBarcode.getAmount()+barcode.getAmount());
boxBarcode.setAmount(boxBarcode.getAmount() + barcode.getAmount());
barcodeManager.save(boxBarcode);
if(inPos != null){
if (inPos != null) {
//流程异常时,为保证数据一致性, pos中的box barcode也需要更新
inPos.setBarcode(boxBarcode);
storagePosManager.save(inPos);
}
return ResultBean.newOkResult(BoxHandleUtil.getBoxInfo(boxStr));
} else {
log.info(barcode.getBarcode() + "不可以放到料格:" + binCode+",原因为:"+canPutIn);
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不可以放到料格:" + binCode+",原因为:"+canPutIn);
log.info(barcode.getBarcode() + "不可以放到料格:" + binCode + ",原因为:" + canPutIn);
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不可以放到料格:" + binCode + ",原因为:" + canPutIn);
}
}
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不可以放到料格:" + binCode);
}
}
private void generatePutInTask(Barcode barcode, Barcode boxBarcode,String status) {
......
......@@ -184,7 +184,7 @@ public class KafkaService {
for (EquipMsg equipMsg : equipMsgList) {
String errorCode = equipMsg.getErrorCode();
if (StringUtils.isEmpty(errorCode)){
if (StringUtils.isEmpty(errorCode) || StringUtils.isEmpty(equipMsg.getMsg())){
continue;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!