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/resources/mapper/OrderMapper.xml                            |   20 +++------
 src/main/java/zy/cloud/wms/manager/controller/OrderController.java   |   23 +++++------
 src/main/webapp/views/delivery/delivery.html                         |    4 +-
 src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java |   69 +++++++++++++++++++++++++++++++---
 4 files changed, 82 insertions(+), 34 deletions(-)

diff --git a/src/main/java/zy/cloud/wms/manager/controller/OrderController.java b/src/main/java/zy/cloud/wms/manager/controller/OrderController.java
index 51f26e5..c4c030d 100644
--- a/src/main/java/zy/cloud/wms/manager/controller/OrderController.java
+++ b/src/main/java/zy/cloud/wms/manager/controller/OrderController.java
@@ -11,6 +11,7 @@
 import com.core.common.DateUtils;
 import com.core.common.R;
 import com.core.exception.CoolException;
+import com.sun.org.apache.xpath.internal.operations.Or;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -19,6 +20,8 @@
 import zy.cloud.wms.common.utils.QrCode;
 import zy.cloud.wms.common.web.BaseController;
 import zy.cloud.wms.manager.entity.Order;
+import zy.cloud.wms.manager.entity.OrderDetl;
+import zy.cloud.wms.manager.service.OrderDetlService;
 import zy.cloud.wms.manager.service.OrderService;
 
 import javax.imageio.ImageIO;
@@ -35,6 +38,8 @@
 
     @Autowired
     private OrderService orderService;
+    @Autowired
+    private OrderDetlService orderDetlService;
 
     @RequestMapping(value = "/order/{id}/auth")
     @ManagerAuth
@@ -90,19 +95,6 @@
         return R.ok();
     }
 
-    @RequestMapping(value = "/order/delete/auth")
-    @ManagerAuth
-    public R delete(@RequestParam String param){
-        List<Order> list = JSONArray.parseArray(param, Order.class);
-        if (Cools.isEmpty(list)){
-            return R.error();
-        }
-        for (Order entity : list){
-            orderService.delete(new EntityWrapper<>(entity));
-        }
-        return R.ok();
-    }
-
     @RequestMapping(value = "/orders/delete/auth")
     @ManagerAuth
     @Transactional
@@ -111,6 +103,11 @@
             return R.error();
         }
         for (Long id : ids){
+            Order order = orderService.selectById(id);
+            if (order == null) {
+                continue;
+            }
+            orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_id", order.getId()));
             if (!orderService.deleteById(id)) {
                 throw new CoolException("鏈嶅姟鍣ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
             }
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);
diff --git a/src/main/resources/mapper/OrderMapper.xml b/src/main/resources/mapper/OrderMapper.xml
index 1232177..322a922 100644
--- a/src/main/resources/mapper/OrderMapper.xml
+++ b/src/main/resources/mapper/OrderMapper.xml
@@ -81,23 +81,17 @@
         <if test="host_id!=null and host_id!='' ">
             and mo.host_id = #{host_id}
         </if>
-        <if test="bill_no!=null and bill_no!='' ">
-            and mo.bill_no like '%' + #{bill_no} + '%'
+        <if test="order_no!=null and order_no!='' ">
+            and mo.order_no like '%' + #{order_no} + '%'
         </if>
-        <if test="bill_type!=null and bill_type!='' ">
-            and bill_type like '%' + #{bill_type} + '%'
+        <if test="doc_type!=null and doc_type!='' ">
+            and mo.doc_type like '%' + #{doc_type} + '%'
         </if>
-        <if test="mat_name!=null and mat_name!='' ">
-            and a.mat_name like '%' + #{mat_name} + '%'
-        </if>
-        <if test="qty!=null and qty!='' ">
-            and a.qty = #{qty}
-        </if>
-        <if test="altme!=null and altme!='' ">
-            and a.unit like '%' + #{unit} + '%'
+        <if test="maktx!=null and maktx!='' ">
+            and mod.maktx like '%' + #{maktx} + '%'
         </if>
         <if test="startTime!=null and endTime!=null">
-            and appe_time between #{startTime} and #{endTime}
+            and mo.create_time between #{startTime} and #{endTime}
         </if>
     </sql>
 
diff --git a/src/main/webapp/views/delivery/delivery.html b/src/main/webapp/views/delivery/delivery.html
index 459982a..0d087cd 100644
--- a/src/main/webapp/views/delivery/delivery.html
+++ b/src/main/webapp/views/delivery/delivery.html
@@ -26,12 +26,12 @@
                 <div class="layui-form-item">
                     <div class="layui-inline">
                         <div class="layui-input-inline mr0">
-                            <input name="bill_no" class="layui-input" type="text" placeholder="杈撳叆鍗曟嵁缂栧彿"/>
+                            <input name="order_no" class="layui-input" type="text" placeholder="杈撳叆鍗曟嵁缂栧彿"/>
                         </div>
                     </div>
                     <div class="layui-inline" style="width: 300px">
                         <div class="layui-input-inline">
-                            <input class="layui-input layui-laydate-range" name="appe_time" type="text" placeholder="璧峰鏃堕棿 - 缁堟鏃堕棿" autocomplete="off" style="width: 300px">
+                            <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="璧峰鏃堕棿 - 缁堟鏃堕棿" autocomplete="off" style="width: 300px">
                         </div>
                     </div>
                     <div class="layui-inline">

--
Gitblit v1.9.1