自动化立体仓库 - WMS系统
cl
15 小时以前 20b72a000801cf006bfe1f487baabc110594832f
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -10,6 +10,7 @@
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.common.entity.Parameter;
import com.zy.integration.iot.biz.IotInstructionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +19,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -49,6 +51,8 @@
    private OrderPakinService orderPakinService;
    @Autowired
    private WorkService workService;
    @Autowired
    private IotInstructionService iotInstructionService;
    @Value("${erp.switch.ErpReportOld}")
    private boolean erpReportOld;
@@ -88,11 +92,30 @@
        if (!Cools.isEmpty(erpReport) && !"true".equalsIgnoreCase(erpReport)) {
            return false;
        }
        if (wrkMast == null || Cools.isEmpty(wrkMast.getBarcode())) {
        if (wrkMast == null) {
            return false;
        }
        Integer ioType = wrkMast.getIoType();
        return ioType != null && (ioType == 101 || ioType == 108 || ioType == 110);
        if (ioType == null || (ioType != 101 && ioType != 108 && ioType != 110)) {
            return false;
        }
        return !Cools.isEmpty(resolveOutboundPalletId(wrkMast));
    }
    private String resolveOutboundPalletId(WrkMast wrkMast) {
        if (!Cools.isEmpty(wrkMast.getBarcode())) {
            return wrkMast.getBarcode();
        }
        List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
        if (Cools.isEmpty(wrkDetls)) {
            return null;
        }
        for (WrkDetl wrkDetl : wrkDetls) {
            if (!Cools.isEmpty(wrkDetl.getZpallet())) {
                return wrkDetl.getZpallet();
            }
        }
        return null;
    }
    public ReturnT<String> doIn(WrkMast wrkMast) {
@@ -437,6 +460,7 @@
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                return FAIL.setMsg("更新入库完成状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]");
            }
            iotInstructionService.queueWorkCompletion(wrkMast);
        } catch (Exception e) {
            log.error("fail", e);
            e.printStackTrace();
@@ -505,6 +529,7 @@
                    if (locMast.getLocSts().equals("R")) {
                        locMast.setLocSts("O");
                        locMast.setBarcode("");
                        locMast.setScWeight(BigDecimal.ZERO);
                        locMast.setModiTime(now);
                        locMast.setIoTime(now);
                        if (!locMastService.updateById(locMast)) {
@@ -554,6 +579,7 @@
                    if (locMast.getLocSts().equals("R")) {
                        locMast.setLocSts("O");
                        locMast.setBarcode("");
                        locMast.setScWeight(BigDecimal.ZERO);
                        locMast.setModiTime(now);
                        locMast.setIoTime(now);
                        if (!locMastService.updateById(locMast)) {
@@ -586,6 +612,7 @@
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                return FAIL.setMsg("更新出库完成状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]");
            }
            iotInstructionService.queueWorkCompletion(wrkMast);
        } catch (Exception e) {
            log.error("fail", e);
            e.printStackTrace();
@@ -595,3 +622,4 @@
        return SUCCESS;
    }
}