You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Aucma.Scada/Aucma.Scada.Business/AssemblyPlanBusiness.cs

66 lines
2.3 KiB
C#

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
{
/// <summary>
/// 组装计划业务逻辑
/// </summary>
public class AssemblyPlanBusiness
{
private static readonly Lazy<AssemblyPlanBusiness> lazy = new Lazy<AssemblyPlanBusiness>(() => 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);
}
}
}
}
}