From 1c2541b283ce6ba855e67c476412dffe2c693480 Mon Sep 17 00:00:00 2001
From: chengsc <11752@DESKTOP-DS49RCP>
Date: 星期三, 11 六月 2025 13:56:23 +0800
Subject: [PATCH] Merge branch 'csc'

---
 Wms/Wms/Controllers/PdaAsnController.cs |  499 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 356 insertions(+), 143 deletions(-)

diff --git a/Wms/Wms/Controllers/PdaAsnController.cs b/Wms/Wms/Controllers/PdaAsnController.cs
index d896832..d8829bc 100644
--- a/Wms/Wms/Controllers/PdaAsnController.cs
+++ b/Wms/Wms/Controllers/PdaAsnController.cs
@@ -1,13 +1,23 @@
 锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Identity;
 using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
+using Model.InterFaceModel;
+using Model.ModelDto.BllAsnDto;
 using Model.ModelDto.DataDto;
 using Model.ModelVm;
 using Model.ModelVm.BllAsnVm;
 using Model.ModelVm.PdaVm;
+using Model.ModelVm.SysVm;
+using Newtonsoft.Json;
 using System;
 using System.Security.Claims;
 using Utility;
+using Utility.Tools;
+using Wms.Tools;
+using WMS.BLL.LogServer;
 using WMS.Entity.BllAsnEntity;
+using WMS.Entity.DataEntity;
 using WMS.IBLL.IPdaServer;
 
 namespace Wms.Controllers
@@ -17,13 +27,302 @@
     [Authorize]
     public class PdaAsnController : ControllerBase
     {
-        #region 渚濊禆娉ㄥ叆
+        private readonly ApiUrlConfig _config; //鎺ュ彛浜や簰璺緞
         private readonly IPdaAsnServer _PdaAsnSvc;
+        private readonly UserManager _userManager;
 
-        public PdaAsnController(IPdaAsnServer pdaAsnSvc)
+        public PdaAsnController(IOptions<ApiUrlConfig> setting, IPdaAsnServer pdaAsnSvc,UserManager userManager)
         {
-            _PdaAsnSvc = pdaAsnSvc;
+            _config = setting.Value;
+            _PdaAsnSvc = pdaAsnSvc; 
+            _userManager = userManager;
         }
+        
+
+        #region JC34
+
+        //---------------------------------------------缁勬墭鏀惰揣椤甸潰----------------------------------------------------------------------
+
+        /// <summary>
+        /// 缁戝畾鎵樼洏
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [UnitOfWork]
+        public IActionResult BindPallet(PdaPalletBindVm model)
+        {
+            var claimsIdentity = this.User.Identity as ClaimsIdentity;
+            if (claimsIdentity == null)
+            {
+                throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+            }
+            string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+            if (string.IsNullOrWhiteSpace(UserId))
+            {
+                throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+            }
+            if (model.TableType == 0)
+            {
+                _PdaAsnSvc.BindPalletPasteCode(model, int.Parse(UserId));
+            }
+            else if (model.TableType == 1)
+            {
+                _PdaAsnSvc.BindPalletNoPasteCode(model, int.Parse(UserId));
+            }
+
+            return Ok(new { code = 0, msg = "缁戝畾鎴愬姛!" });
+
+        }
+
+        /// <summary>
+        /// 鑾峰彇闇�瑕佽创鏍囩鐨勫叆搴撳崟 鍗曟嵁鍙烽泦鍚�
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetPasteAsnNoStrList()
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetPasteAsnNoStrList();
+
+                return Ok(new { code = 0, msg = "鍏ュ簱鍗曚俊鎭�", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇涓嶉渶瑕佽创鏍囩鐨勫叆搴撳崟 鍗曟嵁鍙烽泦鍚�
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetNoPasteAsnNoStrList()
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetNoPasteAsnNoStrList();
+
+                return Ok(new { code = 0, msg = "鍏ュ簱鍗曚俊鎭�", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁鍗曟嵁鍙疯幏鍙栬创鏍囩殑鍏ュ簱鍗曟嵁淇℃伅(ID-鐗╂枡-鎵规)
+        /// </summary>
+        /// <param name="model">AsnNo:鍗曟嵁鍙�</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetBindArrivalNoticeDetails(ArrivalNoticeVm model)
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetBindArrivalNoticeDetails(model);
+
+                return Ok(new { code = 0, msg = "鍏ュ簱鍗曟槑缁嗕俊鎭�", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁鍗曟嵁鍙疯幏鍙栦笉璐存爣鐨勫叆搴撳崟鎹俊鎭�(ID-鐗╂枡-鎵规)
+        /// </summary>
+        /// <param name="model">AsnNo:鍗曟嵁鍙�</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetArrivalNoticeDetails(ArrivalNoticeVm model)
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetArrivalNoticeDetails(model);
+
+                return Ok(new { code = 0, msg = "鍏ュ簱鍗曟槑缁嗕俊鎭�", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁鍏ュ簱鍗曟槑缁咺D鑾峰彇鐗╂枡璇︽儏 锛圥DA鐗╂枡鎵规閫夐」鏁版嵁锛�
+        /// </summary>
+        /// <param name="model">Id锛氬叆搴撳崟鏄庣粏ID</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetArrivalNoticeDetail(ArrivalNoticeDetailVm model)
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetArrivalNoticeDetail(model);
+
+                return Ok(new { code = 0, msg = "鍏ュ簱鍗曟槑缁嗚缁嗕俊鎭�", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁绠辩爜鑾峰彇鏍囩绠辩爜淇℃伅
+        /// </summary>
+        /// <param name="model">BoxNo:绠卞彿</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetBindBoxInfos(BoxInfoVm model)
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetBindBoxInfos(model, _config.BoxHost + _config.GetBoxUrl);
+
+                return Ok(new { code = 0, msg = "鏍囩绠辩爜淇℃伅", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁绠辩爜鑾峰彇鏍囩绠辩爜淇℃伅锛堣溅闂村叆搴�-鑾峰彇WMS鐢熸垚鐨勭淇℃伅锛�
+        /// </summary>
+        /// <param name="boxNo">BoxNo:绠卞彿</param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetWmsBoxInfos(string boxNo)
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetWmsBoxInfos(boxNo);
+
+                return Ok(new { code = 0, msg = "鏍囩绠辩爜淇℃伅", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鎵樼洏鏄惁鍙敤  鍏敤鏂规硶
+        /// </summary>
+        /// <param name="model">PalletNo锛氭墭鐩樻潯鐮�</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult IsEnablePalletNo(PalletBindVm model)
+        {
+            try
+            {
+                var strMsg = _PdaAsnSvc.IsEnablePalletNo(model.PalletNo);
+
+                if (strMsg == "")
+                {
+                    return Ok(new { code = 0, msg = "鎵樼洏鍙敤!" });
+                }
+                else
+                {
+                    return Ok(new { code = 1, msg = strMsg });
+                }
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+
+        /// <summary>
+        /// 鏍规嵁鍗曟嵁鑾峰彇鏍囩鏁伴噺
+        /// </summary>
+        /// <param name="model">ASNNo锛氬叆搴撳崟銆丄SNDetailNo锛氬叆搴撳崟鏄庣粏鍙�</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetBoxCountByAsn(PalletBindVm model)
+        {
+            try
+            {
+                var list = _PdaAsnSvc.GetBoxCountByAsn(model.ASNNo,model.ASNDetailNo);
+
+                 
+                return Ok(new { code = 0, msg = "鏍规嵁鍗曟嵁鑾峰彇鏍囩鏁伴噺", data= list});
+                 
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+
+        /// <summary>
+        /// 缁戝畾鎵樼洏
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost] 
+        public IActionResult ChejianIn(PdaPalletBindVm model)
+        {
+            try
+            {
+                 
+                if (_userManager.UserId ==0)
+                {
+                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+                }
+
+                if (model.TableType == 0)
+                {
+                    _PdaAsnSvc.ChejianIn(model.PalletNo,model.BoxNo,model.SkuQty,model.AreaNo, _userManager.UserId);
+                }
+                else if (model.TableType == 1)
+                {
+                    _PdaAsnSvc.ChejianQtyIn(model.PalletNo,model.SkuNo,model.LotNo,model.SkuQty,model.AreaNo, _userManager.UserId);
+                }
+
+                return Ok(new { code = 0, msg = "缁戝畾鎴愬姛!" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+
+        //---------------------------------------------鐢宠鍏ュ簱椤甸潰----------------------------------------------------------------------
+
+
+        /// <summary>
+        /// 淇濆瓨鎸囧畾鐨勫偍浣�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SaveAppointLocate(PalletBindVm model)
+        {
+            try
+            {
+                _PdaAsnSvc.SaveAppointLocate(model.PalletNo, model.LocatNo, _userManager.UserId);
+
+                return Ok(new HttpReturnModel{ Success = "0", Message = "鎴愬姛鎸囧畾鍌ㄤ綅" });
+
+            }
+            catch (Exception e)
+            {
+                return Ok(new HttpReturnModel { Success = "1", Message = e.Message });
+            }
+        }
+
+
         #endregion
 
         #region 鍏敤鏂规硶
@@ -67,73 +366,6 @@
                 {
                     return Ok(new { code = 0, msg = "鍏ュ簱鍗曚俊鎭�", data = models });
                 }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
-        }
-
-        /// <summary>
-        /// 鍒ゆ柇鎵樼洏鏄惁鍙敤
-        /// </summary>
-        /// <param name="model">PalletNo锛氭墭鐩樻潯鐮�</param>
-        /// <returns></returns>
-        [HttpPost]
-        public IActionResult IsEnablePalletNo(PalletBindVm model)
-        {
-            try
-            {
-                var strMsg = _PdaAsnSvc.IsEnablePalletNo(model.PalletNo);
-
-                if (strMsg == "")
-                {
-                    return Ok(new { code = 0, msg = "鎵樼洏鍙敤!" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = strMsg });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
-        }
-
-        /// <summary>
-        /// 鑾峰彇鍗曟嵁鏄庣粏鍒楄〃
-        /// </summary>
-        /// <param name="model">AsnNo:鍗曟嵁鍙�</param>
-        /// <returns></returns>
-        [HttpPost]
-        public IActionResult GetArrivalNoticeDetails(ArrivalNoticeVm model)
-        {
-            try
-            {
-                var models = _PdaAsnSvc.GetArrivalNoticeDetails(model);
-
-                return Ok(new { code = 0, msg = "鍏ュ簱鍗曟槑缁嗕俊鎭�", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
-        }
-
-        /// <summary>
-        /// 鏍规嵁鏄庣粏ID鑾峰彇鐗╂枡璇︽儏
-        /// </summary>
-        /// <param name="model">Id锛氬叆搴撳崟鏄庣粏ID</param>
-        /// <returns></returns>
-        [HttpPost]
-        public IActionResult GetArrivalNoticeDetail(ArrivalNoticeDetailVm model)
-        {
-            try
-            {
-                var models = _PdaAsnSvc.GetArrivalNoticeDetail(model);
-
-                return Ok(new { code = 0, msg = "鍏ュ簱鍗曟槑缁嗚缁嗕俊鎭�", data = models });
             }
             catch (Exception e)
             {
@@ -300,10 +532,6 @@
                 return Ok(new { code = 1, msg = e.Message });
             }
         }
-        #endregion
-
-        #region 鐢熶骇鍏ュ簱
-
         #endregion
 
         #region 绌烘墭鍏ュ簱
@@ -528,75 +756,7 @@
         }
 
         #endregion
-
-        #region 缁勬墭
-        /// <summary>
-        /// 鏍规嵁绠辩爜鑾峰彇鏍囩绠辩爜淇℃伅
-        /// </summary>
-        /// <param name="model">BoxNo:绠卞彿</param>
-        /// <returns></returns>
-        [HttpPost]
-        public IActionResult GetBindBoxInfos(BoxInfoVm model)
-        {
-            try
-            {
-                var models = _PdaAsnSvc.GetBindBoxInfos(model);
-
-                return Ok(new { code = 0, msg = "鏍囩绠辩爜淇℃伅", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
-        }
-        [HttpPost]
-        public IActionResult GetBindArrivalNoticeDetails(ArrivalNoticeVm model)
-        {
-            try
-            {
-                var models = _PdaAsnSvc.GetBindArrivalNoticeDetails(model);
-
-                return Ok(new { code = 0, msg = "鍏ュ簱鍗曟槑缁嗕俊鎭�", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
-        }
-
-        /// <summary>
-        /// 缁戝畾鎵樼洏
-        /// </summary>
-        /// <param name="model"></param>
-        /// <returns></returns>
-        [HttpPost]
-        [UnitOfWork]
-        public IActionResult BindPallet(PdaPalletBindVm model)
-        {
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(UserId))
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                if (model.TableType == 0)
-                {
-                    _PdaAsnSvc.BindPalletPasteCode(model, int.Parse(UserId));
-                }
-                else if (model.TableType == 1)
-                {
-                    _PdaAsnSvc.BindPalletNoPasteCode(model, int.Parse(UserId));
-                }
-
-                return Ok(new { code = 0, msg = "缁戝畾鎴愬姛!" });
-
-        }
-        #endregion
-
+         
         #region 骞冲簱鍏ュ簱
         /// <summary>
         /// 骞冲簱纭鍏ュ簱
@@ -714,5 +874,58 @@
 
 
         #endregion
+
+        #region 绾跨紪鏍囩
+        /// <summary>
+        /// 骞冲簱纭鍏ュ簱
+        /// </summary>
+        /// <param name="model">鐗╂枡缂栫爜锛涚墿鏂欏悕绉�</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetSkuInfo(GetMaterialsVm model)
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetSkuInfo(model);
+
+                return Ok(new { code = 0, msg = "鑾峰彇鐗╂枡淇℃伅鎴愬姛!", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鐢熸垚鏂版爣绛� 骞惰繑鍥炴墦鍗版暟鎹�
+        /// </summary>
+        /// <param name="model">鏍囩淇℃伅</param>
+        /// <returns>鎵撳嵃鏁版嵁</returns>
+        [HttpPost]
+        public IActionResult AddLabels(LabelsVm model) 
+        {
+            try
+            {
+                var claimsIdentity = this.User.Identity as ClaimsIdentity;
+                if (claimsIdentity == null)
+                {
+                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+                }
+                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+                if (string.IsNullOrWhiteSpace(UserId))
+                {
+                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+                }
+                model.userId = int.Parse(UserId);
+                var models = _PdaAsnSvc.AddLabels(model);
+
+                return Ok(new { code = 0, msg = "绠辩爜鐢熸垚鎴愬姛!", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+        #endregion
     }
 }

--
Gitblit v1.8.0