| | |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private OrderGiftService orderGiftService; |
| | | @Autowired |
| | | private OrderDetlGiftService orderDetlGiftService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | |
| | | } |
| | | |
| | | @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()+"已存在!!!"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional |