From cd93dd1fd57afa3437e43499236273c2e1df4423 Mon Sep 17 00:00:00 2001
From: admin <qiutairan163@163.com>
Date: 星期五, 19 十二月 2025 14:55:50 +0800
Subject: [PATCH] 车间出库页面车间增加1003车间一楼备件库

---
 Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs |  259 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 229 insertions(+), 30 deletions(-)

diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index d641c57..987c28e 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -450,8 +450,8 @@
                                 WaveNo = "",
                                 IsIssueLotNo = string.IsNullOrWhiteSpace(d.lotNo) ? "0" : "1",
                                 IsMixBox = "0",
-
                                 OrderDetailCode = d.lineNo,
+                                Status = "0",//榛樿绛夊緟鎵ц
 
                                 CreateUser = 0,
                             };
@@ -580,7 +580,7 @@
                                     WaveNo = "",
                                     IsIssueLotNo = string.IsNullOrWhiteSpace(d.lotNo) ? "0" : "1",
                                     IsMixBox = "0",
-
+                                    Status = "0",//榛樿绛夊緟鎵ц
                                     CreateUser = 0,
                                 };
                                 list.Add(item);
@@ -613,11 +613,11 @@
 
                         CreateUser = 0,
                     };
-                    if (houseNo == "1000" || houseNo == "1001" || houseNo == "2000" || houseNo == "2002" || houseNo == "2003" || houseNo == "2004")
+                    if (houseNo == "1000" || houseNo == "1001" || houseNo == "1002" || houseNo == "1003" || houseNo == "1098" || houseNo == "2000" || houseNo == "2001" || houseNo == "2002" || houseNo == "2003" || houseNo == "2004" || houseNo == "3101" || houseNo == "3102" || houseNo == "3103" || houseNo == "3104")
                     {
                         notice.WareHouseNo = "W02";
                     }
-                    else if (houseNo == "4000")
+                    else if (houseNo == "4000" | houseNo == "4001")
                     {
                         notice.WareHouseNo = "W01";
                     }
@@ -746,19 +746,19 @@
                         VBELN = notice.OrderCode,
                         WERKS = notice.CustomerNo,
                         LFART = notice.Type,
-                        WADAT_IST = Convert.ToDateTime(notice.CompleteTime).ToString("yyyy-MM-dd"),
+                        WADAT_IST = Convert.ToDateTime(notice.UpdateTime).ToString("yyyy-MM-dd"),
                         ITEM = list
                     };
                     #region 閫氳繃鎺ュ彛鍙戦�佽嚦erp
                     //绯荤粺瀵规帴鍚庢斁寮�
                     var jsonData = JsonConvert.SerializeObject(soInfo);
 
-                    var response = HttpHelper.DoPost(url, jsonData, "鍑哄簱鍗曞畬鎴愪笂浼�", "ERP");
+                    var response = HttpHelper.DoPost(url, jsonData, "鍑哄簱鍗曞畬鎴愪笂浼�", "SAP");
 
-                    var obj = JsonConvert.DeserializeObject<ErpModel>(response);//瑙f瀽杩斿洖鏁版嵁
-                    if (obj.Success != 0)
+                    var obj = JsonConvert.DeserializeObject<SapResultModel>(response);//瑙f瀽杩斿洖鏁版嵁
+                    if (obj.RESULT != true)
                     {
-                        throw new Exception("涓婁紶澶辫触" + obj.Message);
+                        throw new Exception("涓婁紶澶辫触" + obj.MESSAGE);
                     }
                     #endregion
                 }
@@ -1452,7 +1452,8 @@
                 {
                     throw new Exception("鏈煡璇㈠埌鍑哄簱鍗曟嵁淇℃伅");
                 }
-                if (notice.Origin != "WMS" || notice.Status != "0")
+                //if (notice.Origin != "WMS" || notice.Status != "0")
+                if (notice.Status != "0")
                 {
                     throw new Exception("鍙傛暟寮傚父,璇锋鏌ョ姸鎬佹槸鍚︽湭绛夊緟鎵ц鎴栨潵婧愭槸鍚︽槸WMS");
                 }
@@ -1509,7 +1510,7 @@
                         //鏇存柊鍑哄簱鍗�
                         foreach (var d in model.Detail)
                         {
-                            if (d.Qty < 0M)
+                            if (d.Qty <= 0)
                             {
                                 throw new Exception("鍑哄簱鏁版嵁蹇呴』澶т簬0");
                             }
@@ -1913,12 +1914,14 @@
                 {
                     throw new Exception("鏈煡璇㈠埌鍑哄簱鍗曟嵁淇℃伅");
                 }
-                if (notice.Status != "4")
+                //2025骞�12鏈�08鏃ュ彲鎴疯姹傚皯鎷h揣涔熷彲浠ユ甯稿叧鍗�
+                List<string> statusList = new List<string>() { "3", "4" };
+                if (!statusList.Contains(notice.Status))
                 {
                     throw new Exception("鍙傛暟寮傚父,璇锋鏌ョ姸鎬佹槸鍚︿负鎵ц瀹屾垚鎴栬鍗曞叧闂�");
                 }
-                //鎬诲簱瀛樹俊鎭�
-                var stockList = Db.Queryable<DataStock>().ToList();
+                ////鎬诲簱瀛樹俊鎭�
+                //var stockList = Db.Queryable<DataStock>().ToList();
                 //鍑哄簱鍗曟槑缁�
                 var noticeDetail = Db.Queryable<BllExportNoticeDetail>().Where(m => m.IsDel == "0" && m.SONo == notice.SONo).ToList();
 
@@ -1931,11 +1934,21 @@
                     notice.UpdateTime = DateTime.Now;
                     Db.Updateable(notice).ExecuteCommand();
 
-                    var skuList = noticeDetail.Select(d => d.SkuNo).ToList();
-                    var stocks = stockList.Where(s => skuList.Contains(s.SkuNo)).ToList();
+                    //var skuList = noticeDetail.Select(d => d.SkuNo).ToList();
+                    //var stocks = stockList.Where(s => skuList.Contains(s.SkuNo)).ToList();
+
+                    List<string> sqlList = new List<string>();
 
                     foreach (var d in noticeDetail)
                     {
+                        if (notice.Type == "0")//鎴愬搧鍑哄簱锛岃鍒掓暟閲忓拰鎷h揣鏁伴噺蹇呴』涓�鑷�
+                        {
+                            if (d.CompleteQty != d.Qty)
+                            {
+                                throw new Exception($"鍏冲崟澶辫触,鐗╂枡:{d.SkuNo}璁″垝鏁伴噺鍜屾嫞璐ф暟閲忎笉涓�鑷达紒");
+                            }
+                        }
+                        #region MyRegion
                         //鏇存敼搴撳瓨鏄庣粏閿佸畾鏁伴噺
                         //var orders = dataContext.WmsExportOrder.Where(o => o.ExportDetailId == d.Id
                         //                && o.ExportExecuteFlag != "4" && o.ExportExecuteFlag == "3" && o.pickingType == 0).ToList();
@@ -1967,7 +1980,8 @@
                         //{
                         //    throw new Exception("褰撳墠鍗曟嵁鏄庣粏涓鍒掓暟閲忎笌鎷h揣鏁伴噺涓嶇锛岃鏍稿疄");
                         //}
-                        #region 搴撳瓨琛ㄥ噺鍘婚攣瀹氭暟閲忎笌鎬绘暟閲�(PDA鎷h揣鐨勬椂鍊欏凡缁忓噺鍘绘暟閲忎簡)
+
+                        //搴撳瓨琛ㄥ噺鍘婚攣瀹氭暟閲忎笌鎬绘暟閲�(PDA鎷h揣鐨勬椂鍊欏凡缁忓噺鍘绘暟閲忎簡)
                         /*var sq = stocks.Where(s => s.SkuNo == d.SkuNo);
                         if (!string.IsNullOrWhiteSpace(d.LotNo))
                         {
@@ -1994,7 +2008,62 @@
                             Db.Updateable(st).UpdateColumns(it => new { it.Qty, it.LockQty }).ExecuteCommand();
                         }*/
                         #endregion
+                        //瀹為檯鎷h揣琛�
+                        string completeSql = $@"select PalletNo,Qty-CompleteQty as lessQty
+	from BllExportAllot
+	where IsDel='0' and SONo='{d.SONo}' and SkuNo='{d.SkuNo}' and LotNo='{d.LotNo}'";
+                        DataTable completeDt = Db.Ado.GetDataTable(completeSql);
+                        //淇敼鎵樼洏鏄庣粏鐨勯攣瀹氭暟閲�
+                        foreach (DataRow dr in completeDt.Rows)
+                        {
+                            decimal lessQty = Convert.ToDecimal(dr["lessQty"]);
+                            if (lessQty > 0)
+                            {
+                                //鏌ョ湅搴撳瓨鏄庣粏閿佸畾鏁伴噺-lessQty
+                                string stockDetailSql = $@"select LockQty-{lessQty} as morelockQty from DataStockDetail where IsDel='0' and SkuNo='{d.SkuNo}' and LotNo='{d.LotNo}' and PalletNo='{dr["PalletNo"] + ""}'";
+                                decimal morelockQty = Db.Ado.GetDecimal(stockDetailSql);
+
+                                if (morelockQty > 0)
+                                {
+                                    sqlList.Add($@"update DataStockDetail set LockQty=LockQty-{lessQty} where IsDel='0' and SkuNo='{d.SkuNo}' and LotNo='{d.LotNo}' and PalletNo='{dr["PalletNo"] + ""}'");
+                                }
+                                else if (morelockQty == 0)
+                                {
+                                    sqlList.Add($@"update DataStockDetail set LockQty=0,Status='0' where IsDel='0' and SkuNo='{d.SkuNo}' and LotNo='{d.LotNo}' and PalletNo='{dr["PalletNo"] + ""}'");
+                                }
+                            }
+
+                        }
                     }
+
+                    //淇敼搴撳瓨鎬昏〃
+                    string exportDetailSql = $@"select SkuNo,LotNo,sum(Qty)-sum(CompleteQty) as lessQty
+	from BllExportNoticeDetail
+	where IsDel='0' and SONo='{notice.SONo}'
+	group by SkuNo,LotNo";
+                    DataTable exportDetailDt = Db.Ado.GetDataTable(exportDetailSql);
+
+                    foreach (DataRow dr in exportDetailDt.Rows)
+                    {
+                        decimal lessQty = Convert.ToDecimal(dr["lessQty"]);
+                        if (lessQty > 0)
+                        {
+                            //鏌ョ湅搴撳瓨閿佸畾鏁伴噺-lessQty
+                            string stockDetailSql = $@"select LockQty-{lessQty} as morelockQty from DataStock where IsDel='0' and SkuNo='{dr["SkuNo"] + ""}' and LotNo='{dr["LotNo"] + ""}'";
+                            decimal morelockQty = Db.Ado.GetDecimal(stockDetailSql);
+
+                            if (morelockQty >= 0)
+                            {
+                                sqlList.Add($@"update DataStock set LockQty=LockQty-{lessQty} where IsDel='0' and SkuNo='{dr["SkuNo"] + ""}' and LotNo='{dr["LotNo"] + ""}'");
+                            }
+                        }
+                    }
+
+                    foreach (string sqlStr in sqlList)
+                    {
+                        var end = Db.Ado.ExecuteCommand(sqlStr);
+                    }
+
                     //娣诲姞鎿嶄綔鏃ュ織璁板綍
                     var k = new OperationSOServer().AddLogOperationSo("鍑哄簱浣滀笟", "鍑哄簱鍗曟嵁", notice.SONo, "鍏冲崟", $"鍏抽棴浜嗗崟鎹彿涓簕notice.SONo}鐨勫崟鎹俊鎭�", userId);
 
@@ -2087,10 +2156,10 @@
                                 strr[i] = comDetail[i].BoxNo + "," + comDetail[i].SONo + "," + userinfo + "," + Convert.ToString(comDetail[i].CreateTime);
                                 break;
                             case 2:
-                                strr[i] = comDetail[i].BoxNo3 + "," + comDetail[i].SONo + "," + userinfo + "," + Convert.ToString(comDetail[i].CreateTime);
+                                strr[i] = comDetail[i].BoxNo2 + "," + comDetail[i].SONo + "," + userinfo + "," + Convert.ToString(comDetail[i].CreateTime);
                                 break;
                             case 3:
-                                strr[i] = comDetail[i].BoxNo2 + "," + comDetail[i].SONo + "," + userinfo + "," + Convert.ToString(comDetail[i].CreateTime);
+                                strr[i] = comDetail[i].BoxNo3 + "," + comDetail[i].SONo + "," + userinfo + "," + Convert.ToString(comDetail[i].CreateTime);
                                 break;
                             default:
                                 break;
@@ -2118,6 +2187,123 @@
                 throw new Exception("鐢熸垚XML鏂囦欢閿欒锛�" + ex.Message);
             }
         }
+
+
+        /// <summary>
+        /// 鎵归噺鐢熸垚xml
+        /// </summary>
+        /// <param name="date">鏃ユ湡</param>
+        /// <param name="userId">鐢ㄦ埛id</param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public List<ExportXmlDto> AddExportXmls(string date, int userId)
+        {
+            List<ExportXmlDto> xmlList = new List<ExportXmlDto>();
+            try
+            {
+                string exportSql = $@"select SONo,Status,Type,case isnull(OrderCode,'') when '' then 'null' else OrderCode end OrderCode
+	from BllExportNotice
+	where IsDel='0' and Type='0'and SONo like 'SO{date.Replace("-", "")}%'
+	order by SONo";
+                DataTable exportDt = Db.Ado.GetDataTable(exportSql);
+
+                if (exportDt == null || exportDt.Rows.Count < 1)
+                {
+                    return xmlList;
+                }
+
+                foreach (DataRow dr in exportDt.Rows)
+                {
+                    string soNo = dr["SONo"] + "";
+                    string status = dr["Status"] + "";
+                    string type = dr["Type"] + "";
+
+                    var noticeDetial = Db.Queryable<BllExportNoticeDetail>().Where(w => w.IsDel == "0" && w.SONo == soNo).First();
+                    if (noticeDetial == null)
+                    {
+                        throw new Exception("鏈煡璇㈠埌鍑哄簱鍗曟嵁鏄庣粏淇℃伅");
+                    }
+                    List<string> statusList = new List<string>() { "4", "5", "6" };
+                    if (!statusList.Contains(status))
+                    {
+                        throw new Exception("鍙傛暟寮傚父,璇锋鏌ョ姸鎬佹槸鍚︿负鎵ц瀹屾垚鎴栬鍗曞叧闂�/宸蹭笂浼�");
+                    }
+                    string xmlName = string.Empty;
+                    string fileName = "";
+                    switch (type)
+                    {
+                        //鎴愬搧鍑哄簱/閿�鍞嚭搴�
+                        case "0": { xmlName = "SalesWareHouseOut"; fileName = $@"SalesWareHouseOut_{dr["OrderCode"] + ""}_linklink"; } break;
+                        //鎶芥鍑哄簱
+                        case "2": { xmlName = "CheckWareHouseOut"; fileName = $@"CheckWareHouseOut_{dr["OrderCode"] + ""}_linklink"; } break;
+                        default: throw new Exception("鍗曟嵁绫诲瀷寮傚父");
+                    }
+
+                    var materiDetial = Db.Queryable<SysMaterials>().First(w => w.IsDel == "0" && w.SkuNo == noticeDetial.SkuNo);
+                    var packType = Db.Queryable<SysPackag>().First(w => w.IsDel == "0" && w.PackagNo == materiDetial.PackagNo);
+                    int level = 0;
+                    if (!string.IsNullOrEmpty(packType.L2Name))
+                    {
+                        level = 1;
+                    }
+                    if (!string.IsNullOrEmpty(packType.L3Name))
+                    {
+                        level = 2;
+                    }
+                    if (!string.IsNullOrEmpty(packType.L4Name))
+                    {
+                        level = 3;
+                    }
+                    //鍑哄簱鍗曟槑缁�
+                    var comDetail = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.SONo == soNo).ToList();
+                    var userinfo = Db.Queryable<SysUserInfor>().Where(m => m.Id == comDetail.First().CreateUser).First().RealName;
+
+                    //寮�鍚簨鍔�
+                    Db.BeginTran();
+                    try
+                    {
+                        var pars = new List<string>();
+                        string[] strr = new string[comDetail.Count];
+
+                        for (int i = 0; i < comDetail.Count(); i++)
+                        {
+                            switch (level)
+                            {
+                                case 1: strr[i] = comDetail[i].BoxNo + "," + comDetail[i].SONo + "," + userinfo + "," + Convert.ToString(comDetail[i].CreateTime); break;
+                                case 2: strr[i] = comDetail[i].BoxNo2 + "," + comDetail[i].SONo + "," + userinfo + "," + Convert.ToString(comDetail[i].CreateTime); break;
+                                case 3: strr[i] = comDetail[i].BoxNo3 + "," + comDetail[i].SONo + "," + userinfo + "," + Convert.ToString(comDetail[i].CreateTime); break;
+                                default: break;
+                            }
+                            pars.Add(strr[i]);
+                        }
+
+                        XmlDocument dom = HttpHelper.EncodeParsToFuMa(pars, "", xmlName, "ExInfoXml");
+
+                        ExportXmlDto xmlDto = new ExportXmlDto()
+                        {
+                            fileName = fileName,
+                            fileContent = dom.InnerXml
+                        };
+                        xmlList.Add(xmlDto);
+                        //娣诲姞鎿嶄綔鏃ュ織璁板綍
+                        var k = new OperationSOServer().AddLogOperationSo("鍑哄簱浣滀笟", "鍑哄簱鍗曟嵁", soNo, "涓婁紶", $"涓婁紶浜嗗崟鎹彿涓簕soNo}鐨勫崟鎹俊鎭�", userId);
+
+                        Db.CommitTran();
+                    }
+                    catch (Exception e)
+                    {
+                        Db.RollbackTran();
+                        throw new Exception(e.Message);
+                    }
+                }
+                return xmlList;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("鐢熸垚XML鏂囦欢閿欒锛�" + ex.Message);
+            }
+        }
+
 
         #endregion
 
@@ -2790,11 +2976,14 @@
                         }
                         //杩橀渶瑕佸垎閰嶇殑鏁伴噺
                         decimal needQty = detail.Qty - (detail.AllotQty == null ? 0 : decimal.Parse(detail.AllotQty.ToString()));
-                        //搴撳瓨鏄庣粏 Status 0锛氬緟鍒嗛厤 1锛氶儴鍒嗗垎閰�  2锛氬凡鍒嗛厤 
-                        var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.SkuNo == detail.SkuNo && (m.Qty - m.FrozenQty - m.LockQty + m.InspectQty) > 0 && (m.Status == "0" || m.Status == "1") && m.IsDel == "0"
-                        && m.AreaNo != "B06" && m.AreaNo != "B07" && m.AreaNo != "B09" && m.AreaNo != "B24")//鎺掗櫎杞﹂棿搴撳瓨
-                            .ToList();
 
+                        //鎺掗櫎杞﹂棿搴撳瓨
+                        string areaNoSql = $@"select AreaNo from SysStorageArea where IsDel='0' and AreaType='1'";
+                        DataTable areaNoDt = Db.Ado.GetDataTable(areaNoSql);
+                        List<string> areaNoList = areaNoDt.Rows.Cast<DataRow>().Select(e => e["AreaNo"] + "").ToList();
+
+                        //搴撳瓨鏄庣粏 Status 0锛氬緟鍒嗛厤 1锛氶儴鍒嗗垎閰�  2锛氬凡鍒嗛厤 
+                        var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.SkuNo == detail.SkuNo && (m.Qty - m.FrozenQty - m.LockQty + m.InspectQty) > 0 && (m.Status == "0" || m.Status == "1") && m.IsDel == "0" && !areaNoList.Contains(m.AreaNo)).ToList();
 
                         //鍒ゆ柇鍗曞彿鏄惁鎸囧畾鎵规
                         if (!string.IsNullOrWhiteSpace(detail.LotNo))
@@ -2879,7 +3068,9 @@
                                 CreateUser = userId,
                                 CreateTime = DateTime.Now
                             };
-                            if (s.WareHouseNo == "W04")
+                            //2025骞�12鏈�08鏃ヨ揣鏋跺簱鍜屽钩搴擄紝鐩存帴寰呮嫞璐�
+                            List<string> wareHouseList = new List<string>() { "W02", "W04" };
+                            if (wareHouseList.Contains(s.WareHouseNo))
                             {
                                 allot.Status = "2";//寰呮嫞璐�
                                 xQty += allot.Qty;
@@ -3335,7 +3526,9 @@
                             CreateUser = userId,
                             CreateTime = DateTime.Now
                         };
-                        if (stock.WareHouseNo == "W04")
+                        //2025骞�12鏈�08鏃ヨ揣鏋跺簱鍜屽钩搴擄紝鐩存帴寰呮嫞璐�
+                        List<string> wareHouseList = new List<string>() { "W02", "W04" };
+                        if (wareHouseList.Contains(stock.WareHouseNo))
                         {
                             allot.Status = "2";//寰呮嫞璐�
                             xQty += allot.Qty;
@@ -4763,7 +4956,9 @@
 
                     }
 
-                    var endLocateList = Db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && (m.AreaNo == "B02" || m.AreaNo == "B05")).Select(m => m.LocatNo).ToList();
+                    //鎵�灞炲尯鍩熼泦鍚�
+                    List<string> areNolist = new List<string>() { "B01", "B02", "B05" };
+                    var endLocateList = Db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && areNolist.Contains(m.AreaNo)).Select(m => m.LocatNo).ToList();
                     //鍒ゆ柇鏄惁鏄師杈呮枡鍑哄簱浠诲姟  璐ф灦鍌ㄤ綅=銆嬪钩搴撳偍浣�
                     if (endLocateList.Contains(task.EndLocat) && PalletType == "0")
                     {
@@ -6522,19 +6717,22 @@
                         throw new Exception("鏈煡璇㈠埌浠诲姟淇℃伅");
                     }
                     //鑾峰彇瀵瑰簲搴撲綅淇℃伅
-                    var startlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.StartLocat);
+                    //var startlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.StartLocat);
+                    var startlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.LocatNo == task.StartLocat);
                     if (startlocat == null)
                     {
                         throw new Exception("鏈煡璇㈠埌鍌ㄤ綅淇℃伅");
                     }
                     startlocat.Status = "0";//淇敼鍒嗛厤淇℃伅鐘舵��
                     //鑾峰彇鍌ㄤ綅淇℃伅
-                    var locat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.StartLocat);
+                    //var locat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.StartLocat);
+                    var locat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.LocatNo == task.StartLocat);
                     //鑾峰彇绉诲簱浠籨鍔″搴旂洰鏍囧偍浣嶄俊鎭�
                     SysStorageLocat endlocat = new SysStorageLocat();
                     if (task.Type == "2")
                     {
-                        endlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.EndLocat);
+                        //endlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.EndLocat);
+                        endlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.LocatNo == task.EndLocat);
                         if (endlocat == null)
                         {
                             throw new Exception("鏈煡璇㈠埌鐩爣鍌ㄤ綅淇℃伅");
@@ -6598,7 +6796,8 @@
                         //鑾峰彇搴撳瓨
                         var datastock = Db.Queryable<DataStock>().First(a => a.IsDel == "0" && a.SkuNo == stockDetail.SkuNo);
                         //鑾峰彇鍌ㄤ綅淇℃伅
-                        var locate = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == stockDetail.LocatNo);
+                        //var locate = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == stockDetail.LocatNo);
+                        var locate = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.LocatNo == stockDetail.LocatNo);
 
                         //鍒ゆ柇鏄惁涓虹┖鎵樼洏
                         if (stockDetail.SkuNo == "100099")

--
Gitblit v1.8.0