From 2a7ba2095fede6da921e696f2667cb896ba0bd8d Mon Sep 17 00:00:00 2001
From: bklLiudl <673013083@qq.com>
Date: 星期日, 04 二月 2024 08:02:44 +0800
Subject: [PATCH] 平库创建储位

---
 Wms/WMS.Entity/SysEntity/SysStorageLocat.cs    |   10 +++
 Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs |   15 +++++
 Wms/Wms/Controllers/SysController.cs           |   50 ++++++++++++++++
 Wms/WMS.BLL/SysServer/StorageLocatServer.cs    |   46 +++++++++++++++
 4 files changed, 120 insertions(+), 1 deletions(-)

diff --git a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
index 0b17705..46abd4e 100644
--- a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
+++ b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
@@ -217,6 +217,52 @@
                 throw new Exception(e.Message);
             }
         }
+
+        /// <summary>
+        /// 娣诲姞鍌ㄤ綅淇℃伅锛堝钩搴擄級鐢ㄤ簬寮�鍙戜汉鍛樻坊鍔犲熀纭�淇℃伅
+        /// </summary>
+        /// <param name="model"></param>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        public async Task<int> AddPkStorageLocat(AddLocateVm model, int userId)
+        {
+            try
+            {
+                var q = 0;
+                // 鎺�(缁�)寰幆
+                for(int i=1;i<=model.Row;i++)
+                {
+                    // 鍒楀惊鐜�
+                    for (int z = 1; z <= model.Col; z++)  
+                    {
+                        q += await LocatRst.AddAsync(new SysStorageLocat()
+                        {
+                            // 鍖哄煙+鎺�+鍒�+灞�
+                            LocatNo = model.AreaNo + i.ToString().PadLeft(2, '0') + z.ToString().PadLeft(2, '0') + "01",
+                            WareHouseNo = model.HouseNo,
+                            RoadwayNo = "",
+                            AreaNo = model.AreaNo,
+                            Status = "0",
+                            AisleOne = "1",
+                            AisleTwo = "",
+                            Flag = "0",
+                            Depth = z.ToString(),
+                            Row = i,
+                            Column = z,
+                            Layer = 1,
+                            CreateUser = userId
+                        }); ;
+                    }
+                }
+
+                return q;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+
         public bool EditStorageLocatList(EditLocateListVm model, int userId)
         {
             try
diff --git a/Wms/WMS.Entity/SysEntity/SysStorageLocat.cs b/Wms/WMS.Entity/SysEntity/SysStorageLocat.cs
index dbe22f0..faebbe4 100644
--- a/Wms/WMS.Entity/SysEntity/SysStorageLocat.cs
+++ b/Wms/WMS.Entity/SysEntity/SysStorageLocat.cs
@@ -47,6 +47,16 @@
         public string Status {get;set;}
 
         /// <summary>
+        /// 閫氶亾鍙�1
+        /// </summary>
+        public string AisleOne { get; set; }
+
+        /// <summary>
+        /// 閫氶亾鍙�2
+        /// </summary>
+        public string AisleTwo { get; set; }
+
+        /// <summary>
         /// 鍌ㄤ綅鏍囧織 0锛氭甯� 1锛氬睆钄� 2锛氭崯鍧�     灞忚斀锛氬偍浣嶄笉鍙瓨鏀捐揣鐗╋紝涓嶅奖鍝嶅唴渚у偍浣嶄娇鐢�  鎹熷潖锛氬唴渚у偍浣嶄篃涓嶅厑璁镐娇鐢� 
         /// Default: 0
         /// Nullable:False
diff --git a/Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs b/Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs
index cc0419f..4a04723 100644
--- a/Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs
+++ b/Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs
@@ -56,6 +56,21 @@
         /// <param name="userId">鎿嶄綔浜�</param>
         /// <returns></returns>
         Task<int> AddStorageLocat(string houseNo, string roadwayNo, string areaNo, int row, int col, int layer, string dept, int userId);
+
+        /// <summary>
+        /// 娣诲姞鍌ㄤ綅淇℃伅锛堝钩搴擄級鐢ㄤ簬寮�鍙戜汉鍛樻坊鍔犲熀纭�淇℃伅
+        /// </summary>
+        /// <param name="locateNo">鍌ㄤ綅鍙�</param>
+        /// <param name="houseNo">浠撳簱鍙�</param>
+        /// <param name="roadwayNo">宸烽亾鍙�</param>
+        /// <param name="areaNo">鍖哄煙鍙�</param>
+        /// <param name="row">鎺�</param>
+        /// <param name="col">鍒�</param>
+        /// <param name="layer">灞�</param>
+        /// <param name="dept">娣卞害</param>
+        /// <param name="userId">鎿嶄綔浜�</param>
+        /// <returns></returns>
+        Task<int> AddPkStorageLocat(AddLocateVm model, int userId);
         /// <summary>
         /// 缂栬緫鍌ㄤ綅淇℃伅
         /// </summary>
diff --git a/Wms/Wms/Controllers/SysController.cs b/Wms/Wms/Controllers/SysController.cs
index 94988f0..b159d44 100644
--- a/Wms/Wms/Controllers/SysController.cs
+++ b/Wms/Wms/Controllers/SysController.cs
@@ -1012,7 +1012,7 @@
             }
         }
         /// <summary>
-        /// 娣诲姞鍌ㄤ綅淇℃伅
+        /// 娣诲姞绔嬩綋搴撳偍浣嶄俊鎭�
         /// </summary>
         /// <param name="model">妯″瀷</param>
         /// <returns></returns> 
@@ -1057,6 +1057,54 @@
                 return Ok(new { code = 400, ErrorMsg = "鏁版嵁鏍煎紡閿欒" });
             }
         }
+
+        /// <summary>
+        /// 娣诲姞骞冲簱鍌ㄤ綅淇℃伅
+        /// </summary>
+        /// <param name="model">妯″瀷</param>
+        /// <returns></returns> 
+        [AllowAnonymous]
+        [HttpPost]
+        public async Task<IActionResult> AddPkStorageLocat(AddLocateVm model)
+        {
+            if (ModelState.IsValid)
+            {
+                try
+                {
+                    //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
+                    //var claimsIdentity = this.User.Identity as ClaimsIdentity;
+                    //if (claimsIdentity == null)
+                    //{
+                    //    return Ok(new { code = 400, ErrorMsg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                    //}
+                    //var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+                    //if (string.IsNullOrWhiteSpace(userId))
+                    //{
+                    //    return Ok(new { code = 400, ErrorMsg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                    //}
+                    var bolls = await _locatSvc.AddPkStorageLocat(model, 1);
+                    if (bolls > 0)
+                    {
+                        await _operation.InsertOperation("浠撳簱璁剧疆", "鍌ㄤ綅绠$悊", model.RoadwayNo, "娣诲姞", "娣诲姞鍌ㄤ綅淇℃伅 鍌ㄤ綅鍙凤細" + model.RoadwayNo, 1);
+                        return Ok(new { code = 200, ErrorMsg = "娣诲姞鎴愬姛", data = bolls });
+                    }
+                    else
+                    {
+                        return Ok(new { code = 400, ErrorMsg = "娣诲姞澶辫触", data = "" });
+                    }
+
+                }
+                catch (Exception e)
+                {
+                    return Ok(new { code = 400, ErrorMsg = "璇疯仈绯荤鐞嗗憳/" + e.Message });
+                }
+            }
+            else //鏁版嵁鏍煎紡閿欒
+            {
+                return Ok(new { code = 400, ErrorMsg = "鏁版嵁鏍煎紡閿欒" });
+            }
+        }
+
         /// <summary>
         /// 淇敼鍌ㄤ綅淇℃伅
         /// </summary>

--
Gitblit v1.8.0