using HighWayIot.Config; using HighWayIot.Log4net; using HighWayIot.Repository.domain; using HighWayIot.Repository.service; using HighWayIot.Repository.service.Impl; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Aucma.Scada.Business { /// /// 组装计划业务逻辑 /// public class AssemblyPlanBusiness { private static readonly Lazy lazy = new Lazy(() => new AssemblyPlanBusiness()); public static AssemblyPlanBusiness Instance { get { return lazy.Value; } } private LogHelper logHelper = LogHelper.Instance; private AppConfig appConfig = AppConfig.Instance; private IProductPlanInfoService _productPlanInfoService = new ProductPlanInfoServiceImpl(); private IExecutePlanInfoService _executePlanInfoService = new ExecutePlanInfoServiceImpl(); public AssemblyPlanBusiness() { Init(); } private void Init() { var info = _productPlanInfoService.GetProductPlanInfosByProductLineCode(appConfig.stationCode); if(info != null) { foreach(var item in info) { ExecutePlanInfo executePlanInfo = new ExecutePlanInfo(); executePlanInfo.executePlanCode = System.Guid.NewGuid().ToString("N"); executePlanInfo.productPlanCode = item.planCode; executePlanInfo.productLineCode = item.productLineCode; executePlanInfo.orderCode = item.orderCode; executePlanInfo.materialCode = item.materialCode; executePlanInfo.materialName = item.materialName; executePlanInfo.executeOrder = 1; executePlanInfo.executeStatus = 1; executePlanInfo.planAmount = item.planAmount; executePlanInfo.completeAmount = item.completeAmount; executePlanInfo.beginTime = DateTime.Now; bool result = _executePlanInfoService.InsertExecutePlanInfo(executePlanInfo); } } } } }