From 4e4e1fcf869ccd460640210794cecbe3f710d70d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 29 六月 2020 09:58:54 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/waitPakin/waitPakin.js              |    9 +++-
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   56 ++++++++++++++++++++++++++++
 src/main/java/com/zy/asrs/controller/MobileController.java    |   10 ++++-
 src/main/java/com/zy/asrs/service/MobileService.java          |    9 ++++
 4 files changed, 80 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index 0af752a..8eadac7 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -3,6 +3,9 @@
 import com.core.annotations.ManagerAuth;
 import com.core.common.R;
 import com.zy.asrs.entity.param.CombParam;
+import com.zy.asrs.service.MobileService;
+import com.zy.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -13,7 +16,10 @@
  */
 @RestController
 @RequestMapping("mobile")
-public class MobileController {
+public class MobileController extends BaseController  {
+
+    @Autowired
+    private MobileService mobileService;
 
     /**
      * 缁勬墭
@@ -21,7 +27,7 @@
     @RequestMapping("/comb/auth")
     @ManagerAuth(memo = "缁勬墭")
     public R comb(@RequestBody CombParam combParam){
-
+        mobileService.comb(combParam, getUserId());
         return R.ok();
     }
 
diff --git a/src/main/java/com/zy/asrs/service/MobileService.java b/src/main/java/com/zy/asrs/service/MobileService.java
index 805156c..c3b6fd3 100644
--- a/src/main/java/com/zy/asrs/service/MobileService.java
+++ b/src/main/java/com/zy/asrs/service/MobileService.java
@@ -1,4 +1,13 @@
 package com.zy.asrs.service;
 
+import com.zy.asrs.entity.param.CombParam;
+
 public interface MobileService {
+
+    /**
+     * 缁勬墭
+     * @param param
+     */
+    void comb(CombParam param, Long userId);
+
 }
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 1743309..3760b18 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1,10 +1,66 @@
 package com.zy.asrs.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.BaseRes;
+import com.core.common.Cools;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.MatCode;
+import com.zy.asrs.entity.WaitPakin;
+import com.zy.asrs.entity.param.CombParam;
+import com.zy.asrs.service.MatCodeService;
 import com.zy.asrs.service.MobileService;
+import com.zy.asrs.service.WaitPakinService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
 
 /**
  * 绉诲姩绔湇鍔℃牳蹇冪被
  * Created by vincent on 2020/6/28
  */
+@Service
 public class MobileServiceImpl implements MobileService {
+
+    @Autowired
+    private MatCodeService matCodeService;
+    @Autowired
+    private WaitPakinService waitPakinService;
+
+    @Override
+    @Transactional
+    public void comb(CombParam param, Long userId) {
+        if (Cools.isEmpty(param.getBarcode()) || param.getCombMats().isEmpty()) {
+            throw new CoolException(BaseRes.PARAM);
+        }
+        int count = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
+                eq("barcode", param.getBarcode()).eq("status", "N"));
+        if (count > 0) {
+            throw new CoolException("绠卞彿鏁版嵁宸插瓨鍦�");
+        }
+        for (CombParam.CombMat combMat : param.getCombMats()) {
+            MatCode matCode = matCodeService.selectById(combMat.getMatNo());
+            if (Cools.isEmpty(matCode)) {
+                throw new CoolException("鐗╂枡鏁版嵁閿欒");
+            }
+            WaitPakin waitPakin = new WaitPakin(
+                    param.getBarcode(),    // 鎵樼洏鐮�
+                    matCode.getMatNo(),    // 鐗╂枡缂栫爜
+                    matCode.getMatName(),    // 鐗╂枡鎻忚堪
+                    combMat.getCount(),    // 鏁伴噺
+                    matCode.getStr1(),    // 鍗曚綅
+                    "N",    // 鐘舵��
+                    "",    // 澶囨敞
+                    new Date(),    // 淇敼鏃堕棿
+                    userId,    // 淇敼浜哄憳
+                    new Date(),    // 娣诲姞鏃堕棿
+                    userId    // 鍒涘缓鑰�
+            );
+            if (!waitPakinService.insert(waitPakin)) {
+                throw new CoolException("淇濆瓨鏁版嵁澶辫触");
+            }
+        }
+    }
+
 }
diff --git a/src/main/webapp/static/js/waitPakin/waitPakin.js b/src/main/webapp/static/js/waitPakin/waitPakin.js
index a04fec8..0a9aa06 100644
--- a/src/main/webapp/static/js/waitPakin/waitPakin.js
+++ b/src/main/webapp/static/js/waitPakin/waitPakin.js
@@ -20,13 +20,18 @@
         cols: [[
             {type: 'checkbox'}
 //            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
-            ,{field: 'id', align: 'center',title: '缂栧彿'}
+            ,{field: 'id', align: 'center',title: '缂栧彿', sort: true}
             ,{field: 'barcode', align: 'center',title: '鎵樼洏鐮�'}
             ,{field: 'matnr', align: 'center',title: '鐗╂枡缂栫爜'}
             ,{field: 'maktx', align: 'center',title: '鐗╂枡鎻忚堪'}
             ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
             ,{field: 'unit', align: 'center',title: '鍗曚綅'}
-            ,{field: 'status', align: 'center',title: '鐘舵��'}
+            ,{field: 'status', align: 'center',title: '鐘舵��', templet:function(row){
+                    var html = "<input value='status' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'";
+                    if(row.inEnable === 'Y'){html += " checked ";}
+                    html += ">";
+                    return html;
+                }}
             ,{field: 'memo', align: 'center',title: '澶囨敞'}
             ,{field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿', hide: true}
             ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳', hide: true}

--
Gitblit v1.9.1