From 1af20c9696ba73b10e9065d0441c786ae9a28c9f Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 22 二月 2022 09:03:04 +0800
Subject: [PATCH] #

---
 src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java |   69 +++++++++++++++++++++++++++++++---
 1 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java b/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
index 84194f1..b8c981e 100644
--- a/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
+++ b/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
@@ -1,11 +1,9 @@
 package zy.cloud.wms.manager.service.impl;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.core.common.BaseRes;
-import com.core.common.Cools;
-import com.core.common.R;
-import com.core.common.SnowflakeIdWorker;
+import com.core.common.*;
 import com.core.exception.CoolException;
+import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -149,6 +147,65 @@
         if (locDetl == null || locDetl.getAnfme() < param.getCount()) {
             return R.error(mat.getMaktx() + "搴撳瓨涓嶈冻");
         }
+        Date now = new Date();
+        Cstmr cstmr = cstmrService.selectByName(param.getCstmr());
+        // 鐢熸垚璁㈠崟
+        Order order = new Order(
+                hostId,
+                String.valueOf(snowflakeIdWorker.nextId()),    // 缂栧彿[闈炵┖]
+                "HM-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15),    // 璁㈠崟缂栧彿
+//                null,    // 璁㈠崟缂栧彿
+                DateUtils.convert(now, DateUtils.yyyyMMdd_F),    // 鍗曟嵁鏃ユ湡
+                null,    // 鍗曟嵁绫诲瀷
+                null,    // 椤圭洰缂栧彿
+                null,   // 椤圭洰鍚嶇О
+                null,    // 璋冩嫧椤圭洰缂栧彿
+                null,    // 鍒濆绁ㄦ嵁鍙�
+                null,    // 绁ㄦ嵁鍙�
+                cstmr==null?null:cstmr.getId(),    // 瀹㈡埛缂栧彿
+                param.getCstmr(),    // 瀹㈡埛
+                null,    // 鑱旂郴鏂瑰紡
+                null,    // 鎿嶄綔浜哄憳
+                null,    // 鍚堣閲戦
+                null,    // 浼樻儬鐜�
+                null,    // 浼樻儬閲戦
+                null,    // 閿�鍞垨閲囪喘璐圭敤鍚堣
+                null,    // 瀹炰粯閲戦
+                null,    // 浠樻绫诲瀷
+                null,    // 涓氬姟鍛�
+                null,    // 缁撶畻澶╂暟
+                null,    // 閭垂鏀粯绫诲瀷
+                null,    // 閭垂
+                null,    // 浠樻鏃堕棿
+                null,    // 鍙戣揣鏃堕棿
+                null,    // 鐗╂祦鍚嶇О
+                null,    // 鐗╂祦鍗曞彿
+                4L,    // 璁㈠崟鐘舵��
+                1,    // 鐘舵��
+                userId,    // 娣诲姞浜哄憳
+                now,    // 娣诲姞鏃堕棿
+                userId,    // 淇敼浜哄憳
+                now,    // 淇敼鏃堕棿
+                "鐩存帴鍑哄簱"    // 澶囨敞
+        );
+        if (!orderService.insert(order)) {
+            throw new CoolException("鐢熸垚璁㈠崟澶辫触锛�");
+        }
+        OrderDetl orderDetl = new OrderDetl();
+        orderDetl.setHostId(hostId);
+        orderDetl.setOrderId(order.getId());  // 璁㈠崟鍐呯爜
+        orderDetl.setAnfme(param.getCount());         // 鏁伴噺
+        orderDetl.setCreateBy(userId);
+        orderDetl.setCreateTime(now);
+        orderDetl.setUpdateBy(userId);
+        orderDetl.setUpdateTime(now);
+        orderDetl.setStatus(1);
+        VersionUtils.setOrderDetl(orderDetl, mat);
+        if (!orderDetlService.insert(orderDetl)) {
+            throw new CoolException("鐢熸垚璁㈠崟澶辫触");
+        }
+
+        // 鐢熸垚鎷h揣鍗�
         Pakout pakout = new Pakout(
                 hostId,
                 String.valueOf(snowflakeIdWorker.nextId()),    // 浠诲姟鍙穂闈炵┖]
@@ -173,9 +230,9 @@
                 null,    // 閲嶉噺
                 1,    // 鐘舵��
                 userId,    // 娣诲姞浜哄憳
-                new Date(),    // 娣诲姞鏃堕棿
+                now,    // 娣诲姞鏃堕棿
                 userId,    // 淇敼浜哄憳
-                new Date(),    // 淇敼鏃堕棿
+                now,    // 淇敼鏃堕棿
                 null    // 澶囨敞
         );
         VersionUtils.setPakout(pakout, mat);

--
Gitblit v1.9.1