自动化立体仓库 - WMS系统
skyouc
21 小时以前 8896a0841940bac10c17b9a02f8d1cd76dd52084
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -97,11 +97,6 @@
                            return FAIL.setMsg("空板入库 ===>> 修改库位状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]");
                        }
                    }
                    break;
                // 全板入库
                case 1:
@@ -132,11 +127,7 @@
                            locDetl = new LocDetl();
                            locDetl.sync(wrkDetl);
                            locDetl.setLocNo(wrkMast.getLocNo()); // 库位号
                            if (!Objects.isNull(wrkMast.getWrkCode())) {
                                locDetl.setAnfme(wrkDetl.getAnfme()); // 数量
                            } else {
                                locDetl.setAnfme(wrkDetl.getRealQty());
                            }
                            locDetl.setAnfme(wrkDetl.getAnfme()); // 数量
                            locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码
                            locDetl.setModiTime(now);
                            locDetl.setAppeTime(now);
@@ -148,8 +139,34 @@
                        }
                        //判断匹配编码不为空,且任务编码包含-2,确认为有上组任务
                        if (!Objects.isNull(wrkMast.getWrkCode()) && wrkMast.getWrkCode().contains("-2")) {
                            //不需要更新单据信息(子任务无单据
                        if (!Objects.isNull(wrkMast.getWrkCode())) {
                            //TODO 获取101出库 主任务档总数量 - 子任务档的实际数量 = 当前作业完成数量
                            WrkDetl selectOne = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
                            Double v = Math.round((selectOne.getStockQty() - selectOne.getAnfme()) * 10000) / 10000.0;
                            OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), null, null, null, null,
                                    null, null, null);
                            if (!Objects.isNull(orderDetlPakout)) {
                                orderDetlPakout.setQty(v);
                                if (!orderDetlPakoutService.updateById(orderDetlPakout)) {
                                    throw new CoolException("单据完成数量修改失败!!");
                                }
                            }
                            int indexOf = wrkMast.getWrkCode().indexOf("-1");
                            if (indexOf != -1) {
                                String wrkNo = wrkMast.getWrkCode().substring(0, indexOf);
                                WrkMast mast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", wrkNo));
                                if (Objects.isNull(mast)) {
                                    throw new CoolException("数据错误,主任务档不存在或已删除!!");
                                }
                                mast.setWrkCode(null);
                                if (!wrkMastService.updateById(mast)) {
                                    throw new CoolException("原任务档删除失败!!");
                                }
                            }
                        } else {
                            //正常单据才存存入库单,作入库单据信息更新
                            // 更新订单完成数量
@@ -452,15 +469,23 @@
        }
        /***/
        if (Objects.isNull(wrkMast.getWrkCode())) {
        if (!Objects.isNull(wrkMast.getWrkCode())) {
            LocMast lcmst = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", wrkMast.getSourceLocNo()));
            lcmst.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
            if (!locMastService.updateById(lcmst)) {
                throw new CoolException("库位状态修改失败!!");
            }
            LocAroundBind bLocNo = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>().eq("b_loc_no", wrkMast.getSourceLocNo()));
            if (Objects.isNull(bLocNo)) {
                throw new CoolException("工位不存在 !!");
            }
            bLocNo.setLocType(LocStsType.LOC_STS_TYPE_O.type);
            if (!locAroundBindService.updateById(bLocNo)) {
                throw new CoolException("工位状态修改失败!!");
            }
            locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo()));
        }
        return SUCCESS;