瀏覽代碼

账号时效性验证

Pengxy 1 年之前
父節點
當前提交
d45ab42d84

+ 28 - 1
MicroServices/Business/Business.Application/ReplenishmentManagement/ReplenishmentAppService.cs

@@ -215,6 +215,11 @@ namespace Business.Replenishment
         /// </summary>
         private readonly ProductExamineAppService _productExamineAppService;
 
+        /// <summary>
+        /// 账号时效性验证
+        /// </summary>
+        private readonly AccountValidityAppService _AccountValidityAppService;
+
         /// <summary>
         /// 资源检查入参
         /// </summary>
@@ -348,7 +353,8 @@ namespace Business.Replenishment
             PretreatmentAppService pretreatmentAppService,
             PurchaseOrderAppService purchaseOrderAppService,
             CalcBomViewAppService CalcBomViewAppService,
-            ProductExamineAppService productExamineAppService,
+            AccountValidityAppService AccountValidityAppService,
+        ProductExamineAppService productExamineAppService,
             BusinessBangDbContext businessBangDbContext,
             BusinessDbContext businessDbContext,
             ICurrentTenant currentTenant,
@@ -446,6 +452,7 @@ namespace Business.Replenishment
             _serialNumberAppService = serialNumberAppService;
             _pretreatmentAppService = pretreatmentAppService;
             _CalcBomViewAppService = CalcBomViewAppService;
+            _AccountValidityAppService = AccountValidityAppService;
             _purchaseOrderAppService = purchaseOrderAppService;
             _productExamineAppService = productExamineAppService;
             _currentTenant = currentTenant;
@@ -983,6 +990,11 @@ namespace Business.Replenishment
         /// <returns></returns>
         public async Task<string> CalcROP(InputDto input)
         {
+            var IsActived = _AccountValidityAppService.IsActived();
+            if (!IsActived)
+            {
+                return "此账号已限制访问";
+            }
             //来自定时任务的请求
             if (input.year == 0 && input.month == 0)
             {
@@ -1685,6 +1697,11 @@ namespace Business.Replenishment
         /// <returns></returns>
         public async Task<string> CalcWeekPlan(InputDto input)
         {
+            var IsActived = _AccountValidityAppService.IsActived();
+            if (!IsActived)
+            {
+                return "此账号已限制访问";
+            }
             //1.获取补货模型全局参数
             ReplenishmentDto replenishmentDto = GetROPParam(input.factory_id.ToString());
             //发货计划列表,用于判断成品物料编码
@@ -3158,6 +3175,11 @@ namespace Business.Replenishment
         /// <returns></returns>
         public async Task<string> CalcTempWeekPlan(InputDto input)
         {
+            var IsActived = _AccountValidityAppService.IsActived();
+            if (!IsActived)
+            {
+                return "此账号已限制访问";
+            }
             await ClearDO(input.factory_id.ToString());
             routingOps = _routingOpDetail.Select(p => p.Domain == input.factory_id.ToString()).ToList();
             long bang_id = help.NextId();
@@ -3997,6 +4019,11 @@ namespace Business.Replenishment
         /// <param name="allRoutings">工艺路线数据</param>
         public void CreateWorkOrdDates(List<mes_morder> morders, List<RoutingOpDetail> allRoutings, List<WorkOrdMaster> workOrds, List<WorkOrdRouting> workOrdRoutings, List<WorkOrdDetail> workOrdDetails, List<b_examine_result> exmResult, List<b_bom_child_examine> childExamineList)
         {
+            var IsActived = _AccountValidityAppService.IsActived();
+            if (!IsActived)
+            {
+                return;
+            }
             //工单主表
             WorkOrdMaster workOrd;
             //工单工艺路线表

+ 34 - 0
MicroServices/Business/Business.Application/ResourceExamineManagement/AccountValidityAppService.cs

@@ -0,0 +1,34 @@
+using Business.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+
+namespace Business.ResourceExamineManagement
+{
+    public class AccountValidityAppService : ApplicationService
+    {
+        private readonly BusinessDbContext _businessDbContext;
+        public AccountValidityAppService(BusinessDbContext businessDbContext)
+        {
+            _businessDbContext = businessDbContext;
+        }
+        public bool IsActived()
+        {
+            string sql = $"exec pr_User_Account_Validity @type=0";
+            var rfuser = _businessDbContext.rf_userDto.FromSqlRaw(sql).ToList();
+
+            if (rfuser.Any())
+            {
+                if (rfuser[0].TimePassword.Contains(DateTime.Now.Year.ToString()))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+}

+ 5 - 0
MicroServices/Business/Business.Application/ResourceExamineManagement/CalcBomViewAppService.cs

@@ -912,9 +912,14 @@ namespace Business.ResourceExamineManagement
                                 CalcIcitem(cilList, returnlist, bangid, sklist, wwPlan_data, icitemlist, sentrys, childidList);
                                 item.kitting_time = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays((int)maxLeadTime);//加上物料的采购提前期
                             }
+                            //item.lack_qty = wwCount;
                             item.subcontracting_qty = wwCount;
                             item.subcontracting_list = new List<ooder>();
                         }
+                        //else if (item.erp_cls == 3 && wwCount > 0)
+                        //{
+                        //    item.lack_qty = wwCount;
+                        //}
                     }
                 }
                 /*else if (item.erp_cls == 2)

+ 36 - 8
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -22,6 +22,7 @@ using MongoDB.Driver.Linq;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using NUglify.JavaScript.Syntax;
+using Org.BouncyCastle.Asn1.X500;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Crypto;
 using SixLabors.ImageSharp;
@@ -330,6 +331,11 @@ namespace Business.ResourceExamineManagement
         /// </summary>
         private readonly CalcBomViewAppService _CalcBomViewAppService;
 
+        /// <summary>
+        /// 账号时效性验证
+        /// </summary>
+        private readonly AccountValidityAppService _AccountValidityAppService;
+
         private List<ICItemLeadTimeDto> leadTimeList;
 
         private List<mo_srm_purchase> supplierList;
@@ -466,6 +472,7 @@ namespace Business.ResourceExamineManagement
             ISqlRepository<ItemMaster> itemMaster,
             PretreatmentAppService pretreatmentAppService,
             CalcBomViewAppService calcbomviewAppService,
+            AccountValidityAppService accountValidityAppService,
             PurchaseOrderAppService purchaseOrderAppService,
             ICurrentTenant currentTenant,
             MorderAppService morderAppService,
@@ -573,6 +580,7 @@ namespace Business.ResourceExamineManagement
             _empWorkDutyMaster = empWorkDutyMaster;
             _pretreatmentAppService = pretreatmentAppService;
             _CalcBomViewAppService = calcbomviewAppService;
+            _AccountValidityAppService = accountValidityAppService;
             _purchaseOrderAppService = purchaseOrderAppService;
             _currentTenant = currentTenant;
             _morderAppService = morderAppService;
@@ -622,15 +630,20 @@ namespace Business.ResourceExamineManagement
         /// <returns></returns>
         public async Task<string> receiveresultControllerApi(string companyid)
         {
-            //获取订单行数据
-            var sentrys = await _mysql_crm_seorderentry.GetListAsync(p => (p.progress == "1" || p.progress == "2") && p.company_id.ToString() == companyid && !p.IsDeleted);
-            var seorders = _mysql_crm_seorder.GetListAsync(s => sentrys.Select(x => x.seorder_id.GetValueOrDefault()).Contains(s.Id) && s.company_id.ToString() == companyid).Result;
-            string ids = string.Join(',', seorders.Select(x => x.Id));
-            var rtn = await ReceiveResult(ids, 0, companyid);
-            if (rtn == "ok")
+            var IsActived = _AccountValidityAppService.IsActived();
+            if (!IsActived)
             {
-                rtn = await ReviewExamineResult(ids, 0);
+                return "此账号已限制访问";
             }
+            ////获取订单行数据
+            var sentrys = await _mysql_crm_seorderentry.GetListAsync(p => (p.progress == "1" || p.progress == "2") && p.company_id.ToString() == companyid && !p.IsDeleted);
+                var seorders = _mysql_crm_seorder.GetListAsync(s => sentrys.Select(x => x.seorder_id.GetValueOrDefault()).Contains(s.Id) && s.company_id.ToString() == companyid).Result;
+                string ids = string.Join(',', seorders.Select(x => x.Id));
+                var rtn = await ReceiveResult(ids, 0, companyid);
+                if (rtn == "ok")
+                {
+                    rtn = await ReviewExamineResult(ids, 0);
+                }
             return rtn;
         }
 
@@ -643,7 +656,12 @@ namespace Business.ResourceExamineManagement
         /// <exception cref="NotImplementedException"></exception>
         public async Task<string> ReceiveResult(string ids, int type, string companyid)
         {
-            if (string.IsNullOrEmpty(ids))
+            var IsActived = _AccountValidityAppService.IsActived();
+            if (!IsActived)
+            {
+                return "此账号已限制访问";
+            }
+                if (string.IsNullOrEmpty(ids))
             {
                 throw new NotImplementedException("请输入正确的订单号!");
             }
@@ -5031,6 +5049,11 @@ namespace Business.ResourceExamineManagement
         /// <param name="allRoutings">工艺路线数据</param>
         public void CreateWorkOrdDates(List<mes_morder> morders, List<mo_mes_moentry> WriteMoentry, List<RoutingOpDetail> allRoutings, List<WorkOrdMaster> workOrds, List<WorkOrdRouting> workOrdRoutings, List<WorkOrdDetail> workOrdDetails, List<b_examine_result> exmResult, List<b_bom_child_examine> childExamineList)
         {
+            var IsActived = _AccountValidityAppService.IsActived();
+            if (!IsActived)
+            {
+                return;
+            }
             //工单主表
             WorkOrdMaster workOrd;
             //工单工艺路线表
@@ -5597,6 +5620,11 @@ namespace Business.ResourceExamineManagement
         /// <exception cref="NotImplementedException"></exception>
         public async Task<string> ProductionSchedule(string domain)
         {
+            var IsActived = _AccountValidityAppService.IsActived();
+            if (!IsActived)
+            {
+                return "此账号已限制访问";
+            }
             //取数开始时间为当前日期
             DateTime startTime = DateTime.Now;
             ////获取需要排产的工单(获取四周的工单:正常工单+已审批通过的特殊工单)

+ 23 - 0
MicroServices/Business/Business.Domain/StructuredDB/MES/rf_userDto.cs

@@ -0,0 +1,23 @@
+using Business.Core.Attributes;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Business.StructuredDB.MES
+{
+    /// <summary>
+    /// 人员列表
+    /// </summary>
+    [Comment("人员列表")]
+    [Keyless]
+    public class rf_userDto
+    {
+        /// <summary>
+        /// 密码
+        /// </summary>
+        [Comment("密码")]
+        public string TimePassword { get; set; }
+
+    }
+}

+ 11 - 0
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/DOP/BusinessDbContext.cs

@@ -76,7 +76,18 @@ namespace Business.EntityFrameworkCore
         public DbSet<BalanceNumDto> BalanceNumDto { get; set; }
 
         public DbSet<InventoryDto> InventoryDto { get; set; }
+
+        #endregion
+
+        #region Organization
+
+        /// <summary>
+        /// ÈËÔ±Áбí
+        /// </summary>
+        public DbSet<rf_userDto> rf_userDto { get; set; }
+
         #endregion
+
         #region MES
         public DbSet<mes_producedailyplan> mes_Producedailyplans { get; set; }
         #endregion