莫海杰 3 месяцев назад
Родитель
Сommit
05020cfd6a

+ 4 - 4
SCADA_DAQ/Customer/Service/Wcs_ItemTaskInventoryService.cs

@@ -79,7 +79,7 @@ namespace SCADA_DAQ.Customer.Service
     
             #region /完成任务更新库存数量逻辑
             var successItemTaskQtyList = successItemTaskQty.ToLookup(t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode }).ToList();
-            string inventoryFilter = null;
+            string inventoryFilter = "ID = 0";
             foreach (var itemTaskQtyValues in successItemTaskQtyList)
             {
                 foreach (var itemTaskQtyValue in itemTaskQtyValues)
@@ -106,7 +106,7 @@ namespace SCADA_DAQ.Customer.Service
             }
             for (int j = 0; j < updateSumItemQtyList.Count; j++)
             {
-                if (inventoryFilter == null)
+                if (inventoryFilter == "ID = 0")
                 {
                     inventoryFilter = $" (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
                 }
@@ -222,7 +222,7 @@ namespace SCADA_DAQ.Customer.Service
 
             #region /完成任务更新库存数量逻辑
             var successItemTaskQtyList = successItemTaskQty.ToLookup(t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode }).ToList();
-            string inventoryFilter = null;
+            string inventoryFilter = "ID = 0";
             foreach (var itemTaskQtyValues in successItemTaskQtyList)
             {
                 foreach (var itemTaskQtyValue in itemTaskQtyValues)
@@ -249,7 +249,7 @@ namespace SCADA_DAQ.Customer.Service
             }
             for (int j = 0; j < updateSumItemQtyList.Count; j++)
             {
-                if (inventoryFilter == null)
+                if (inventoryFilter == "ID = 0")
                 {
                     inventoryFilter = $" (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
                 }

+ 46 - 37
SCADA_DAQ/Customer/Service/Wcs_WebInventoryService.cs

@@ -21,7 +21,7 @@ namespace SCADA_DAQ.Customer.Service
         {
             var sourLocationFilter = row.SourceLocation == "" ? "1=1" : $"SourceLocation_Str='{row.SourceLocation}'";
             var itemCodeFilter = row.ItemCode == "" ? "1=1" : $"ItemCode_Str='{row.ItemCode}'";
-            var itemNameFilter = row.ItemName == "" ? "1=1" : $"ItemName_Str like '%{row.ItemName}%'";
+            var itemNameFilter = row.ItemName == "" ? "1=1" : $"ItemName_Str like '%{row.ItemName}'";
             var filterStr = $"{itemCodeFilter} and {sourLocationFilter} and {itemNameFilter}";
             var sqlStr = GetTableSql("App_BC_Inventory", filterStr, page);
             var taskTable = Env.DAL.ReadDataTable(sqlStr).DtToList<AppBCInventoryVo>();
@@ -34,6 +34,13 @@ namespace SCADA_DAQ.Customer.Service
         public RpcResponse<object> AddEditInventoryTableRow(int action, AppBCInventoryVo row)
         {
             var res = new RpcResponse<object>();
+            var list = Env.DAL.App_BC_Inventory.GetData<App_BC_Inventory>(t => t.WarehouseCode_Str == row.WarehouseCode && t.ItemCode_Str == row.ItemCode);
+            if (list != null && list.Count > 0)
+            {
+                res.IsSucceed = false;
+                res.Message = $"已存在 仓库{row.WarehouseCode}物料号{row.ItemCode}, 修改货架号即可";
+                return res;
+            }
             if (action == 1)
             {
                 var ok = Env.DAL.App_BC_Inventory.Insert(
@@ -43,15 +50,16 @@ namespace SCADA_DAQ.Customer.Service
                     new UpdateItem(T_Col_Name.App_BC_Inventory.Qty_Dec, row.Qty),
                     new UpdateItem(T_Col_Name.App_BC_Inventory.WarehouseCode_Str, row.WarehouseCode),
                     new UpdateItem(T_Col_Name.App_BC_Inventory.SourceLocation_Str, row.SourceLocation),
+                    new UpdateItem(T_Col_Name.App_BC_Inventory.LocationName_Str, row.LocationName),
                     new UpdateItem(T_Col_Name.App_BC_Inventory.Remark_Str, row.Remark)
                    );
                 if (!ok)
                 {
                     res.IsSucceed = false;
-                    res.Data = ok.ErrorMessage;
+                    res.Message = ok.ErrorMessage.ToString();
                     return res;
                 }
-                res.Data = "新增成功";
+                res.Message = "新增成功";
                 return res;
             }
             else
@@ -63,15 +71,16 @@ namespace SCADA_DAQ.Customer.Service
                     new UpdateItem(T_Col_Name.App_BC_Inventory.Qty_Dec, row.Qty),
                     new UpdateItem(T_Col_Name.App_BC_Inventory.WarehouseCode_Str, row.WarehouseCode),
                     new UpdateItem(T_Col_Name.App_BC_Inventory.SourceLocation_Str, row.SourceLocation),
+                    new UpdateItem(T_Col_Name.App_BC_Inventory.LocationName_Str, row.LocationName),
                     new UpdateItem(T_Col_Name.App_BC_Inventory.Remark_Str, row.Remark)
                 );
                 if (!ok)
                 {
                     res.IsSucceed = false;
-                    res.Data = ok.ErrorMessage;
+                    res.Message = ok.ErrorMessage.ToString();
                     return res;
                 }
-                res.Data = "更改成功";
+                res.Message = "更改成功";
                 return res;
             }
         }
@@ -83,41 +92,41 @@ namespace SCADA_DAQ.Customer.Service
             if (!ok)
             {
                 res.IsSucceed = false;
-                res.Data = ok.ErrorMessage;
+                res.Message = ok.ErrorMessage.ToString();
                 return res;
             }
-            res.Data = "删除成功";
+            res.Message = "删除成功";
             return res;
         }
 
         // 获取二维图
-        public RpcResponse<object> GetInventoryView(int row)
-        {
-            var rowFilter = $"Row_Int='{row}'";
-            var tets = Env.DAL.App_BC_Warehouse.GetData<App_BC_Warehouse>(rowFilter).ToLookup(t => t.Layer_Int).OrderByDescending(x => x.Key);
-            var views = new List<List<InventoryViewVo>>();
-            foreach (var view in tets)
-            {
-                var viewChildren = new List<InventoryViewVo>();
-                foreach (var viewChild in view.OrderBy(x => x.Col_Int))
-                {
-                    viewChildren.Add(new InventoryViewVo
-                    {
-                        ID = (int)viewChild.ID,
-                        SourceLocation = viewChild.SourceLocation_Str,
-                        Row = viewChild.Row_Int,
-                        Col = viewChild.Col_Int,
-                        Layer = viewChild.Layer_Int,
-                        State = viewChild.State_Int,
-                    });
-                }
-                views.Add(viewChildren);
-            }
-            return new RpcResponse<object>()
-            {
-                Data = views
-            };
-        }
+        //public RpcResponse<object> GetInventoryView(int row)
+        //{
+        //    var rowFilter = $"Row_Int='{row}'";
+        //    var tets = Env.DAL.App_BC_Warehouse.GetData<App_BC_Warehouse>(rowFilter).ToLookup(t => t.Layer_Int).OrderByDescending(x => x.Key);
+        //    var views = new List<List<InventoryViewVo>>();
+        //    foreach (var view in tets)
+        //    {
+        //        var viewChildren = new List<InventoryViewVo>();
+        //        foreach (var viewChild in view.OrderBy(x => x.Col_Int))
+        //        {
+        //            viewChildren.Add(new InventoryViewVo
+        //            {
+        //                ID = (int)viewChild.ID,
+        //                SourceLocation = viewChild.SourceLocation_Str,
+        //                Row = viewChild.Row_Int,
+        //                Col = viewChild.Col_Int,
+        //                Layer = viewChild.Layer_Int,
+        //                State = viewChild.State_Int,
+        //            });
+        //        }
+        //        views.Add(viewChildren);
+        //    }
+        //    return new RpcResponse<object>()
+        //    {
+        //        Data = views
+        //    };
+        //}
 
         // 获取具体库位信息
         //public RpcResponse<object> GetSourceLocation(PointBo row)
@@ -151,14 +160,14 @@ namespace SCADA_DAQ.Customer.Service
         //    };
         //}
 
-        // 获取具体库位信息
+        // 导入
         public RpcResponse<object> ImportInventory(List<AppBCInventoryModel> row)
         {
             var res = Env.DAL.BatchUpdateOrInsert(
                     row,
-                    t => new { t.SourceLocation, t.ItemCode, t.WarehouseCode },
+                    t => new { t.ItemCode, t.WarehouseCode },
                     null,
-                    t => new { t.ItemName, t.Qty, t.UnitCode, t.Remark, t.LocationName }
+                    t => new { t.ItemName, t.Qty, t.UnitCode, t.Remark, t.LocationName, t.SourceLocation }
                 );
             return new RpcResponse<object>()
             {

+ 469 - 469
SCADA_DAQ/Customer/Service/Wcs_WebItemTaskService.cs

@@ -21,364 +21,364 @@ namespace SCADA_DAQ.Customer.Service
 {
     public partial class WcsService
     {
-        public RpcResponse<object> GetItemUpTable(PageBo page, AppBCItemVo item, ShowSyncedState showSynced, string tag)
-        {
-            var itemWorkNoFilter = item.ItemWorkNo == null ? "1=1" : item.ItemWorkNo == "" ? "1=1" : $"ItemWorkNo_Str='{item.ItemWorkNo}'";
-            var billNoFilter = item.BillNo == null ? "1=1" : item.BillNo == "" ? "1=1" : $"BillNo_Str='{item.BillNo}'";
-            var itemNoFilter = item.ItemNo == null ? "1=1" : item.ItemNo == "" ? "1=1" : $"ItemNo_Str='{item.ItemNo}'";
-            var itemCodeFilter = item.ItemCode == null ? "1=1" : item.ItemCode == "" ? "1=1" : $"ItemCode_Str='{item.ItemCode}'";
-            var syncedFilter = showSynced == ShowSyncedState.Synced ? "IsSynced_Bit='1'" : showSynced == ShowSyncedState.NotSynced ? "IsSynced_Bit='0' and ( Remark_Str is null or Remark_Str = '') " : showSynced == ShowSyncedState.SyncedError ? "IsSynced_Bit='0' and ( Remark_Str is not null or Remark_Str != '')" : $"1=1";
-            var tagFilter = tag == "L-" ? "SourceLocationTag_Str like '%L-%'" : tag == "DQA-" ? "SourceLocationTag_Str like '%DQA-%'" : $"1=1";
-            var filterStr = $"{itemWorkNoFilter} and {billNoFilter} and {itemNoFilter} and {itemCodeFilter} and {syncedFilter} and {tagFilter}";
-            var sqlStr = GetTableSql("App_BC_ItemUp", filterStr, page);
-            var taskTable = Env.DAL.ReadDataTable(sqlStr).DtToList<AppBCItemVo>();
-            return new RpcResponse<object>()
-            {
-                Data = taskTable
-            };
-        }
+        //public RpcResponse<object> GetItemUpTable(PageBo page, AppBCItemVo item, ShowSyncedState showSynced, string tag)
+        //{
+        //    var itemWorkNoFilter = item.ItemWorkNo == null ? "1=1" : item.ItemWorkNo == "" ? "1=1" : $"ItemWorkNo_Str='{item.ItemWorkNo}'";
+        //    var billNoFilter = item.BillNo == null ? "1=1" : item.BillNo == "" ? "1=1" : $"BillNo_Str='{item.BillNo}'";
+        //    var itemNoFilter = item.ItemNo == null ? "1=1" : item.ItemNo == "" ? "1=1" : $"ItemNo_Str='{item.ItemNo}'";
+        //    var itemCodeFilter = item.ItemCode == null ? "1=1" : item.ItemCode == "" ? "1=1" : $"ItemCode_Str='{item.ItemCode}'";
+        //    var syncedFilter = showSynced == ShowSyncedState.Synced ? "IsSynced_Bit='1'" : showSynced == ShowSyncedState.NotSynced ? "IsSynced_Bit='0' and ( Remark_Str is null or Remark_Str = '') " : showSynced == ShowSyncedState.SyncedError ? "IsSynced_Bit='0' and ( Remark_Str is not null or Remark_Str != '')" : $"1=1";
+        //    var tagFilter = tag == "L-" ? "SourceLocationTag_Str like '%L-%'" : tag == "DQA-" ? "SourceLocationTag_Str like '%DQA-%'" : $"1=1";
+        //    var filterStr = $"{itemWorkNoFilter} and {billNoFilter} and {itemNoFilter} and {itemCodeFilter} and {syncedFilter} and {tagFilter}";
+        //    var sqlStr = GetTableSql("App_BC_ItemUp", filterStr, page);
+        //    var taskTable = Env.DAL.ReadDataTable(sqlStr).DtToList<AppBCItemVo>();
+        //    return new RpcResponse<object>()
+        //    {
+        //        Data = taskTable
+        //    };
+        //}
 
-        public RpcResponse<object> AddEditItemUpTableRow(int action, AppBCItemVo item)
-        {
-            var res = new RpcResponse<object>();
-            if (action == 1)
-            {
-                return res;
-            }
-            else
-            {
-                var ok = Env.DAL.App_BC_ItemUp.Update($"ItemNo_Str='{item.ItemNo}'",
-                    new UpdateItem(T_Col_Name.App_BC_ItemUp.ActualTotalQty_Dec, item.ActualTotalQty),
-                    new UpdateItem(T_Col_Name.App_BC_ItemUp.SourceLocations_Str, item.SourceLocations),
-                    new UpdateItem(T_Col_Name.App_BC_ItemUp.LocationItemsNum_Str, item.LocationItemsNum)
-                );
-                string taskNosStr = null;
-                item.ItemNo.Split('/').ToList().ForEach(t =>
-                {
-                    if (taskNosStr == null)
-                    {
-                        taskNosStr = $"'{t}'"; ;
-                    }
-                    else
-                    {
-                        taskNosStr = $"{taskNosStr},'{t}'";
-                    }
-                });
-                var filter = $" TaskNo_Str in ({taskNosStr})";
-                var filterStr = $"{filter}";
-                var itemTasks = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskModel>(filterStr);
-                bool dbRes;
-                if (itemTasks?.Count != 0)
-                {
-                    foreach (var it in itemTasks)
-                    {
-                        if (item.ActualTotalQty >= it.PlannedQty)
-                        {
-                            it.ActualQty = it.PlannedQty;
-                            item.ActualTotalQty -= it.PlannedQty;
-                        }
-                        else
-                        {
-                            it.ActualQty = item.ActualTotalQty;
-                            item.ActualTotalQty = 0;
-                        }
-                    }
-                    dbRes = Env.DAL.BatchUpdateOrInsert(
-                        itemTasks,
-                        t => new { t.TaskNo },
-                        null,
-                        t => new { t.ActualQty }
-                    );
-                    if (ok == false || dbRes == false)
-                    {
-                        res.IsSucceed = false;
-                        res.Message = (string)ok.ErrorMessage;
-                        return res;
-                    }
-                }
-                res.Message = "更改成功";
-                return res;
-            }
-        }
+        //public RpcResponse<object> AddEditItemUpTableRow(int action, AppBCItemVo item)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    if (action == 1)
+        //    {
+        //        return res;
+        //    }
+        //    else
+        //    {
+        //        var ok = Env.DAL.App_BC_ItemUp.Update($"ItemNo_Str='{item.ItemNo}'",
+        //            new UpdateItem(T_Col_Name.App_BC_ItemUp.ActualTotalQty_Dec, item.ActualTotalQty),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemUp.SourceLocations_Str, item.SourceLocations),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemUp.LocationItemsNum_Str, item.LocationItemsNum)
+        //        );
+        //        string taskNosStr = null;
+        //        item.ItemNo.Split('/').ToList().ForEach(t =>
+        //        {
+        //            if (taskNosStr == null)
+        //            {
+        //                taskNosStr = $"'{t}'"; ;
+        //            }
+        //            else
+        //            {
+        //                taskNosStr = $"{taskNosStr},'{t}'";
+        //            }
+        //        });
+        //        var filter = $" TaskNo_Str in ({taskNosStr})";
+        //        var filterStr = $"{filter}";
+        //        var itemTasks = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskModel>(filterStr);
+        //        bool dbRes;
+        //        if (itemTasks?.Count != 0)
+        //        {
+        //            foreach (var it in itemTasks)
+        //            {
+        //                if (item.ActualTotalQty >= it.PlannedQty)
+        //                {
+        //                    it.ActualQty = it.PlannedQty;
+        //                    item.ActualTotalQty -= it.PlannedQty;
+        //                }
+        //                else
+        //                {
+        //                    it.ActualQty = item.ActualTotalQty;
+        //                    item.ActualTotalQty = 0;
+        //                }
+        //            }
+        //            dbRes = Env.DAL.BatchUpdateOrInsert(
+        //                itemTasks,
+        //                t => new { t.TaskNo },
+        //                null,
+        //                t => new { t.ActualQty }
+        //            );
+        //            if (ok == false || dbRes == false)
+        //            {
+        //                res.IsSucceed = false;
+        //                res.Message = (string)ok.ErrorMessage;
+        //                return res;
+        //            }
+        //        }
+        //        res.Message = "更改成功";
+        //        return res;
+        //    }
+        //}
 
-        public RpcResponse<object> GetItemLowTable(PageBo page, AppBCItemVo item, ShowSyncedState showSynced, string tag)
-        {
-            var itemWorkNoFilter = item.ItemWorkNo == null ? "1=1" : item.ItemWorkNo == "" ? "1=1" : $"ItemWorkNo_Str='{item.ItemWorkNo}'";
-            var billNoFilter = item.BillNo == null ? "1=1" : item.BillNo == "" ? "1=1" : $"BillNo_Str='{item.BillNo}'";
-            var itemNoFilter = item.ItemNo == null ? "1=1" : item.ItemNo == "" ? "1=1" : $"ItemNo_Str='{item.ItemNo}'";
-            var workCenterFilter = item.WorkCenter == null ? "1=1" : item.WorkCenter == "" ? "1=1" : $"WorkCenter_Str='{item.WorkCenter}'";
-            var itemCodeFilter = item.ItemCode == null ? "1=1" : item.ItemCode == "" ? "1=1" : $"ItemCode_Str='{item.ItemCode}'";
-            var syncedFilter = showSynced == ShowSyncedState.Synced ? "IsSynced_Bit='1'" : showSynced == ShowSyncedState.NotSynced ? "IsSynced_Bit='0' and ( Remark_Str is null or Remark_Str = '') " : showSynced == ShowSyncedState.SyncedError ? "IsSynced_Bit='0' and ( Remark_Str is not null or Remark_Str != '')" : $"1=1";
-            var tagFilter = tag == "L-" ? "SourceLocationTag_Str like '%L-%'" : tag == "DQA-" ? "SourceLocationTag_Str like '%DQA-%'" : $"1=1";
-            var filterStr = $"{itemWorkNoFilter} and {billNoFilter} and {itemNoFilter} and {itemCodeFilter} and {syncedFilter} and {workCenterFilter} and {tagFilter}";
-            var sqlStr = GetTableSql("App_BC_ItemLow", filterStr, page);
-            var taskTable = Env.DAL.ReadDataTable(sqlStr).DtToList<AppBCItemVo>();
-            return new RpcResponse<object>()
-            {
-                Data = taskTable
-            };
-        }
+        //public RpcResponse<object> GetItemLowTable(PageBo page, AppBCItemVo item, ShowSyncedState showSynced, string tag)
+        //{
+        //    var itemWorkNoFilter = item.ItemWorkNo == null ? "1=1" : item.ItemWorkNo == "" ? "1=1" : $"ItemWorkNo_Str='{item.ItemWorkNo}'";
+        //    var billNoFilter = item.BillNo == null ? "1=1" : item.BillNo == "" ? "1=1" : $"BillNo_Str='{item.BillNo}'";
+        //    var itemNoFilter = item.ItemNo == null ? "1=1" : item.ItemNo == "" ? "1=1" : $"ItemNo_Str='{item.ItemNo}'";
+        //    var workCenterFilter = item.WorkCenter == null ? "1=1" : item.WorkCenter == "" ? "1=1" : $"WorkCenter_Str='{item.WorkCenter}'";
+        //    var itemCodeFilter = item.ItemCode == null ? "1=1" : item.ItemCode == "" ? "1=1" : $"ItemCode_Str='{item.ItemCode}'";
+        //    var syncedFilter = showSynced == ShowSyncedState.Synced ? "IsSynced_Bit='1'" : showSynced == ShowSyncedState.NotSynced ? "IsSynced_Bit='0' and ( Remark_Str is null or Remark_Str = '') " : showSynced == ShowSyncedState.SyncedError ? "IsSynced_Bit='0' and ( Remark_Str is not null or Remark_Str != '')" : $"1=1";
+        //    var tagFilter = tag == "L-" ? "SourceLocationTag_Str like '%L-%'" : tag == "DQA-" ? "SourceLocationTag_Str like '%DQA-%'" : $"1=1";
+        //    var filterStr = $"{itemWorkNoFilter} and {billNoFilter} and {itemNoFilter} and {itemCodeFilter} and {syncedFilter} and {workCenterFilter} and {tagFilter}";
+        //    var sqlStr = GetTableSql("App_BC_ItemLow", filterStr, page);
+        //    var taskTable = Env.DAL.ReadDataTable(sqlStr).DtToList<AppBCItemVo>();
+        //    return new RpcResponse<object>()
+        //    {
+        //        Data = taskTable
+        //    };
+        //}
 
-        public RpcResponse<object> AddEditItemLowTableRow(int action, AppBCItemVo item)
-        {
-            var res = new RpcResponse<object>();
-            if (action == 1)
-            {
-                return res;
-            }
-            else
-            {
-                var ok = Env.DAL.App_BC_ItemLow.Update($"ItemNo_Str='{item.ItemNo}'",
-                    new UpdateItem(T_Col_Name.App_BC_ItemLow.ActualTotalQty_Dec, item.ActualTotalQty),
-                    new UpdateItem(T_Col_Name.App_BC_ItemLow.SourceLocations_Str, item.SourceLocations),
-                    new UpdateItem(T_Col_Name.App_BC_ItemLow.LocationItemsNum_Str, item.LocationItemsNum)
-                );
-                string taskNosStr = null;
-                item.ItemNo.Split('/').ToList().ForEach(t =>
-                {
-                    if (taskNosStr == null)
-                    {
-                        taskNosStr = $"'{t}'"; ;
-                    }
-                    else
-                    {
-                        taskNosStr = $"{taskNosStr},'{t}'";
-                    }
-                });
-                var filter = $" TaskNo_Str in ({taskNosStr})";
-                var filterStr = $"{filter}";
-                var itemTasks = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskModel>(filterStr);
-                bool dbRes;
-                if (itemTasks?.Count != 0)
-                {
-                    foreach (var it in itemTasks)
-                    {
-                        if (item.ActualTotalQty >= it.PlannedQty)
-                        {
-                            it.ActualQty = it.PlannedQty;
-                            item.ActualTotalQty -= it.PlannedQty;
-                        }
-                        else
-                        {
-                            it.ActualQty = item.ActualTotalQty;
-                            item.ActualTotalQty = 0;
-                        }
-                    }
-                    dbRes = Env.DAL.BatchUpdateOrInsert(
-                        itemTasks,
-                        t => new { t.TaskNo },
-                        null,
-                        t => new { t.ActualQty }
-                    );
-                    if (ok == false || dbRes == false)
-                    {
-                        res.IsSucceed = false;
-                        res.Message = (string)ok.ErrorMessage;
-                        return res;
-                    }
-                }
-                res.Message = "更改成功";
-                return res;
-            }
-        }
+        //public RpcResponse<object> AddEditItemLowTableRow(int action, AppBCItemVo item)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    if (action == 1)
+        //    {
+        //        return res;
+        //    }
+        //    else
+        //    {
+        //        var ok = Env.DAL.App_BC_ItemLow.Update($"ItemNo_Str='{item.ItemNo}'",
+        //            new UpdateItem(T_Col_Name.App_BC_ItemLow.ActualTotalQty_Dec, item.ActualTotalQty),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemLow.SourceLocations_Str, item.SourceLocations),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemLow.LocationItemsNum_Str, item.LocationItemsNum)
+        //        );
+        //        string taskNosStr = null;
+        //        item.ItemNo.Split('/').ToList().ForEach(t =>
+        //        {
+        //            if (taskNosStr == null)
+        //            {
+        //                taskNosStr = $"'{t}'"; ;
+        //            }
+        //            else
+        //            {
+        //                taskNosStr = $"{taskNosStr},'{t}'";
+        //            }
+        //        });
+        //        var filter = $" TaskNo_Str in ({taskNosStr})";
+        //        var filterStr = $"{filter}";
+        //        var itemTasks = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskModel>(filterStr);
+        //        bool dbRes;
+        //        if (itemTasks?.Count != 0)
+        //        {
+        //            foreach (var it in itemTasks)
+        //            {
+        //                if (item.ActualTotalQty >= it.PlannedQty)
+        //                {
+        //                    it.ActualQty = it.PlannedQty;
+        //                    item.ActualTotalQty -= it.PlannedQty;
+        //                }
+        //                else
+        //                {
+        //                    it.ActualQty = item.ActualTotalQty;
+        //                    item.ActualTotalQty = 0;
+        //                }
+        //            }
+        //            dbRes = Env.DAL.BatchUpdateOrInsert(
+        //                itemTasks,
+        //                t => new { t.TaskNo },
+        //                null,
+        //                t => new { t.ActualQty }
+        //            );
+        //            if (ok == false || dbRes == false)
+        //            {
+        //                res.IsSucceed = false;
+        //                res.Message = (string)ok.ErrorMessage;
+        //                return res;
+        //            }
+        //        }
+        //        res.Message = "更改成功";
+        //        return res;
+        //    }
+        //}
 
-        public RpcResponse<object> GetItemTaskTable(PageBo page, List<string> taskNos)
-        {
-            string taskNosStr = null;
-            taskNos.ForEach(item =>
-            {
-                if (taskNosStr == null)
-                {
-                    taskNosStr = $"'{item}'"; ;
-                }
-                else
-                {
-                    taskNosStr = $"{taskNosStr},'{item}'";
-                }
-            });
-            var filter = $" TaskNo_Str in ({taskNosStr})";
-            var filterStr = $"{filter}";
-            var sqlStr = GetTableSql("App_BC_ItemTask", filterStr, page);
-            var taskTable = Env.DAL.ReadDataTable(sqlStr).DtToList<AppBCItemTaskVo>();
-            return new RpcResponse<object>()
-            {
-                Data = taskTable
-            };
-        }
+        //public RpcResponse<object> GetItemTaskTable(PageBo page, List<string> taskNos)
+        //{
+        //    string taskNosStr = null;
+        //    taskNos.ForEach(item =>
+        //    {
+        //        if (taskNosStr == null)
+        //        {
+        //            taskNosStr = $"'{item}'"; ;
+        //        }
+        //        else
+        //        {
+        //            taskNosStr = $"{taskNosStr},'{item}'";
+        //        }
+        //    });
+        //    var filter = $" TaskNo_Str in ({taskNosStr})";
+        //    var filterStr = $"{filter}";
+        //    var sqlStr = GetTableSql("App_BC_ItemTask", filterStr, page);
+        //    var taskTable = Env.DAL.ReadDataTable(sqlStr).DtToList<AppBCItemTaskVo>();
+        //    return new RpcResponse<object>()
+        //    {
+        //        Data = taskTable
+        //    };
+        //}
 
-        public RpcResponse<object> AddEditItemTaskTableRow(int action, AppBCItemTaskVo task)
-        {
-            var res = new RpcResponse<object>();
-            if (action == 1)
-            {
-                var ok = Env.DAL.App_BC_ItemTask.Insert(
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.BillNo_Str, task.BillNo),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.ItemCode_Str, task.ItemCode),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.ItemName_Str, task.ItemName),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.OrgID_Int, task.OrgID),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.TaskNo_Str, task.TaskNo),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.State_Int, task.State),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.OnhandState_Int, task.OnhandState),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.UnitCode_Str, task.UnitCode),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.TaskGroupNo_Str, task.TaskGroupNo),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.TechStation_Str, task.TechStation),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.ItemExtPropName_Str, task.ItemExtPropName),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.WarehouseCode_Str, task.WarehouseCode),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.ActualQty_Dec, task.ActualQty),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.SourceLocation_Str, task.SourceLocation),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.Lot_Str, task.Lot),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.Lpn_Str, task.Lpn),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.StorageArea_Str, task.StorageArea),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.TaskType_Bit, task.TaskType),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.IsMerged_Bit, 1),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt01_Str, task.LotAtt01),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt02_Str, task.LotAtt02),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt03_Str, task.LotAtt03),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt04_Str, task.LotAtt04),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt05_Str, task.LotAtt05),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt06_Str, task.LotAtt06),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt07_Str, task.LotAtt07),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt08_Str, task.LotAtt08),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt09_Str, task.LotAtt09),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt10_Str, task.LotAtt10),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt11_Str, task.LotAtt11),
-                    new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt12_Str, task.LotAtt12)
-                    );
-                if (!ok)
-                {
-                    res.IsSucceed = false;
-                    res.Message = (string)ok.ErrorMessage;
-                    return res;
-                }
-                res.Message = "新增成功";
-                return res;
-            }
-            else
-            {
-                var ok = Env.DAL.App_BC_ItemTask.Update($"ID='{task.ID}'",
-                     new UpdateItem(T_Col_Name.App_BC_ItemTask.SourceLocation_Str, task.SourceLocation),
-                     new UpdateItem(T_Col_Name.App_BC_ItemTask.ActualQty_Dec, task.ActualQty)
-                );
-                if (!ok)
-                {
-                    res.IsSucceed = false;
-                    res.Message = (string)ok.ErrorMessage;
-                    return res;
-                }
-                res.Message = "更改成功";
-                return res;
-            }
-        }
-        public RpcResponse<object> DelItemTaskTableRow(int id)
-        {
-            var res = new RpcResponse<object>();
-            var ok = Env.DAL.App_BC_ItemTask.Delete("ID", id);
-            if (!ok)
-            {
-                res.IsSucceed = false;
-                res.Data = ok.ErrorMessage;
-                return res;
-            }
-            res.Message = "删除成功";
-            return res;
-        }
+        //public RpcResponse<object> AddEditItemTaskTableRow(int action, AppBCItemTaskVo task)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    if (action == 1)
+        //    {
+        //        var ok = Env.DAL.App_BC_ItemTask.Insert(
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.BillNo_Str, task.BillNo),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.ItemCode_Str, task.ItemCode),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.ItemName_Str, task.ItemName),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.OrgID_Int, task.OrgID),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.TaskNo_Str, task.TaskNo),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.State_Int, task.State),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.OnhandState_Int, task.OnhandState),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.UnitCode_Str, task.UnitCode),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.TaskGroupNo_Str, task.TaskGroupNo),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.TechStation_Str, task.TechStation),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.ItemExtPropName_Str, task.ItemExtPropName),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.WarehouseCode_Str, task.WarehouseCode),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.ActualQty_Dec, task.ActualQty),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.SourceLocation_Str, task.SourceLocation),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.Lot_Str, task.Lot),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.Lpn_Str, task.Lpn),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.StorageArea_Str, task.StorageArea),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.TaskType_Bit, task.TaskType),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.IsMerged_Bit, 1),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt01_Str, task.LotAtt01),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt02_Str, task.LotAtt02),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt03_Str, task.LotAtt03),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt04_Str, task.LotAtt04),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt05_Str, task.LotAtt05),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt06_Str, task.LotAtt06),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt07_Str, task.LotAtt07),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt08_Str, task.LotAtt08),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt09_Str, task.LotAtt09),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt10_Str, task.LotAtt10),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt11_Str, task.LotAtt11),
+        //            new UpdateItem(T_Col_Name.App_BC_ItemTask.LotAtt12_Str, task.LotAtt12)
+        //            );
+        //        if (!ok)
+        //        {
+        //            res.IsSucceed = false;
+        //            res.Message = (string)ok.ErrorMessage;
+        //            return res;
+        //        }
+        //        res.Message = "新增成功";
+        //        return res;
+        //    }
+        //    else
+        //    {
+        //        var ok = Env.DAL.App_BC_ItemTask.Update($"ID='{task.ID}'",
+        //             new UpdateItem(T_Col_Name.App_BC_ItemTask.SourceLocation_Str, task.SourceLocation),
+        //             new UpdateItem(T_Col_Name.App_BC_ItemTask.ActualQty_Dec, task.ActualQty)
+        //        );
+        //        if (!ok)
+        //        {
+        //            res.IsSucceed = false;
+        //            res.Message = (string)ok.ErrorMessage;
+        //            return res;
+        //        }
+        //        res.Message = "更改成功";
+        //        return res;
+        //    }
+        //}
+        //public RpcResponse<object> DelItemTaskTableRow(int id)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    var ok = Env.DAL.App_BC_ItemTask.Delete("ID", id);
+        //    if (!ok)
+        //    {
+        //        res.IsSucceed = false;
+        //        res.Data = ok.ErrorMessage;
+        //        return res;
+        //    }
+        //    res.Message = "删除成功";
+        //    return res;
+        //}
 
-        /// <summary>
-        /// 下发堆垛机任务,更新子表库位信息
-        /// </summary>
-        /// <param name="itemNoAndSourceLocation"></param>
-        /// <returns></returns>
-        public RpcResponse<object> AddMachineTask(Dictionary<string, string> itemNoAndSourceLocation)
-        {
-            var res = new RpcResponse<object>();
-            var sourceLocationList = new List<OperationBo>();
-            var itemTaskList = new List<AppBCItemTaskModel>();
-            var endLine1 = 1;
-            var endLine2 = 3;
-            foreach (var item in itemNoAndSourceLocation)
-            {
-                var sourceLocationArray = item.Value.Split('/');
-                var itemNo = item.Key.Split('/');
-                for (var i = 0; i < itemNo.Length; i++)
-                {
-                    itemTaskList.Add(new AppBCItemTaskModel()
-                    {
-                        TaskNo = itemNo[i],
-                        SourceLocation = sourceLocationArray[0]
-                    });
-                }
-                var sourceLocation = sourceLocationArray[0].Split('-');
-                var crane = 2;
-                var endCol = 65;
-                var endRow = endLine2;
-                if (Convert.ToInt32(sourceLocation[1]) == 1 || Convert.ToInt32(sourceLocation[1]) == 2)
-                {
-                    crane = 1;
-                    endCol = 47;
-                    endRow = endLine1;
-                }
-                sourceLocationList.Add(new OperationBo()
-                {
-                    StartRow = Convert.ToInt32(sourceLocation[1]),
-                    StartCol = Convert.ToInt32(sourceLocation[2]),
-                    StartLayer = Convert.ToInt32(sourceLocation[3]),
-                    IsStart = false,
-                    OperateNo = Guid.NewGuid().ToString(),
-                    MachineTaskId = 5,
-                    Crane = crane,
-                    Line = endRow,
-                    EndRow = endRow,
-                    EndCol = endCol,
-                    EndLayer = 1,
-                });
-                if ((Convert.ToInt32(sourceLocation[1]) == 01 || Convert.ToInt32(sourceLocation[1]) == 02) && endLine1 == 1)
-                {
-                    endLine1 = 2;
-                }
-                else if ((Convert.ToInt32(sourceLocation[1]) == 01 || Convert.ToInt32(sourceLocation[1]) == 02) && endLine1 == 2)
-                {
-                    endLine1 = 1;
-                }
-                if ((Convert.ToInt32(sourceLocation[1]) == 03 || Convert.ToInt32(sourceLocation[1]) == 04) && endLine2 == 3)
-                {
-                    endLine2 = 4;
-                }
-                else if ((Convert.ToInt32(sourceLocation[1]) == 03 || Convert.ToInt32(sourceLocation[1]) == 04) && endLine2 == 4)
-                {
-                    endLine2 = 3;
-                }
-            }
-            var operationCrane1List = sourceLocationList.Where(i => i.Crane == 1).ToList();
-            var operationCrane2List = sourceLocationList.Where(i => i.Crane == 2).ToList();
-            operationCrane1List.ForEach(t =>
-            {
-                if (!CustomerEnv.OperationCrane1List.Any(i => i.StartLayer == t.StartLayer && i.StartCol == t.StartCol && i.StartRow == t.StartRow))
-                {
-                    CustomerEnv.OperationCrane1List.Add(t);
-                }
-            });
-            operationCrane2List.ForEach(t =>
-            {
-                if (!CustomerEnv.OperationCrane2List.Any(i => i.StartLayer == t.StartLayer && i.StartCol == t.StartCol && i.StartRow == t.StartRow))
-                {
-                    CustomerEnv.OperationCrane2List.Add(t);
-                }
-            });
-            var dbRes = Env.DAL.BatchUpdateOrInsert(
-                itemTaskList,
-                t => new { t.TaskNo },   //更新条件
-                null,
-                t => new { t.SourceLocation }   //更新字段
-            );   //批量更新
-            if (dbRes)
-            {
-                res.Message = $"下发堆垛机任务成功";
-                return res;
-            }
-            res.IsSucceed = false;
-            res.Message = $"下发堆垛机任务失败";
-            return res;
-        }
+        ///// <summary>
+        ///// 下发堆垛机任务,更新子表库位信息
+        ///// </summary>
+        ///// <param name="itemNoAndSourceLocation"></param>
+        ///// <returns></returns>
+        //public RpcResponse<object> AddMachineTask(Dictionary<string, string> itemNoAndSourceLocation)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    var sourceLocationList = new List<OperationBo>();
+        //    var itemTaskList = new List<AppBCItemTaskModel>();
+        //    var endLine1 = 1;
+        //    var endLine2 = 3;
+        //    foreach (var item in itemNoAndSourceLocation)
+        //    {
+        //        var sourceLocationArray = item.Value.Split('/');
+        //        var itemNo = item.Key.Split('/');
+        //        for (var i = 0; i < itemNo.Length; i++)
+        //        {
+        //            itemTaskList.Add(new AppBCItemTaskModel()
+        //            {
+        //                TaskNo = itemNo[i],
+        //                SourceLocation = sourceLocationArray[0]
+        //            });
+        //        }
+        //        var sourceLocation = sourceLocationArray[0].Split('-');
+        //        var crane = 2;
+        //        var endCol = 65;
+        //        var endRow = endLine2;
+        //        if (Convert.ToInt32(sourceLocation[1]) == 1 || Convert.ToInt32(sourceLocation[1]) == 2)
+        //        {
+        //            crane = 1;
+        //            endCol = 47;
+        //            endRow = endLine1;
+        //        }
+        //        sourceLocationList.Add(new OperationBo()
+        //        {
+        //            StartRow = Convert.ToInt32(sourceLocation[1]),
+        //            StartCol = Convert.ToInt32(sourceLocation[2]),
+        //            StartLayer = Convert.ToInt32(sourceLocation[3]),
+        //            IsStart = false,
+        //            OperateNo = Guid.NewGuid().ToString(),
+        //            MachineTaskId = 5,
+        //            Crane = crane,
+        //            Line = endRow,
+        //            EndRow = endRow,
+        //            EndCol = endCol,
+        //            EndLayer = 1,
+        //        });
+        //        if ((Convert.ToInt32(sourceLocation[1]) == 01 || Convert.ToInt32(sourceLocation[1]) == 02) && endLine1 == 1)
+        //        {
+        //            endLine1 = 2;
+        //        }
+        //        else if ((Convert.ToInt32(sourceLocation[1]) == 01 || Convert.ToInt32(sourceLocation[1]) == 02) && endLine1 == 2)
+        //        {
+        //            endLine1 = 1;
+        //        }
+        //        if ((Convert.ToInt32(sourceLocation[1]) == 03 || Convert.ToInt32(sourceLocation[1]) == 04) && endLine2 == 3)
+        //        {
+        //            endLine2 = 4;
+        //        }
+        //        else if ((Convert.ToInt32(sourceLocation[1]) == 03 || Convert.ToInt32(sourceLocation[1]) == 04) && endLine2 == 4)
+        //        {
+        //            endLine2 = 3;
+        //        }
+        //    }
+        //    var operationCrane1List = sourceLocationList.Where(i => i.Crane == 1).ToList();
+        //    var operationCrane2List = sourceLocationList.Where(i => i.Crane == 2).ToList();
+        //    operationCrane1List.ForEach(t =>
+        //    {
+        //        if (!CustomerEnv.OperationCrane1List.Any(i => i.StartLayer == t.StartLayer && i.StartCol == t.StartCol && i.StartRow == t.StartRow))
+        //        {
+        //            CustomerEnv.OperationCrane1List.Add(t);
+        //        }
+        //    });
+        //    operationCrane2List.ForEach(t =>
+        //    {
+        //        if (!CustomerEnv.OperationCrane2List.Any(i => i.StartLayer == t.StartLayer && i.StartCol == t.StartCol && i.StartRow == t.StartRow))
+        //        {
+        //            CustomerEnv.OperationCrane2List.Add(t);
+        //        }
+        //    });
+        //    var dbRes = Env.DAL.BatchUpdateOrInsert(
+        //        itemTaskList,
+        //        t => new { t.TaskNo },   //更新条件
+        //        null,
+        //        t => new { t.SourceLocation }   //更新字段
+        //    );   //批量更新
+        //    if (dbRes)
+        //    {
+        //        res.Message = $"下发堆垛机任务成功";
+        //        return res;
+        //    }
+        //    res.IsSucceed = false;
+        //    res.Message = $"下发堆垛机任务失败";
+        //    return res;
+        //}
 
         //public RpcResponse<object> UpdateItemUpInventory()
         //{
@@ -404,123 +404,123 @@ namespace SCADA_DAQ.Customer.Service
         //}
 
         // 更新任务库存 防止新物料 下架任务比上架任务先到 而下架库存不更新1
-        public RpcResponse<object> UpdateItemLowInventory()
-        {
-            var res = new RpcResponse<object>();
-            var wmsItemLowList = Env.DAL.ReadDataTable($"select * from App_BC_ItemLow where IsSynced_Bit = 0 and SourceLocations_Str = '新'").DtToList<AppBCItemLowModel>();
-            if (wmsItemLowList?.Count != 0)
-            {
-                CustomerEnv.AddWMSItemLowList(wmsItemLowList);
-                var itemTaskList = new List<AppBCItemTaskModel>();
-                foreach (var item in wmsItemLowList)
-                {
-                    var sourceLocationArray = item.SourceLocations.Split('/');
-                    var itemNo = item.ItemNo.Split('/');
-                    for (var i = 0; i < itemNo.Length; i++)
-                    {
-                        itemTaskList.Add(new AppBCItemTaskModel()
-                        {
-                            TaskNo = itemNo[i],
-                            SourceLocation = sourceLocationArray[0]
-                        });
-                    }
-                }
-                var dbRes = Env.DAL.BatchUpdateOrInsert(
-                       itemTaskList,
-                       t => new { t.TaskNo },   //更新条件
-                       null,
-                       t => new { t.SourceLocation }   //更新字段
-                );   //批量更新
-                res.Message = "库位更新成功";
-                return res;
-            }
-            res.Message = "无库位更新";
-            return res;
-        }
+        //public RpcResponse<object> UpdateItemLowInventory()
+        //{
+        //    var res = new RpcResponse<object>();
+        //    var wmsItemLowList = Env.DAL.ReadDataTable($"select * from App_BC_ItemLow where IsSynced_Bit = 0 and SourceLocations_Str = '新'").DtToList<AppBCItemLowModel>();
+        //    if (wmsItemLowList?.Count != 0)
+        //    {
+        //        CustomerEnv.AddWMSItemLowList(wmsItemLowList);
+        //        var itemTaskList = new List<AppBCItemTaskModel>();
+        //        foreach (var item in wmsItemLowList)
+        //        {
+        //            var sourceLocationArray = item.SourceLocations.Split('/');
+        //            var itemNo = item.ItemNo.Split('/');
+        //            for (var i = 0; i < itemNo.Length; i++)
+        //            {
+        //                itemTaskList.Add(new AppBCItemTaskModel()
+        //                {
+        //                    TaskNo = itemNo[i],
+        //                    SourceLocation = sourceLocationArray[0]
+        //                });
+        //            }
+        //        }
+        //        var dbRes = Env.DAL.BatchUpdateOrInsert(
+        //               itemTaskList,
+        //               t => new { t.TaskNo },   //更新条件
+        //               null,
+        //               t => new { t.SourceLocation }   //更新字段
+        //        );   //批量更新
+        //        res.Message = "库位更新成功";
+        //        return res;
+        //    }
+        //    res.Message = "无库位更新";
+        //    return res;
+        //}
 
-        /// <summary>
-        /// 删除任务接口 6
-        /// </summary>
-        /// <param name="itemTaskType">1上架0下架</param>
-        /// <returns></returns>
-        public RpcResponse<object> CloseItemTask(int itemTaskType)
-        {
-            var res = new RpcResponse<object>();
-            string upOrLow;
-            if (itemTaskType == 0)
-            {
-                upOrLow = "App_BC_ItemLow";
-            }
-            else
-            {
-                upOrLow = "App_BC_ItemUp";
-            }
-            var wmsCloseItemTaskList = Env.DAL.ReadDataTable($"select * from App_BC_ItemTask where State_Int = 6 and TaskType_Bit = {itemTaskType} ").DtToList<AppBCItemTaskModel>();
-            wmsCloseItemTaskList.Sort((item1, item2) => item1.TaskNo.CompareTo(item2.TaskNo));
-            var ColseItemTaskList = wmsCloseItemTaskList.ToLookup(item => new { item.BillNo, item.WorkCenter, item.ItemCode,item.WarehouseCode });
-            var selectFilter = "";
-            foreach (var itemKey in ColseItemTaskList)
-            {
-                var itemKeyFilter = "";
-                foreach (var itemValue in itemKey)
-                {
-                    if (itemKeyFilter == "")
-                    {
-                        itemKeyFilter = $"{itemValue.TaskNo}";
-                    }
-                    else
-                    {
-                        itemKeyFilter += $"/{itemValue.TaskNo}";
-                    }
-                }
-                if (selectFilter == "")
-                {
-                    selectFilter = $"'{itemKeyFilter}'";
-                }
-                else
-                {
-                    selectFilter += $",'{itemKeyFilter}'";
-                }
-            }
-            var deleteItemFilter = "";
-            dynamic closeItem;
-            if (itemTaskType == 0)
-            {
-                closeItem = Env.DAL.ReadDataTable($" SELECT * FROM {upOrLow} where ItemNo_Str in ({selectFilter}) ").DtToList<AppBCItemLowModel>();
-            }
-            else
-            {
-                closeItem = Env.DAL.ReadDataTable($" SELECT * FROM {upOrLow} where ItemNo_Str in ({selectFilter}) ").DtToList<AppBCItemUpModel>();
-            }
-            if (closeItem.Count == 0) { res.IsSucceed = false; res.Message = $"无任务需关闭"; return res; }
-            for (int i = 0; i < closeItem.Count; i++)
-            {
-                if (deleteItemFilter == "")
-                {
-                    deleteItemFilter = $"'{closeItem[i].ItemNo}'";
-                }
-                else
-                {
-                    deleteItemFilter += $",'{closeItem[i].ItemNo}'";
-                }
-            }
-            Env.DAL.ReadDataTable($"delete from {upOrLow} where ItemNo_Str in ({deleteItemFilter}) ");
-            var splitDeleteItemFilter = deleteItemFilter.Split('\'', '/', ',').Where(item => item != "").ToList();
-            var deleteItemTaskFilter = "";
-            for (int j = 0; j < splitDeleteItemFilter.Count; j++)
-            {
-                if (deleteItemTaskFilter == "")
-                {
-                    deleteItemTaskFilter = $"'{splitDeleteItemFilter[j]}'";
-                }
-                else
-                {
-                    deleteItemTaskFilter += $",'{splitDeleteItemFilter[j]}'";
-                }
-            }
-            Env.DAL.ReadDataTable($"delete from App_BC_ItemTask where TaskNo_Str in ({deleteItemTaskFilter}) ");
-            res.Message = $"关闭任务成功";
-            return res;
-        }
+        ///// <summary>
+        ///// 删除任务接口 6
+        ///// </summary>
+        ///// <param name="itemTaskType">1上架0下架</param>
+        ///// <returns></returns>
+        //public RpcResponse<object> CloseItemTask(int itemTaskType)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    string upOrLow;
+        //    if (itemTaskType == 0)
+        //    {
+        //        upOrLow = "App_BC_ItemLow";
+        //    }
+        //    else
+        //    {
+        //        upOrLow = "App_BC_ItemUp";
+        //    }
+        //    var wmsCloseItemTaskList = Env.DAL.ReadDataTable($"select * from App_BC_ItemTask where State_Int = 6 and TaskType_Bit = {itemTaskType} ").DtToList<AppBCItemTaskModel>();
+        //    wmsCloseItemTaskList.Sort((item1, item2) => item1.TaskNo.CompareTo(item2.TaskNo));
+        //    var ColseItemTaskList = wmsCloseItemTaskList.ToLookup(item => new { item.BillNo, item.WorkCenter, item.ItemCode,item.WarehouseCode });
+        //    var selectFilter = "";
+        //    foreach (var itemKey in ColseItemTaskList)
+        //    {
+        //        var itemKeyFilter = "";
+        //        foreach (var itemValue in itemKey)
+        //        {
+        //            if (itemKeyFilter == "")
+        //            {
+        //                itemKeyFilter = $"{itemValue.TaskNo}";
+        //            }
+        //            else
+        //            {
+        //                itemKeyFilter += $"/{itemValue.TaskNo}";
+        //            }
+        //        }
+        //        if (selectFilter == "")
+        //        {
+        //            selectFilter = $"'{itemKeyFilter}'";
+        //        }
+        //        else
+        //        {
+        //            selectFilter += $",'{itemKeyFilter}'";
+        //        }
+        //    }
+        //    var deleteItemFilter = "";
+        //    dynamic closeItem;
+        //    if (itemTaskType == 0)
+        //    {
+        //        closeItem = Env.DAL.ReadDataTable($" SELECT * FROM {upOrLow} where ItemNo_Str in ({selectFilter}) ").DtToList<AppBCItemLowModel>();
+        //    }
+        //    else
+        //    {
+        //        closeItem = Env.DAL.ReadDataTable($" SELECT * FROM {upOrLow} where ItemNo_Str in ({selectFilter}) ").DtToList<AppBCItemUpModel>();
+        //    }
+        //    if (closeItem.Count == 0) { res.IsSucceed = false; res.Message = $"无任务需关闭"; return res; }
+        //    for (int i = 0; i < closeItem.Count; i++)
+        //    {
+        //        if (deleteItemFilter == "")
+        //        {
+        //            deleteItemFilter = $"'{closeItem[i].ItemNo}'";
+        //        }
+        //        else
+        //        {
+        //            deleteItemFilter += $",'{closeItem[i].ItemNo}'";
+        //        }
+        //    }
+        //    Env.DAL.ReadDataTable($"delete from {upOrLow} where ItemNo_Str in ({deleteItemFilter}) ");
+        //    var splitDeleteItemFilter = deleteItemFilter.Split('\'', '/', ',').Where(item => item != "").ToList();
+        //    var deleteItemTaskFilter = "";
+        //    for (int j = 0; j < splitDeleteItemFilter.Count; j++)
+        //    {
+        //        if (deleteItemTaskFilter == "")
+        //        {
+        //            deleteItemTaskFilter = $"'{splitDeleteItemFilter[j]}'";
+        //        }
+        //        else
+        //        {
+        //            deleteItemTaskFilter += $",'{splitDeleteItemFilter[j]}'";
+        //        }
+        //    }
+        //    Env.DAL.ReadDataTable($"delete from App_BC_ItemTask where TaskNo_Str in ({deleteItemTaskFilter}) ");
+        //    res.Message = $"关闭任务成功";
+        //    return res;
+        //}
     }
 }

Разница между файлами не показана из-за своего большого размера
+ 534 - 504
SCADA_DAQ/Customer/Service/Wcs_WebMergeTaskService.cs


+ 1 - 1
SCADA_DAQ/Customer/Service/Wcs_WebOperationService.cs

@@ -361,7 +361,7 @@ namespace SCADA_DAQ.Customer.Service
 
 
         /// <summary>
-        /// 下发堆垛机任务,更新子表库位信息
+        /// 下发堆垛机任务
         /// </summary>
         /// <param name="itemNoAndSourceLocation"></param>
         /// <returns></returns>

+ 21 - 21
SCADA_DAQ/Customer/Service/Wcs_WebService.cs

@@ -34,27 +34,27 @@ namespace SCADA_DAQ.Customer.Service
         }
 
         // 库位
-        public RpcResponse<object> GETTT(int row, int c, int l)
-        {
-            for (int layer = 1; layer <= l; layer++)
-            {
-                for (int col = 1; col <= c; col++)
-                {
-                    var layerStr = layer < 10 ? "0" + layer.ToString() : layer.ToString();
-                    var colStr = col < 10 ? "00" + col.ToString() : col < 100 ? "0" + col.ToString() : col.ToString();
-                    Env.DAL.App_BC_Warehouse.Insert(
-               new UpdateItem(T_Col_Name.App_BC_Warehouse.SourceLocation_Str, $"0{row}-{colStr}-{layerStr}"),
-               new UpdateItem(T_Col_Name.App_BC_Warehouse.Layer_Int, layer),
-               new UpdateItem(T_Col_Name.App_BC_Warehouse.Col_Int, col),
-                new UpdateItem(T_Col_Name.App_BC_Warehouse.Row_Int, row)
-            );
-                }
-            }
-            return new RpcResponse<object>()
-            {
-                Data = 1
-            };
-        }
+        //public RpcResponse<object> GETTT(int row, int c, int l)
+        //{
+        //    for (int layer = 1; layer <= l; layer++)
+        //    {
+        //        for (int col = 1; col <= c; col++)
+        //        {
+        //            var layerStr = layer < 10 ? "0" + layer.ToString() : layer.ToString();
+        //            var colStr = col < 10 ? "00" + col.ToString() : col < 100 ? "0" + col.ToString() : col.ToString();
+        //            Env.DAL.App_BC_Warehouse.Insert(
+        //       new UpdateItem(T_Col_Name.App_BC_Warehouse.SourceLocation_Str, $"0{row}-{colStr}-{layerStr}"),
+        //       new UpdateItem(T_Col_Name.App_BC_Warehouse.Layer_Int, layer),
+        //       new UpdateItem(T_Col_Name.App_BC_Warehouse.Col_Int, col),
+        //        new UpdateItem(T_Col_Name.App_BC_Warehouse.Row_Int, row)
+        //    );
+        //        }
+        //    }
+        //    return new RpcResponse<object>()
+        //    {
+        //        Data = 1
+        //    };
+        //}
 
         //// 把sap 符合 字母-数字-数字-数字 无/ \ ( ) 拆分 生成库存
         //public RpcResponse<object> GetI()

+ 398 - 398
SCADA_DAQ/Customer/Service/Wcs_WebWmsUpLoadService.cs

@@ -19,407 +19,407 @@ namespace SCADA_DAQ.Customer.Service
         /// </summary>
         /// <param name="p"></param>
         /// <returns></returns>
-        public static string JoinItemNo(List<AppBCItemTaskVo> p)
-        {
-            if (p.Count == 0) return "";
-            var itemNo = "";
-            for (int i = 0; i < p.Count; i++)
-            {
-                if (itemNo == "")
-                {
-                    itemNo = $"{p[i].TaskNo}";
-                }
-                else
-                {
-                    itemNo += $"/{p[i].TaskNo}";
-                }
-            }
-            return itemNo;
-        }
-        public RpcResponse<object> WmsUpLoadUpShelfList(List<string> itemNos)
-        {
-            var res = new RpcResponse<object>();
-            string taskNosStr = null;
-            var itemTasks = new List<AppBCItemTaskModel>();
-            var itemUps = new List<AppBCItemUpModel>();
-            var updateInventoryQtyList = new List<AppBCInventoryModel>();
-            List<string> taskNoList;  //单独的TaskNo
-            for (var i = 0; i < itemNos.Count; i++)
-            {
-                taskNoList = itemNos[i].Split('/').ToList();
-                for (var j = 0; j < taskNoList.Count; j++)
-                {
-                    if (taskNosStr == null)
-                    {
-                        taskNosStr = $"'{taskNoList[j]}'";
-                    }
-                    else
-                    {
-                        taskNosStr += $",'{taskNoList[j]}'";
-                    }
-                }
-            }
-            var filter = $" TaskNo_Str in ({taskNosStr}) and State_Int = 0";
-            var ItemTasks = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskVo>(filter);
-            if (ItemTasks == null || ItemTasks?.Count == 0)
-            {
-                res.IsSucceed = false;
-                res.Message = $"未找到创建任务";
-                return res;
-            }
-            var wmsUpShelfIL = ItemTasks.ToLookup(item => new { item.WarehouseCode, item.BillNo, item.ItemCode, item.WorkCenter });
-            var message = "";
-            foreach (var item in wmsUpShelfIL)
-            {
-                var updateSumItemQtyList = new List<AppBCInventoryModel>();
-                var successItemTaskQty = new List<AppBCItemTaskVo>();
-                var values = item.OrderBy(x => x.TaskNo).ToList();
-                var wmsRes = CustomerEnv.FinishWmsUpTask(values);
-                var itemTaskListDis = values.GroupBy(t => t.TaskNo).Select(t => t.First()).ToList();
-                if (wmsRes.Success == false)
-                {
-                    res.IsSucceed = false;
-                    message = $@"{message} {wmsRes.Message}";
-                    var itemNo = JoinItemNo(itemTaskListDis);
-                    itemUps.Add(new AppBCItemUpModel
-                    {
-                        ItemNo = itemNo,
-                        IsSynced = false,
-                        Remark = wmsRes.Message
-                    });
-                }
-                if (wmsRes.Success == true && wmsRes.Result.IsSuccess == false)
-                {
-                    res.IsSucceed = false;
-                    message = $@"{message} {wmsRes.Result.Error}";
-                    var itemNo = JoinItemNo(itemTaskListDis);
-                    itemUps.Add(new AppBCItemUpModel
-                    {
-                        ItemNo = itemNo,
-                        IsSynced = false,
-                        Remark = wmsRes.Result.Error
-                    });
-                }
-                if (wmsRes.Success == true && wmsRes.Result.IsSuccess == true)
-                {
-                    // 任务可能一个任务号对应多个库位,故去重 
-                    string itemNo = "";
-                    for (int i = 0; i < itemTaskListDis.Count; i++)
-                    {
-                        if (itemNo == "")
-                        {
-                            itemNo = $"{itemTaskListDis[i].TaskNo}";
-                        }
-                        else
-                        {
-                            itemNo += $"/{itemTaskListDis[i].TaskNo}";
-                        }
-                        itemTasks.Add(new AppBCItemTaskModel
-                        {
-                            TaskNo = itemTaskListDis[i].TaskNo,
-                            State = TaskStateEnum.Finish,
-                            EndDate = DateTime.Now,
-                            Remark = "1"
-                        });
-                        var itemTask = ItemTasks.Where(x => x.TaskNo == values[i].TaskNo).ToList();
-                        successItemTaskQty.AddRange(itemTask);
-                    }
-                    message = $@"{message} {itemNo}上传成功";
-                    itemUps.Add(new AppBCItemUpModel
-                    {
-                        ItemNo = itemNo,
-                        IsSynced = true,
-                        Remark = "成功"
-                    });
-                    #region /完成任务更新库存数量逻辑
-                    var successItemTaskQtyList = successItemTaskQty.ToLookup(t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode }).ToList();
-                    string inventoryFilter = null;
-                    foreach (var itemTaskQtyValues in successItemTaskQtyList)
-                    {
-                        foreach (var itemTaskQtyValue in itemTaskQtyValues)
-                        {
-                            if (!updateSumItemQtyList.Any(i => i.ItemCode == itemTaskQtyValue.ItemCode && i.SourceLocation == itemTaskQtyValue.SourceLocation && i.WarehouseCode == itemTaskQtyValue.WarehouseCode))
-                            {
-                                updateSumItemQtyList.Add(new AppBCInventoryModel()
-                                {
-                                    ItemCode = itemTaskQtyValue.ItemCode,
-                                    SourceLocation = itemTaskQtyValue.SourceLocation,
-                                    ItemName = itemTaskQtyValue.ItemName,
-                                    OnhandState = 10,
-                                    UnitCode = itemTaskQtyValue.UnitCode,
-                                    Qty = itemTaskQtyValue.ActualQty,
-                                    WarehouseCode = itemTaskQtyValue.WarehouseCode
-                                });
-                            }
-                            else
-                            {
-                                var inventory = updateSumItemQtyList.Where(qty => qty.ItemCode == itemTaskQtyValue.ItemCode && qty.SourceLocation == itemTaskQtyValue.SourceLocation && qty.WarehouseCode == itemTaskQtyValue.WarehouseCode).ToList()[0];
-                                inventory.Qty += itemTaskQtyValue.ActualQty;
-                            }
-                        }
-                    }
-                    for (int j = 0; j < updateSumItemQtyList.Count; j++)
-                    {
-                        if (inventoryFilter == null)
-                        {
-                            inventoryFilter = $" (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
-                        }
-                        else
-                        {
-                            inventoryFilter += $"or (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
-                        }
-                    }
-                    var inventoryList = Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>(inventoryFilter);
-                    for (int i = 0; i < updateSumItemQtyList.Count; i++)
-                    {
-                        if (inventoryList.Any(j => j.ItemCode == updateSumItemQtyList[i].ItemCode && j.SourceLocation == updateSumItemQtyList[i].SourceLocation && j.WarehouseCode == updateSumItemQtyList[i].WarehouseCode))
-                        {
-                            var inventory = inventoryList.Where(qty => qty.ItemCode == updateSumItemQtyList[i].ItemCode && qty.SourceLocation == updateSumItemQtyList[i].SourceLocation && qty.WarehouseCode == updateSumItemQtyList[i].WarehouseCode).ToList()[0];
-                            updateInventoryQtyList.Add(new AppBCInventoryModel()
-                            {
-                                ItemCode = inventory.ItemCode,
-                                SourceLocation = inventory.SourceLocation,
-                                ItemName = inventory.ItemName,
-                                OnhandState = 10,
-                                UnitCode = updateSumItemQtyList[i].UnitCode,
-                                Qty = inventory.Qty + updateSumItemQtyList[i].Qty,
-                                WarehouseCode = updateSumItemQtyList[i].WarehouseCode
-                            });
-                        }
-                        else if (!inventoryList.Any(j => j.ItemCode == updateSumItemQtyList[i].ItemCode && j.SourceLocation == updateSumItemQtyList[i].SourceLocation && j.WarehouseCode == updateSumItemQtyList[i].WarehouseCode))
-                        {
-                            updateInventoryQtyList.Add(new AppBCInventoryModel()
-                            {
-                                ItemCode = updateSumItemQtyList[i].ItemCode,
-                                SourceLocation = updateSumItemQtyList[i].SourceLocation,
-                                ItemName = updateSumItemQtyList[i].ItemName,
-                                OnhandState = 10,
-                                UnitCode = updateSumItemQtyList[i].UnitCode,
-                                Qty = updateSumItemQtyList[i].Qty,
-                                WarehouseCode = updateSumItemQtyList[i].WarehouseCode
-                            });
-                        }
-                    }
-                    #endregion
-                }
-            }
-            res.Message = message;
-            if (itemUps.Count != 0)
-            {
-                Env.DAL.BatchUpdateOrInsert(
-                       itemUps,
-                       t => new { t.ItemNo },
-                       null,
-                       t => new { t.IsSynced, t.Remark }
-               );
-            }
-            if (itemTasks.Count != 0)
-            {
-                Env.DAL.BatchUpdateOrInsert(
-                   itemTasks,
-                   t => new { t.TaskNo },
-                   null,
-                   t => new { t.State, t.EndDate, t.Remark }
-               );
-            }
-            if (updateInventoryQtyList.Count != 0)
-            {
-                Env.DAL.BatchUpdateOrInsert(
-                 updateInventoryQtyList,
-                 t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode },   //更新条件
-                 null,
-                 t => new { t.Qty, t.ItemCode, t.SourceLocation, t.ItemName, t.OnhandState, t.UnitCode, t.WarehouseCode }   //更新字段
-               );   //批量更新
-            }
-            return res;
-        }
+        //public static string JoinItemNo(List<AppBCItemTaskVo> p)
+        //{
+        //    if (p.Count == 0) return "";
+        //    var itemNo = "";
+        //    for (int i = 0; i < p.Count; i++)
+        //    {
+        //        if (itemNo == "")
+        //        {
+        //            itemNo = $"{p[i].TaskNo}";
+        //        }
+        //        else
+        //        {
+        //            itemNo += $"/{p[i].TaskNo}";
+        //        }
+        //    }
+        //    return itemNo;
+        //}
+        //public RpcResponse<object> WmsUpLoadUpShelfList(List<string> itemNos)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    string taskNosStr = null;
+        //    var itemTasks = new List<AppBCItemTaskModel>();
+        //    var itemUps = new List<AppBCItemUpModel>();
+        //    var updateInventoryQtyList = new List<AppBCInventoryModel>();
+        //    List<string> taskNoList;  //单独的TaskNo
+        //    for (var i = 0; i < itemNos.Count; i++)
+        //    {
+        //        taskNoList = itemNos[i].Split('/').ToList();
+        //        for (var j = 0; j < taskNoList.Count; j++)
+        //        {
+        //            if (taskNosStr == null)
+        //            {
+        //                taskNosStr = $"'{taskNoList[j]}'";
+        //            }
+        //            else
+        //            {
+        //                taskNosStr += $",'{taskNoList[j]}'";
+        //            }
+        //        }
+        //    }
+        //    var filter = $" TaskNo_Str in ({taskNosStr}) and State_Int = 0";
+        //    var ItemTasks = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskVo>(filter);
+        //    if (ItemTasks == null || ItemTasks?.Count == 0)
+        //    {
+        //        res.IsSucceed = false;
+        //        res.Message = $"未找到创建任务";
+        //        return res;
+        //    }
+        //    var wmsUpShelfIL = ItemTasks.ToLookup(item => new { item.WarehouseCode, item.BillNo, item.ItemCode, item.WorkCenter });
+        //    var message = "";
+        //    foreach (var item in wmsUpShelfIL)
+        //    {
+        //        var updateSumItemQtyList = new List<AppBCInventoryModel>();
+        //        var successItemTaskQty = new List<AppBCItemTaskVo>();
+        //        var values = item.OrderBy(x => x.TaskNo).ToList();
+        //        var wmsRes = CustomerEnv.FinishWmsUpTask(values);
+        //        var itemTaskListDis = values.GroupBy(t => t.TaskNo).Select(t => t.First()).ToList();
+        //        if (wmsRes.Success == false)
+        //        {
+        //            res.IsSucceed = false;
+        //            message = $@"{message} {wmsRes.Message}";
+        //            var itemNo = JoinItemNo(itemTaskListDis);
+        //            itemUps.Add(new AppBCItemUpModel
+        //            {
+        //                ItemNo = itemNo,
+        //                IsSynced = false,
+        //                Remark = wmsRes.Message
+        //            });
+        //        }
+        //        if (wmsRes.Success == true && wmsRes.Result.IsSuccess == false)
+        //        {
+        //            res.IsSucceed = false;
+        //            message = $@"{message} {wmsRes.Result.Error}";
+        //            var itemNo = JoinItemNo(itemTaskListDis);
+        //            itemUps.Add(new AppBCItemUpModel
+        //            {
+        //                ItemNo = itemNo,
+        //                IsSynced = false,
+        //                Remark = wmsRes.Result.Error
+        //            });
+        //        }
+        //        if (wmsRes.Success == true && wmsRes.Result.IsSuccess == true)
+        //        {
+        //            // 任务可能一个任务号对应多个库位,故去重 
+        //            string itemNo = "";
+        //            for (int i = 0; i < itemTaskListDis.Count; i++)
+        //            {
+        //                if (itemNo == "")
+        //                {
+        //                    itemNo = $"{itemTaskListDis[i].TaskNo}";
+        //                }
+        //                else
+        //                {
+        //                    itemNo += $"/{itemTaskListDis[i].TaskNo}";
+        //                }
+        //                itemTasks.Add(new AppBCItemTaskModel
+        //                {
+        //                    TaskNo = itemTaskListDis[i].TaskNo,
+        //                    State = TaskStateEnum.Finish,
+        //                    EndDate = DateTime.Now,
+        //                    Remark = "1"
+        //                });
+        //                var itemTask = ItemTasks.Where(x => x.TaskNo == values[i].TaskNo).ToList();
+        //                successItemTaskQty.AddRange(itemTask);
+        //            }
+        //            message = $@"{message} {itemNo}上传成功";
+        //            itemUps.Add(new AppBCItemUpModel
+        //            {
+        //                ItemNo = itemNo,
+        //                IsSynced = true,
+        //                Remark = "成功"
+        //            });
+        //            #region /完成任务更新库存数量逻辑
+        //            var successItemTaskQtyList = successItemTaskQty.ToLookup(t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode }).ToList();
+        //            string inventoryFilter = null;
+        //            foreach (var itemTaskQtyValues in successItemTaskQtyList)
+        //            {
+        //                foreach (var itemTaskQtyValue in itemTaskQtyValues)
+        //                {
+        //                    if (!updateSumItemQtyList.Any(i => i.ItemCode == itemTaskQtyValue.ItemCode && i.SourceLocation == itemTaskQtyValue.SourceLocation && i.WarehouseCode == itemTaskQtyValue.WarehouseCode))
+        //                    {
+        //                        updateSumItemQtyList.Add(new AppBCInventoryModel()
+        //                        {
+        //                            ItemCode = itemTaskQtyValue.ItemCode,
+        //                            SourceLocation = itemTaskQtyValue.SourceLocation,
+        //                            ItemName = itemTaskQtyValue.ItemName,
+        //                            OnhandState = 10,
+        //                            UnitCode = itemTaskQtyValue.UnitCode,
+        //                            Qty = itemTaskQtyValue.ActualQty,
+        //                            WarehouseCode = itemTaskQtyValue.WarehouseCode
+        //                        });
+        //                    }
+        //                    else
+        //                    {
+        //                        var inventory = updateSumItemQtyList.Where(qty => qty.ItemCode == itemTaskQtyValue.ItemCode && qty.SourceLocation == itemTaskQtyValue.SourceLocation && qty.WarehouseCode == itemTaskQtyValue.WarehouseCode).ToList()[0];
+        //                        inventory.Qty += itemTaskQtyValue.ActualQty;
+        //                    }
+        //                }
+        //            }
+        //            for (int j = 0; j < updateSumItemQtyList.Count; j++)
+        //            {
+        //                if (inventoryFilter == null)
+        //                {
+        //                    inventoryFilter = $" (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
+        //                }
+        //                else
+        //                {
+        //                    inventoryFilter += $"or (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
+        //                }
+        //            }
+        //            var inventoryList = Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>(inventoryFilter);
+        //            for (int i = 0; i < updateSumItemQtyList.Count; i++)
+        //            {
+        //                if (inventoryList.Any(j => j.ItemCode == updateSumItemQtyList[i].ItemCode && j.SourceLocation == updateSumItemQtyList[i].SourceLocation && j.WarehouseCode == updateSumItemQtyList[i].WarehouseCode))
+        //                {
+        //                    var inventory = inventoryList.Where(qty => qty.ItemCode == updateSumItemQtyList[i].ItemCode && qty.SourceLocation == updateSumItemQtyList[i].SourceLocation && qty.WarehouseCode == updateSumItemQtyList[i].WarehouseCode).ToList()[0];
+        //                    updateInventoryQtyList.Add(new AppBCInventoryModel()
+        //                    {
+        //                        ItemCode = inventory.ItemCode,
+        //                        SourceLocation = inventory.SourceLocation,
+        //                        ItemName = inventory.ItemName,
+        //                        OnhandState = 10,
+        //                        UnitCode = updateSumItemQtyList[i].UnitCode,
+        //                        Qty = inventory.Qty + updateSumItemQtyList[i].Qty,
+        //                        WarehouseCode = updateSumItemQtyList[i].WarehouseCode
+        //                    });
+        //                }
+        //                else if (!inventoryList.Any(j => j.ItemCode == updateSumItemQtyList[i].ItemCode && j.SourceLocation == updateSumItemQtyList[i].SourceLocation && j.WarehouseCode == updateSumItemQtyList[i].WarehouseCode))
+        //                {
+        //                    updateInventoryQtyList.Add(new AppBCInventoryModel()
+        //                    {
+        //                        ItemCode = updateSumItemQtyList[i].ItemCode,
+        //                        SourceLocation = updateSumItemQtyList[i].SourceLocation,
+        //                        ItemName = updateSumItemQtyList[i].ItemName,
+        //                        OnhandState = 10,
+        //                        UnitCode = updateSumItemQtyList[i].UnitCode,
+        //                        Qty = updateSumItemQtyList[i].Qty,
+        //                        WarehouseCode = updateSumItemQtyList[i].WarehouseCode
+        //                    });
+        //                }
+        //            }
+        //            #endregion
+        //        }
+        //    }
+        //    res.Message = message;
+        //    if (itemUps.Count != 0)
+        //    {
+        //        Env.DAL.BatchUpdateOrInsert(
+        //               itemUps,
+        //               t => new { t.ItemNo },
+        //               null,
+        //               t => new { t.IsSynced, t.Remark }
+        //       );
+        //    }
+        //    if (itemTasks.Count != 0)
+        //    {
+        //        Env.DAL.BatchUpdateOrInsert(
+        //           itemTasks,
+        //           t => new { t.TaskNo },
+        //           null,
+        //           t => new { t.State, t.EndDate, t.Remark }
+        //       );
+        //    }
+        //    if (updateInventoryQtyList.Count != 0)
+        //    {
+        //        Env.DAL.BatchUpdateOrInsert(
+        //         updateInventoryQtyList,
+        //         t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode },   //更新条件
+        //         null,
+        //         t => new { t.Qty, t.ItemCode, t.SourceLocation, t.ItemName, t.OnhandState, t.UnitCode, t.WarehouseCode }   //更新字段
+        //       );   //批量更新
+        //    }
+        //    return res;
+        //}
 
-        public RpcResponse<object> WmsUpLoadLowShelfList(List<string> itemNos)
-        {
-            var res = new RpcResponse<object>();
-            string taskNosStr = null;
-            var itemTasks = new List<AppBCItemTaskModel>();
-            var itemLows = new List<AppBCItemLowModel>();
-            var updateInventoryQtyList = new List<AppBCInventoryModel>();
-            List<string> taskNoList;  //单独的TaskNo
-            for (var i = 0; i < itemNos.Count; i++)
-            {
-                taskNoList = itemNos[i].Split('/').ToList();
-                for (var j = 0; j < taskNoList.Count; j++)
-                {
-                    if (taskNosStr == null)
-                    {
-                        taskNosStr = $"'{taskNoList[j]}'";
-                    }
-                    else
-                    {
-                        taskNosStr += $",'{taskNoList[j]}'";
-                    }
-                }
-            }
+        //public RpcResponse<object> WmsUpLoadLowShelfList(List<string> itemNos)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    string taskNosStr = null;
+        //    var itemTasks = new List<AppBCItemTaskModel>();
+        //    var itemLows = new List<AppBCItemLowModel>();
+        //    var updateInventoryQtyList = new List<AppBCInventoryModel>();
+        //    List<string> taskNoList;  //单独的TaskNo
+        //    for (var i = 0; i < itemNos.Count; i++)
+        //    {
+        //        taskNoList = itemNos[i].Split('/').ToList();
+        //        for (var j = 0; j < taskNoList.Count; j++)
+        //        {
+        //            if (taskNosStr == null)
+        //            {
+        //                taskNosStr = $"'{taskNoList[j]}'";
+        //            }
+        //            else
+        //            {
+        //                taskNosStr += $",'{taskNoList[j]}'";
+        //            }
+        //        }
+        //    }
 
-            var filter = $" TaskNo_Str in ({taskNosStr}) and State_Int = 0";
-            var ItemTasks = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskVo>(filter);
-            if (ItemTasks == null || ItemTasks?.Count == 0)
-            {
-                res.IsSucceed = false;
-                res.Message = $"未找到创建任务";
-                return res;
-            }
-            var wmsUpShelfIL = ItemTasks.ToLookup(item => new { item.WarehouseCode, item.BillNo, item.ItemCode, item.WorkCenter });
-            var message = "";
-            foreach (var item in wmsUpShelfIL)
-            {
-                var updateSumItemQtyList = new List<AppBCInventoryModel>();
-                var successItemTaskQty = new List<AppBCItemTaskVo>();
-                var values = item.OrderBy(x => x.TaskNo).ToList();
-                var wmsRes = CustomerEnv.FinishWmsLowTask(values);
-                // 任务可能一个任务号对应多个库位,故去重 
-                var itemTaskListDis = values.GroupBy(t => t.TaskNo).Select(t => t.First()).ToList();
-                if (wmsRes.Success == false)
-                {
-                    res.IsSucceed = false;
-                    message = $@"{message} {wmsRes.Message}";
-                    var itemNo = JoinItemNo(itemTaskListDis);
-                    itemLows.Add(new AppBCItemLowModel
-                    {
-                        ItemNo = itemNo,
-                        IsSynced = false,
-                        Remark = wmsRes.Result.Error
-                    });
-                }
-                if (wmsRes.Success == true && wmsRes.Result.IsSuccess == false)
-                {
-                    res.IsSucceed = false;
-                    message = $@"{message} {wmsRes.Result.Error}";
-                    var itemNo = JoinItemNo(itemTaskListDis);
-                    itemLows.Add(new AppBCItemLowModel
-                    {
-                        ItemNo = itemNo,
-                        IsSynced = false,
-                        Remark = wmsRes.Result.Error
-                    });
-                }
-                if (wmsRes.Success == true && wmsRes.Result.IsSuccess == true)//wmsRes.Success == true && wmsRes.Result.IsSuccess == true
-                {
-                    string itemNo = "";
-                    for (int i = 0; i < itemTaskListDis.Count; i++)
-                    {
-                        if (itemNo == "")
-                        {
-                            itemNo = $"{itemTaskListDis[i].TaskNo}";
-                        }
-                        else
-                        {
-                            itemNo += $"/{itemTaskListDis[i].TaskNo}";
-                        }
-                        itemTasks.Add(new AppBCItemTaskModel
-                        {
-                            TaskNo = itemTaskListDis[i].TaskNo,
-                            State = TaskStateEnum.Finish,
-                            EndDate = DateTime.Now,
-                            Remark = "1"
-                        });
-                        var itemTask = ItemTasks.Where(x => x.TaskNo == values[i].TaskNo).ToList();
-                        successItemTaskQty.AddRange(itemTask);
-                    }
-                    message = $@"{message} {itemNo}上传成功";
-                    itemLows.Add(new AppBCItemLowModel
-                    {
-                        ItemNo = itemNo,
-                        IsSynced = true,
-                        Remark = "成功"
-                    });
-                    #region /完成任务更新库存数量逻辑
-                    var successItemTaskQtyList = successItemTaskQty.ToLookup(t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode }).ToList();
-                    string inventoryFilter = null;
-                    foreach (var itemTaskQtyValues in successItemTaskQtyList)
-                    {
-                        foreach (var itemTaskQtyValue in itemTaskQtyValues)
-                        {
-                            if (!updateSumItemQtyList.Any(i => i.ItemCode == itemTaskQtyValue.ItemCode && i.SourceLocation == itemTaskQtyValue.SourceLocation && i.WarehouseCode == itemTaskQtyValue.WarehouseCode))
-                            {
-                                updateSumItemQtyList.Add(new AppBCInventoryModel()
-                                {
-                                    ItemCode = itemTaskQtyValue.ItemCode,
-                                    SourceLocation = itemTaskQtyValue.SourceLocation,
-                                    ItemName = itemTaskQtyValue.ItemName,
-                                    OnhandState = 10,
-                                    UnitCode = itemTaskQtyValue.UnitCode,
-                                    Qty = itemTaskQtyValue.ActualQty,
-                                    WarehouseCode = itemTaskQtyValue.WarehouseCode
-                                });
-                            }
-                            else
-                            {
-                                var inventory = updateSumItemQtyList.Where(qty => qty.ItemCode == itemTaskQtyValue.ItemCode && qty.SourceLocation == itemTaskQtyValue.SourceLocation && qty.WarehouseCode == itemTaskQtyValue.WarehouseCode).ToList()[0];
-                                inventory.Qty += itemTaskQtyValue.ActualQty;
-                            }
-                        }
-                    }
-                    for (int j = 0; j < updateSumItemQtyList.Count; j++)
-                    {
-                        if (inventoryFilter == null)
-                        {
-                            inventoryFilter = $" (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
-                        }
-                        else
-                        {
-                            inventoryFilter += $"or (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
-                        }
-                    }
-                    var inventoryList = Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>(inventoryFilter);
-                    for (int i = 0; i < updateSumItemQtyList.Count; i++)
-                    {
-                        if (inventoryList.Any(j => j.ItemCode == updateSumItemQtyList[i].ItemCode && j.SourceLocation == updateSumItemQtyList[i].SourceLocation && j.WarehouseCode == updateSumItemQtyList[i].WarehouseCode))
-                        {
-                            var inventory = inventoryList.Where(qty => qty.ItemCode == updateSumItemQtyList[i].ItemCode && qty.SourceLocation == updateSumItemQtyList[i].SourceLocation && qty.WarehouseCode == updateSumItemQtyList[i].WarehouseCode).ToList()[0];
-                            updateInventoryQtyList.Add(new AppBCInventoryModel()
-                            {
-                                ItemCode = inventory.ItemCode,
-                                SourceLocation = inventory.SourceLocation,
-                                ItemName = inventory.ItemName,
-                                OnhandState = 10,
-                                UnitCode = updateSumItemQtyList[i].UnitCode,
-                                Qty = inventory.Qty - updateSumItemQtyList[i].Qty,
-                                WarehouseCode = inventory.WarehouseCode
-                            });
-                        }
-                    }
-                    #endregion
+        //    var filter = $" TaskNo_Str in ({taskNosStr}) and State_Int = 0";
+        //    var ItemTasks = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskVo>(filter);
+        //    if (ItemTasks == null || ItemTasks?.Count == 0)
+        //    {
+        //        res.IsSucceed = false;
+        //        res.Message = $"未找到创建任务";
+        //        return res;
+        //    }
+        //    var wmsUpShelfIL = ItemTasks.ToLookup(item => new { item.WarehouseCode, item.BillNo, item.ItemCode, item.WorkCenter });
+        //    var message = "";
+        //    foreach (var item in wmsUpShelfIL)
+        //    {
+        //        var updateSumItemQtyList = new List<AppBCInventoryModel>();
+        //        var successItemTaskQty = new List<AppBCItemTaskVo>();
+        //        var values = item.OrderBy(x => x.TaskNo).ToList();
+        //        var wmsRes = CustomerEnv.FinishWmsLowTask(values);
+        //        // 任务可能一个任务号对应多个库位,故去重 
+        //        var itemTaskListDis = values.GroupBy(t => t.TaskNo).Select(t => t.First()).ToList();
+        //        if (wmsRes.Success == false)
+        //        {
+        //            res.IsSucceed = false;
+        //            message = $@"{message} {wmsRes.Message}";
+        //            var itemNo = JoinItemNo(itemTaskListDis);
+        //            itemLows.Add(new AppBCItemLowModel
+        //            {
+        //                ItemNo = itemNo,
+        //                IsSynced = false,
+        //                Remark = wmsRes.Result.Error
+        //            });
+        //        }
+        //        if (wmsRes.Success == true && wmsRes.Result.IsSuccess == false)
+        //        {
+        //            res.IsSucceed = false;
+        //            message = $@"{message} {wmsRes.Result.Error}";
+        //            var itemNo = JoinItemNo(itemTaskListDis);
+        //            itemLows.Add(new AppBCItemLowModel
+        //            {
+        //                ItemNo = itemNo,
+        //                IsSynced = false,
+        //                Remark = wmsRes.Result.Error
+        //            });
+        //        }
+        //        if (wmsRes.Success == true && wmsRes.Result.IsSuccess == true)//wmsRes.Success == true && wmsRes.Result.IsSuccess == true
+        //        {
+        //            string itemNo = "";
+        //            for (int i = 0; i < itemTaskListDis.Count; i++)
+        //            {
+        //                if (itemNo == "")
+        //                {
+        //                    itemNo = $"{itemTaskListDis[i].TaskNo}";
+        //                }
+        //                else
+        //                {
+        //                    itemNo += $"/{itemTaskListDis[i].TaskNo}";
+        //                }
+        //                itemTasks.Add(new AppBCItemTaskModel
+        //                {
+        //                    TaskNo = itemTaskListDis[i].TaskNo,
+        //                    State = TaskStateEnum.Finish,
+        //                    EndDate = DateTime.Now,
+        //                    Remark = "1"
+        //                });
+        //                var itemTask = ItemTasks.Where(x => x.TaskNo == values[i].TaskNo).ToList();
+        //                successItemTaskQty.AddRange(itemTask);
+        //            }
+        //            message = $@"{message} {itemNo}上传成功";
+        //            itemLows.Add(new AppBCItemLowModel
+        //            {
+        //                ItemNo = itemNo,
+        //                IsSynced = true,
+        //                Remark = "成功"
+        //            });
+        //            #region /完成任务更新库存数量逻辑
+        //            var successItemTaskQtyList = successItemTaskQty.ToLookup(t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode }).ToList();
+        //            string inventoryFilter = null;
+        //            foreach (var itemTaskQtyValues in successItemTaskQtyList)
+        //            {
+        //                foreach (var itemTaskQtyValue in itemTaskQtyValues)
+        //                {
+        //                    if (!updateSumItemQtyList.Any(i => i.ItemCode == itemTaskQtyValue.ItemCode && i.SourceLocation == itemTaskQtyValue.SourceLocation && i.WarehouseCode == itemTaskQtyValue.WarehouseCode))
+        //                    {
+        //                        updateSumItemQtyList.Add(new AppBCInventoryModel()
+        //                        {
+        //                            ItemCode = itemTaskQtyValue.ItemCode,
+        //                            SourceLocation = itemTaskQtyValue.SourceLocation,
+        //                            ItemName = itemTaskQtyValue.ItemName,
+        //                            OnhandState = 10,
+        //                            UnitCode = itemTaskQtyValue.UnitCode,
+        //                            Qty = itemTaskQtyValue.ActualQty,
+        //                            WarehouseCode = itemTaskQtyValue.WarehouseCode
+        //                        });
+        //                    }
+        //                    else
+        //                    {
+        //                        var inventory = updateSumItemQtyList.Where(qty => qty.ItemCode == itemTaskQtyValue.ItemCode && qty.SourceLocation == itemTaskQtyValue.SourceLocation && qty.WarehouseCode == itemTaskQtyValue.WarehouseCode).ToList()[0];
+        //                        inventory.Qty += itemTaskQtyValue.ActualQty;
+        //                    }
+        //                }
+        //            }
+        //            for (int j = 0; j < updateSumItemQtyList.Count; j++)
+        //            {
+        //                if (inventoryFilter == null)
+        //                {
+        //                    inventoryFilter = $" (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
+        //                }
+        //                else
+        //                {
+        //                    inventoryFilter += $"or (ItemCode_Str = '{updateSumItemQtyList[j].ItemCode}' and SourceLocation_Str = '{updateSumItemQtyList[j].SourceLocation}' and WarehouseCode_Str = '{updateSumItemQtyList[j].WarehouseCode}') ";
+        //                }
+        //            }
+        //            var inventoryList = Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>(inventoryFilter);
+        //            for (int i = 0; i < updateSumItemQtyList.Count; i++)
+        //            {
+        //                if (inventoryList.Any(j => j.ItemCode == updateSumItemQtyList[i].ItemCode && j.SourceLocation == updateSumItemQtyList[i].SourceLocation && j.WarehouseCode == updateSumItemQtyList[i].WarehouseCode))
+        //                {
+        //                    var inventory = inventoryList.Where(qty => qty.ItemCode == updateSumItemQtyList[i].ItemCode && qty.SourceLocation == updateSumItemQtyList[i].SourceLocation && qty.WarehouseCode == updateSumItemQtyList[i].WarehouseCode).ToList()[0];
+        //                    updateInventoryQtyList.Add(new AppBCInventoryModel()
+        //                    {
+        //                        ItemCode = inventory.ItemCode,
+        //                        SourceLocation = inventory.SourceLocation,
+        //                        ItemName = inventory.ItemName,
+        //                        OnhandState = 10,
+        //                        UnitCode = updateSumItemQtyList[i].UnitCode,
+        //                        Qty = inventory.Qty - updateSumItemQtyList[i].Qty,
+        //                        WarehouseCode = inventory.WarehouseCode
+        //                    });
+        //                }
+        //            }
+        //            #endregion
 
-                }
-            }
-            res.Message = message;
-            if (itemLows.Count != 0)
-            {
-                Env.DAL.BatchUpdateOrInsert(
-                       itemLows,
-                       t => new { t.ItemNo },
-                       null,
-                       t => new { t.IsSynced, t.Remark }
-               );
-            }
+        //        }
+        //    }
+        //    res.Message = message;
+        //    if (itemLows.Count != 0)
+        //    {
+        //        Env.DAL.BatchUpdateOrInsert(
+        //               itemLows,
+        //               t => new { t.ItemNo },
+        //               null,
+        //               t => new { t.IsSynced, t.Remark }
+        //       );
+        //    }
 
-            if (itemTasks.Count != 0)
-            {
-                Env.DAL.BatchUpdateOrInsert(
-                   itemTasks,
-                   t => new { t.TaskNo },
-                   null,
-                   t => new { t.State, t.EndDate, t.Remark }
-               );
-            }
-            if (updateInventoryQtyList.Count != 0)
-            {
-                Env.DAL.BatchUpdateOrInsert(
-                 updateInventoryQtyList,
-                 t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode },   //更新条件
-                 null,
-                 t => new { t.Qty, t.ItemCode, t.SourceLocation, t.ItemName, t.OnhandState, t.UnitCode, t.WarehouseCode }   //更新字段
-               );   //批量更新
-            }
-            return res;
-        }
+        //    if (itemTasks.Count != 0)
+        //    {
+        //        Env.DAL.BatchUpdateOrInsert(
+        //           itemTasks,
+        //           t => new { t.TaskNo },
+        //           null,
+        //           t => new { t.State, t.EndDate, t.Remark }
+        //       );
+        //    }
+        //    if (updateInventoryQtyList.Count != 0)
+        //    {
+        //        Env.DAL.BatchUpdateOrInsert(
+        //         updateInventoryQtyList,
+        //         t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode },   //更新条件
+        //         null,
+        //         t => new { t.Qty, t.ItemCode, t.SourceLocation, t.ItemName, t.OnhandState, t.UnitCode, t.WarehouseCode }   //更新字段
+        //       );   //批量更新
+        //    }
+        //    return res;
+        //}
     }
 }

Некоторые файлы не были показаны из-за большого количества измененных файлов