自动化立体仓库 - WMS系统
#
lsh
2024-12-04 42ca72b5b74453b0753a9ee334bc1dcb697ed5d4
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -80,6 +80,10 @@
    private SlaveProperties slaveProperties;
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private OrderGiftService orderGiftService;
    @Autowired
    private OrderDetlGiftService orderDetlGiftService;
    @Override
    @Transactional
@@ -167,6 +171,8 @@
        for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) {
            if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) {
                LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch());
                one.setMemo(paramLocDetl.getMemo());
                one.setColor(paramLocDetl.getColor());
                if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount(), param.getOrderNo()));
            }
        }
@@ -206,7 +212,7 @@
                    null,    // 初始票据号
                    null,    // 票据号
                    null,    // 客户编号
                    null,    // 客户
                    param.getCstmrName(),    // 客户
                    null,    // 联系方式
                    null,    // 操作人员
                    null,    // 合计金额
@@ -267,6 +273,7 @@
                orderDetl.setUpdateTime(now);
                orderDetl.setStatus(1);
                orderDetl.setQty(0.0D);
                orderDetl.setMemo(locDetl.getMemo());
                if (!orderDetlService.insert(orderDetl)) {
                    throw new CoolException("生成单据明细失败,请联系管理员");
                }
@@ -276,6 +283,105 @@
//            for (StockOutParam stockOutParam : stockOutParams){
//                startupFullTakeStore(stockOutParam,userId);
//            }
        } else {
            throw new CoolException("订单号重复,订单"+param.getOrderNo()+"已存在!!!");
        }
    }
    @Override
    @Transactional
    public void startupFullTakeStoreOrderGift(StockOutParam param, Long userId) {
        if (Cools.isEmpty(param) || Cools.isEmpty(param.getLocDetls())){
            throw new CoolException("参数为空");
        }
        if (Cools.isEmpty(param.getOrderNo())){
            throw new CoolException("订单号参数为空");
        }
        DocType docType = docTypeService.selectOrAdd("手动出库单", Boolean.FALSE);
        OrderGift order = orderGiftService.selectByNo(param.getOrderNo());
        if (Cools.isEmpty(order)){
            Date now = new Date();
            order = new OrderGift(
                    String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空]
                    param.getOrderNo(),    // 订单编号
                    DateUtils.convert(now),    // 单据日期
                    docType.getDocId(),    // 单据类型
                    null,    // 项目编号
                    null,    //
                    null,    // 调拨项目编号
                    null,    // 初始票据号
                    null,    // 票据号
                    null,    // 客户编号
                    null,    // 客户
                    null,    // 联系方式
                    null,    // 操作人员
                    null,    // 合计金额
                    null,    // 优惠率
                    null,    // 优惠金额
                    null,    // 销售或采购费用合计
                    null,    // 实付金额
                    null,    // 付款类型
                    null,    // 业务员
                    null,    // 结算天数
                    null,    // 邮费支付类型
                    null,    // 邮费
                    null,    // 付款时间
                    null,    // 发货时间
                    null,    // 物流名称
                    null,    // 物流单号
//                    2L,    // 订单状态
                    1L,    // 订单状态
                    1,    // 状态
                    userId,    // 添加人员
                    now,    // 添加时间
                    userId,    // 修改人员
                    now,    // 修改时间
                    null    // 备注
            );
            if (!orderGiftService.insert(order)) {
                throw new CoolException("保存订单主档失败");
            }
            // 单据明细档
            List<DetlDto> list = new ArrayList<>();
            List<StockOutParam.LocDetl> locDetls = param.getLocDetls();
            int i=0;
            for (StockOutParam.LocDetl locDetl : locDetls) {
                i++;
                Mat mat = matService.selectByMatnr(locDetl.getMatnr());
                if (Cools.isEmpty(mat)) {
                    throw new CoolException(locDetl.getMatnr() + "物料编码检索失败,请先添加商品");
                }
                OrderDetlGift orderDetl = new OrderDetlGift();
                orderDetl.sync(mat);
                orderDetl.setSuppCode(String.valueOf(i));  // 行号
                orderDetl.setManu(locDetl.getLocNo());  //库位号
                orderDetl.setBatch(locDetl.getBatch()); //木箱编码
                orderDetl.setAnfme(locDetl.getAnfme());//出库数量
                orderDetl.setModel(locDetl.getModel());//批次
                orderDetl.setSpecs(locDetl.getSpecs());//规格
                orderDetl.setBrand(locDetl.getBrand());//木箱类型
                orderDetl.setBarcode(locDetl.getZpallet());//木箱类型
                orderDetl.setWeight(locDetl.getWeight());
                orderDetl.setVolume(locDetl.getVolume());
                orderDetl.setPrice(locDetl.getPrice());
//                orderDetl.setWorkQty(locDetl.getAnfme());
                orderDetl.setWorkQty(0.0);
                orderDetl.setOrderId(order.getId());
                orderDetl.setOrderNo(order.getOrderNo());
                orderDetl.setOrigin(locDetl.getOrigin());
                orderDetl.setCreateBy(userId);
                orderDetl.setCreateTime(now);
                orderDetl.setUpdateBy(userId);
                orderDetl.setUpdateTime(now);
                orderDetl.setStatus(1);
                orderDetl.setQty(0.0D);
                orderDetl.setMemo(locDetl.getMemo());
                if (!orderDetlGiftService.insert(orderDetl)) {
                    throw new CoolException("生成单据明细失败,请联系管理员");
                }
            }
        } else {
            throw new CoolException("订单号重复,订单"+param.getOrderNo()+"已存在!!!");
@@ -673,6 +779,7 @@
        }
        if (!locDetlDtos.isEmpty()) {
            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
            if (locMast.getLocSts().equals("F")){
                // 启动出库开始 107.盘点出库
                stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId);
@@ -1247,7 +1354,7 @@
        }
        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", param.getLocDetls().get(0).getMatnr()));
        if (Cools.isEmpty(locDetls) || locDetls.size()<1){
            throw new CoolException("待修改商品无库存,无需修改!  品号:"+param.getLocDetls().get(0).getMatnr());
            throw new CoolException("待修改商品无库存,无需修改!  规格:"+param.getLocDetls().get(0).getMatnr());
        }
        try {
            locDetlService.updateMatTurn(param.getLocDetls().get(0).getMatnr(),mat.getMatnr());