From 19e95f4acc328bbf62a0427fe658d00268019e66 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期一, 07 四月 2025 10:14:34 +0800
Subject: [PATCH] 修改IIS配置

---
 Wms/WMS.BLL/SysServer/StorageLocatServer.cs |  383 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 325 insertions(+), 58 deletions(-)

diff --git a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
index 0b17705..5ad72d4 100644
--- a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
+++ b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
@@ -2,26 +2,29 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq.Expressions;
+using System.Runtime.Intrinsics.X86;
 using System.Text;
 using System.Threading.Tasks;
 using Model.ModelDto.SysDto;
 using Model.ModelVm.SysVm;
 using SqlSugar;
+using WMS.BLL.LogServer;
 using WMS.DAL;
 using WMS.Entity.BllAsnEntity;
 using WMS.Entity.Context;
 using WMS.Entity.DataEntity;
 using WMS.Entity.SysEntity;
+using WMS.IBLL.ILogServer;
 using WMS.IBLL.ISysServer;
 using WMS.IDAL.ISysInterface;
 
 namespace WMS.BLL.SysServer
 {
-    public class StorageLocatServer:DbHelper<SysStorageLocat>,IStorageLocatServer
+    public class StorageLocatServer : DbHelper<SysStorageLocat>, IStorageLocatServer
     {
         private static readonly SqlSugarScope Db = DataContext.Db;
         public IStorageLocatRepository LocatRst { get; set; }
-        public StorageLocatServer(IStorageLocatRepository locatRst):base(Db)
+        public StorageLocatServer(IStorageLocatRepository locatRst) : base(Db)
         {
             LocatRst = locatRst;
         }
@@ -42,7 +45,7 @@
         /// <param name="limit"></param>
         /// <param name="count"></param>
         /// <returns></returns>
-        public List<LocatDto> GetStorageLocatList(string houseNo, string roadwayNo, string areaNo, string status, string flag,string locat, int? row, int? col, int? layer, int page, int limit,out int count)
+        public List<LocatDto> GetStorageLocatList(string houseNo, string roadwayNo, string areaNo, string status, string flag, string locat, int? row, int? col, int? layer, int page, int limit, out int count)
         {
             try
             {
@@ -58,10 +61,11 @@
                     .AndIF(layer != null, it => it.Layer == layer)
                     .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
 
-                
-                var data = LocatRst.GetAllByOrderPageAsync(item, limit, page,out int counts)
+
+                var data = LocatRst.GetAllByOrderPageAsync(item, limit, page, out int counts)
                     .Includes(x => x.WareHouseInfo)
                     .Includes(x => x.AreaInfo)
+                    .Includes(x => x.RoadwayInfo)
                     .Includes(x => x.TemperatureInfo)
                     .Includes(x => x.CreateUserInfo)
                     .Includes(x => x.UpdateUserInfo).ToList();
@@ -70,8 +74,11 @@
                 {
                     Id = m.Id,
                     LocatNo = m.LocatNo,
+                    WareHouseNo = m.WareHouseNo,
                     WareHouseName = m.WareHouseInfo == null ? "" : m.WareHouseInfo.WareHouseName,
                     RoadwayNo = m.RoadwayNo,
+                    RoadwayName = m.RoadwayInfo == null ? "" : m.RoadwayInfo.RoadwayName,
+                    AreaNo = m.AreaNo,
                     AreaName = m.AreaInfo == null ? "" : m.AreaInfo.AreaName,
                     Status = m.Status,
                     StatusName = GetStatus(m.Status),
@@ -106,6 +113,7 @@
             try
             {
                 var data = LocatRst.GetOneById(id);
+                //var data = Db.Queryable<SysStorageLocat>().First(m=>m.Id == id);
                 return data;
             }
             catch (Exception e)
@@ -114,18 +122,35 @@
                 throw;
             }
         }
+        public List<SysStorageLocat> GetStorageLocat(List<int> id)
+        {
+            try
+            {
+                var SysStorageLocats = new List<SysStorageLocat>();
+                foreach (var item in id)
+                {
+                    var storage = LocatRst.GetOneById(item);
+                    SysStorageLocats.Add(storage);
+                }
+                return SysStorageLocats;
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e);
+                throw;
+            }
+        }
 
-         
         public bool EditStorageLocat(EditLocateVm model, int userId)
         {
             try
             {
-                var bl = LocatRst.EditStorageLocat(model.Id, model.Status, model.Flag, model.Temperature, userId);
+                var bl = LocatRst.EditStorageLocat(model.Id, model.Status, model.Flag, model.Temperature,model.Area, userId);
 
                 return bl;
             }
             catch (Exception e)
-            { 
+            {
                 throw new Exception(e.Message);
             }
         }
@@ -183,12 +208,12 @@
                                 c1 = c.ToString();
                             }
                             var area = l <= 7 ? "A12" : "A11";//鍖哄煙
-                            for (int d = 1; d<= int.Parse(dept); d++) //娣卞害
+                            for (int d = 1; d <= int.Parse(dept); d++) //娣卞害
                             {
                                 var s = "0" + d;//娣卞害
                                 q += await LocatRst.AddAsync(new SysStorageLocat()
                                 {
-                                    LocatNo = r1 + c1 + l1+s,
+                                    LocatNo = r1 + c1 + l1 + s,
                                     WareHouseNo = houseNo,
                                     RoadwayNo = roadwayNo,
                                     AreaNo = area,
@@ -201,11 +226,11 @@
                                     CreateUser = userId
                                 });
                             }
-                            
 
-                            
 
-                            
+
+
+
                         }
                     }
                 }
@@ -217,16 +242,172 @@
                 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
             {
-                var bl = LocatRst.EditStorageLocatList(model.Id, model.Status, model.Flag,model.Temperature ,userId);
+                var bl = LocatRst.EditStorageLocatList(model.Id, model.Status, model.Flag, model.Temperature, userId);
 
                 return bl;
             }
             catch (Exception e)
             {
+                throw new Exception(e.Message);
+            }
+        }
+        public bool EditStorageLocatListNew(EditLocateListNewVm model, int userId)
+        {
+            try
+            {
+                if (string.IsNullOrWhiteSpace(model.RoadWayNo))
+                {
+                    throw new Exception("宸烽亾涓嶈兘涓虹┖");
+                }
+                bool isRow = false;
+                if (model.Row != null)
+                {
+                    if (model.Row <= 0)
+                    {
+                        throw new Exception("鎺掗渶瑕佸ぇ浜�0");
+                    }
+                    isRow = true;
+                }
+                bool isColumn = false;
+                if (model.Column != null)
+                {
+                    if (model.Column <= 0)
+                    {
+                        throw new Exception("鍒楅渶瑕佸ぇ浜�0");
+                    }
+                    isColumn = true;
+                }
+                bool isLayer = false;
+                if (model.Layer != null )
+                {
+                    if (model.Column <= 0)
+                    {
+                        throw new Exception("灞傞渶瑕佸ぇ浜�0");
+                    }
+                    isLayer = true;
+                }
+                bool isDepth = false;
+                if (model.Dept != null)
+                {
+                    if (model.Dept != 1 && model.Dept != 2)
+                    {
+                        throw new Exception("娣卞害鍙兘涓�1鎴�2");
+                    }
+                    isDepth = true;
+                }
+                Expression<Func<SysStorageLocat, bool>> item = Expressionable.Create<SysStorageLocat>() //鍒涘缓琛ㄨ揪寮�
+                    .AndIF(isRow, it => it.Row == model.Row)
+                    .AndIF(isColumn, it => it.Column == model.Column)
+                    .AndIF(isLayer, it => it.Layer == model.Layer)
+                    .AndIF(isDepth, it => it.Depth == "0"+model.Dept)
+                    .AndIF(!string.IsNullOrWhiteSpace(model.RoadWayNo), it => it.RoadwayNo == model.RoadWayNo)
+                    .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
+                var locateList = Db.Queryable<SysStorageLocat>().Where(item).ToList();
+                if (locateList.Count == 0)
+                {
+                    throw new Exception($"鏈煡璇㈠埌鐩稿搴旂殑鍌ㄤ綅淇℃伅");
+                }
+
+                var com = new Common();
+                var i = 0;
+                Db.BeginTran();
+                foreach (var locate in locateList)
+                {
+                    if (model.Flag == "2" && locate.Depth == "01")//鏍囪瘑鏄崯鍧忎笖娣卞害鏄�01鏃� 闇�鎶婃繁搴︿负2鐨勫偍浣嶇粰灞忚斀
+                    {
+                        var locate2 = com.GetLocateNoDepth2(locate.WareHouseNo, locate.LocatNo);
+                        if (locate2.Flag == "0" && !locateList.Contains(locate2))
+                        {
+                            locate2.Flag = "1";
+                            locate2.UpdateUser = userId;
+                            locate2.UpdateTime = DateTime.Now;
+                            var m = Db.Updateable(locate2).ExecuteCommand();
+                        }
+
+                    }
+                    if (model.Flag == "0" && locate.Depth == "02")//鏍囪瘑鏄甯镐笖娣卞害鏄�02鏃� 闇�鍒ゆ柇娣卞害涓�1鐨勫偍浣嶇姸鎬佹槸鍚︽甯�
+                    {
+                        var locate1 = com.GetLocateNoDepth1(locate.WareHouseNo, locate.LocatNo);
+
+                        if (locate1.Flag == "2")
+                        {
+                            throw new Exception($"闇�鍏堜慨鏀箋locate1.LocatNo}鐨勫偍浣嶆爣璇嗕负涓嶆槸鎹熷潖");
+                        }
+                    }
+
+                    if (!string.IsNullOrEmpty(model.Status))
+                    {
+                        locate.Status = model.Status;
+                    }
+                    if (!string.IsNullOrEmpty(model.Flag))
+                    {
+                        locate.Flag = model.Flag;
+                    }
+                    if (!string.IsNullOrEmpty(model.AreaNo))
+                    {
+                        locate.AreaNo = model.AreaNo;
+                    }
+                    locate.UpdateUser = userId;
+                    locate.UpdateTime = DateTime.Now;
+                    i = Db.Updateable(locate).ExecuteCommand();
+                }
+                Db.CommitTran();
+                return i > 0;
+
+            }
+            catch (Exception e)
+            {
+                Db.RollbackTran();
                 throw new Exception(e.Message);
             }
         }
@@ -314,14 +495,14 @@
             {
                 var list = Db.Queryable<SysStorageLocat>().Where(m =>
                     m.IsDel == "0" && m.WareHouseNo == wareHouseNo && m.RoadwayNo == roadway && m.Row == int.Parse(row) && m.Depth == depth).ToList();
-                 
+
                 return list;
             }
             catch (Exception e)
             {
                 throw new Exception(e.Message);
             }
-           
+
         }
 
         /// <summary>
@@ -334,20 +515,20 @@
         public int GetMaxLayer(string wareHouseNo, string roadway, string row)
         {
             try
-            { 
+            {
                 var road = roadway.Substring(1, roadway.Length - 1);
                 var num = int.Parse(road);
                 var rows = (num - 1) * 2 + int.Parse(row);//鎺�
 
                 var maxLayer = Db.Queryable<SysStorageLocat>().Where(m =>
-                    m.IsDel == "0" && m.WareHouseNo == wareHouseNo && m.RoadwayNo == roadway && m.Row == int.Parse(row)).Max(m=>m.Layer);
+                    m.IsDel == "0" && m.WareHouseNo == wareHouseNo && m.RoadwayNo == roadway && m.Row == int.Parse(row)).Max(m => m.Layer);
 
                 return maxLayer;
             }
             catch (Exception e)
             {
                 throw new Exception(e.Message);
-            } 
+            }
         }
 
         /// <summary>
@@ -398,7 +579,7 @@
             return depthlist;
         }
 
-        
+
 
         /// <summary>
         /// 鑾峰彇搴撲綅鍗犳瘮(鍦�)
@@ -423,8 +604,8 @@
                 int b = 0; //1锛氭湁鐗╁搧 
                 int c = 0; //2锛氬叆搴撲腑 
                 int d = 0; //3锛氬嚭搴撲腑 
-                //int e = 0; //4锛氱Щ鍏ヤ腑 
-                //int f = 0; //5锛氱Щ鍑轰腑 
+                int e = 0; //4锛氱Щ鍏ヤ腑 
+                int f = 0; //5锛氱Щ鍑轰腑 
                 int g = 0; //6锛氭崯鍧廫灞忚斀 
 
                 foreach (var item in getLocateVms)
@@ -453,18 +634,18 @@
                         d = 1; //3锛氬嚭搴撲腑 
                         continue;
                     }
-                    ////4锛氱Щ鍏ヤ腑 
-                    //if (item.Status == "4")
-                    //{
-                    //    e = 1; //4锛氱Щ鍏ヤ腑 
-                    //    continue;
-                    //}
-                    ////5锛氱Щ鍑轰腑 
-                    //if (item.Status == "5")
-                    //{
-                    //    f = 1; //5锛氱Щ鍑轰腑 
-                    //    continue;
-                    //}
+                    //4锛氱Щ鍏ヤ腑 
+                    if (item.Status == "4")
+                    {
+                        e = 1; //4锛氱Щ鍏ヤ腑 
+                        continue;
+                    }
+                    //5锛氱Щ鍑轰腑 
+                    if (item.Status == "5")
+                    {
+                        f = 1; //5锛氱Щ鍑轰腑 
+                        continue;
+                    }
                     //6锛氭崯鍧廫灞忚斀 
                     if (item.Status == "6")
                     {
@@ -509,24 +690,24 @@
                     getLocateVm.Status = "3";
                     getLocateVms.Add(getLocateVm);
                 }
-                ////4锛氱Щ鍏ヤ腑 
-                //if (e == 0)
-                //{
-                //    getLocateVm = new GetLocateVm();
-                //    getLocateVm.WareHouseNo = wareHouseNo; //浠撳簱鍙�
-                //    getLocateVm.StatusNum = "0";
-                //    getLocateVm.Status = "4";
-                //    getLocateVms.Add(getLocateVm);
-                //}
-                ////5锛氱Щ鍑轰腑 
-                //if (f == 0)
-                //{
-                //    getLocateVm = new GetLocateVm();
-                //    getLocateVm.WareHouseNo = wareHouseNo; //浠撳簱鍙�
-                //    getLocateVm.StatusNum = "0";
-                //    getLocateVm.Status = "5";
-                //    getLocateVms.Add(getLocateVm);
-                //}
+                //4锛氱Щ鍏ヤ腑 
+                if (e == 0)
+                {
+                    getLocateVm = new GetLocateVm();
+                    getLocateVm.WareHouseNo = wareHouseNo; //浠撳簱鍙�
+                    getLocateVm.StatusNum = "0";
+                    getLocateVm.Status = "4";
+                    getLocateVms.Add(getLocateVm);
+                }
+                //5锛氱Щ鍑轰腑 
+                if (f == 0)
+                {
+                    getLocateVm = new GetLocateVm();
+                    getLocateVm.WareHouseNo = wareHouseNo; //浠撳簱鍙�
+                    getLocateVm.StatusNum = "0";
+                    getLocateVm.Status = "5";
+                    getLocateVms.Add(getLocateVm);
+                }
                 //6锛氭崯鍧廫灞忚斀 
                 if (g == 0)
                 {
@@ -557,7 +738,7 @@
             {
                 //鏍规嵁浠撳簱鍙蜂互鍙婂贩閬撳彿鑾峰彇鍌ㄤ綅鍚勭姸鎬佹暟鎹�
                 string str = "select Row,Status,COUNT(Status) StatusNum from SysStorageLocat where WareHouseNo = @warehouseno and RoadwayNo = @roadwayno group by Row,Status order by Row,Status";
-               
+
                 List<GetLocateVm> getLocateVms = Db.Ado.SqlQuery<GetLocateVm>(str, new
                 {
                     warehouseno = wareHouseNo, //浠撳簱鍙�
@@ -585,8 +766,13 @@
         {
             try
             {
-                string str = "select RoadwayNo,RoadwayName from SysStorageRoadway where IsDel = @isdel and WareHouseNo = @warehouseno";
-                
+                string str = "select RoadwayNo,RoadwayName,WareHouseNo from SysStorageRoadway where IsDel = @isdel";
+
+                if (!string.IsNullOrWhiteSpace(wareHouseNo))
+                {
+                    str += " and WareHouseNo = @warehouseno";
+                }
+
                 List<RoadwayDto> roadway = Db.Ado.SqlQuery<RoadwayDto>(str, new
                 {
                     isdel = "0", //鏄惁鍒犻櫎
@@ -610,6 +796,7 @@
             try
             {
                 LocateInfoVm model = new LocateInfoVm();
+                string status = "";
                 //鍌ㄤ綅淇℃伅
                 SysStorageLocat storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == locatNo && w.IsDel == "0");
                 if (storageLocat == null)
@@ -617,7 +804,7 @@
                     throw new Exception("鏈壘鍒板搴斿偍浣�");
                 }
                 //鏈夌墿鍝併�佸嚭搴撲腑鏁版嵁婧愶紙搴撳瓨鏄庣粏琛級
-                if (storageLocat.Status == "1" || storageLocat.Status == "3")
+                if (storageLocat.Status == "1" || storageLocat.Status == "3" || storageLocat.Status == "5")
                 {
                     //搴撳瓨鏄庣粏
                     List<DataStockDetail> stockDetailList = Db.Queryable<DataStockDetail>().Where(w => w.LocatNo == locatNo && w.IsDel == "0").ToList();
@@ -628,7 +815,7 @@
                     model.LocatNo = locatNo;
                     model.Status = storageLocat.Status;
                     model.PalletNo = stockDetailList[0].PalletNo;
-                    
+
                     List<LocateGoodsInfoVm> goodsList = new List<LocateGoodsInfoVm>();
                     foreach (var item in stockDetailList)
                     {
@@ -637,6 +824,19 @@
                         goodsModel.SkuName = item.SkuName;
                         goodsModel.LotNo = item.LotNo;
                         goodsModel.Qty = item.Qty;
+                        switch (item.InspectStatus)
+                        {
+                            case "0":
+                                status = "寰呮楠�";
+                                break;
+                            case "1":
+                                status = "鍚堟牸";
+                                break;
+                            case "2":
+                                status = "涓嶅悎鏍�";
+                                break;
+                        }
+                        goodsModel.InspectStatus = status;
 
                         goodsList.Add(goodsModel);
                     }
@@ -646,7 +846,8 @@
                 else if (storageLocat.Status == "2")
                 {
                     //鎵樼洏缁戝畾淇℃伅
-                    List<BllPalletBind> palletBindList = Db.Queryable<BllPalletBind>().Where(w => w.LocatNo == locatNo && w.IsDel == "0").ToList();
+                    List<BllPalletBind> palletBindList = Db.Queryable<BllPalletBind>()
+                        .Where(w => w.LocatNo == locatNo && w.IsDel == "0" && w.Status == "1").ToList();
                     if (palletBindList == null || palletBindList.Count <= 0)
                     {
                         throw new Exception("鏈壘鍒板搴旂殑鎵樼洏缁戝畾淇℃伅");
@@ -669,6 +870,7 @@
                         goodsModel.SkuName = noticeDetail.SkuName;
                         goodsModel.LotNo = noticeDetail.LotNo;
                         goodsModel.Qty = noticeDetail.Qty;
+                        goodsModel.InspectStatus = "寰呮楠�";
 
                         goodsList.Add(goodsModel);
                     }
@@ -694,6 +896,12 @@
                     case "3":
                         model.Status = "鍑哄簱涓�";
                         break;
+                    case "4":
+                        model.Status = "绉诲叆涓�";
+                        break;
+                    case "5":
+                        model.Status = "绉诲嚭涓�";
+                        break;
                     default:
                         model.Status = "";
                         break;
@@ -705,5 +913,64 @@
                 throw new Exception(e.Message);
             }
         }
+
+        #region 骞冲簱鍥句緥
+
+        /// <summary>
+        /// 鑾峰彇鍌ㄤ綅淇℃伅(骞冲簱鍥句緥)
+        /// </summary>
+        /// <param name="wareHouseNo">浠撳簱</param>
+        /// <param name="row">鎺�</param>
+        /// <returns></returns>
+        public List<SysStorageLocat> GetFlatLibraryLegend(string wareHouseNo, string row)
+        {
+            try
+            {
+                //涓�妤煎尯鍩�
+                //List<string> row1 = new List<string>()
+                //{
+                //    "B01",
+                //    "B02",
+                //    "B03",
+                //    "B04",
+                //    "B05",
+                //    "B06",
+                //    "B07",
+                //};
+                ////浜屾ゼ鍖哄煙
+                //List<string> row3 = new List<string>()
+                //{
+                //    "B11",
+                //    "B12",
+                //    "B13",
+                //    "B14",
+                //    "B15",
+                //};
+                string row1 = "'B01','B02','B03','B04','B05','B06','B07'";
+                string row3 = "'B11','B12','B13','B14','B15'";
+                string str = $"select * from SysStorageLocat where IsDel = '0' and WareHouseNo = '{wareHouseNo}' and ";
+                if (row == "1")
+                {
+                    str += $" AreaNo in ({row1})";
+                }
+                else if (row == "3")
+                {
+                    str += $" AreaNo in ({row3})";
+                }
+
+                var list = Db.Ado.SqlQuery<SysStorageLocat>(str);
+
+                //var list = Db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && m.WareHouseNo == wareHouseNo && row == "1" ? row1.Contains(m.AreaNo) : row3.Contains(m.AreaNo)).ToList();
+
+                return list;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.8.0