2024-01-08 10:58:24 +08:00
|
|
|
|
using ExtensionMethods;
|
|
|
|
|
|
using Kingdee.BOS;
|
|
|
|
|
|
using Kingdee.BOS.Core.Metadata;
|
|
|
|
|
|
using Kingdee.BOS.Log;
|
|
|
|
|
|
using Kingdee.BOS.Orm.DataEntity;
|
|
|
|
|
|
using Kingdee.BOS.ServiceHelper;
|
|
|
|
|
|
using Kingdee.K3.Core.MFG;
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Kingdee.K3.MFG.PLN.App.MrpModel.PolicyImpl.NetCalc
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// MRP运算将产生的计划订单或组织间需求单数据提交保存前更新数据策略
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[MrpProgressItem("P0033", "30")]
|
|
|
|
|
|
public class UpdatePlanOrderCustInfoPolicyEx : AbstractNetCalcPolicy
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 后置策略:单条执行模式
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override Enu_NetCalcPolicyCallStyle CallStyle
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return Enu_NetCalcPolicyCallStyle.KdLastSingleExecutionMode; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 策略执行前事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected override bool BeforeExecuteDataPolicy()
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var demandGroupRow in this.MrpDemandDimContext.MrpNetDemandContextGroupRows)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (demandGroupRow.PlanOrderItem != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
///TODO:本分支可对计划订单数据在提交保存前进行干预
|
|
|
|
|
|
//string MaterialId_Id = Convert.ToString(demandGroupRow.PlanOrderItem["MaterialId_Id"]);
|
|
|
|
|
|
//FormMetadata FMaterial = MetaDataServiceHelper.Load(this.Context, "BD_MATERIAL", true) as FormMetadata;
|
|
|
|
|
|
//DynamicObject FMaterialId = BusinessDataServiceHelper.LoadSingle(this.Context, MaterialId_Id, FMaterial.BusinessInfo.GetDynamicObjectType(), null);
|
|
|
|
|
|
//DynamicObjectCollection MaterialProduce = FMaterialId["MaterialProduce"] as DynamicObjectCollection;
|
|
|
|
|
|
|
|
|
|
|
|
//LotQty 批数
|
|
|
|
|
|
//LotYield 每批产量
|
|
|
|
|
|
//FirmQty 确认订单数量
|
|
|
|
|
|
//计划运算时根据确认订单数量、每批产量计算批数
|
|
|
|
|
|
|
|
|
|
|
|
var LotYield = Convert.ToDecimal(demandGroupRow.PlanOrderItem["LotYield"]);
|
|
|
|
|
|
|
|
|
|
|
|
if (LotYield != 0)
|
2024-03-04 16:50:20 +08:00
|
|
|
|
{
|
2024-01-08 10:58:24 +08:00
|
|
|
|
demandGroupRow.PlanOrderItem["LotQty"] = Convert.ToDecimal(demandGroupRow.PlanOrderItem["BaseFirmQty"]) / LotYield;
|
2024-03-04 16:50:20 +08:00
|
|
|
|
demandGroupRow.PlanOrderItem["BaseSugLotQty"] = Convert.ToDecimal(demandGroupRow.PlanOrderItem["BaseSugQty"]) / LotYield;
|
|
|
|
|
|
demandGroupRow.PlanOrderItem["SugLotQty"] = Convert.ToDecimal(demandGroupRow.PlanOrderItem["BaseSugQty"]) / LotYield;
|
|
|
|
|
|
}
|
2024-01-08 10:58:24 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (demandGroupRow.RequirementOrderItem != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
///TODO:本分支可对组织间需求单数据在提交保存前进行干预
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return base.BeforeExecuteDataPolicy();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|