From a869e7291b6016b297bc00b30a2e83f8ed3983ea Mon Sep 17 00:00:00 2001
From: wang..123 <brook_w@163.com>
Date: 星期一, 14 二月 2022 08:28:08 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index 52ccdc3..3977f57 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -16,7 +16,10 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.List;
+import java.util.Random;
 
 /**
  * 绉诲姩绔湇鍔℃牳蹇冪被
@@ -53,15 +56,21 @@
 
         Date now = new Date();
         if (Cools.isEmpty(param.getBillNo())) {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+            Random rand = new Random();
+            Integer r = rand.nextInt(900)+ 100;
+            String billNo = sdf.format(new Date()) + r;
+            Integer seqNo=0;
             for (CombParam.CombMat combMat : param.getCombMats()) {
                 MatCode matCode = matCodeService.selectOne(new EntityWrapper<MatCode>().eq("mat_no", combMat.getMatNo()));
                 if (Cools.isEmpty(matCode)) {
                     throw new CoolException("鐗╂枡鏁版嵁閿欒");
                 }
+                seqNo++;
                 PltBarcode pltBarcode = new PltBarcode();
                 pltBarcode.setBarcode(param.getBarcode());
-                pltBarcode.setBillNo("");
-                pltBarcode.setSeqNo(0);
+                pltBarcode.setBillNo(billNo);
+                pltBarcode.setSeqNo(seqNo);
                 pltBarcode.setBillType(5);
                 pltBarcode.setMatNo(matCode.getMatNo());
                 pltBarcode.setMatName(matCode.getMatName());
@@ -69,13 +78,25 @@
                 pltBarcode.setUnit(matCode.getUnit());
                 pltBarcode.setSpecs(matCode.getSpecs());
                 pltBarcode.setSize(matCode.getSize());
+//                pltBarcode.setSupplier(combMat.getSupplier());
+                pltBarcode.setMemo(combMat.getMemo());
                 pltBarcode.setColor(matCode.getColor());
                 pltBarcode.setLinkErp(0);
                 pltBarcode.setModiUser(userId);
                 pltBarcode.setModiTime(now);
                 pltBarcode.setAppeUser(userId);
                 pltBarcode.setAppeTime(now);
-
+                if(matCode.getWeight()==null){
+                    matCode.setWeight(0.0);
+                }
+                if(matCode.getStr6()==null){
+                    matCode.setStr6(0.0);
+                    pltBarcode.setAllQty(pltBarcode.getQty());
+                }else {
+                    pltBarcode.setAllQty(matCode.getStr6()*pltBarcode.getQty());
+                }
+                pltBarcode.setWeight(matCode.getWeight());
+                pltBarcode.setAllWeight(matCode.getWeight()*pltBarcode.getQty()+30);
                 if (!pltBarcodeService.insert(pltBarcode)) {
                     throw new CoolException("淇濆瓨鏁版嵁澶辫触");
                 }
@@ -84,6 +105,7 @@
             // 鍏宠仈閫氱煡鍗曠粍鎵�
             for (CombParam.CombMat combMat : param.getCombMats()) {
                 WaitMatin waitMatin = waitMatinService.selectOne(new EntityWrapper<WaitMatin>()
+
                         .eq("bill_no",param.getBillNo()).eq("seq_no",combMat.getSeqNo()));
 
                 if (waitMatin == null) {

--
Gitblit v1.9.1