莫海杰 2 місяців тому
батько
коміт
432b4c6f44

+ 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; }

+ 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;
+        //}
     }
 }

+ 8 - 6
SCADA_DAQ/Customer/Service/Wcs_WmsService.cs

@@ -311,7 +311,8 @@ 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 =>
@@ -372,19 +373,20 @@ namespace SCADA_DAQ.Customer.Service
                 if (newTask.SourceLocation != null)
                 {
                     taskNos = $"{taskNos} {task.No} ";
-                    wmsHaveSourceLocationTask.Add(newTask);
+                    sourceLocationWmsTask.Add(newTask);
                 }
                 if (newTask.SourceLocation == null)
                 {
                     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);
-            //wmsHaveSourceLocationTask = wmsHaveSourceLocationTask.Where(t=>!t.WoNo.StartsWith("CS12")).ToList();
-            AddDeviceTaskList(wmsHaveSourceLocationTask);
-            //UpLoadWms(wmsHaveSourceLocationTask);
+            //sourceLocationWmsTask = sourceLocationWmsTask.Where(t=>!t.WoNo.StartsWith("CS12")).ToList();
+            AddDeviceTaskList(sourceLocationWmsTask);
+            //UpLoadWms(sourceLocationWmsTask);
             if (dbRes.IsSucceed == true)
             {
                 res.Message = $"{taskNos}";

+ 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>