服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-10-28 96e980330268e93e4b65e428f2a26e74ca992ed7
计划任务改写
已修改1个文件
84 ■■■■■ 文件已修改
Tiger.Business.MES/iERP/U9C_MES.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/iERP/U9C_MES.cs
@@ -16,6 +16,7 @@
using Tiger.Model.Entitys.MES.Position;
using Apache.NMS.ActiveMQ.Commands;
using System.Security.Cryptography;
using System.Diagnostics;
namespace Tiger.Business.MES
{
@@ -87,38 +88,37 @@
            {
                if (items.Any())
                {
                    if (items.Count > 150)
                    if (items.Count > 100)
                    {
                        db.Utilities.PageEach(items, 1000, pageList =>
                        db.Utilities.PageEach(items, 100, pageList =>
                        {
                            var y = db.Storageable(pageList, "U9C")
                                   .WhereColumns(t => new { t.ID, t.GHOST_ROW })
                                   .ToStorage();
                            y.BulkCopy();
                            y.BulkUpdate();
                            y.AsInsertable.ExecuteCommand();
                            y.AsUpdateable.ExecuteCommand();
                        });
                    }
                    else
                    {
                        var s = db.Storageable(items, "U9C")
                               .WhereColumns(t => new { t.ID, t.GHOST_ROW })
                               .ToStorage();
                        s.AsInsertable.ExecuteCommand();
                        s.AsUpdateable.ExecuteCommand();
                    else {
                        var y = db.Storageable(items, "U9C")
                                       .WhereColumns(t => new { t.ID, t.GHOST_ROW })
                                       .ToStorage();
                        y.AsInsertable.ExecuteCommand();
                        y.AsUpdateable.ExecuteCommand();
                    }
                }
                if (itemExts.Any())
                {
                    if (itemExts.Count > 150)
                    if (itemExts.Count > 100)
                    {
                        db.Utilities.PageEach(itemExts, 1000, pageList =>
                        {
                            var y = db.Storageable(pageList, "U9C")
                                   .WhereColumns(t => new { t.ITEM_ID, t.GHOST_ROW })
                                   .ToStorage();
                            y.BulkCopy();
                            y.BulkUpdate();
                        });
                        db.Utilities.PageEach(itemExts, 100, pageList =>
                         {
                             var y = db.Storageable(pageList, "U9C")
                                    .WhereColumns(t => new { t.ITEM_ID, t.GHOST_ROW })
                                    .ToStorage();
                             y.AsInsertable.ExecuteCommand();
                             y.AsUpdateable.ExecuteCommand();
                         });
                    }
                    else
                    {
@@ -340,23 +340,19 @@
                }
            }
            Logger.Scheduler.Info($"客户信息存入实体中,总数:[{items.Count}]");
            db = Biz.Db;
            var LastRun = db.Queryable<SYS_PARAM>().Where(q => q.PRMG_CODE == "Interface_LastRun" && q.PARAM_CODE == "GetCust_LastRun").Single();
            LastRun.PARAM_VALUE = (input.endTime.ToDateTime() - DateTime.Now).TotalMinutes > 0 ? LastRun.PARAM_VALUE : input.endTime;
            var dbTran = db.UseTran(() =>
                {
                    db.Storageable(LastRun, "U9C_MES_GetCustomer").ExecuteCommand();
                    if (items.Any())
                    {
                        if (items.Count > 150)
                        if (items.Count > 100)
                        {
                            db.Utilities.PageEach(items, 1000, pageList =>
                           db.Utilities.PageEach(items, 100, pageList =>
                            {
                                var y = db.Storageable(pageList, "U9C")
                                       .WhereColumns(t => new { t.CUST_CODE, t.GHOST_ROW })
                                       .ToStorage();
                                y.BulkCopy();
                                y.BulkUpdate();
                                y.AsInsertable.ExecuteCommand();
                                y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
                            });
                        }
                        else
@@ -416,23 +412,19 @@
                }
            }
            Logger.Scheduler.Info($"供应商信息存入实体中,总数:[{items.Count}]");
            db = Biz.Db;
            var LastRun = db.Queryable<SYS_PARAM>().Where(q => q.PRMG_CODE == "Interface_LastRun" && q.PARAM_CODE == "Vender_LastTime").Single();
            LastRun.PARAM_VALUE = (input.endTime.ToDateTime() - DateTime.Now).TotalMinutes > 0 ? LastRun.PARAM_VALUE : input.endTime;
            var dbTran = db.UseTran(() =>
            {
                db.Storageable(LastRun, "U9C_MES_GetCustomer").ExecuteCommand();
                if (items.Any())
                {
                    if (items.Count > 150)
                    if (items.Count > 100)
                    {
                        db.Utilities.PageEach(items, 1000, pageList =>
                        db.Utilities.PageEach(items, 100, pageList =>
                        {
                            var y = db.Storageable(pageList, "U9C")
                                   .WhereColumns(t => new { t.SUPP_CODE, t.GHOST_ROW })
                                   .ToStorage();
                            y.BulkCopy();
                            y.BulkUpdate();
                            y.AsInsertable.ExecuteCommand();
                            y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
                        });
                    }
                    else
@@ -497,23 +489,19 @@
                }
            }
            Logger.Scheduler.Info($"客户条码信息存入实体中,总数:[{items.Count}]");
            db = Biz.Db;
            var LastRun = db.Queryable<SYS_PARAM>().Where(q => q.PRMG_CODE == "Interface_LastRun" && q.PARAM_CODE == "GetCustBar_LastTime").Single();
            LastRun.PARAM_VALUE = (input.endTime.ToDateTime() - DateTime.Now).TotalMinutes > 0 ? LastRun.PARAM_VALUE : input.endTime;
            var dbTran = db.UseTran(() =>
            {
                db.Storageable(LastRun, "U9C_MES_GetCustomer").ExecuteCommand();
                if (items.Any())
                {
                    if (items.Count > 150)
                    if (items.Count > 100)
                    {
                        db.Utilities.PageEach(items, 1000, pageList =>
                      db.Utilities.PageEach(items, 100, pageList =>
                        {
                            var y = db.Storageable(pageList, "U9C")
                                   .WhereColumns(t => new { t.CUST_SN, t.GHOST_ROW })
                                   .ToStorage();
                            y.BulkCopy();
                            y.BulkUpdate();
                            y.AsInsertable.ExecuteCommand();
                            y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
                        });
                    }
                    else
@@ -594,15 +582,15 @@
            {
                if (items.Any())
                {
                    if (items.Count > 150)
                    if (items.Count > 100)
                    {
                        db.Utilities.PageEach(items, 1000, pageList =>
                        db.Utilities.PageEach(items, 100, pageList =>
                        {
                            var y = db.Storageable(pageList, "U9C")
                                   .WhereColumns(t => new { t.ORDER_NO, t.GHOST_ROW })
                                   .ToStorage();
                            y.BulkCopy();
                            y.BulkUpdate();
                            y.AsInsertable.ExecuteCommand();
                            y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
                        });
                    }
                    else