src/main/java/com/zy/asrs/entity/param/CombParam.java
@@ -19,10 +19,14 @@ // 库位编号 private String locNo; private List<CombMat> combMats; @Data public static class CombMat { // 条码 private String vbarcode; private String orderNo; @@ -36,9 +40,9 @@ private String standby2 = ""; private String standby3 = ""; private String boxType1 = "1"; private String boxType2 = "1"; private String boxType3 = "1"; private String boxType1 = ""; private String boxType2 = ""; private String boxType3 = ""; // 物料数量 private Double anfme; src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1,24 +1,24 @@ package com.zy.asrs.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; import com.core.common.*; import com.core.common.BaseRes; import com.core.common.Cools; import com.core.common.R; import com.core.common.SnowflakeIdWorker; import com.core.exception.CoolException; import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.*; import com.zy.asrs.mapper.LocMastMapper; import com.zy.asrs.mapper.ManLocDetlMapper; import com.zy.asrs.service.*; import com.zy.asrs.utils.MatUtils; import com.zy.asrs.utils.OrderInAndOutUtil; import com.zy.common.entity.Parameter; import com.zy.common.model.DetlDto; import com.zy.common.model.MesCombParam; import com.zy.common.model.enums.WorkNoType; import com.zy.common.service.CommonService; import com.zy.common.utils.HttpHandler; import com.zy.nc.entity.NccJcQilibcBarcodeflowWms; import com.zy.nc.service.NccJcQilibcBarcodeflowWmsService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -95,16 +95,19 @@ @Resource private OrderDetlPakoutService orderDetlPakoutService; @Autowired private NccJcQilibcBarcodeflowWmsService barcodeflowWmsService; @Override @Transactional public R WarehouseOutPickMergeV1(WarehouseOutPickMergeParam param, Long hostId, Long userId) { //判断库位状态 LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo())); if (Cools.isEmpty(locMast)){ if (Cools.isEmpty(locMast)) { return R.error("该库位不存在"); } if (!locMast.getLocSts().equals("P")){ return R.error("该库位状态为:"+locMast.getLocSts()+",不满足拣料途中并板条件!!!"); if (!locMast.getLocSts().equals("P")) { return R.error("该库位状态为:" + locMast.getLocSts() + ",不满足拣料途中并板条件!!!"); } Date now = new Date(); @@ -134,7 +137,7 @@ wrkMastService.insert(wrkMast); for (OrderDetl orderDetl : param.getCombMats()) { Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr",orderDetl.getMatnr())); Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", orderDetl.getMatnr())); if (mat == null) { throw new CoolException("保存工作档失败,物料信息不存在:" + orderDetl.getMatnr()); } @@ -150,7 +153,7 @@ wrkDetl.setModiUser(userId); wrkDetl.setZpallet(wrkMast.getBarcode()); wrkDetl.setBatch(orderDetl.getBatch()); if(Cools.isEmpty(orderDetl.getBatch())){ if (Cools.isEmpty(orderDetl.getBatch())) { wrkDetl.setBatch(""); } wrkDetl.setBoxType1(orderDetl.getBoxType1()); @@ -164,11 +167,11 @@ if (!Cools.isEmpty(orderDetl.getOrderNo())) { OrderPakin order = orderPakinService.selectByNo(orderDetl.getOrderNo()); if (Cools.isEmpty(order)){ if (Cools.isEmpty(order)) { continue; } OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch(),orderDetl.getBrand(),orderDetl.getStandby1(),orderDetl.getStandby2(),orderDetl.getStandby3(),orderDetl.getBoxType1(),orderDetl.getBoxType2(),orderDetl.getBoxType3()); if (Cools.isEmpty(orderDetlPakin)){ OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(), orderDetl.getStandby3(), orderDetl.getBoxType1(), orderDetl.getBoxType2(), orderDetl.getBoxType3()); if (Cools.isEmpty(orderDetlPakin)) { continue; } if (orderDetlPakin.getAnfme() < (orderDetlPakin.getWorkQty() + orderDetl.getAnfme())) { @@ -176,11 +179,11 @@ } // 修改订单明细作业数量 if (!orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), orderDetlPakin.getMatnr(), orderDetlPakin.getBatch(), orderDetlPakin.getBrand(), orderDetlPakin.getStandby1(), orderDetlPakin.getStandby2(), orderDetlPakin.getStandby3(), orderDetlPakin.getBoxType1(), orderDetlPakin.getBoxType2(), orderDetlPakin.getBoxType3(),orderDetl.getAnfme())) { orderDetlPakin.getStandby1(), orderDetlPakin.getStandby2(), orderDetlPakin.getStandby3(), orderDetlPakin.getBoxType1(), orderDetlPakin.getBoxType2(), orderDetlPakin.getBoxType3(), orderDetl.getAnfme())) { throw new CoolException("修改单据明细工作数量失败"); } if (order.getSettle() == 1){ if (order.getSettle() == 1) { orderPakinService.updateSettle(order.getId(), 2L, userId); } } @@ -191,7 +194,7 @@ @Override @Transactional public R pickConfirm(PickConfirmParam param,Long userId) { public R pickConfirm(PickConfirmParam param, Long userId) { LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() .eq("loc_no", param.getLocNo())); @@ -215,9 +218,9 @@ //检验传参是否和订单明细匹配 for (PickMatParam matParam : param.getList()) { orderDetlPakin = orderDetlPakinService.selectItem (matParam.getOrderNo(), matParam.getMatnr(),matParam.getBatch(),matParam.getBrand(), matParam.getStandby1(),matParam.getStandby2(),matParam.getStandby3(), matParam.getBoxType1(),matParam.getBoxType2(),matParam.getBoxType3()); (matParam.getOrderNo(), matParam.getMatnr(), matParam.getBatch(), matParam.getBrand(), matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(), matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3()); if (orderDetlPakin == null) { return R.error("物料数据不存在"); } @@ -281,7 +284,7 @@ wrkDetl.setModiTime(now); wrkDetl.setModiUser(userId); wrkDetl.setZpallet(wrkMast.getBarcode()); if(Cools.isEmpty(matParam.getBatch())){ if (Cools.isEmpty(matParam.getBatch())) { wrkDetl.setBatch(""); } if (!wrkDetlService.insert(wrkDetl)) { @@ -290,10 +293,10 @@ //更新订单工作数量 orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), matParam.getMatnr(), matParam.getBatch(),matParam.getBrand(),matParam.getStandby1(),matParam.getStandby2(),matParam.getStandby3(), matParam.getBoxType1(),matParam.getBoxType2(),matParam.getBoxType3(),matParam.getUseCount()); matParam.getBatch(), matParam.getBrand(), matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(), matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3(), matParam.getUseCount()); // 更新工作档状态 orderPakinService.updateSettle(orderDetlPakin.getOrderId(),2L,userId); orderPakinService.updateSettle(orderDetlPakin.getOrderId(), 2L, userId); } // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo())); @@ -316,47 +319,47 @@ public R WarehouseOutV1(CombParam combParam, Long hostId, Long userId) { //判断库位状态 LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", combParam.getLocNo())); if (Cools.isEmpty(locMast)){ if (Cools.isEmpty(locMast)) { return R.error("该库位不存在"); } if (!locMast.getLocSts().equals("P")){ return R.error("该库位状态为:"+locMast.getLocSts()+",不满足并板途中拣选条件!!!"); if (!locMast.getLocSts().equals("P")) { return R.error("该库位状态为:" + locMast.getLocSts() + ",不满足并板途中拣选条件!!!"); } //查询库存数据 for (CombParam.CombMat combMat :combParam.getCombMats()){ for (CombParam.CombMat combMat : combParam.getCombMats()) { List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>() .eq("loc_no", combParam.getLocNo()) .eq("matnr", combMat.getMatnr()) .eq("loc_no", combParam.getLocNo()) .eq("matnr", combMat.getMatnr()) ); if (locDetlList.isEmpty()){ if (locDetlList.isEmpty()) { return R.error("未查询到库存数据"); } if (locDetlList.size()>1){ if (locDetlList.size() > 1) { return R.error("库存数据大于1条,为保证数据准确性,请用正常流程出库!!!"); } LocDetl locDetl = locDetlList.get(0); if (combMat.getAnfme() > locDetl.getAnfme()){ if (combMat.getAnfme() > locDetl.getAnfme()) { return R.error("拣选数量错误,超出库存数量"); } if (!Cools.isEmpty(combMat.getOrderNo())){ if (!Cools.isEmpty(combMat.getOrderNo())) { OrderPakout orderPakout = orderPakoutService.selectByNo(combMat.getOrderNo()); if (Cools.isEmpty(orderPakout)){ if (Cools.isEmpty(orderPakout)) { continue; } if (orderPakout.getSettle() == 1){ OrderInAndOutUtil.updateOrder(false,orderPakout.getId(), 2L, 9527L); if (orderPakout.getSettle() == 1) { OrderInAndOutUtil.updateOrder(false, orderPakout.getId(), 2L, 9527L); } OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(orderPakout.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getBrand(), combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3()); if (Cools.isEmpty(orderDetlPakout)){ if (Cools.isEmpty(orderDetlPakout)) { continue; } if (orderDetlPakout.getAnfme() < (orderDetlPakout.getWorkQty()+combMat.getAnfme())){ if (orderDetlPakout.getAnfme() < (orderDetlPakout.getWorkQty() + combMat.getAnfme())) { throw new CoolException("拣选数量出错,订单剩余出库数量小于已出库数量与将拣选数量之和!!!"); } // 修改订单明细作业数量 if (!orderDetlPakoutService.increaseWorkQty(orderDetlPakout.getOrderId(), combMat.getMatnr(), combMat.getBatch(), combMat.getBrand(), combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3(),combMat.getAnfme())) { combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3(), combMat.getAnfme())) { throw new CoolException("修改单据明细工作数量失败"); } // // 修改订单明细完成数量 @@ -394,7 +397,7 @@ wrkMast.setModiUser(userId); wrkMastService.insert(wrkMast); Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr",combMat.getMatnr())); Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", combMat.getMatnr())); if (mat == null) { throw new CoolException("保存工作档失败,物料信息不存在:" + combMat.getMatnr()); } @@ -411,7 +414,7 @@ wrkDetl.setModiUser(userId); wrkDetl.setZpallet(wrkMast.getBarcode()); wrkDetl.setBatch(combMat.getBatch()); if(Cools.isEmpty(combMat.getBatch())){ if (Cools.isEmpty(combMat.getBatch())) { wrkDetl.setBatch(""); } wrkDetl.setBoxType1(combMat.getBoxType1()); @@ -424,8 +427,8 @@ wrkDetlService.insert(wrkDetl); System.out.println("正常"); }catch (Exception e) { throw new CoolException("操作数据异常:"+e.getMessage()); } catch (Exception e) { throw new CoolException("操作数据异常:" + e.getMessage()); } } return R.ok("操作成功!"); @@ -508,7 +511,7 @@ Wrapper<OrderDetl> wrapper1 = new EntityWrapper<>(); wrapper1.eq("status", 1); wrapper1.in("order_id", orderIds); wrapper1.orderBy("create_time",false); wrapper1.orderBy("create_time", false); if (!Cools.isEmpty(matnr)) { wrapper1.like("matnr", matnr); } @@ -543,7 +546,7 @@ if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { throw new CoolException(BaseRes.PARAM); } if(param.getCombMats().size()>1){ if (param.getCombMats().size() > 1) { throw new CoolException("请提取一个商品,或者刷新重新组托!"); } // 判断是否有相同条码的数据 @@ -552,16 +555,16 @@ throw new CoolException(param.getBarcode() + "数据正在进行入库"); } if(param.getBarcode().length()!=8){ if (param.getBarcode().length() != 8) { throw new CoolException("条码长度不是8位===>>" + param.getBarcode()); } if (param.getCombMats().size()>1){ if (param.getCombMats().size() > 1) { throw new CoolException("不允许混料===>>" + param.getBarcode()); } int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode())); int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode())); int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode())); int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); if (countLoc > 0 || countWrk > 0 || countwait > 0) { throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode()); } @@ -574,8 +577,8 @@ // 生成入库通知档 List<DetlDto> detlDtos = new ArrayList<>(); param.getCombMats().forEach(elem -> { DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); if (DetlDto.has(detlDtos, detlDto)) { DetlDto one = DetlDto.findDto(detlDtos, detlDto); assert one != null; @@ -606,7 +609,7 @@ throw new CoolException("保存入库通知档失败"); } } // 关联组托 // 关联组托 } else { // Order order = orderService.selectByNo(param.getOrderNo()); Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, param.getOrderNo()); @@ -615,12 +618,20 @@ } // 生成入库通知档 List<DetlDto> detlDtos = new ArrayList<>(); param.getCombMats().forEach(elem -> { // TODO 不考虑代码效率,因为旧代码bug少 if (!Cools.isEmpty(elem.getVbarcode())) { NccJcQilibcBarcodeflowWms vbarcode1 = barcodeflowWmsService.selectOne(new EntityWrapper<NccJcQilibcBarcodeflowWms>().eq("vbarcode", elem.getVbarcode())); elem.setBatch(vbarcode1.getVbatchcode()); elem.setMatnr(vbarcode1.getWlbm()); elem.setAnfme(vbarcode1.getNastnum().doubleValue()); } // 订单明细数量校验 // OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3()); OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3()); if (elem.getAnfme() > orderDetl.getEnableQty()) { throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); } @@ -628,10 +639,10 @@ // if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { // throw new CoolException("修改单据作业数量失败"); // } OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE,order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); if (DetlDto.has(detlDtos, detlDto)) { DetlDto one = DetlDto.findDto(detlDtos, detlDto); assert one != null; @@ -662,7 +673,7 @@ } } // orderService.updateSettle(order.getId(), 2L, userId); OrderInAndOutUtil.updateOrder(Boolean.TRUE,order.getId(), 2L, userId); OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId); } } @@ -679,15 +690,15 @@ } // 获取商品列表 for(CombParam.CombMat combMat : param.getCombMats()){ for (CombParam.CombMat combMat : param.getCombMats()) { Mat mat = matService.selectByMatnr(combMat.getMatnr()); if (Cools.isEmpty(mat)){ if (Cools.isEmpty(mat)) { throw new CoolException(combMat.getMatnr() + ":商品档案不存在!"); } if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme()==0){ if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme() == 0) { throw new CoolException(combMat.getMatnr() + ":商品数量有误!"); } if (Cools.isEmpty(combMat.getBatch())){ if (Cools.isEmpty(combMat.getBatch())) { // throw new CoolException(combMat.getMatnr() + ":商品批号有误!"); } ManLocDetl manLocDetl = new ManLocDetl(); @@ -708,16 +719,16 @@ @Override public void offSale(OffSaleParam offSaleParam) { ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); if (Cools.isEmpty(manLocDetl)){ if (Cools.isEmpty(manLocDetl)) { throw new CoolException("无此商品!"); } double anfme = manLocDetl.getAnfme() - offSaleParam.getAnfme(); if (anfme < 0) { throw new CoolException("商品库存不足!"); } else if (anfme == 0){ } else if (anfme == 0) { manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); } manLocDetlMapper.updateAnfme0(anfme,manLocDetl.getNodeId()); manLocDetlMapper.updateAnfme0(anfme, manLocDetl.getNodeId()); } // 查找商品 @@ -776,7 +787,9 @@ // 添加明细 for (WrkDetl wrkDetl : list) { if (wrkDetl.getAnfme() == 0.0D) { continue; } if (wrkDetl.getAnfme() == 0.0D) { continue; } // todo 盘点记录、保存调整记录 String orderNo = wrkDetl.getOrderNo(); Mat mat = matService.selectByMatnr(wrkDetl.getMatnr()); @@ -792,7 +805,7 @@ } // 修改盘点任务主档状态 wrkMast.setFullPlt(wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()).size() != 0?"Y":"N"); wrkMast.setFullPlt(wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()).size() != 0 ? "Y" : "N"); wrkMast.setModiTime(now); wrkMast.setModiUser(userId); if (!wrkMastService.updateById(wrkMast)) { @@ -977,7 +990,7 @@ //根据订单号生成出库任务工作档 Order order = OrderInAndOutUtil.selectByNo(Boolean.FALSE, orderNo); // Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", orderNo)); if (order.getSettle() != 1 && order.getSettle() != 2){ if (order.getSettle() != 1 && order.getSettle() != 2) { throw new CoolException("该订单已处理"); } @@ -985,13 +998,13 @@ List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(Boolean.FALSE, order.getId()); Date now = new Date(); for(OrderDetl orderDetl : orderDetls){ for (OrderDetl orderDetl : orderDetls) { //查询所有库位状态为F的库位信息 List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(),orderDetl.getBatch(),null,null); List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, null); if (locDetls.size() == 0) { throw new CoolException("库存中没有该物料"); } for(LocDetl locDetl : locDetls){ for (LocDetl locDetl : locDetls) { //如果该库位出库路线所用的堆垛机out_enable不为Y,跳过该循环 LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() .eq("loc_no", locDetl.getLocNo())); @@ -1000,13 +1013,13 @@ } BasCrnp crn_no = basCrnpService.selectOne(new EntityWrapper<BasCrnp>() .eq("crn_no", locMast.getCrnNo())); if (Cools.isEmpty(crn_no) || !crn_no.getOutEnable().equals("Y")){ if (Cools.isEmpty(crn_no) || !crn_no.getOutEnable().equals("Y")) { continue; } //可出库数量 = 订单数量 - 作业中数量 Double outQty = orderDetl.getAnfme() - orderDetl.getWorkQty(); if(outQty <= 0){ if (outQty <= 0) { break; } // 判断入出库类型:101.全板出库 or 103.拣料出库 @@ -1021,19 +1034,19 @@ // if(!orderService.update(order, new EntityWrapper<Order>().eq("order_no", orderNo))){ // throw new CoolException("更新订单状态失败"); // } OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(),order.getId(),2L,userId); OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(), order.getId(), 2L, userId); orderDetl.setWorkQty(orderDetl.getWorkQty() + curOutQty); orderDetl.setUpdateBy(userId); orderDetl.setUpdateTime(now); Wrapper wrapper = new EntityWrapper<OrderDetl>().eq("order_no", orderNo) .eq("matnr",orderDetl.getMatnr()); if(!Cools.isEmpty(orderDetl.getBatch())){ .eq("matnr", orderDetl.getMatnr()); if (!Cools.isEmpty(orderDetl.getBatch())) { wrapper.eq("batch", orderDetl.getBatch()); } // if(!orderDetlService.update(orderDetl, wrapper)){ // throw new CoolException("更新订单明细失败"); // } OrderInAndOutUtil.updateOrderDetl(order.getPakinPakoutStatus$(),order,orderDetl); OrderInAndOutUtil.updateOrderDetl(order.getPakinPakoutStatus$(), order, orderDetl); } src/main/java/com/zy/asrs/service/impl/ReportToThirdServiceImpl.java
@@ -12,7 +12,9 @@ import com.zy.asrs.service.ReportToThirdService; 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.util.NcResultMessage; import com.zy.nc.vo.*; import lombok.extern.slf4j.Slf4j; @@ -44,14 +46,27 @@ @Value("${NYNC.saveRefDelivery}") private String saveRefDelivery; @Value("${NYNC.saveRefWhsTrans}") private String saveRefWhsTrans; @Value("${NYNC.purchasein}") private String purchasein; @Value("${NYNC.whstrans}") private String whstrans; @Value("${NYNC.generalout}") private String generalout; @Value("${NYNC.dbdd}") private String dbdd; @Override public void report(Order order, List<OrderDetl> orderDetls, DocType docType) { int step = (Cools.isEmpty(order.getStep()) || order.getStep() == 0) ? 0 : order.getStep(); NcResultMessage response = null; Object process1 = null; Object process2 = null; Object process3 = null; try { switch (order.getDocType$().toString()) { case "销售发货": @@ -59,78 +74,50 @@ //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); log.info("销售发货response:{}", response); step = 10; } break; case "转库": process1 = processQTRK(orderDetls); case "转库-入库": process1 = processZKRK(orderDetls); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1)); response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefWhsTrans, JSONObject.toJSONString(process1)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); log.info("转库-入库response:{}", response); step = 10; } break; case "采购到货": process1 = processCGDH(orderDetls); List<Object> cg = new ArrayList<>(); cg.add(process1); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1)); response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); log.info("采购到货response:{}", response); step = 10; } break; case "产成品入库单": if (step == 2) { process3 = processQTRK(orderDetls); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process3)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); step = 10; } } else if (step == 1) { process2 = processGENERALOUT(orderDetls); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process2)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); step = 2; } process3 = processQTRK(orderDetls); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process3)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); step = 10; } } else if (step == 0) { process1 = processZK(orderDetls); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); step = 1; } process2 = processGENERALOUT(orderDetls); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process2)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); step = 2; } process3 = processQTRK(orderDetls); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process3)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("response:{}", response); step = 10; } case "转库-出库": process1 = processGENERALOUT(orderDetls); List<Object> zkck = new ArrayList<>(); zkck.add(process1); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, generalout, JSONObject.toJSONString(zkck)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("转库-出库response:{}", response); step = 10; } break; // case "内部调拨": // break; case "集团内部调拨": process1 = processDBDD(orderDetls); //发送请求 response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, dbdd, JSONObject.toJSONString(process1)); if (!Cools.isEmpty(response) && response.isSuccess()) { log.info("集团内部调拨response:{}", response); step = 10; } break; default: throw new CoolException("不能识别的单据类型"); } @@ -190,8 +177,7 @@ return data; } private Object processQTRK(List<OrderDetl> orderDetls) { private Object processZKRK(List<OrderDetl> orderDetls) { //组装对象数据 Map<String, Object> data = new HashMap<String, Object>(); GeneralInHeadVO generalInHeadVO = new GeneralInHeadVO(); @@ -203,14 +189,14 @@ generalInBodyVO = new GeneralInBodyVO(); String remark = orderDetl.getRemark(); if (!Cools.isEmpty(remark)) { NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); generalInBodyVO.setCsourcetype("4331"); generalInBodyVO.setClocationid("610101"); generalInBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid()); generalInBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid()); NccScZkmxbWms nccScZkmxbWms = JSONObject.parseObject(remark, NccScZkmxbWms.class); generalInBodyVO.setCsourcebillbid(nccScZkmxbWms.getCspecialbid()); //generalInBodyVO.setCsourcebillhid(nccScZkmxbWms.getCdeliveryid()); //generalInBodyVO.setCmaterialvid(orderDetl.getMatnr()); generalInBodyVO.setNnum(orderDetl.getQty()); generalInBodyVO.setNshouldnum(orderDetl.getAnfme()); generalInBodyVO.setVbatchcode(orderDetl.getBatch()); generalInBodyVO.setCmaterialoid(orderDetl.getMatnr()); } generalInBodyVOS.add(generalInBodyVO); } @@ -220,33 +206,36 @@ } private Object processZK(List<OrderDetl> orderDetls) { private Object processDBDD(List<OrderDetl> orderDetls) { //组装对象数据 Map<String, Object> data = new HashMap<String, Object>(); WhsTransBillHeaderVO whsTransBillHeaderVO = new WhsTransBillHeaderVO(); whsTransBillHeaderVO.setPk_org("FYT"); whsTransBillHeaderVO.setCwarehouseid("6101"); WhsTransBillBodyVO whsTransBillBodyVO = null; List<WhsTransBillBodyVO> whsTransBillBodyVOS = new ArrayList<>(); IaIjBill iaIjBill = new IaIjBill(); iaIjBill.setPk_org("FYT"); //iaIjBill.setCwarehouseid("6101"); IaIjBillB iaIjBillB = null; List<IaIjBillB> iaIjBillBS = new ArrayList<>(); for (OrderDetl orderDetl : orderDetls) { whsTransBillBodyVO = new WhsTransBillBodyVO(); iaIjBillB = new IaIjBillB(); String remark = orderDetl.getRemark(); if (!Cools.isEmpty(remark)) { NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); whsTransBillBodyVO.setCsourcetype("4331"); whsTransBillBodyVO.setClocationid("610101"); whsTransBillBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid()); whsTransBillBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid()); whsTransBillBodyVO.setNnum(orderDetl.getQty()); whsTransBillBodyVO.setVbatchcode(orderDetl.getBatch()); whsTransBillBodyVO.setCmaterialoid(orderDetl.getMatnr()); NccSaleDbddWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleDbddWms.class); iaIjBillB.setCinventoryid(nccSaleXsfhmxWms.getWlbm()); iaIjBillB.setCinventoryvid(nccSaleXsfhmxWms.getWlbm()); iaIjBillB.setCsrcid(nccSaleXsfhmxWms.getCbillid()); iaIjBillB.setNnum(orderDetl.getQty().intValue() + ""); iaIjBillB.setPk_org("FYT"); } whsTransBillBodyVOS.add(whsTransBillBodyVO); iaIjBillBS.add(iaIjBillB); } data.put("WhsTransBillHeaderVO", whsTransBillHeaderVO); data.put("WhsTransBillBodyVO", whsTransBillBodyVOS); data.put("ia_ijbill", iaIjBill); data.put("ia_ijbill_b", iaIjBillBS); return data; } private Object processCGDH(List<OrderDetl> orderDetls) { //组装对象数据 @@ -261,17 +250,18 @@ String remark = orderDetl.getRemark(); if (!Cools.isEmpty(remark)) { NccCgCgdhdWms nccCgCgdhdWms = JSONObject.parseObject(remark, NccCgCgdhdWms.class); ic_purchasein_b.setCsourcebillbid(nccCgCgdhdWms.getPkArriveorderB()); ic_purchasein_b.setCsourcebillhid(nccCgCgdhdWms.getPkArriveorder()); ic_purchasein_b.setCmaterialvid(orderDetl.getMaktx()); ic_purchasein_h.setCvendorid(nccCgCgdhdWms.getGysbm()); ic_purchasein_h.setCbizid(nccCgCgdhdWms.getDhlxbm()); ic_purchasein_b.setCmaterialvid(orderDetl.getMatnr()); ic_purchasein_b.setNnum(orderDetl.getQty()); ic_purchasein_b.setNshouldassistnum(orderDetl.getQty()); //ic_purchasein_b.setNorigprice(nccSaleXsfhmxWms.getNorigprice().doubleValue()); //ic_purchasein_b.setNshouldassistnum(orderDetl.getQty()); ic_purchasein_b.setVbatchcode(orderDetl.getBatch()); } ic_purchasein_bs.add(ic_purchasein_b); } data.put("ic_purchasein_h", ic_purchasein_h); data.put("ic_purchasein_b", ic_purchasein_b); data.put("ic_purchasein_b", ic_purchasein_bs); return data; } @@ -282,22 +272,24 @@ private Object processGENERALOUT(List<OrderDetl> orderDetls) { //组装对象数据 Map<String, Object> data = new HashMap<String, Object>(); ic_purchasein_h ic_purchasein_h = new ic_purchasein_h(); ic_purchasein_h.setPk_org("FYT"); ic_purchasein_h.setCwarehouseid("6101"); ic_purchasein_b ic_purchasein_b = null; List<ic_purchasein_b> ic_purchasein_bs = new ArrayList<>(); ic_generalout_h generalout_h = new ic_generalout_h(); generalout_h.setPk_org("FYT"); generalout_h.setCwarehouseid("6101"); ic_generalout_b generalout_b = null; List<ic_generalout_b> ic_purchasein_bs = new ArrayList<>(); for (OrderDetl orderDetl : orderDetls) { ic_purchasein_b = new ic_purchasein_b(); generalout_b = new ic_generalout_b(); String remark = orderDetl.getRemark(); if (!Cools.isEmpty(remark)) { NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); generalout_b.setMaterialvid(orderDetl.getMatnr()); generalout_b.setNshouldassistnum(orderDetl.getQty()); generalout_b.setVbatchcode(orderDetl.getBatch()); } ic_purchasein_bs.add(ic_purchasein_b); ic_purchasein_bs.add(generalout_b); } data.put("ic_purchasein_h", ic_purchasein_h); data.put("ic_purchasein_b", ic_purchasein_b); data.put("ic_generalout_h", generalout_h); data.put("ic_generalout_b", ic_purchasein_bs); return data; } src/main/java/com/zy/nc/SendUtil.java
@@ -148,6 +148,7 @@ } catch (Exception e) { throw new RuntimeException(e); } System.out.println("【url】:" + apiUrl); System.out.println("【json】:" + json); System.out.println("【RESULT】:" + result); System.out.println("result解密:" + result2); src/main/java/com/zy/nc/entity/NccCgCgdhdWms.java
@@ -150,6 +150,11 @@ private BigDecimal ydzsl; /** * */ private String vbatchcode; /** * */ private BigDecimal ydsl; src/main/java/com/zy/nc/entity/NccJcQilibcBarcodeflowWms.java
@@ -32,6 +32,16 @@ /** * */ private String wlbm; /** * */ private String vbatchcode; /** * */ private String infla; /** @@ -68,8 +78,9 @@ * */ private Integer wmsFlag; /** * * */ private String wmsMemo; @@ -88,6 +99,8 @@ return (this.getPkBarcode() == null ? other.getPkBarcode() == null : this.getPkBarcode().equals(other.getPkBarcode())) && (this.getTs() == null ? other.getTs() == null : this.getTs().equals(other.getTs())) && (this.getVbarcode() == null ? other.getVbarcode() == null : this.getVbarcode().equals(other.getVbarcode())) && (this.getWlbm() == null ? other.getWlbm() == null : this.getWlbm().equals(other.getWlbm())) && (this.getVbatchcode() == null ? other.getVbatchcode() == null : this.getVbatchcode().equals(other.getVbatchcode())) && (this.getInfla() == null ? other.getInfla() == null : this.getInfla().equals(other.getInfla())) && (this.getAsnnum() == null ? other.getAsnnum() == null : this.getAsnnum().equals(other.getAsnnum())) && (this.getPkMaterial() == null ? other.getPkMaterial() == null : this.getPkMaterial().equals(other.getPkMaterial())) @@ -95,7 +108,8 @@ && (this.getMemo() == null ? other.getMemo() == null : this.getMemo().equals(other.getMemo())) && (this.getVbillno() == null ? other.getVbillno() == null : this.getVbillno().equals(other.getVbillno())) && (this.getNastnum() == null ? other.getNastnum() == null : this.getNastnum().equals(other.getNastnum())) && (this.getWmsFlag() == null ? other.getWmsFlag() == null : this.getWmsFlag().equals(other.getWmsFlag())); && (this.getWmsFlag() == null ? other.getWmsFlag() == null : this.getWmsFlag().equals(other.getWmsFlag())) && (this.getWmsMemo() == null ? other.getWmsMemo() == null : this.getWmsMemo().equals(other.getWmsMemo())); } @Override @@ -105,6 +119,8 @@ result = prime * result + ((getPkBarcode() == null) ? 0 : getPkBarcode().hashCode()); result = prime * result + ((getTs() == null) ? 0 : getTs().hashCode()); result = prime * result + ((getVbarcode() == null) ? 0 : getVbarcode().hashCode()); result = prime * result + ((getWlbm() == null) ? 0 : getWlbm().hashCode()); result = prime * result + ((getVbatchcode() == null) ? 0 : getVbatchcode().hashCode()); result = prime * result + ((getInfla() == null) ? 0 : getInfla().hashCode()); result = prime * result + ((getAsnnum() == null) ? 0 : getAsnnum().hashCode()); result = prime * result + ((getPkMaterial() == null) ? 0 : getPkMaterial().hashCode()); @@ -113,6 +129,7 @@ result = prime * result + ((getVbillno() == null) ? 0 : getVbillno().hashCode()); result = prime * result + ((getNastnum() == null) ? 0 : getNastnum().hashCode()); result = prime * result + ((getWmsFlag() == null) ? 0 : getWmsFlag().hashCode()); result = prime * result + ((getWmsMemo() == null) ? 0 : getWmsMemo().hashCode()); return result; } @@ -125,6 +142,8 @@ sb.append(", pkBarcode=").append(pkBarcode); sb.append(", ts=").append(ts); sb.append(", vbarcode=").append(vbarcode); sb.append(", wlbm=").append(wlbm); sb.append(", vbatchcode=").append(vbatchcode); sb.append(", infla=").append(infla); sb.append(", asnnum=").append(asnnum); sb.append(", pkMaterial=").append(pkMaterial); @@ -133,6 +152,7 @@ sb.append(", vbillno=").append(vbillno); sb.append(", nastnum=").append(nastnum); sb.append(", wmsFlag=").append(wmsFlag); sb.append(", wmsMemo=").append(wmsMemo); sb.append("]"); return sb.toString(); } src/main/java/com/zy/nc/entity/NccScZkmxbWms.java
@@ -1,10 +1,10 @@ package com.zy.nc.entity; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import java.math.BigDecimal; import java.util.Date; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import lombok.Data; /** @@ -15,297 +15,298 @@ @Data public class NccScZkmxbWms { /** * * */ @TableId private String cspecialbid; /** * * */ private String vbillcode; /** * * */ private String dmakedate; /** * * */ private Date scdmakedate; /** * * */ private String dbilldate; /** * * */ private String taudittime; /** * * */ private String zzbm; /** * * */ private String zzmc; /** * * */ private String ckzzbm; /** * * */ private String ckzzmc; /** * * */ private String ckssbcode; /** * * */ private String cksssyb; /** * * */ private String ckckbm; /** * * */ private String ckckmc; /** * * */ private String ckbmbm; /** * * */ private String ckbmmc; /** * * */ private String rkzzbm; /** * * */ private String rkzzmc; /** * * */ private String rkssbcode; /** * * */ private String rksssyb; /** * * */ private String rkckbm; /** * * */ private String rkckmc; /** * * */ private String rkbmbm; /** * * */ private String rkbmmc; /** * * */ private Long djzt; /** * * */ private String zklx; /** * * */ private String wlbm; /** * * */ private String wlmc; /** * * */ private String wlgg; /** * * */ private String wlxh; /** * * */ private String wljc; /** * * */ private String jbflbm; /** * * */ private String jbflmc; /** * * */ private String sjflbm; /** * * */ private String sjflmc; /** * * */ private String zsjflbm; /** * * */ private String zsjflmc; /** * * */ private String zdw; /** * * */ private String fdw; /** * * */ private String kczt; /** * * */ private String vbatchcode; /** * * */ private String vdef1; /** * * */ private String vdef2; /** * * */ private String vdef3; /** * * */ private String khbm; /** * * */ private String khmc; /** * * */ private String khjc; /** * * */ private BigDecimal yzzsl; /** * * */ private BigDecimal yzfsl; /** * * */ private BigDecimal ljckzsl; /** * * */ private BigDecimal ljrkzsl; /** * * */ private Integer dr; /** * * */ private String ts; /** * * */ private Integer wmsFlag; /** * * */ private BigDecimal yingzsl; /** * * */ private BigDecimal yingzzsl; /** * * */ private Integer bdr; /** * * */ private String bts; /** * * */ private String wmsMemo; @@ -378,7 +379,8 @@ && (this.getYingzsl() == null ? other.getYingzsl() == null : this.getYingzsl().equals(other.getYingzsl())) && (this.getYingzzsl() == null ? other.getYingzzsl() == null : this.getYingzzsl().equals(other.getYingzzsl())) && (this.getBdr() == null ? other.getBdr() == null : this.getBdr().equals(other.getBdr())) && (this.getBts() == null ? other.getBts() == null : this.getBts().equals(other.getBts())); && (this.getBts() == null ? other.getBts() == null : this.getBts().equals(other.getBts())) && (this.getWmsMemo() == null ? other.getWmsMemo() == null : this.getWmsMemo().equals(other.getWmsMemo())); } @Override @@ -443,6 +445,7 @@ result = prime * result + ((getYingzzsl() == null) ? 0 : getYingzzsl().hashCode()); result = prime * result + ((getBdr() == null) ? 0 : getBdr().hashCode()); result = prime * result + ((getBts() == null) ? 0 : getBts().hashCode()); result = prime * result + ((getWmsMemo() == null) ? 0 : getWmsMemo().hashCode()); return result; } @@ -510,6 +513,7 @@ sb.append(", yingzzsl=").append(yingzzsl); sb.append(", bdr=").append(bdr); sb.append(", bts=").append(bts); sb.append(", wmsMemo=").append(wmsMemo); sb.append("]"); return sb.toString(); } src/main/java/com/zy/nc/mapper/NccSaleDbddWmsMapper.java
@@ -2,18 +2,19 @@ import com.baomidou.mybatisplus.mapper.BaseMapper; import com.zy.nc.entity.NccSaleDbddWms; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @author zc857 * @description 针对表【ncc_sale_dbdd_wms】的数据库操作Mapper * @createDate 2025-05-21 16:04:17 * @Entity com.zy.nc.entity.NccSaleDbddWms */ * @author zc857 * @description 针对表【ncc_sale_dbdd_wms】的数据库操作Mapper * @createDate 2025-05-21 16:04:17 * @Entity com.zy.nc.entity.NccSaleDbddWms */ public interface NccSaleDbddWmsMapper extends BaseMapper<NccSaleDbddWms> { List<String> selectDbdd(); List<String> selectDbdd(@Param("ids") List<Integer> ids); } src/main/java/com/zy/nc/mapper/NccScZkmxbWmsMapper.java
@@ -1,18 +1,21 @@ package com.zy.nc.mapper; import com.zy.nc.entity.NccScZkmxbWms; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.zy.nc.entity.NccScZkmxbWms; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @author ZY * @description 针对表【ncc_sc_zkmxb_wms】的数据库操作Mapper * @createDate 2025-05-13 17:50:58 * @Entity com.zy.nc.entity.NccScZkmxbWms */ * @author ZY * @description 针对表【ncc_sc_zkmxb_wms】的数据库操作Mapper * @createDate 2025-05-13 17:50:58 * @Entity com.zy.nc.entity.NccScZkmxbWms */ public interface NccScZkmxbWmsMapper extends BaseMapper<NccScZkmxbWms> { List<String> selectZk(); List<String> selectZkOut(@Param("ids") List<Integer> ids); List<String> selectZkIn(@Param("ids")List<Integer> ids); } src/main/java/com/zy/nc/service/NccSaleDbddWmsService.java
@@ -6,11 +6,11 @@ import java.util.List; /** * @author zc857 * @description 针对表【ncc_sale_dbdd_wms】的数据库操作Service * @createDate 2025-05-21 16:04:17 */ * @author zc857 * @description 针对表【ncc_sale_dbdd_wms】的数据库操作Service * @createDate 2025-05-21 16:04:17 */ public interface NccSaleDbddWmsService extends IService<NccSaleDbddWms> { List<String> selectDbdd(); List<String> selectDbdd(List<Integer> ids); } src/main/java/com/zy/nc/service/NccScZkmxbWmsService.java
@@ -12,5 +12,7 @@ */ public interface NccScZkmxbWmsService extends IService<NccScZkmxbWms> { List<String> selectZk(); List<String> selectZkOut(List<Integer> ids); List<String> selectZkIn(List<Integer> ids); } src/main/java/com/zy/nc/service/impl/NccSaleDbddWmsServiceImpl.java
@@ -2,25 +2,24 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.zy.nc.entity.NccSaleDbddWms; import com.zy.nc.service.NccSaleDbddWmsService; import com.zy.nc.mapper.NccSaleDbddWmsMapper; import com.zy.nc.service.NccSaleDbddWmsService; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; /** * @author zc857 * @description 针对表【ncc_sale_dbdd_wms】的数据库操作Service实现 * @createDate 2025-05-21 16:04:17 */ * @author zc857 * @description 针对表【ncc_sale_dbdd_wms】的数据库操作Service实现 * @createDate 2025-05-21 16:04:17 */ @Service public class NccSaleDbddWmsServiceImpl extends ServiceImpl<NccSaleDbddWmsMapper, NccSaleDbddWms> implements NccSaleDbddWmsService{ implements NccSaleDbddWmsService { @Override public List<String> selectDbdd() { return this.baseMapper.selectDbdd(); public List<String> selectDbdd(List<Integer> ids) { return this.baseMapper.selectDbdd(ids); } } src/main/java/com/zy/nc/service/impl/NccScZkmxbWmsServiceImpl.java
@@ -18,8 +18,14 @@ public class NccScZkmxbWmsServiceImpl extends ServiceImpl<NccScZkmxbWmsMapper, NccScZkmxbWms> implements NccScZkmxbWmsService{ @Override public List<String> selectZk() { return this.baseMapper.selectZk(); public List<String> selectZkOut(List<Integer> ids) { return this.baseMapper.selectZkOut(ids); } @Override public List<String> selectZkIn(List<Integer> ids) { return this.baseMapper.selectZkIn(ids); } } src/main/java/com/zy/nc/task/PlanOrderTask.java
@@ -5,11 +5,13 @@ import com.zy.nc.entity.*; import com.zy.nc.service.*; import com.zy.nc.task.handler.PlanOrderHandler; import com.zy.system.service.impl.ConfigServiceImpl; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.List; @Slf4j @@ -34,6 +36,8 @@ @Autowired private NccCkPddWmsService nccCkPddWmsService; @Autowired private ConfigServiceImpl configService; /** * 发货 @@ -45,6 +49,9 @@ List<String> Ids = nccSaleXsfhmxWmsService.selectXsfh(); for (String id : Ids) { List<NccSaleXsfhmxWms> wmsFlag = nccSaleXsfhmxWmsService.selectList(new EntityWrapper<NccSaleXsfhmxWms>().eq("vbillcode", id).ne("wms_flag", 1).eq("fstatusflag", 2)); if (wmsFlag == null || wmsFlag.isEmpty()) { return; } ReturnT<String> returnT = planOrderHandler.start1(wmsFlag); if (!returnT.isSuccess()) { for (NccSaleXsfhmxWms wms : wmsFlag) { @@ -63,11 +70,17 @@ * @return */ @Scheduled(cron = "0/3 * * * * ? ") public void execute2() { List<String> strings = nccScZkmxbWmsService.selectZk(); public void execute2_1() { //Config wmsFlag1 = configService.selectConfigByCode("wms_flag"); List<Integer> ids = Arrays.asList(6101, 6102, 6106, 6110); //String s = "一期成品库-内贸(立体库)、一期成品库-福莱国际外贸(立体库)、一期成品库-外购(立体库)、一期成品库-福达/工厂外贸(立体库)、一期辅料库-包材(立体库)"; List<String> strings = nccScZkmxbWmsService.selectZkIn(ids); for (String string : strings) { List<NccScZkmxbWms> wmsFlag = nccScZkmxbWmsService.selectList(new EntityWrapper<NccScZkmxbWms>().eq("vbillcode", string).ne("wms_flag", 1)); ReturnT<String> returnT = planOrderHandler.start2(wmsFlag); if (wmsFlag == null || wmsFlag.isEmpty()) { return; } ReturnT<String> returnT = planOrderHandler.start2In(wmsFlag); if (!returnT.isSuccess()) { for (NccScZkmxbWms wms : wmsFlag) { wms.setWmsMemo(returnT.getMsg()); @@ -76,7 +89,31 @@ log.error(returnT.getMsg()); } } } /** * 转库 * * @return */ @Scheduled(cron = "0/3 * * * * ? ") public void execute2_2() { List<Integer> ids = Arrays.asList(6101, 6102, 6106, 6110); List<String> strings = nccScZkmxbWmsService.selectZkOut(ids); for (String string : strings) { List<NccScZkmxbWms> wmsFlag = nccScZkmxbWmsService.selectList(new EntityWrapper<NccScZkmxbWms>().eq("vbillcode", string).ne("wms_flag", 1)); if (wmsFlag == null || wmsFlag.isEmpty()) { return; } ReturnT<String> returnT = planOrderHandler.start2Out(wmsFlag); if (!returnT.isSuccess()) { for (NccScZkmxbWms wms : wmsFlag) { wms.setWmsMemo(returnT.getMsg()); nccScZkmxbWmsService.updateById(wms); } log.error(returnT.getMsg()); } } } /** @@ -89,6 +126,9 @@ List<String> strings = nccCgCgdhdWmsService.selectCg(); for (String string : strings) { List<NccCgCgdhdWms> wmsFlag = nccCgCgdhdWmsService.selectList(new EntityWrapper<NccCgCgdhdWms>().eq("vbillcode", string).ne("wms_flag", 1)); if (wmsFlag == null || wmsFlag.isEmpty()) { return; } ReturnT<String> returnT = planOrderHandler.start3(wmsFlag); if (!returnT.isSuccess()) { for (NccCgCgdhdWms wms : wmsFlag) { @@ -108,9 +148,13 @@ */ @Scheduled(cron = "0/3 * * * * ? ") public void execute5() { List<String> strings = nccSaleDbddWmsService.selectDbdd(); List<Integer> ids = Arrays.asList(6101, 6102, 6106, 6110); List<String> strings = nccSaleDbddWmsService.selectDbdd(ids); for (String string : strings) { List<NccSaleDbddWms> wmsFlag = nccSaleDbddWmsService.selectList(new EntityWrapper<NccSaleDbddWms>().eq("vbillcode", string).ne("wms_flag", 1)); if (wmsFlag == null || wmsFlag.isEmpty()) { return; } ReturnT<String> returnT = planOrderHandler.start5(wmsFlag); if (!returnT.isSuccess()) { for (NccSaleDbddWms wms : wmsFlag) { @@ -133,7 +177,7 @@ public void execute4() { List<String> strings = nccCkPddWmsService.selectPdd(); for (String string : strings) { List<NccCkPddWms> wmsFlag = nccCkPddWmsService.selectList(new EntityWrapper<NccCkPddWms>().eq("vbillcode", string).ne("wms_flag", 1).eq("hdr",0).eq("bdr",0)); List<NccCkPddWms> wmsFlag = nccCkPddWmsService.selectList(new EntityWrapper<NccCkPddWms>().eq("vbillcode", string).ne("wms_flag", 1).eq("hdr", 0).eq("bdr", 0)); ReturnT<String> returnT = planOrderHandler.start4(wmsFlag); if (!returnT.isSuccess()) { for (NccCkPddWms wms : wmsFlag) { src/main/java/com/zy/nc/task/handler/PlanOrderHandler.java
@@ -99,16 +99,16 @@ * * @return */ public ReturnT<String> start2(List<NccScZkmxbWms> wmsFlag) { public ReturnT<String> start2In(List<NccScZkmxbWms> wmsFlag) { try { OpenOrderPakinParam param = new OpenOrderPakinParam(); param.setOrderType("转库"); param.setOrderType("转库-入库"); DetlDto detlDto; List<DetlDto> orderDetails = new ArrayList<>(); long i = 1; for (NccScZkmxbWms nccScZkmxbWms : wmsFlag) { log.info("NccScZkmxbWms数据:{}", JSONObject.toJSON(nccScZkmxbWms)); if ( nccScZkmxbWms.getBdr() == 0 && nccScZkmxbWms.getDr() == 0) { if (nccScZkmxbWms.getBdr() == 0 && nccScZkmxbWms.getDr() == 0) { detlDto = new DetlDto(); detlDto.setMatnr(nccScZkmxbWms.getWlbm()); detlDto.setAnfme(nccScZkmxbWms.getYingzzsl().doubleValue()); @@ -132,6 +132,43 @@ return SUCCESS; } /** * 转库,包含出库 * * @return */ public ReturnT<String> start2Out(List<NccScZkmxbWms> wmsFlag) { try { OpenOrderPakoutParam param = new OpenOrderPakoutParam(); param.setOrderType("转库-出库"); DetlDto detlDto; List<DetlDto> orderDetails = new ArrayList<>(); long i = 1; for (NccScZkmxbWms nccScZkmxbWms : wmsFlag) { log.info("NccScZkmxbWms数据:{}", JSONObject.toJSON(nccScZkmxbWms)); if (nccScZkmxbWms.getBdr() == 0 && nccScZkmxbWms.getDr() == 0) { detlDto = new DetlDto(); detlDto.setMatnr(nccScZkmxbWms.getWlbm()); detlDto.setAnfme(nccScZkmxbWms.getYingzzsl().doubleValue()); detlDto.setBatch(nccScZkmxbWms.getVbatchcode()); detlDto.setLineNumber(i); detlDto.setRemark(JSONObject.toJSONString(nccScZkmxbWms)); orderDetails.add(detlDto); i++; } nccScZkmxbWms.setWmsFlag(1); param.setOrderNo(nccScZkmxbWms.getVbillcode()); } param.setOrderDetails(orderDetails); openService.pakoutOrderCreate(param); nccScZkmxbWmsService.updateBatchById(wmsFlag); } catch (Exception e) { e.printStackTrace(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return FAIL.setMsg(e.getMessage()); } return SUCCESS; } /** * 采购到货 @@ -151,6 +188,7 @@ detlDto = new DetlDto(); detlDto.setMatnr(nccCgCgdhdWms.getWlbm()); detlDto.setAnfme(nccCgCgdhdWms.getYdzsl().doubleValue()); detlDto.setBatch(nccCgCgdhdWms.getVbatchcode()); detlDto.setLineNumber(i); detlDto.setRemark(JSONObject.toJSONString(nccCgCgdhdWms)); orderDetails.add(detlDto); @@ -214,7 +252,6 @@ } /** * 调拨单 * @@ -229,16 +266,14 @@ long i = 1; for (NccSaleDbddWms nccCgCgdhdWms : wmsFlag) { log.info("nccCgCgdhdWms数据:{}", JSONObject.toJSON(nccCgCgdhdWms)); if (nccCgCgdhdWms.getDr() == 0 ) { detlDto = new DetlDto(); detlDto.setMatnr(nccCgCgdhdWms.getWlbm()); detlDto.setAnfme(nccCgCgdhdWms.getZsl().doubleValue()); detlDto.setBatch(nccCgCgdhdWms.getVbatchcode()); detlDto.setLineNumber(i); detlDto.setRemark(JSONObject.toJSONString(nccCgCgdhdWms)); orderDetails.add(detlDto); i++; } detlDto = new DetlDto(); detlDto.setMatnr(nccCgCgdhdWms.getWlbm()); detlDto.setAnfme(nccCgCgdhdWms.getZsl().doubleValue()); detlDto.setBatch(nccCgCgdhdWms.getVbatchcode()); detlDto.setLineNumber(i); detlDto.setRemark(JSONObject.toJSONString(nccCgCgdhdWms)); orderDetails.add(detlDto); i++; nccCgCgdhdWms.setWmsFlag(1); param.setOrderNo(nccCgCgdhdWms.getVbillcode()); } src/main/java/com/zy/nc/vo/IaIjBill.java
New file @@ -0,0 +1,8 @@ package com.zy.nc.vo; import lombok.Data; @Data public class IaIjBill { private String pk_org; } src/main/java/com/zy/nc/vo/IaIjBillB.java
New file @@ -0,0 +1,12 @@ package com.zy.nc.vo; import lombok.Data; @Data public class IaIjBillB { private String csrcid; private String cinventoryid; private String nnum; private String cinventoryvid; private String pk_org; } src/main/java/com/zy/nc/vo/ic_generalout_b.java
@@ -1,4 +1,16 @@ package com.zy.nc.vo; import lombok.Data; @Data public class ic_generalout_b { private String materialvid; private Double nshouldassistnum; private String ncostprice; /** * 批次号 */ private String vbatchcode; } src/main/resources/application.yml
@@ -101,7 +101,7 @@ #5.3.其他入库单参照转库新增 #saveRefWhsTrans: http://ip:port/nccloud/api/ic/generalin/saveRefWhsTrans #6.调拨订单查询 #saveRefWhsTrans: http://ip:port/nccloud/api/ic/generalin/saveRefWhsTrans dbdd: /nccloud/api/ia/ij/operation/save #7.盘点单查询 invcount: http://ip:port/nccloud/api/ic/invcount/query src/main/resources/com/zy/nc/mapper/NccSaleDbddWmsMapper.xml
File was deleted src/main/resources/mapper/nc/NccSaleDbddWmsMapper.xml
@@ -60,6 +60,13 @@ <select id="selectDbdd" resultType="java.lang.String"> select distinct VBILLCODE from ncc_sale_dbdd_wms where wms_flag != 1 and FSTATUSFLAG = 4 and FROWSTATUFLAG = 4 limit 100 where (wms_flag is null or wms_flag != 1) and FSTATUSFLAG = 4 and FROWSTATUFLAG = 4 and dr = 0 <if test="ids != null"> and DCCKBM in <foreach item="id" collection="ids" separator="," open="(" close=")" index=""> #{id} </foreach> </if> limit 100 </select> </mapper> src/main/resources/mapper/nc/NccScZkmxbWmsMapper.xml
@@ -76,9 +76,29 @@ DR,TS,wms_flag </sql> <select id="selectZk" resultType="java.lang.String"> <select id="selectZkIn" resultType="java.lang.String"> select distinct VBILLCODE from ncc_sc_zkmxb_wms where wms_flag != 1 and DJZT = 4 limit 100 where wms_flag != 1 and DJZT = 4 <if test="ids != null"> and RKCKBM in <foreach item="id" collection="ids" separator="," open="(" close=")" index=""> #{id} </foreach> </if> limit 100 </select> <select id="selectZkOut" resultType="java.lang.String"> select distinct VBILLCODE from ncc_sc_zkmxb_wms where wms_flag != 1 and DJZT = 4 <if test="ids != null"> and CKCKBM in <foreach item="id" collection="ids" separator="," open="(" close=")" index=""> #{id} </foreach> </if> limit 100 </select> </mapper>