From 02c74d142c9623aaa44fe8bca02070eb2c539a1b Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期四, 15 十二月 2022 16:16:54 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/service/erp/task/ErpScheduler.java | 56 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/zy/common/service/erp/task/ErpScheduler.java b/src/main/java/com/zy/common/service/erp/task/ErpScheduler.java index 790f9ea..f76f630 100644 --- a/src/main/java/com/zy/common/service/erp/task/ErpScheduler.java +++ b/src/main/java/com/zy/common/service/erp/task/ErpScheduler.java @@ -56,12 +56,12 @@ Date now = new Date(); if (!Cools.isEmpty(goods)) { for (Goods good : goods) { - Mat mat = matService.selectByMatnr(good.getBarCode()); + Mat mat = matService.selectByMatnr(good.getMaterialNO()); if (mat == null) { mat = new Mat(); mat.setTagId(top.getId()); - mat.setMatnr(good.getBarCode()); - mat.setMaktx(good.getMaterialNO()); + mat.setMatnr(good.getMaterialNO()); +// mat.setMaktx(good.getBarCode()); mat.setSpecs(good.getProdSpec()); mat.setModel(good.getBatch()); mat.setWeight(good.getNWT()); @@ -76,12 +76,11 @@ if (!matService.insert(mat)) { throw new CoolException(good.getBarCode() + "鍟嗗搧鍚屾澶辫触"); - } else { - int state = 1; - if (!erpService.updateStateForGoods(good.getBarCode(), state)) { - throw new CoolException(good.getBarCode() + "鍟嗗搧淇敼State涓�"+state+"澶辫触"); - } } + } + int state = 1; + if (!erpService.updateStateForGoods(good.getBarCode(), state)) { + throw new CoolException(good.getBarCode() + "鍟嗗搧淇敼State涓�"+state+"澶辫触"); } } } @@ -144,17 +143,44 @@ if (!orderService.insert(order)) { throw new CoolException(order.getOrderNo() + "鐢熸垚鍗曟嵁涓绘。澶辫触锛岃鑱旂郴绠$悊鍛�"); } - for (VoucherDetail detail : dto.getDetails()) { - Mat mat = matService.selectByMatnr(detail.getBarcode()); - if (mat == null) { - throw new CoolException(detail.getBarcode() + "鍗曟嵁鍙蜂笉瀛樺湪"); + Mat mat = matService.selectByMatnr(voucher.getMaterialNO()); + if (mat == null) { + throw new CoolException(voucher.getMaterialNO() + "鐗╂枡鍙蜂笉瀛樺湪"); + } + + // 绻冲韩鍠� + if (docType.getPakin() == 1) { + for (VoucherDetail detail : dto.getDetails()) { + OrderDetl orderDetl = new OrderDetl(); + orderDetl.sync(mat); + + orderDetl.setBatch(detail.getBarcode()); + orderDetl.setAnfme(mat.getWeight()); + + orderDetl.setOrderId(order.getId()); + orderDetl.setOrderNo(order.getOrderNo()); + orderDetl.setCreateBy(9527L); + orderDetl.setCreateTime(now); + orderDetl.setUpdateBy(9527L); + orderDetl.setUpdateTime(now); + orderDetl.setStatus(1); + orderDetl.setQty(0.0D); + if (!orderDetlService.insert(orderDetl)) { + throw new CoolException(order.getOrderNo() + "鐢熸垚鍗曟嵁鏄庣粏澶辫触锛岃鑱旂郴绠$悊鍛�"); + } } - + } else { OrderDetl orderDetl = new OrderDetl(); orderDetl.sync(mat); -// orderDetl.setBatch(detlDto.getBatch()); - orderDetl.setAnfme(1.0D); + StringBuilder sb = new StringBuilder(); + if (!Cools.isEmpty(dto.getDetails())) { + for (VoucherDetail detail : dto.getDetails()) { + sb.append(detail.getBarcode()).append(","); + } + orderDetl.setBatch(sb.toString()); + } + orderDetl.setAnfme(voucher.getExpectedWeight()); orderDetl.setOrderId(order.getId()); orderDetl.setOrderNo(order.getOrderNo()); orderDetl.setCreateBy(9527L); -- Gitblit v1.9.1