|  |  |  | 
|---|
|  |  |  | null,    // 客户编号 | 
|---|
|  |  |  | null,    // 客户 | 
|---|
|  |  |  | null,    // 联系方式 | 
|---|
|  |  |  | null,    // 操作人员 | 
|---|
|  |  |  | getUser().getUsername(),    // 操作人员 | 
|---|
|  |  |  | null,    // 合计金额 | 
|---|
|  |  |  | null,    // 优惠率 | 
|---|
|  |  |  | null,    // 优惠金额 | 
|---|
|  |  |  | 
|---|
|  |  |  | private String storeName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 部门 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value = "部门") | 
|---|
|  |  |  | @TableField("department") | 
|---|
|  |  |  | private String department; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 部门id | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value = "部门id") | 
|---|
|  |  |  | @TableField("department_id") | 
|---|
|  |  |  | private String departmentId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 是否立库本身 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value = "是否立库本身,0不是,1是") | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SnowflakeIdWorker snowflakeIdWorker; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderDetlPakoutService orderDetlService; | 
|---|
|  |  |  | private OrderDetlPakoutService orderDetlPakoutService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderDetlService orderDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DocTypeService docTypeService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (complete) { | 
|---|
|  |  |  | //            // 出库订单重新整理明细 | 
|---|
|  |  |  | // 出库订单重新整理明细 | 
|---|
|  |  |  | //            DocType docType = docTypeService.selectById(order.getDocType()); | 
|---|
|  |  |  | //            if (null != docType && docType.getPakout() == 1&& docType.getDocName().equals("销售发货")) { | 
|---|
|  |  |  | //                if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", order.getId()))) { | 
|---|
|  |  |  | //            if (null != docType && docType.getPakout() == 1 && docType.getDocName().equals("销售发货")) { | 
|---|
|  |  |  | //                if (!orderDetlPakoutService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", order.getId()))) { | 
|---|
|  |  |  | //                    throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); | 
|---|
|  |  |  | 
|---|
|  |  |  | //                    orderDetl.setCreateBy(order.getCreateBy()); | 
|---|
|  |  |  | //                    orderDetl.setUpdateTime(order.getUpdateTime()); | 
|---|
|  |  |  | //                    orderDetl.setUpdateBy(order.getUpdateBy()); | 
|---|
|  |  |  | //                    if (!orderDetlService.insert(orderDetl)) { | 
|---|
|  |  |  | //                    if (!orderDetlPakoutService.insert(orderDetl)) { | 
|---|
|  |  |  | //                        throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!this.updateSettle(order.getId(), 4L, null)) { | 
|---|
|  |  |  | throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | List<DetlDto> detlDtos = new ArrayList<>(); | 
|---|
|  |  |  | wrkDetls.forEach(wrkDetl -> { | 
|---|
|  |  |  | detlDtos.add(new DetlDto(wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand(),wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3(),wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3(), wrkDetl.getAnfme())); | 
|---|
|  |  |  | detlDtos.add(new DetlDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(), wrkDetl.getStandby3(), wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3(), wrkDetl.getAnfme())); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | String orderNo = "HAND" + snowflakeIdWorker.nextId(); | 
|---|
|  |  |  | if (pakin) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (DetlDto detlDto : detlDtos) { | 
|---|
|  |  |  | // 修改订单明细数量 | 
|---|
|  |  |  | if (!orderDetlService.increase(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getBrand(),detlDto.getStandby1(),detlDto.getStandby2(),detlDto.getStandby3() | 
|---|
|  |  |  | ,detlDto.getBoxType1(),detlDto.getBoxType2(),detlDto.getBoxType3(), detlDto.getAnfme())) { | 
|---|
|  |  |  | if (!orderDetlPakoutService.increase(order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getBrand(), detlDto.getStandby1(), detlDto.getStandby2(), detlDto.getStandby3() | 
|---|
|  |  |  | , detlDto.getBoxType1(), detlDto.getBoxType2(), detlDto.getBoxType3(), detlDto.getAnfme())) { | 
|---|
|  |  |  | throw new CoolException("修改单据明细数量失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 修改订单作业数量 | 
|---|
|  |  |  | if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getBrand(),detlDto.getStandby1(),detlDto.getStandby2(),detlDto.getStandby3() | 
|---|
|  |  |  | ,detlDto.getBoxType1(),detlDto.getBoxType2(),detlDto.getBoxType3(), detlDto.getAnfme())) { | 
|---|
|  |  |  | if (!orderDetlPakoutService.increaseWorkQty(order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getBrand(), detlDto.getStandby1(), detlDto.getStandby2(), detlDto.getStandby3() | 
|---|
|  |  |  | , detlDto.getBoxType1(), detlDto.getBoxType2(), detlDto.getBoxType3(), detlDto.getAnfme())) { | 
|---|
|  |  |  | throw new CoolException("修改单据作业数量失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!this.deleteById(orderId)) { | 
|---|
|  |  |  | throw new CoolException("删除单据失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | orderDetlService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", orderId)); | 
|---|
|  |  |  | orderDetlPakoutService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", orderId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | public OrderPakout selectOrderMoveStatus() { | 
|---|
|  |  |  | return this.baseMapper.selectOrderMoveStatus(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public OrderPakout selectOrderMoveStatusInitial() { | 
|---|
|  |  |  | return this.baseMapper.selectOrderMoveStatusInitial(); | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.DocType; | 
|---|
|  |  |  | import com.zy.asrs.entity.Order; | 
|---|
|  |  |  | import com.zy.asrs.entity.OrderDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.StoreType; | 
|---|
|  |  |  | import com.zy.asrs.service.ApiLogService; | 
|---|
|  |  |  | import com.zy.asrs.service.OrderService; | 
|---|
|  |  |  | import com.zy.asrs.service.ReportToThirdService; | 
|---|
|  |  |  | import com.zy.asrs.service.StoreTypeService; | 
|---|
|  |  |  | import com.zy.nc.SendUtil; | 
|---|
|  |  |  | import com.zy.nc.entity.NccCgCgdhdWms; | 
|---|
|  |  |  | import com.zy.nc.entity.NccSaleDbddWms; | 
|---|
|  |  |  | import com.zy.nc.entity.NccSaleXsfhmxWms; | 
|---|
|  |  |  | import com.zy.nc.entity.NccScZkmxbWms; | 
|---|
|  |  |  | import com.zy.nc.entity.*; | 
|---|
|  |  |  | import com.zy.nc.service.NccScPcdaWmsService; | 
|---|
|  |  |  | import com.zy.nc.util.NcResultMessage; | 
|---|
|  |  |  | import com.zy.nc.vo.*; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderService orderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private StoreTypeService storeTypeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NccScPcdaWmsService nccScPcdaWmsService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${NYNC.ip}") | 
|---|
|  |  |  | private String nyncIp; | 
|---|
|  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "转库-出库": | 
|---|
|  |  |  | if (step == 1) { | 
|---|
|  |  |  | process2 = processGENERALOUT2(orderDetls, memo); | 
|---|
|  |  |  | process2 = processGENERALOUT2(orderDetls, order.getOperMemb(), order.getItemId(), memo); | 
|---|
|  |  |  | List<Object> zkck2 = new ArrayList<>(); | 
|---|
|  |  |  | zkck2.add(process2); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | 
|---|
|  |  |  | log.info("转库-出库1response:{}", response); | 
|---|
|  |  |  | memo = response.getData().toString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | process2 = processGENERALOUT2(orderDetls, memo); | 
|---|
|  |  |  | process2 = processGENERALOUT2(orderDetls, order.getOperMemb(), order.getItemId(), memo); | 
|---|
|  |  |  | List<Object> zkck2 = new ArrayList<>(); | 
|---|
|  |  |  | zkck2.add(process2); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param orderDetls | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private Object processGENERALOUT2(List<OrderDetl> orderDetls, String memo) { | 
|---|
|  |  |  | private Object processGENERALOUT2(List<OrderDetl> orderDetls, String renyuan, String rukucangku, String memo) { | 
|---|
|  |  |  | Object o = JSONObject.parseArray(memo).get(0); | 
|---|
|  |  |  | JSONObject jsonObject = JSONObject.parseObject(o.toString()); | 
|---|
|  |  |  | String cspecialhid = JSONObject.parseObject(jsonObject.getString("ic.WhsTransBillHeaderVO")).getString("cspecialhid"); | 
|---|
|  |  |  | 
|---|
|  |  |  | ic_generalout_b generalout_b = null; | 
|---|
|  |  |  | List<ic_generalout_b> ic_purchasein_bs = new ArrayList<>(); | 
|---|
|  |  |  | for (int i = 0; i < orderDetls.size(); i++) { | 
|---|
|  |  |  | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>().eq("vbatchcode", orderDetls.get(i).getBatch()).eq("wlbm", orderDetls.get(i).getMatnr())); | 
|---|
|  |  |  | if (nccScPcdaWms == null) { | 
|---|
|  |  |  | throw new CoolException("批次[{}]物料[{}]未找到" + orderDetls.get(i).getBatch() + orderDetls.get(i).getMatnr()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | OrderDetl orderDetl = orderDetls.get(i); | 
|---|
|  |  |  | generalout_b = new ic_generalout_b(); | 
|---|
|  |  |  | generalout_b.setCsourcebillbid(s.get(i)); | 
|---|
|  |  |  | generalout_b.setCsourcetype("4K-01"); | 
|---|
|  |  |  | generalout_b.setCsourcebillhid(cspecialhid); | 
|---|
|  |  |  | generalout_b.setCmaterialvid(orderDetl.getMatnr()); | 
|---|
|  |  |  | generalout_b.setCstateid(nccScPcdaWms.getVcode()); | 
|---|
|  |  |  | StoreType storeType = storeTypeService.selectOne(new EntityWrapper<StoreType>().eq("store_id", orderDetl.getStandby1())); | 
|---|
|  |  |  | generalout_b.setCdptvid(storeType.getDepartmentId()); | 
|---|
|  |  |  | generalout_b.setBillmaker(renyuan); | 
|---|
|  |  |  | StoreType storeType2 = storeTypeService.selectOne(new EntityWrapper<StoreType>().eq("store_id", rukucangku)); | 
|---|
|  |  |  | generalout_b.setCotherwhid(rukucangku); | 
|---|
|  |  |  | generalout_b.setCothercalbodyvid(storeType2.getDepartmentId()); | 
|---|
|  |  |  | generalout_b.setNshouldassistnum(orderDetl.getQty()); | 
|---|
|  |  |  | generalout_b.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | ic_purchasein_bs.add(generalout_b); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Scheduled(cron = "0/5 * * * * ? ") | 
|---|
|  |  |  | @Async("orderThreadPool") | 
|---|
|  |  |  | public void completeAndReportOrderInAndOutUtil() { | 
|---|
|  |  |  | //        String erpReport = Parameter.get().getErpReport(); | 
|---|
|  |  |  | //        if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { | 
|---|
|  |  |  | List<Order> orders = OrderInAndOutUtil.selectComplete(null); | 
|---|
|  |  |  | for (Order order : orders) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | ReturnT<String> result = orderSyncHandler.startOrderInAndOutUtil(order); | 
|---|
|  |  |  | if (!result.isSuccess()) { | 
|---|
|  |  |  | log.error("单据[orderNo={}]转上报表失败", order.getOrderNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error(e.getMessage()); | 
|---|
|  |  |  | log.error("单据[orderNo={}]转上报表失败", order.getOrderNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //@Scheduled(cron = "0/5 * * * * ? ") | 
|---|
|  |  |  | //@Async("orderThreadPool") | 
|---|
|  |  |  | public void completeAndReportOrderInAndOutUtil2() { | 
|---|
|  |  |  | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Scheduled(cron = "0/5 * * * * ? ") | 
|---|
|  |  |  | @Async("orderThreadPool") | 
|---|
|  |  |  | public void completeAndReportOrderInAndOutUtil() { | 
|---|
|  |  |  | //        String erpReport = Parameter.get().getErpReport(); | 
|---|
|  |  |  | //        if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { | 
|---|
|  |  |  | List<Order> orders = OrderInAndOutUtil.selectComplete(null); | 
|---|
|  |  |  | for (Order order : orders) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | ReturnT<String> result = orderSyncHandler.startOrderInAndOutUtil(order); | 
|---|
|  |  |  | if (!result.isSuccess()) { | 
|---|
|  |  |  | log.error("单据[orderNo={}]转上报表失败", order.getOrderNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error(e.getMessage()); | 
|---|
|  |  |  | log.error("单据[orderNo={}]转上报表失败", order.getOrderNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Scheduled(cron = "0/30 * * * * ? ") | 
|---|
|  |  |  | @Async("orderThreadPool") | 
|---|
|  |  |  | public void completeAndReportOrderReport() { | 
|---|
|  |  |  | 
|---|
|  |  |  | private OrderDetlService orderDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderDetlPakoutService orderDetlPakoutService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WrkDetlService wrkDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private InventoryCheckOrderDetlService inventoryCheckOrderDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | List<OrderDetl> orderDetlList = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (OrderDetl detail : orderDetls) { | 
|---|
|  |  |  | DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(), detail.getBrand(), detail.getStandby1(), detail.getStandby2(), detail.getStandby3(), | 
|---|
|  |  |  | detail.getBoxType1(), detail.getBoxType2(), detail.getBoxType3(), detail.getAnfme()); | 
|---|
|  |  |  | DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(), detail.getBrand(), detail.getStandby1(), detail.getStandby2(), detail.getStandby3(), detail.getBoxType1(), detail.getBoxType2(), detail.getBoxType3(), detail.getAnfme()); | 
|---|
|  |  |  | if (DetlDto.has(list, dto)) { | 
|---|
|  |  |  | DetlDto detlDto = DetlDto.find(list, dto.getMatnr(), dto.getBatch(), dto.getBrand(), dto.getStandby1(), dto.getStandby2(), dto.getStandby3(), dto.getBoxType1(), dto.getBoxType2(), dto.getBoxType3()); | 
|---|
|  |  |  | assert detlDto != null; | 
|---|
|  |  |  | 
|---|
|  |  |  | if (null == docType) { | 
|---|
|  |  |  | return SUCCESS; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        if (docType.getDocName().equals("销售发货")) { | 
|---|
|  |  |  | //            return SUCCESS; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | if (docType.getDocName().equals("销售发货")) { | 
|---|
|  |  |  | return SUCCESS; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Order orderSou = orderService.selectByNo(order.getOrderNo()); | 
|---|
|  |  |  | if (!orderSou.getSettle().equals(2L)) { | 
|---|
|  |  |  | return FAIL.setMsg("订单状态不正确,请联系管理员"); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (orderDetl.getQty().equals(0D)) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(orderDetlSou.getBatch())){ | 
|---|
|  |  |  | if (orderDetlSou.beSimilar(orderDetl)) { | 
|---|
|  |  |  | double v = orderDetlSou.getAnfme() - orderDetlSou.getQty(); | 
|---|
|  |  |  | if (v < orderDetl.getQty() || orderDetl.getQty().equals(v)) { | 
|---|
|  |  |  | orderDetlSou.setQty(orderDetlSou.getAnfme()); | 
|---|
|  |  |  | orderDetl.setQty(orderDetl.getQty() - v); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | orderDetlSou.setQty(orderDetlSou.getQty() + orderDetl.getQty()); | 
|---|
|  |  |  | orderDetl.setQty(0D); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | if (orderDetlSou.beSimilar2(orderDetl)) { | 
|---|
|  |  |  | double v = orderDetlSou.getAnfme() - orderDetlSou.getQty(); | 
|---|
|  |  |  | if (v < orderDetl.getQty() || orderDetl.getQty().equals(v)) { | 
|---|
|  |  |  | orderDetlSou.setQty(orderDetlSou.getAnfme()); | 
|---|
|  |  |  | orderDetl.setQty(orderDetl.getQty() - v); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | orderDetlSou.setQty(orderDetlSou.getQty() + orderDetl.getQty()); | 
|---|
|  |  |  | orderDetl.setQty(0D); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (orderDetlSou.beSimilar(orderDetl)) { | 
|---|
|  |  |  | double v = orderDetlSou.getAnfme() - orderDetlSou.getQty(); | 
|---|
|  |  |  | if (v < orderDetl.getQty() || orderDetl.getQty().equals(v)) { | 
|---|
|  |  |  | orderDetlSou.setQty(orderDetlSou.getAnfme()); | 
|---|
|  |  |  | orderDetl.setQty(orderDetl.getQty() - v); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | orderDetlSou.setQty(orderDetlSou.getQty() + orderDetl.getQty()); | 
|---|
|  |  |  | orderDetl.setQty(0D); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (complete) { | 
|---|
|  |  |  | if (!orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_id", order.getId()))) { | 
|---|
|  |  |  | throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(order.getOrderNo()); | 
|---|
|  |  |  | for (WrkDetl wrkDetl : wrkDetls) { | 
|---|
|  |  |  | OrderDetl orderDetl = new OrderDetl(); | 
|---|
|  |  |  | orderDetl.sync(wrkDetl); | 
|---|
|  |  |  | orderDetl.setQty(wrkDetl.getAnfme()); | 
|---|
|  |  |  | orderDetl.setOrderId(order.getId()); | 
|---|
|  |  |  | orderDetl.setOrderNo(order.getOrderNo()); | 
|---|
|  |  |  | orderDetl.setStatus(1); | 
|---|
|  |  |  | orderDetl.setCreateTime(order.getCreateTime()); | 
|---|
|  |  |  | orderDetl.setCreateBy(order.getCreateBy()); | 
|---|
|  |  |  | orderDetl.setUpdateTime(order.getUpdateTime()); | 
|---|
|  |  |  | orderDetl.setUpdateBy(order.getUpdateBy()); | 
|---|
|  |  |  | if (!orderDetlService.insert(orderDetl)) { | 
|---|
|  |  |  | throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 修改订单状态 2.作业中 ===>> 4.待上报 | 
|---|
|  |  |  | if (!orderService.updateSettle(orderSou.getId(), 4L, null)) { | 
|---|
|  |  |  | throw new CoolException("服务器内部错误,请联系管理员"); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.nc.entity; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableName; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @TableName ncc_sc_pcda_wms | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @TableName(value ="ncc_sc_pcda_wms") | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | public class NccScPcdaWms { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String vcode; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String vname; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String pkBatchcode; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String vbatchcode; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String wlbm; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String ts; | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.nc.mapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.BaseMapper; | 
|---|
|  |  |  | import com.zy.nc.entity.NccScPcdaWms; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author zc857 | 
|---|
|  |  |  | * @description 针对表【ncc_sc_pcda_wms】的数据库操作Mapper | 
|---|
|  |  |  | * @createDate 2025-06-04 16:01:00 | 
|---|
|  |  |  | * @Entity com.zy.nc.entity.NccScPcdaWms | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public interface NccScPcdaWmsMapper extends BaseMapper<NccScPcdaWms> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.nc.service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.IService; | 
|---|
|  |  |  | import com.zy.nc.entity.NccScPcdaWms; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author zc857 | 
|---|
|  |  |  | * @description 针对表【ncc_sc_pcda_wms】的数据库操作Service | 
|---|
|  |  |  | * @createDate 2025-06-04 16:01:00 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public interface NccScPcdaWmsService extends IService<NccScPcdaWms> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.nc.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.zy.nc.entity.NccScPcdaWms; | 
|---|
|  |  |  | import com.zy.nc.service.NccScPcdaWmsService; | 
|---|
|  |  |  | import com.zy.nc.mapper.NccScPcdaWmsMapper; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author zc857 | 
|---|
|  |  |  | * @description 针对表【ncc_sc_pcda_wms】的数据库操作Service实现 | 
|---|
|  |  |  | * @createDate 2025-06-04 16:01:00 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class NccScPcdaWmsServiceImpl extends ServiceImpl<NccScPcdaWmsMapper, NccScPcdaWms> | 
|---|
|  |  |  | implements NccScPcdaWmsService{ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!returnT.isSuccess()) { | 
|---|
|  |  |  | for (NccSaleXsfhmxWms wms : wmsFlag) { | 
|---|
|  |  |  | wms.setWmsMemo(returnT.getMsg()); | 
|---|
|  |  |  | wms.setWmsFlag(0); | 
|---|
|  |  |  | nccSaleXsfhmxWmsService.updateById(wms); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.error(returnT.getMsg()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!returnT.isSuccess()) { | 
|---|
|  |  |  | for (NccScZkmxbWms wms : wmsFlag) { | 
|---|
|  |  |  | wms.setWmsMemo(returnT.getMsg()); | 
|---|
|  |  |  | wms.setWmsFlag(0); | 
|---|
|  |  |  | nccScZkmxbWmsService.updateById(wms); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.error(returnT.getMsg()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!returnT.isSuccess()) { | 
|---|
|  |  |  | for (NccScZkmxbWms wms : wmsFlag) { | 
|---|
|  |  |  | wms.setWmsMemo(returnT.getMsg()); | 
|---|
|  |  |  | wms.setWmsFlag(0); | 
|---|
|  |  |  | nccScZkmxbWmsService.updateById(wms); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.error(returnT.getMsg()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!returnT.isSuccess()) { | 
|---|
|  |  |  | for (NccCgCgdhdWms wms : wmsFlag) { | 
|---|
|  |  |  | wms.setWmsMemo(returnT.getMsg()); | 
|---|
|  |  |  | wms.setWmsFlag(0); | 
|---|
|  |  |  | nccCgCgdhdWmsService.updateById(wms); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.error(returnT.getMsg()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!returnT.isSuccess()) { | 
|---|
|  |  |  | for (NccSaleDbddWms wms : wmsFlag) { | 
|---|
|  |  |  | wms.setWmsMemo(returnT.getMsg()); | 
|---|
|  |  |  | wms.setWmsFlag(0); | 
|---|
|  |  |  | nccSaleDbddWmsService.updateById(wms); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.error(returnT.getMsg()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!returnT.isSuccess()) { | 
|---|
|  |  |  | for (NccCkPddWms wms : wmsFlag) { | 
|---|
|  |  |  | wms.setWmsMemo(returnT.getMsg()); | 
|---|
|  |  |  | wms.setWmsFlag(0); | 
|---|
|  |  |  | nccCkPddWmsService.updateById(wms); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.error(returnT.getMsg()); | 
|---|
|  |  |  | 
|---|
|  |  |  | storeType.setStoreId(nccJcCkWms.getCode()); | 
|---|
|  |  |  | storeType.setCreateBy(1L); | 
|---|
|  |  |  | storeType.setCreateTime(new Date()); | 
|---|
|  |  |  | storeType.setDepartmentId((Cools.isEmpty(nccJcCkWms.getDef3()) || "~".equals(nccJcCkWms.getDef3())) ? null : nccJcCkWms.getDef3()); | 
|---|
|  |  |  | //storeType.setDepartment(); | 
|---|
|  |  |  | storeTypeService.insert(storeType); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | storeType.setStoreName(nccJcCkWms.getName()); | 
|---|
|  |  |  | storeType.setDepartmentId((Cools.isEmpty(nccJcCkWms.getDef3()) || "~".equals(nccJcCkWms.getDef3())) ? null : nccJcCkWms.getDef3()); | 
|---|
|  |  |  | storeTypeService.updateById(storeType); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | nccJcCkWms.setWmsFlag(1); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String csourcebillbid; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String  csourcetype; | 
|---|
|  |  |  | private String csourcetype; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String   csourcebillhid; | 
|---|
|  |  |  | private String csourcebillhid; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String cstateid; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String cdptvid; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String billmaker; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String  cotherwhid; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String cothercalbodyvid; | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <?xml version="1.0" encoding="UTF-8"?> | 
|---|
|  |  |  | <!DOCTYPE mapper | 
|---|
|  |  |  | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | 
|---|
|  |  |  | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
|---|
|  |  |  | <mapper namespace="com.zy.nc.mapper.NccScPcdaWmsMapper"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.zy.nc.entity.NccScPcdaWms"> | 
|---|
|  |  |  | <result property="vcode" column="VCODE" /> | 
|---|
|  |  |  | <result property="vname" column="VNAME" /> | 
|---|
|  |  |  | <result property="pkBatchcode" column="PK_BATCHCODE" /> | 
|---|
|  |  |  | <result property="vbatchcode" column="VBATCHCODE" /> | 
|---|
|  |  |  | <result property="wlbm" column="WLBM" /> | 
|---|
|  |  |  | <result property="ts" column="TS" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | VCODE,VNAME,PK_BATCHCODE,VBATCHCODE,WLBM,TS | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | </mapper> | 
|---|