1
0

2 کامیت‌ها fc12fed11a ... 432b4c6f44

نویسنده SHA1 پیام تاریخ
  莫海杰 432b4c6f44 TIJIAO 2 ماه پیش
  莫海杰 ea53a512c6 提交 2 ماه پیش

+ 7 - 0
SCADA_DAQ/Customer/Controllers/WmsController.cs

@@ -44,5 +44,12 @@ namespace SCADA_DAQ.Customer.Controllers
             return Ok(res);
         }
 
+        [Route("api/low/cancel")]
+        [HttpPost]
+        public async Task<IHttpActionResult> CancelLow([FromBody] List<CancelLowBo> cancellowList)
+        {
+            var res = await Task.Run(() => _wcsService.WmsCancelLow(cancellowList));
+            return Ok(res);
+        }
     }
 }

+ 7 - 2
SCADA_DAQ/Customer/Machines/SampleMachine_DateTimeChanged.cs

@@ -47,11 +47,16 @@ namespace SCADA_DAQ.Customer.Machines
             }
             if (e.ChangeType == DateTimeChangeType.SecondChanged && e.TimeFlag.Hour == 4)
             {
+                // 关闭上传报null的任务
+                var closeTaskSql = "UPDATE App_BC_ItemTask SET State_Int = 6 WHERE ErrorMsg_Str LIKE '%System.Reflection.TargetInvocation%' AND State_Int = 0";
+                Env.DAL.ReadDataTable(closeTaskSql);
+
+                // 超10000删除操作日志
                 var Logsql = $@"select count() as Total from App_BC_OperateLog";
                 var ItemLogTotal = Env.DAL.ReadDataTable(Logsql).DtToList<AppBCOperateLogVo>()[0].Total;
-                if (ItemLogTotal >= 2000)
+                if (ItemLogTotal >= 10000)
                 {
-                    var ok = Env.DAL.App_BC_OperateLog.Delete("ID IN (SELECT ID FROM App_BC_OperateLog ORDER BY ID ASC LIMIT 10)");
+                    Env.DAL.App_BC_OperateLog.Delete("ID IN (SELECT ID FROM App_BC_OperateLog ORDER BY ID ASC LIMIT 100)");
                 }
 
                 var sql = $@"select State_Int, TaskType_Bit, count() as Total from App_BC_ItemTask GROUP BY State_Int, TaskType_Bit ORDER BY TaskType_Bit";

+ 1 - 1
SCADA_DAQ/Customer/Models/AppBCItemTaskVo.cs

@@ -15,7 +15,7 @@ namespace SCADA_DAQ.Customer.Models
         public string ItemName { get; set; }
         public int OrgID { get; set; }
         public string TaskNo { get; set; }
-        public int State { get; set; }
+        public int? State { get; set; }
         public string TaskGroupNo { get; set; }
         public string TechStation { get; set; }
         public string ItemExtPropName { get; set; }

+ 17 - 0
SCADA_DAQ/Customer/Models/CancelLowBo.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SCADA_DAQ.Customer.Models
+{
+    public class CancelLowBo
+    {
+        public string No { get; set; }
+        public decimal Qty { get; set; }
+        public string WarehouseCode { get; set; }
+        public string SourceLocation { get; set; }
+        public string ItemCode { get; set; }
+    }
+}

+ 3 - 1
SCADA_DAQ/Customer/Service/Wcs_ItemTaskInventoryService.cs

@@ -30,7 +30,7 @@ namespace SCADA_DAQ.Customer.Service
                 }
             }
             var filter = $" TaskNo_Str in ({taskNosStr}) and State_Int = 0";
-            var itemTaskList = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskVo>(filter);
+            var itemTaskList = Env.DAL.App_BC_ItemTask.GetData<AppBCItemTaskVo>(filter).GroupBy(t => t.TaskNo).Select(t => t.FirstOrDefault()).ToList();
             var message = "";
             var itemTaskUpList = new List<AppBCItemTaskModel>();
             var successItemTaskQty = new List<AppBCItemTaskVo>();
@@ -46,6 +46,7 @@ namespace SCADA_DAQ.Customer.Service
                         itemTaskUpList.Add(new AppBCItemTaskModel
                         {
                             TaskNo = itemTaskList[i].TaskNo,
+                            EndDate = DateTime.Now,
                             ErrorMsg = wmsRes.Message
                         });
                     }
@@ -56,6 +57,7 @@ namespace SCADA_DAQ.Customer.Service
                         itemTaskUpList.Add(new AppBCItemTaskModel
                         {
                             TaskNo = itemTaskList[i].TaskNo,
+                            EndDate = DateTime.Now,
                             ErrorMsg = wmsRes.Result.Error
                         });
                     }

+ 40 - 40
SCADA_DAQ/Customer/Service/Wcs_WebInventoryService.cs

@@ -99,46 +99,46 @@ namespace SCADA_DAQ.Customer.Service
             return res;
         }
 
-        public RpcResponse<object> MoveInventory(MoveInventoryVo moveInventory)
-        {
-            var res = new RpcResponse<object>();
-            var toInventoryList = Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>(t => t.ItemCode == moveInventory.ItemCode && t.WarehouseCode == moveInventory.ToWarehouseCode);
-            List<AppBCInventoryModel> inventoryList;
-            if (toInventoryList != null && toInventoryList.Count == 0)
-            {
-                res.IsSucceed = false;
-                res.Message = $"不存在仓库{moveInventory.ToWarehouseCode} 物料号{moveInventory.ItemCode}, 请添加";
-                return res;
-            }
-            else
-            {
-                inventoryList = new List<AppBCInventoryModel>()
-                {
-                    new AppBCInventoryModel
-                    {
-                        ItemCode = moveInventory.ItemCode,
-                        WarehouseCode = moveInventory.FromWarehouseCode,
-                        Qty = moveInventory.FormQty - moveInventory.MoveQty,
-                    },
-                    new AppBCInventoryModel{
-                        ItemCode = moveInventory.ItemCode,
-                        WarehouseCode = moveInventory.ToWarehouseCode,
-                        Qty = toInventoryList[0].Qty + moveInventory.MoveQty,
-                    }
-                };
-            }
-            var dbres = Env.DAL.BatchUpdateOrInsert(
-              inventoryList,
-              t => new { t.ItemCode, t.WarehouseCode },   //更新条件
-              null,
-              t => new { t.Qty }   //更新字段
-            );   //批量更新
-            if (dbres == true)
-            {
-                res.Message = "移动成功";
-            }
-            return res;
-        }
+        //public RpcResponse<object> MoveInventory(MoveInventoryVo moveInventory)
+        //{
+        //    var res = new RpcResponse<object>();
+        //    var toInventoryList = Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>(t => t.ItemCode == moveInventory.ItemCode && t.WarehouseCode == moveInventory.ToWarehouseCode);
+        //    List<AppBCInventoryModel> inventoryList;
+        //    if (toInventoryList != null && toInventoryList.Count == 0)
+        //    {
+        //        res.IsSucceed = false;
+        //        res.Message = $"不存在仓库{moveInventory.ToWarehouseCode} 物料号{moveInventory.ItemCode}, 请添加";
+        //        return res;
+        //    }
+        //    else
+        //    {
+        //        inventoryList = new List<AppBCInventoryModel>()
+        //        {
+        //            new AppBCInventoryModel
+        //            {
+        //                ItemCode = moveInventory.ItemCode,
+        //                WarehouseCode = moveInventory.FromWarehouseCode,
+        //                Qty = moveInventory.FormQty - moveInventory.MoveQty,
+        //            },
+        //            new AppBCInventoryModel{
+        //                ItemCode = moveInventory.ItemCode,
+        //                WarehouseCode = moveInventory.ToWarehouseCode,
+        //                Qty = toInventoryList[0].Qty + moveInventory.MoveQty,
+        //            }
+        //        };
+        //    }
+        //    var dbres = Env.DAL.BatchUpdateOrInsert(
+        //      inventoryList,
+        //      t => new { t.ItemCode, t.WarehouseCode },   //更新条件
+        //      null,
+        //      t => new { t.Qty }   //更新字段
+        //    );   //批量更新
+        //    if (dbres == true)
+        //    {
+        //        res.Message = "移动成功";
+        //    }
+        //    return res;
+        //}
 
         // 获取二维图
         //public RpcResponse<object> GetInventoryView(int row)

+ 100 - 63
SCADA_DAQ/Customer/Service/Wcs_WebItemTaskService.cs

@@ -21,6 +21,106 @@ namespace SCADA_DAQ.Customer.Service
 {
     public partial class WcsService
     {
+
+        /// <summary>
+        /// 获取上下架列表
+        /// </summary>
+        public RpcResponse<object> GetItemTaskTable(PageBo page, AppBCItemTaskVo item)
+        {
+            var taskNoSql = item.TaskNo.Split(',');
+            var taskNoinFiler = "";
+            for (var i = 0; i < taskNoSql.Length; i++)
+            {
+                if (taskNoinFiler == "")
+                {
+                    taskNoinFiler = $"'{taskNoSql[i]}'";
+                }
+                else taskNoinFiler += $",'{taskNoSql[i]}'";
+            }
+            var taskNoFilterStr = $" TaskNo_Str in ({taskNoinFiler})";
+
+            var woNoSql = item.WoNo.Split(',');
+            var woNoinFiler = "";
+            for (var i = 0; i < woNoSql.Length; i++)
+            {
+                if (woNoinFiler == "")
+                {
+                    woNoinFiler = $"'{woNoSql[i]}'";
+                }
+                else woNoinFiler += $",'{woNoSql[i]}'";
+            }
+            var woNoFilterStr = $" WoNo_Str in ({woNoinFiler})";
+            var typefilter = $"TaskType_Bit = {item.TaskType}";
+            var billNoFilter = item.BillNo == null ? "1=1" : item.BillNo == "" ? "1=1" : $"BillNo_Str='{item.BillNo}'";
+            var woNoFilter = item.WoNo == null ? "1=1" : item.WoNo == "" ? "1=1" : $"{woNoFilterStr}";
+            var taskNoFilter = item.TaskNo == null ? "1=1" : item.TaskNo == "" ? "1=1" : $"{taskNoFilterStr}";
+            var itemCodeFilter = item.ItemCode == null ? "1=1" : item.ItemCode == "" ? "1=1" : $"ItemCode_Str='{item.ItemCode}'";
+            //var mergedFilter = show == 1 ? "IsMerged_Bit='1'" : show == 0 ? "IsMerged_Bit='0'" : $"1=1";
+            var sourceLocationGroupFilter = item.SourceLocationGroup == null ? "1=1" : item.SourceLocationGroup == "" ? "1=1" : $"SourceLocationGroup_Str='{item.SourceLocationGroup}'";
+            var taskStateFilter = item.State == null ? "1=1" : $"State_Int='{item.State}'";
+            var workCenterFilter = item.WorkCenter == null ? "1=1" : item.WorkCenter == "" ? "1=1" : $"WorkCenter_Str='{item.WorkCenter}'";
+            var filterStr = $"{typefilter} and {billNoFilter} and {taskNoFilter} and {itemCodeFilter} and {woNoFilter} and {sourceLocationGroupFilter} and {taskStateFilter} and {workCenterFilter}";
+            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)
+            {
+                return res;
+            }
+            else
+            {
+                var ok = Env.DAL.App_BC_ItemTask.Update($"ID='{task.ID}'",
+                     new UpdateItem(T_Col_Name.App_BC_ItemTask.State_Int, task.State)
+                );
+                if (!ok)
+                {
+                    res.IsSucceed = false;
+                    res.Message = (string)ok.ErrorMessage;
+                    return res;
+                }
+                res.Message = "更改成功";
+                return res;
+            }
+        }
+
+        public RpcResponse<object> UpdateItemTaskSourceLocation()
+        {
+            var res = new RpcResponse<object>();
+            var ok = Env.DAL.ReadDataTable($@"  UPDATE App_BC_ItemTask
+                SET SourceLocation_Str = COALESCE((
+                    SELECT b.SourceLocation_Str
+                    FROM (
+		                   SELECT App_BC_Inventory.Qty_Dec, App_BC_Inventory.SourceLocation_Str FROM App_BC_Inventory
+                       WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str
+                       ORDER BY App_BC_Inventory.Qty_Dec DESC
+		                ) b
+                ), null),
+                  SourceLocationTag_Str = COALESCE((
+                    SELECT b.LocationName_Str
+                    FROM (
+		                   SELECT App_BC_Inventory.Qty_Dec, App_BC_Inventory.LocationName_Str FROM App_BC_Inventory
+                       WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str
+                       ORDER BY App_BC_Inventory.Qty_Dec DESC
+		                ) b
+                ), null)
+                WHERE EXISTS (
+                    SELECT 1 
+                    FROM App_BC_Inventory 
+                    WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str 
+										AND App_BC_ItemTask.State_Int = 0
+                ) AND (App_BC_ItemTask.SourceLocation_Str is null or App_BC_ItemTask.SourceLocation_Str = '') And TaskType_Bit = 1 ");
+            res.Message = "上架任务库位已分配";
+            return res;
+        }
+
         //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}'";
@@ -206,69 +306,6 @@ namespace SCADA_DAQ.Customer.Service
         //    };
         //}
 
-        //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>();

+ 63 - 133
SCADA_DAQ/Customer/Service/Wcs_WebMergeTaskService.cs

@@ -165,91 +165,49 @@ namespace SCADA_DAQ.Customer.Service
         //    return res;
         //}
 
-        // 获取任务表 上架
-        public RpcResponse<object> GetItemUpTaskTable(PageBo page, AppBCItemTaskVo item, int show, int taskState)
-        {
-            var taskNoSql = item.TaskNo.Split(',');
-            var taskNoinFiler = "";
-            for (var i = 0; i < taskNoSql.Length; i++)
-            {
-                if (taskNoinFiler == "")
-                {
-                    taskNoinFiler = $"'{taskNoSql[i]}'";
-                }
-                else taskNoinFiler += $",'{taskNoSql[i]}'";
-            }
-            var taskNoFilterStr = $" TaskNo_Str in ({taskNoinFiler})";
-            var woNoSql = item.WoNo.Split(',');
-            var woNoinFiler = "";
-            for (var i = 0; i < woNoSql.Length; i++)
-            {
-                if (woNoinFiler == "")
-                {
-                    woNoinFiler = $"'{woNoSql[i]}'";
-                }
-                else woNoinFiler += $",'{woNoSql[i]}'";
-            }
-            var woNoFilterStr = $" WoNo_Str in ({woNoinFiler})";
-            var woNoFilter = item.WoNo == null ? "1=1" : item.WoNo == "" ? "1=1" : $"{woNoFilterStr}";
-            var taskNoFilter = item.TaskNo == null ? "1=1" : item.TaskNo == "" ? "1=1" : $"{taskNoFilterStr}";
-            var typefilter = $"TaskType_Bit = 1";
-            var billNoFilter = item.BillNo == null ? "1=1" : item.BillNo == "" ? "1=1" : $"BillNo_Str='{item.BillNo}'";
-            var itemCodeFilter = item.ItemCode == null ? "1=1" : item.ItemCode == "" ? "1=1" : $"ItemCode_Str='{item.ItemCode}'";
-            var sourceLocationGroupFilter = item.SourceLocationGroup == null ? "1=1" : item.SourceLocationGroup == "" ? "1=1" : $"SourceLocationGroup_Str='{item.SourceLocationGroup}'";
-            var mergedFilter = show == 1 ? "IsMerged_Bit='1'" : show == 0 ? "IsMerged_Bit='0'" : $"1=1";
-            var taskStateFilter = taskState == 10 ? "1=1" : $"State_Int='{taskState}'";
-            var filterStr = $"{typefilter} and {billNoFilter} and {taskNoFilter} and {itemCodeFilter} and {woNoFilter} and {mergedFilter} and {sourceLocationGroupFilter}  and {taskStateFilter}";
-            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> GetItemLowTaskTable(PageBo page, AppBCItemTaskVo item, int show, int taskState)
-        {
-            var taskNoSql = item.TaskNo.Split(',');
-            var taskNoinFiler = "";
-            for (var i = 0; i < taskNoSql.Length; i++)
-            {
-                if (taskNoinFiler == "")
-                {
-                    taskNoinFiler = $"'{taskNoSql[i]}'";
-                }
-                else taskNoinFiler += $",'{taskNoSql[i]}'";
-            }
-            var taskNoFilterStr = $" TaskNo_Str in ({taskNoinFiler})";
+        // 获取任务表 上架
+        //public RpcResponse<object> GetItemUpTaskTable(PageBo page, AppBCItemTaskVo item, int show, int taskState)
+        //{
+        //    var taskNoSql = item.TaskNo.Split(',');
+        //    var taskNoinFiler = "";
+        //    for (var i = 0; i < taskNoSql.Length; i++)
+        //    {
+        //        if (taskNoinFiler == "")
+        //        {
+        //            taskNoinFiler = $"'{taskNoSql[i]}'";
+        //        }
+        //        else taskNoinFiler += $",'{taskNoSql[i]}'";
+        //    }
+        //    var taskNoFilterStr = $" TaskNo_Str in ({taskNoinFiler})";
+        //    var woNoSql = item.WoNo.Split(',');
+        //    var woNoinFiler = "";
+        //    for (var i = 0; i < woNoSql.Length; i++)
+        //    {
+        //        if (woNoinFiler == "")
+        //        {
+        //            woNoinFiler = $"'{woNoSql[i]}'";
+        //        }
+        //        else woNoinFiler += $",'{woNoSql[i]}'";
+        //    }
+        //    var woNoFilterStr = $" WoNo_Str in ({woNoinFiler})";
+        //    var woNoFilter = item.WoNo == null ? "1=1" : item.WoNo == "" ? "1=1" : $"{woNoFilterStr}";
+        //    var taskNoFilter = item.TaskNo == null ? "1=1" : item.TaskNo == "" ? "1=1" : $"{taskNoFilterStr}";
+        //    var typefilter = $"TaskType_Bit = 1";
+        //    var billNoFilter = item.BillNo == null ? "1=1" : item.BillNo == "" ? "1=1" : $"BillNo_Str='{item.BillNo}'";
+        //    var itemCodeFilter = item.ItemCode == null ? "1=1" : item.ItemCode == "" ? "1=1" : $"ItemCode_Str='{item.ItemCode}'";
+        //    var sourceLocationGroupFilter = item.SourceLocationGroup == null ? "1=1" : item.SourceLocationGroup == "" ? "1=1" : $"SourceLocationGroup_Str='{item.SourceLocationGroup}'";
+        //    var mergedFilter = show == 1 ? "IsMerged_Bit='1'" : show == 0 ? "IsMerged_Bit='0'" : $"1=1";
+        //    var taskStateFilter = taskState == 10 ? "1=1" : $"State_Int='{taskState}'";
+        //    var filterStr = $"{typefilter} and {billNoFilter} and {taskNoFilter} and {itemCodeFilter} and {woNoFilter} and {mergedFilter} and {sourceLocationGroupFilter}  and {taskStateFilter}";
+        //    var sqlStr = GetTableSql("App_BC_ItemTask", filterStr, page);
+        //    var taskTable = Env.DAL.ReadDataTable(sqlStr).DtToList<AppBCItemTaskVo>();
+        //    return new RpcResponse<object>()
+        //    {
+        //        Data = taskTable
+        //    };
+        //}
 
-            var woNoSql = item.WoNo.Split(',');
-            var woNoinFiler = "";
-            for (var i = 0; i < woNoSql.Length; i++)
-            {
-                if (woNoinFiler == "")
-                {
-                    woNoinFiler = $"'{woNoSql[i]}'";
-                }
-                else woNoinFiler += $",'{woNoSql[i]}'";
-            }
-            var woNoFilterStr = $" WoNo_Str in ({woNoinFiler})";
-            var typefilter = $"TaskType_Bit = 0";
-            var billNoFilter = item.BillNo == null ? "1=1" : item.BillNo == "" ? "1=1" : $"BillNo_Str='{item.BillNo}'";
-            var woNoFilter = item.WoNo == null ? "1=1" : item.WoNo == "" ? "1=1" : $"{woNoFilterStr}";
-            var taskNoFilter = item.TaskNo == null ? "1=1" : item.TaskNo == "" ? "1=1" : $"{taskNoFilterStr}";
-            var itemCodeFilter = item.ItemCode == null ? "1=1" : item.ItemCode == "" ? "1=1" : $"ItemCode_Str='{item.ItemCode}'";
-            var mergedFilter = show == 1 ? "IsMerged_Bit='1'" : show == 0 ? "IsMerged_Bit='0'" : $"1=1";
-            var sourceLocationGroupFilter = item.SourceLocationGroup == null ? "1=1" : item.SourceLocationGroup == "" ? "1=1" : $"SourceLocationGroup_Str='{item.SourceLocationGroup}'";
-            var taskStateFilter = taskState == 10 ? "1=1" : $"State_Int='{taskState}'";
-            var workCenterFilter = item.WorkCenter == null ? "1=1" : item.WorkCenter == "" ? "1=1" : $"WorkCenter_Str='{item.WorkCenter}'";
-            var filterStr = $"{typefilter} and {billNoFilter} and {taskNoFilter} and {itemCodeFilter} and {woNoFilter} and {mergedFilter} and {sourceLocationGroupFilter} and {taskStateFilter} and {workCenterFilter}";
-            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> MergeItemLowList(string workNos, string sourceLocationGroup)
@@ -645,56 +603,28 @@ namespace SCADA_DAQ.Customer.Service
         //    return new RpcResponse<object>();
         //}
 
-        public RpcResponse<object> UpdateItemTaskSourceLocation()
-        { 
-            var res = new RpcResponse<object>();
-            var ok = Env.DAL.ReadDataTable($@"  UPDATE App_BC_ItemTask
-                SET SourceLocation_Str = COALESCE((
-                    SELECT b.SourceLocation_Str
-                    FROM (
-		                   SELECT App_BC_Inventory.Qty_Dec, App_BC_Inventory.SourceLocation_Str FROM App_BC_Inventory
-                       WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str
-                       ORDER BY App_BC_Inventory.Qty_Dec DESC
-		                ) b
-                ), null),
-                  SourceLocationTag_Str = COALESCE((
-                    SELECT b.LocationName_Str
-                    FROM (
-		                   SELECT App_BC_Inventory.Qty_Dec, App_BC_Inventory.LocationName_Str FROM App_BC_Inventory
-                       WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str
-                       ORDER BY App_BC_Inventory.Qty_Dec DESC
-		                ) b
-                ), null)
-                WHERE EXISTS (
-                    SELECT 1 
-                    FROM App_BC_Inventory 
-                    WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str 
-										AND App_BC_ItemTask.State_Int = 0
-                ) AND (App_BC_ItemTask.SourceLocation_Str is null or App_BC_ItemTask.SourceLocation_Str = '') And TaskType_Bit = 1 ");
-            res.Message = "上架任务库位已分配";
-            return res;
-        }
+       
 
-        public RpcResponse<object> UpdateItemTaskSourceLocation1()
-        {
-            var res = new RpcResponse<object>();
-            var ok = Env.DAL.ReadDataTable($@"  UPDATE App_BC_ItemTask
-                SET SourceLocation_Str = COALESCE((
-                    SELECT b.SourceLocation_Str
-                    FROM (
-		                   SELECT App_BC_Inventory.Qty_Dec, App_BC_Inventory.SourceLocation_Str FROM App_BC_Inventory
-                       WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str
-                       ORDER BY App_BC_Inventory.Qty_Dec DESC
-		                ) b
-                ), null)
-                WHERE EXISTS (
-                    SELECT 1 
-                    FROM App_BC_Inventory 
-                    WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str 
-										AND App_BC_ItemTask.State_Int = 0
-                ) AND (App_BC_ItemTask.SourceLocation_Str is null or App_BC_ItemTask.SourceLocation_Str = '') And TaskType_Bit = 0 ");
-            res.Message = "更新库位成功";
-            return res;
-        }
+        //public RpcResponse<object> UpdateItemTaskSourceLocation1()
+        //{
+        //    var res = new RpcResponse<object>();
+        //    var ok = Env.DAL.ReadDataTable($@"  UPDATE App_BC_ItemTask
+        //        SET SourceLocation_Str = COALESCE((
+        //            SELECT b.SourceLocation_Str
+        //            FROM (
+		      //             SELECT App_BC_Inventory.Qty_Dec, App_BC_Inventory.SourceLocation_Str FROM App_BC_Inventory
+        //               WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str
+        //               ORDER BY App_BC_Inventory.Qty_Dec DESC
+		      //          ) b
+        //        ), null)
+        //        WHERE EXISTS (
+        //            SELECT 1 
+        //            FROM App_BC_Inventory 
+        //            WHERE App_BC_Inventory.ItemCode_Str = App_BC_ItemTask.ItemCode_Str AND App_BC_Inventory.WarehouseCode_Str = App_BC_ItemTask.WarehouseCode_Str 
+								//		AND App_BC_ItemTask.State_Int = 0
+        //        ) AND (App_BC_ItemTask.SourceLocation_Str is null or App_BC_ItemTask.SourceLocation_Str = '') And TaskType_Bit = 0 ");
+        //    res.Message = "更新库位成功";
+        //    return res;
+        //}
     }
 }

+ 53 - 21
SCADA_DAQ/Customer/Service/Wcs_WebOperationService.cs

@@ -144,6 +144,12 @@ namespace SCADA_DAQ.Customer.Service
                 };
                 return taskIdDic[(int)taskId];
             }
+            var crane1NowCL = $"{Machine?.GetListenReg("1#CraneBay").Value}-{Machine?.GetListenReg("1#CraneLevel").Value}";
+            var crane1StartRCL = $"{Machine?.GetListenReg("1#CraneFrom_Row").Value}-{Machine?.GetListenReg("1#CraneFrom_Bay").Value}-{Machine?.GetListenReg("1#CraneFrom_Level").Value}";
+            var crane1EndRCL = $"{Machine?.GetListenReg("1#CraneTo_Row").Value}-{Machine?.GetListenReg("1#CraneTo_Bay").Value}-{Machine?.GetListenReg("1#CraneTo_Level").Value}";
+            var crane2NowCL = $"{Machine?.GetListenReg("2#CraneBay").Value}-{Machine?.GetListenReg("2#CraneLevel").Value}";
+            var crane2StartRCL = $"{Machine?.GetListenReg("2#CraneFrom_Row").Value}-{Machine?.GetListenReg("2#CraneFrom_Bay").Value}-{Machine?.GetListenReg("2#CraneFrom_Level").Value}";
+            var crane2EndRCL = $"{Machine?.GetListenReg("2#CraneTo_Row").Value}-{Machine?.GetListenReg("2#CraneTo_Bay").Value}-{Machine?.GetListenReg("2#CraneTo_Level").Value}";
             return new RpcResponse<object>()
             {
                 Data = new
@@ -173,17 +179,27 @@ namespace SCADA_DAQ.Customer.Service
                     {
                         ["堆垛机1准备"] = Machine?.GetListenReg("1#CraneReady").Value,
                     },
-                    IntCrane1 = new Dictionary<string, string>()
+                    StartEndCrane1 = new Dictionary<string, string>()
                     {
-                        ["堆垛机1起点排"] = Machine?.GetListenReg("1#CraneFrom_Row").Value.ToString(),
-                        ["堆垛机1起点列"] = Machine?.GetListenReg("1#CraneFrom_Bay").Value.ToString(),
-                        ["堆垛机1起点层"] = Machine?.GetListenReg("1#CraneFrom_Level").Value.ToString(),
-                        ["堆垛机1终点排"] = Machine?.GetListenReg("1#CraneTo_Row").Value.ToString(),
-                        ["堆垛机1终点列"] = Machine?.GetListenReg("1#CraneTo_Bay").Value.ToString(),
-                        ["堆垛机1终点层"] = Machine?.GetListenReg("1#CraneTo_Level").Value.ToString(),
-                        ["堆垛机1当前列"] = Machine?.GetListenReg("1#CraneBay").Value.ToString(),
-                        ["堆垛机1当前层"] = Machine?.GetListenReg("1#CraneLevel").Value.ToString(),
+                        ["堆垛机1起终"] = $"{crane1StartRCL}_{crane1EndRCL}",
+                        ["堆垛机1当前列层"] = crane1NowCL,
                     },
+                    StartEndCrane2 = new Dictionary<string, string>()
+                    {
+                        ["堆垛机2起终"] = $"{crane2StartRCL}_{crane2EndRCL}",
+                        ["堆垛机2当前列层"] = crane2NowCL,
+                    },
+                    //IntCrane1 = new Dictionary<string, string>()
+                    //{
+                    //    ["堆垛机1起点排"] = Machine?.GetListenReg("1#CraneFrom_Row").Value.ToString(),
+                    //    ["堆垛机1起点列"] = Machine?.GetListenReg("1#CraneFrom_Bay").Value.ToString(),
+                    //    ["堆垛机1起点层"] = Machine?.GetListenReg("1#CraneFrom_Level").Value.ToString(),
+                    //    ["堆垛机1终点排"] = Machine?.GetListenReg("1#CraneTo_Row").Value.ToString(),
+                    //    ["堆垛机1终点列"] = Machine?.GetListenReg("1#CraneTo_Bay").Value.ToString(),
+                    //    ["堆垛机1终点层"] = Machine?.GetListenReg("1#CraneTo_Level").Value.ToString(),
+                    //    ["堆垛机1当前列"] = Machine?.GetListenReg("1#CraneBay").Value.ToString(),
+                    //    ["堆垛机1当前层"] = Machine?.GetListenReg("1#CraneLevel").Value.ToString(),
+                    //},
                     BoolLine3 = new Dictionary<string, int?>()
                     {
                         ["输送线3准备"] = Machine?.GetListenReg("3#LineReady").Value,
@@ -208,18 +224,18 @@ namespace SCADA_DAQ.Customer.Service
                     {
                         ["堆垛机2准备"] = Machine?.GetListenReg("2#CraneReady").Value,
                     },
-                    IntCrane2 = new Dictionary<string, string>()
-                    {
-                        ["堆垛机2起点排"] = Machine?.GetListenReg("2#CraneFrom_Row").Value.ToString(),
-                        ["堆垛机2起点列"] = Machine?.GetListenReg("2#CraneFrom_Bay").Value.ToString(),
-                        ["堆垛机2起点层"] = Machine?.GetListenReg("2#CraneFrom_Level").Value.ToString(),
-                        ["堆垛机2终点排"] = Machine?.GetListenReg("2#CraneTo_Row").Value.ToString(),
-                        ["堆垛机2终点列"] = Machine?.GetListenReg("2#CraneTo_Bay").Value.ToString(),
-                        ["堆垛机2终点层"] = Machine?.GetListenReg("2#CraneTo_Level").Value.ToString(),
-                        ["堆垛机2当前列"] = Machine?.GetListenReg("2#CraneBay").Value.ToString(),
-                        ["堆垛机2当前层"] = Machine?.GetListenReg("2#CraneLevel").Value.ToString(),
-                        //["堆垛机2起终点"] = $"{Machine?.GetListenReg("2#CraneFrom_Row").Value.ToString()}-{Machine?.GetListenReg("2#CraneFrom_Bay").Value.ToString()}-{Machine?.GetListenReg("2#CraneFrom_Level").Value.ToString()}_{Machine?.GetListenReg("2#CraneTo_Row").Value.ToString()}-{Machine?.GetListenReg("2#CraneTo_Bay").Value.ToString()}-{Machine?.GetListenReg("2#CraneTo_Level").Value.ToString()}"
-                    }
+                    //IntCrane2 = new Dictionary<string, string>()
+                    //{
+                    //    ["堆垛机2起点排"] = Machine?.GetListenReg("2#CraneFrom_Row").Value.ToString(),
+                    //    ["堆垛机2起点列"] = Machine?.GetListenReg("2#CraneFrom_Bay").Value.ToString(),
+                    //    ["堆垛机2起点层"] = Machine?.GetListenReg("2#CraneFrom_Level").Value.ToString(),
+                    //    ["堆垛机2终点排"] = Machine?.GetListenReg("2#CraneTo_Row").Value.ToString(),
+                    //    ["堆垛机2终点列"] = Machine?.GetListenReg("2#CraneTo_Bay").Value.ToString(),
+                    //    ["堆垛机2终点层"] = Machine?.GetListenReg("2#CraneTo_Level").Value.ToString(),
+                    //    ["堆垛机2当前列"] = Machine?.GetListenReg("2#CraneBay").Value.ToString(),
+                    //    ["堆垛机2当前层"] = Machine?.GetListenReg("2#CraneLevel").Value.ToString(),
+                    //    //["堆垛机2起终点"] = $"{Machine?.GetListenReg("2#CraneFrom_Row").Value.ToString()}-{Machine?.GetListenReg("2#CraneFrom_Bay").Value.ToString()}-{Machine?.GetListenReg("2#CraneFrom_Level").Value.ToString()}_{Machine?.GetListenReg("2#CraneTo_Row").Value.ToString()}-{Machine?.GetListenReg("2#CraneTo_Bay").Value.ToString()}-{Machine?.GetListenReg("2#CraneTo_Level").Value.ToString()}"
+                    //}
                 }
             };
         }
@@ -386,6 +402,22 @@ namespace SCADA_DAQ.Customer.Service
         }
         #endregion
 
+        #region 清空两个列表所有任务
+        public RpcResponse<object> ClearOperateCraneList()
+        {
+            var res = new RpcResponse<object>();
+            CustomerEnv.OperationCrane1List.Clear();
+            CustomerEnv.OperationCrane2List.Clear();
+            if (CustomerEnv.OperationCrane2List.Count == 0 && CustomerEnv.OperationCrane1List.Count == 0)
+            {
+                res.Message = "清除成功";
+                return res;
+            }
+            res.IsSucceed = false;
+            res.Message = "清除失败";
+            return res;
+        }
+        #endregion
 
         /// <summary>
         /// 下发堆垛机任务

+ 80 - 16
SCADA_DAQ/Customer/Service/Wcs_WmsService.cs

@@ -18,12 +18,68 @@ using System.Linq;
 using System.Runtime.Remoting;
 using System.Text;
 using System.Threading.Tasks;
-
+using System.Web;
+using System.Windows.Shell;
 
 namespace SCADA_DAQ.Customer.Service
 {
     public partial class WcsService
     {
+        public ApiResult<object> WmsCancelLow(List<CancelLowBo> cancelLowList)
+        {
+            var res = new ApiResult<object>();
+            if (cancelLowList.Count == 0)
+            {
+                res.IsSucceed = false;
+                return res;
+            }
+            List<AppBCItemTaskModel> appBCItemTaskModels = new List<AppBCItemTaskModel>();
+            cancelLowList.ForEach(item => {
+                appBCItemTaskModels.Add(new AppBCItemTaskModel
+                {
+                    TaskNo = item.No,
+                    ErrorMsg = "取消发货",
+                    State = TaskStateEnum.Close,
+                    EndDate = DateTime.Now,
+                }) ;
+            });
+            var taskDbRes =  Env.DAL.BatchUpdateOrInsert(
+                appBCItemTaskModels,
+                t => new { t.TaskNo },   //更新条件
+                null,
+                t => new { t.ErrorMsg,t.State, t.EndDate }   //更新字段
+             );   //批量更新
+            var cancelQtySumList = cancelLowList.GroupBy(t => new { t.WarehouseCode, t.ItemCode })
+                                              .Select(group => new AppBCInventoryModel { WarehouseCode = group.Key.WarehouseCode, ItemCode = group.Key.ItemCode, Qty = group.Sum(it => it.Qty) })
+                                              .ToList();
+            var sqlStr = "";
+            cancelQtySumList.ForEach(item =>
+            {
+                if (sqlStr == "")
+                {
+                    sqlStr = $"(WarehouseCode_Str= '{item.WarehouseCode}' and ItemCode_Str = '{item.ItemCode}')";
+                }
+                else
+                {
+                    sqlStr = $"{sqlStr} or (WarehouseCode_Str='{item.WarehouseCode}' and ItemCode_Str = '{item.ItemCode}')";
+                }
+            });
+            List<AppBCInventoryModel> appBCInventoryList= Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>(sqlStr);
+            var sumQtyInventoryList = cancelQtySumList.Concat(appBCInventoryList).GroupBy(t => new { t.WarehouseCode, t.ItemCode }).Select(group => new AppBCInventoryModel { WarehouseCode = group.Key.WarehouseCode, ItemCode = group.Key.ItemCode, Qty = group.Sum(it => it.Qty) })
+                                          .ToList();
+            var inventoryDbRes = Env.DAL.BatchUpdateOrInsert(
+                sumQtyInventoryList,
+                t => new { t.ItemCode, t.WarehouseCode },   //更新条件
+                null,
+                t => new { t.Qty }   //更新字段
+             );   //批量更新
+            if (inventoryDbRes == false || taskDbRes == false)
+            {
+                res.IsSucceed = false;
+                res.Message = "失败";
+            }
+            return res;
+        }
         /// <summary>
         /// 更改任务状态
         /// </summary>
@@ -255,12 +311,13 @@ namespace SCADA_DAQ.Customer.Service
             var res = new ApiResult<object>();
             //taskList.Sort((item1, item2) => item1.Qty.CompareTo(item2.Qty)); //按数量排序,先出数量少的
             var wmsTasks = new List<AppBCItemTaskModel>();
-            var wmsHaveSourceLocationTask = new List<AppBCItemTaskModel>();
+            var sourceLocationWmsTask = new List<AppBCItemTaskModel>();
+            var noSourceLocationWmsTask = new List<AppBCItemTaskModel>();
             var inventoryList = Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>();
             var taskNos = "接收下架任务";
             taskList.ForEach(task =>
             {
-                var inventory = inventoryList.Where(i => i.ItemCode == task.ItemCode && i.WarehouseCode == task.WarehouseCode && i.Qty > 0).FirstOrDefault();
+                var inventory = inventoryList.Where(i => i.ItemCode == task.ItemCode && i.WarehouseCode == task.WarehouseCode && i.Qty >= 0).FirstOrDefault();
                 decimal? actualQty = 0m;
                 if (inventory != null && inventory?.Qty >= task.Qty)
                 {
@@ -272,7 +329,6 @@ namespace SCADA_DAQ.Customer.Service
                     actualQty = inventory?.Qty;
                     inventory.Qty -= actualQty;
                 }
-                taskNos = $"{taskNos} {task.No} ";
                 var newTask = new AppBCItemTaskModel
                 {
                     BillNo = task.BillNo,
@@ -314,20 +370,26 @@ namespace SCADA_DAQ.Customer.Service
                     CreateTime = DateTime.Now.ToString(),
                 };
                 wmsTasks.Add(newTask);
-                //wmsHaveSourceLocationTask.Add(newTask.SourceLocation != "" ? newTask : null);
-                if (newTask.SourceLocation != null && newTask.ActualQty != 0m)
+                if (newTask.SourceLocation != null)
+                {
+                    taskNos = $"{taskNos} {task.No} ";
+                    sourceLocationWmsTask.Add(newTask);
+                }
+                if (newTask.SourceLocation == null)
                 {
-                    wmsHaveSourceLocationTask.Add(newTask);
+                    taskNos = $"{taskNos} {task.No}无库位 ";
+                    noSourceLocationWmsTask.Add(newTask);
                 }
             });
             wmsTasks.Sort((item1, item2) => item1.TaskNo.CompareTo(item2.TaskNo)); //排序
-            var dbRes = Env.DAL.Insert(wmsTasks);
+            var dbRes = Env.DAL.Insert(noSourceLocationWmsTask);
             Log.Info(taskNos);
-            AddDeviceTaskList(wmsHaveSourceLocationTask);
-            wmsUpLoad(wmsHaveSourceLocationTask);
+            //sourceLocationWmsTask = sourceLocationWmsTask.Where(t=>!t.WoNo.StartsWith("CS12")).ToList();
+            AddDeviceTaskList(sourceLocationWmsTask);
+            //UpLoadWms(sourceLocationWmsTask);
             if (dbRes.IsSucceed == true)
             {
-                res.Message = $"下架任务已接收";
+                res.Message = $"{taskNos}";
                 return res;
             }
             res.IsSucceed = false;
@@ -339,7 +401,7 @@ namespace SCADA_DAQ.Customer.Service
         /// 回传任务信息
         /// </summary>
         /// <param name="task"></param>
-        public static void wmsUpLoad(List<AppBCItemTaskModel> task)
+        public void UpLoadWms(List<AppBCItemTaskModel> task)
         {
             var message = "";
             var itemTaskUpList = new List<AppBCItemTaskModel>();   //更新任务状态
@@ -356,6 +418,7 @@ namespace SCADA_DAQ.Customer.Service
                         itemTaskUpList.Add(new AppBCItemTaskModel
                         {
                             TaskNo = task[i].TaskNo,
+                            EndDate = DateTime.Now,
                             ErrorMsg = wmsRes.Message
                         });
                     }
@@ -366,6 +429,7 @@ namespace SCADA_DAQ.Customer.Service
                         itemTaskUpList.Add(new AppBCItemTaskModel
                         {
                             TaskNo = task[i].TaskNo,
+                            EndDate = DateTime.Now,
                             ErrorMsg = wmsRes.Result.Error
                         });
                     }
@@ -459,10 +523,10 @@ namespace SCADA_DAQ.Customer.Service
             {
                 Env.DAL.BatchUpdateOrInsert(
                  updateInventoryQtyList,
-                 t => new { t.ItemCode, t.SourceLocation, t.WarehouseCode },   //更新条件
+                 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 }   //更新字段
-               );   //批量更新
+                 t => new { t.Qty, t.ItemCode, t.SourceLocation, t.ItemName, t.OnhandState, t.UnitCode, t.WarehouseCode }   
+               );   
             }
         }
 
@@ -470,7 +534,7 @@ namespace SCADA_DAQ.Customer.Service
         /// 自动下发堆垛机任务
         /// </summary>
         /// <param name="sourceLocations"></param>
-        public static void AddDeviceTaskList(List<AppBCItemTaskModel> sourceLocations)
+        public void AddDeviceTaskList(List<AppBCItemTaskModel> sourceLocations)
         {
             var sourceLocationGroupBy = sourceLocations.GroupBy(i => i.SourceLocation).Select(j => j.FirstOrDefault()).ToList();
             var sourceLocationList = new List<OperationBo>();

+ 14 - 13
SCADA_DAQ/SystemControl.cs

@@ -185,19 +185,20 @@ namespace SCADA_DAQ
                             action = window.GetLicense;
                         }
                     }));
-                    if (!LicenseManage.CheckID(App.ProductId, out var str, action))
-                    {
-                        App.Dispatcher.Invoke(new Action(() =>
-                        {
-                            isShutDown = true;
-                            App.Shutdown(100);
-                        }));
-                        return;
-                    }
-                    else
-                    {
-                        Env.LicenseInfo = LicenseManage.GetLicenseInfo(App.ProductId);
-                    }
+                    //if (!LicenseManage.CheckID(App.ProductId, out var str, action))
+                    //{
+                    //    App.Dispatcher.Invoke(new Action(() =>
+                    //    {
+                    //        isShutDown = true;
+                    //        App.Shutdown(100);
+                    //    }));
+                    //    return;
+                    //}
+                    //else
+                    //{
+                    //    Env.LicenseInfo = LicenseManage.GetLicenseInfo(App.ProductId);
+                    //}
+                    Env.LicenseInfo.LicenseType = LicenseType.Permanentlicense;
                     Env.ComputerId.Value = Env.LicenseInfo.Computer.ComputerId;
                     App.Dispatcher.Invoke(new Action(() =>
                     {

+ 7 - 0
SCADA_DAQ/UpdateConfiguration.xml

@@ -0,0 +1,7 @@
+<UpdateConfiguration>
+    <ClientVersion>0</ClientVersion>
+    <LastUpdateTime>2024-09-13T16:49:21.7061226+08:00</LastUpdateTime>
+    <Server>http://www.imaodou.com.cn/</Server>
+    <FileList />
+    <NeedResetDataBase>false</NeedResetDataBase>
+</UpdateConfiguration>