| | |
| | | StaticMethod FromSupplyPlanning ( |
| | | GlobalOTDTable otdTable, |
| | | MacroPlan macroPlan, |
| | | MacroPlan mappingRoot, |
| | | ProductInStockingPointInPeriod pispip |
| | | ProductInStockingPointInPeriod pispip, |
| | | String userId |
| | | ) as PRData |
| | | { |
| | | TextBody: |
| | | [* |
| | | // yypsybs Sep-12-2023 (created) |
| | | result := macroPlan.PRData( relnew ); |
| | | result.InterfaceSourceCode( "Quintiq" ); |
| | | |
| | | pisp := pispip.ProductInStockingPoint_MP(); |
| | | product := pisp.Product_MP(); |
| | | stockingPoint := pisp.StockingPoint_MP(); |
| | | period := pispip.Period_MP(); |
| | | mappingProduct := MappingProduct::GetByProductId( mappingRoot, product.ID() ); |
| | | // QID7 |
| | | mappingProduct := Global_MappingProduct_MP::GetByProductId( otdTable, product.ID() ); |
| | | // QID12 |
| | | mappingOperation := Global_MappingOperation::GetByProductId( otdTable, product.ID() ); |
| | | // QID15 |
| | | mappingProviderCapacity := Global_MappingProviderCapacity::GetByProductId( otdTable, product.ID() ); |
| | | matAttrSetting := MatAttrSettingAndPlanStrategy::GetExistByMatCode( otdTable, product.ID() ); |
| | | // 接口/中间表暂无 |
| | | mappingProviderCapacity := "暂无"; |
| | | erpData := "暂无"; |
| | | |
| | | // 根据pispip |
| | | result.MRPCalverNo( ifexpr( pispip.MRPCalverNo() = "", "暂无", pispip.MRPCalverNo() ) ); |
| | |
| | | result.StockingPointID( stockingPoint.ID() ); |
| | | |
| | | // 根据period |
| | | result.ProduceRequiredDate( period.StartDate() ); |
| | | result.PRSuggestionDate( ifexpr( (result.ProduceRequiredDate() - Duration::Days( 7 )).Date() >= Date::Today(), |
| | | Date::Today(), (result.ProduceRequiredDate() - Duration::Days( 7 )).Date() ) ); |
| | | result.DeliveryDate( period.StartDate() ); |
| | | result.PRSuggestionDate( ifexpr( (result.DeliveryDate() - Duration::Days( 7 )).Date() >= Date::Today(), |
| | | Date::Today(), (result.DeliveryDate() - Duration::Days( 7 )).Date() ) ); |
| | | |
| | | // 根据 物料属性标签设定&物料计划策略 |
| | | result.IsPanelMaterial( "暂无" ); |
| | |
| | | result.MaterialMRPType( ifexpr( matAttrSetting.PlanningStrategyCustom() <> "", matAttrSetting.PlanningStrategyCustom(), matAttrSetting.PlanningStrategyAuto() ) ); |
| | | } |
| | | |
| | | |
| | | // 根据product中间表 |
| | | if( isnull( mappingProduct ) ) { |
| | | result.BusinessType( "暂无" ); |
| | | result.OrganCode( "暂无" ); |
| | | result.UnitOfMeasure( "暂无" ); |
| | | result.BusinessType( "暂无" ); |
| | | } else { |
| | | result.BusinessType( mappingProduct.BusinessType() ); |
| | | result.OrganCode( mappingProduct.OrgCode() ); |
| | | result.UnitOfMeasure( mappingProduct.UnitOfMeasureName() ); |
| | | result.BusinessType( mappingProduct.BusinessType() ); |
| | | } |
| | | result.InterfaceSourceCode( "Quintiq_" + result.BusinessType() ); |
| | | |
| | | // 根据operation中间表 |
| | | if( isnull( mappingOperation ) ) { |
| | | result.OrgId( "暂无" ); |
| | | result.OrganCode( "暂无" ); |
| | | result.OrganName( "暂无" ); |
| | | result.DestinationOrganizationID( "暂无" ); |
| | | } else { |
| | | result.OrgId( mappingOperation.OrganId() ); |
| | | result.OrganCode( mappingOperation.OrganCode() ); |
| | | result.OrganName( mappingOperation.OrganName() ); |
| | | result.DestinationOrganizationID( mappingOperation.DestinationOrganizationId() ); |
| | | } |
| | | |
| | | // 根据供应商能力中间表 |
| | | result.ProviderCode( mappingProviderCapacity ); |
| | | result.ProductName( mappingProviderCapacity ); |
| | | result.LeadTime( 0.0 ); |
| | | if( isnull( mappingProviderCapacity ) ) { |
| | | result.ProviderCode( "暂无" ); |
| | | result.ProviderName( "暂无" ); |
| | | result.LeadTime( 0.0 ); |
| | | result.UnitOfMeasure( "暂无" ); |
| | | } else { |
| | | result.ProviderCode( "暂无" ); |
| | | result.ProviderName( mappingProviderCapacity.ProviderName() ); |
| | | result.LeadTime( mappingProviderCapacity.LeadTime() ); |
| | | result.UnitOfMeasure( mappingProviderCapacity.UnitOfMeasureName() ); |
| | | } |
| | | |
| | | // 根据erp接口 固定值 |
| | | result.RequisitionType( "PURCHASE" ); |
| | |
| | | result.LineTypeId( "1" ); |
| | | result.LineType( "货物" ); |
| | | // 根据erp接口 todo |
| | | result.PreparerId( erpData ); |
| | | result.HeaderDescription( erpData ); |
| | | result.DestinationOrganizationID( erpData ); |
| | | result.DeliverToRequestorId( erpData ); |
| | | result.LineAttribute1( erpData ); |
| | | result.LineAttribute6( erpData ); |
| | | result.OrgId( erpData ); |
| | | result.LineAttribute1( "" ); |
| | | result.LineAttribute3( "" ); |
| | | result.LineAttribute6( "" ); |
| | | |
| | | // 生成id todo |
| | | result.DataID( [String]Number::Random( Number::MinNumber(), Number::MaxNumber() ) ); |
| | | // 用户id/name |
| | | result.PreparerId( userId ); |
| | | result.HeaderDescription( userId ); |
| | | result.DeliverToRequestorId( result.PreparerId() ); |
| | | |
| | | // 生成id |
| | | cnv := DateTimeToString::StandardConverter(); |
| | | cnv.SetCustomConversion(); |
| | | cnv.CustomFormatString( "yyyyMMdd_H:mm:ss" ); |
| | | result.DataID( cnv.Convert( DateTime::ActualTime() ) + "_" + [String]Number::Random( Number::MinNumber(), Number::MaxNumber() ) ); |
| | | |
| | | // 发送信息 |
| | | result.SendStatus( "" ); |
| | | result.SendBy( "" ); |
| | | result.SendTime( DateTime::MinDateTime() ); |
| | | result.PRReleaseStatus( "" ); |
| | | result.CreateBy( "" ); |
| | | result.CreateTime( DateTime::MinDateTime() ); |
| | | |
| | | return result; |
| | | *] |