自动化立体仓库 - WMS系统
lty
1 天以前 2ede5469ff64257e97ab92825261afeb643d7b82
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -23,6 +23,8 @@
import com.zy.common.properties.SlaveProperties;
import com.zy.common.service.CommonService;
import com.zy.common.web.WcsController;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -73,6 +75,8 @@
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    @Autowired
    private ConfigService configService;
    @Autowired
    private WcsController wcsController;
    @Autowired
@@ -397,6 +401,8 @@
                throw new CoolException("订单出库异常,请联系管理员");
            }
        }
        Config config = configService.selectConfigByCode("AutoMPArea");
        // 获取库位
        LocMast locMast = locMastService.selectById(taskDto.getLocNo());
        // 判断是否是盘点单
@@ -404,6 +410,16 @@
        OrderPakout orderPakout = orderPakOutService.selectByNo(orderNo);
        int ioType = orderPakout.getDocType() == 8 ? 107 : (taskDto.isAll() ? 101 : 103);
        StaDesc staDesc = staDescService.queryCrnStnAuto(ioType, locMast.getCrnNo(), staNo.getDevNo());
        List<LocMast> list = locMastMapper.selectList(
                new EntityWrapper<LocMast>()
                        .eq("whs_type", 5)
                        .eq("loc_sts", "O")
        );
        LocMast locMastRgv = list.isEmpty() ? null : list.get(0);
        // 生成工作号
        int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType));
        // 生成工作档
@@ -417,6 +433,10 @@
        wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站
        wrkMast.setStaNo(staDesc.getStnNo()); // 目标站
        wrkMast.setSourceLocNo(taskDto.getLocNo()); // 源库位
        if (Boolean.parseBoolean(config.getValue()) && locMastRgv.getLocNo() != null) {  //若有空库位且配置允许则绑定其备料库位号
            wrkMast.setLocNo(locMastRgv.getLocNo());
            wrkMast.setTakeNone("0");  //0rgv未取,1rgv已取货
        }
        wrkMast.setFullPlt("Y"); // 满板:Y
        wrkMast.setPicking("N"); // 拣料
        wrkMast.setExitMk("N"); // 退出
@@ -466,6 +486,18 @@
                    orderDetl.getBoxType1(),orderDetl.getBoxType2(),orderDetl.getBoxType3()
                    , locDto.getAnfme());
            OrderInAndOutUtil.updateOrder(Boolean.FALSE,orderDetl.getOrderId(), 2L, userId);
        }
        //修改agv备料区状态
        if(locMastRgv.getLocSts().equals("O")){
            locMastRgv.setLocSts("S");
            locMastRgv.setModiUser(userId);
            locMastRgv.setModiTime(now);
            if (!locMastService.updateById(locMastRgv)) {
                throw new CoolException("预约agv备料区库位状态失败,库位号:"+taskDto.getLocNo());
            }
        }else{
            throw new CoolException(taskDto.getLocNo() + "备料区不是空库位状态");
        }
        // 修改库位状态:   F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
        locMast = locMastService.selectById(taskDto.getLocNo());
@@ -1128,6 +1160,16 @@
        //取消出库工作档时,查询单据管理表,回滚作业中数量
        if(wrkMast.getIoType() == 101 || wrkMast.getIoType() == 103) {
            List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
            if(wrkMast.getLocNo() != null){
                LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
                locMast.setLocSts("O");
                locMast.setModiTime(now);
                locMast.setModiUser(userId);
                boolean locMastRes = locMastService.updateById(locMast);
                if (!locMastRes) {
                    throw new CoolException("保存数据失败");
                }
            }
            for (WrkDetl wrkDetl : wrkDetls) {
                if (!Cools.isEmpty(wrkDetl.getOrderNo())) {
//                    if (!orderDetlService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) {