Merge branch 'dev_yy' into dev
| | |
| | | TextBody: |
| | | [* |
| | | // yypsybs Aug-17-2023 (created) |
| | | info( "Start data broker of base conversion" ); |
| | | info( "Product Finished, Start BaseConversionFactor Data Broker" ) |
| | | macroPlan.Broker_OTD_BaseConversionFactor().Execute(); |
| | | info( "Start data mapping of base conversion" ); |
| | | info( "BaseConversionFactor Data Broker Finished, Start BaseConversionFactor Mapping" ) |
| | | macroPlan.MappingBaseConversionFactorData(); |
| | | *] |
| | | } |
| | |
| | | TextBody: |
| | | [* |
| | | // yypsybs Aug-17-2023 (created) |
| | | info( "Forecast Finished, Start CustomerOrder Data Broker" ); |
| | | macroPlan.Broker_OTD_CustomerOrder().Execute(); |
| | | info( "CustomerOrder Data Broker Finished, Start CustomerOrder Mapping" ); |
| | | macroPlan.MappingCustomerOrderData( businessTypes ); |
| | | *] |
| | | } |
| | |
| | | TextBody: |
| | | [* |
| | | // yypsybs Aug-17-2023 (created) |
| | | info( "OperationCost Finished, Start Forecast Data Broker" ); |
| | | macroPlan.Broker_OTD_Forecast().Execute(); |
| | | info( "Forecast Data Broker Finished, Start Forecast Mapping" ); |
| | | macroPlan.MappingForecastData( businessTypes ); |
| | | *] |
| | | } |
| | |
| | | TextBody: |
| | | [* |
| | | // yypsybs Aug-17-2023 (created) |
| | | info( "ActualPISPIP Finished, Start InventoryCost Data Broker" ); |
| | | macroPlan.Broker_OTD_InventoryCost().Execute(); |
| | | info( "InventoryCost Data Broker Finished, Start InventoryCost Mapping" ); |
| | | macroPlan.MappingInventoryValueAndCostData(); |
| | | *] |
| | | } |
| | |
| | | [* |
| | | // renhao Aug-14-2023 (created) |
| | | date := Date :: Today(); |
| | | //listtodeal := selectset( this,MappingActualPISPIP,actual, not isnull( Product_MP::FindById( this, actual.ProductID() ) ) ); |
| | | listtodeal := selectset( this,MappingActualPISPIP,actual,true ); |
| | | totalcount := listtodeal.Size(); |
| | | info( "ActualPISPIP has " + totalcount.AsQUILL() + " rows in total" ); |
| | | |
| | | count := 0; |
| | | traverse( this,MappingActualPISPIP,actual){ |
| | | count := count + 1; |
| | | if( count - [Number](count/100) * 100 = 0 or count = totalcount ){ |
| | | info( "Now is dealing with the " + count.AsQUILL() + "ActualPISPIP " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); |
| | | } |
| | | product := select( this,MappingProduct,product,product.ID() = actual.ProductID() and product.KeyProduct() = nuclear,true); |
| | | if( not isnull( product)){ |
| | | if( not isnull(businessTypes)){ |
| | |
| | | queryStartDate := guard( min( this, Period_MP, item, true, item.StartDate() ) - Duration::Days( 30 ), DateTime::MinDateTime() ).Date(); |
| | | queryEndDate := guard( max( this, Period_MP, item, true, item.EndDate() ), Date::MaxDate() ); |
| | | listToDeal := selectset( listToDeal, Elements, item, item.OrderDate() >= queryStartDate and item.OrderDate() <= queryEndDate, not isnull( Product_MP::FindById( this, item.ProductID() ) ) and not isnull( StockingPoint_MP::FindById( this, item.StockPointID() ) ) and not isnull( SalesSegment_MP::FindByName( this, item.SalesSegmentName() ) ) ); |
| | | |
| | | totalcount := listToDeal.Size(); |
| | | info( "CustomerOrder has " + totalcount.AsQUILL() + " rows in total" ); |
| | | |
| | | count := 0; |
| | | // 处理 |
| | | traverse( listToDeal, Elements, item ) { |
| | | count := count + 1; |
| | | if( count - [Number](count/100) * 100 = 0 or count = totalcount ){ |
| | | info( "Now is dealing with the " + count.AsQUILL() + "CustomerOrder " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); |
| | | } |
| | | // if( not isnull( Product_MP::FindById( this, item.ProductID() ) ) ){ |
| | | info( item.ProductID().AsQUILL() ); |
| | | CustomerOrder::CreateOrUpdate( this, item.CurrencyID(), item.Customer(), item.CustomerID(), item.ID(), |
| | | item.OrderDate(), item.OrderID(), item.OrderLineID(), item.Price(), |
| | | item.PriorityName(), item.ProductID(), |
| | | item.StockPointID(), |
| | | item.SalesSegmentName(), |
| | | item.Quantity(), item.UnitOfMeasureName(), item.OrderType(), item.IsAvailable()); |
| | | // info( item.ProductID().AsQUILL() ); |
| | | CustomerOrder::CreateOrUpdate( this, item.CurrencyID(), item.Customer(), item.CustomerID(), item.ID(), |
| | | item.OrderDate(), item.OrderID(), item.OrderLineID(), item.Price(), |
| | | item.PriorityName(), item.ProductID(), |
| | | item.StockPointID(), |
| | | item.SalesSegmentName(), |
| | | item.Quantity(), item.UnitOfMeasureName(), item.OrderType(), item.IsAvailable()); |
| | | // }else{ |
| | | // info( "invaild product: " + item.ProductID().AsQUILL() ); |
| | | // } |
| | |
| | | // renhao Aug-14-2023 (created) |
| | | |
| | | listtodeal := selectset( this,MappingExternalSupply,externalSupply, not isnull( StockingPoint_MP::FindById( this, externalSupply.StockingPointID() ) ) ); |
| | | totalcount := listtodeal.Size(); |
| | | info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" ); |
| | | |
| | | count := 0; |
| | | traverse( listtodeal,Elements,externalSupply){ |
| | | count := count + 1; |
| | | if( count - [Number](count/100) * 100 = 0 or count = totalcount ){ |
| | | info( "Now is dealing with the " + count.AsQUILL() + "ExternalSupply " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); |
| | | } |
| | | // product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID() and product.KeyProduct() = nuclear,true); |
| | | // |
| | | // if( not isnull( product)){ |
| | |
| | | queryStartDate := guard( min( this, Period_MP, item, true, item.StartDate() ) - Duration::Days( 30 ), DateTime::MinDateTime() ).Date(); |
| | | queryEndDate := guard( max( this, Period_MP, item, true, item.EndDate() ), Date::MaxDate() ); |
| | | listToDeal := selectset( listToDeal, Elements, item, item.StartDate() >= queryStartDate and item.EndDate() <= queryEndDate, not isnull( Product_MP::FindById( this, item.ProductID() ) ) and not isnull( StockingPoint_MP::FindById( this, item.StockingPointID() ) ) and not isnull( SalesSegment_MP::FindByName( this, item.SalesSegmentName() ) ) ); |
| | | |
| | | totalcount := listToDeal.Size(); |
| | | info( "Forecast has " + totalcount.AsQUILL() + " rows in total" ); |
| | | |
| | | count := 0; |
| | | // 处理 |
| | | traverse( listToDeal, Elements, item ) { |
| | | count := count + 1; |
| | | if( count - [Number](count/100) * 100 = 0 or count = totalcount ){ |
| | | info( "Now is dealing with the " + count.AsQUILL() + "Forecast " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); |
| | | } |
| | | // if( not isnull( Product_MP::FindById( this, item.ProductID() ) ) ){ |
| | | Forecast::CreateOrUpdate( this, |
| | | item.ProductID(), item.SalesSegmentName(), item.StockingPointID(), item.PriorityName(), |
| | | item.CurrencyID(), item.UnitOfMeasureName(), |
| | | item.ID(), item.StartDate(), item.EndDate(), item.Quantity(), item.Price()); |
| | | Forecast::CreateOrUpdate( this, |
| | | item.ProductID(), item.SalesSegmentName(), item.StockingPointID(), item.PriorityName(), |
| | | item.CurrencyID(), item.UnitOfMeasureName(), |
| | | item.ID(), item.StartDate(), item.EndDate(), item.Quantity(), item.Price()); |
| | | // }else{ |
| | | // info( "invaild product" + item.ProductID().AsQUILL() ); |
| | | // } |
| | |
| | | [* |
| | | // yypsybs Aug-15-2023 (created) |
| | | listtodeal := selectset( this,MappingInventoryValueAndCost,item,not isnull( Product_MP::FindById( this, item.ProductID() ) ), not isnull( StockingPoint_MP::FindById( this, item.StockingPointID() ) ) ); |
| | | totalcount := listtodeal.Size(); |
| | | info( "InventoryCost has " + totalcount.AsQUILL() + " rows in total" ); |
| | | |
| | | count := 0; |
| | | traverse( listtodeal, Elements, item ) { |
| | | count := count + 1; |
| | | if( count - [Number](count/100) * 100 = 0 or count = totalcount ){ |
| | | info( "Now is dealing with the " + count.AsQUILL() + "InventoryCost " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); |
| | | } |
| | | if( not isnull( Product_MP::FindById( this, item.ProductID() ) ) ){ |
| | | InventoryValueAndCost::CreateOrUpdate( this, item.ID(), item.ProductID(), |
| | | item.StockingPointID(), |
| | |
| | | alterBom := mainInput.Operation().LinkPISP( pispAlter, true, mainInput.OperationLinkGroupID(), trash ); |
| | | alterBom.Quantity( mainBOM.MaxQuantityInGroup() * alterRow.AlternativeRate() ); |
| | | alterBom.MaxQuantityInGroup( mainBOM.MaxQuantityInGroup() ); |
| | | info( "Quantity" + [String]alterBom.Quantity() ) |
| | | info( "MaxQuantityInGroup" + [String]alterBom.MaxQuantityInGroup() ) |
| | | // info( "Quantity" + [String]alterBom.Quantity() ) |
| | | // info( "MaxQuantityInGroup" + [String]alterBom.MaxQuantityInGroup() ) |
| | | mainQty := mainQty - alterBom.Quantity(); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | totalcount := listtodealwithmaxsn.Size(); |
| | | info( "OperationCost has " + totalcount.AsQUILL() + " rows in total" ); |
| | | |
| | | count := 0; |
| | | // Get the operation cost data |
| | | traverse( listtodealwithmaxsn, Elements, item ){ |
| | | count := count + 1; |
| | | if( count - [Number](count/100) * 100 = 0 or count = totalcount ){ |
| | | info( "Now is dealing with the " + count.AsQUILL() + "OperationCost " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); |
| | | } |
| | | id := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection() + "_" + item.Line(); |
| | | operation := Operation::FindOperationTypeIndex( id ); |
| | | account := Account_MP::FindByName( this, "Operation cost" ); |
| | |
| | | listToDeal := selectset( this, MappingProduct, item, businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 ); |
| | | } |
| | | } |
| | | totalcount := listToDeal.Size(); |
| | | info( "Product has " + totalcount.AsQUILL() + " rows in total" ); |
| | | |
| | | // Get the root data |
| | | Product_MP::CreateOrUpdate( this, |
| | |
| | | "全部物料产品", |
| | | 0.0 |
| | | ); |
| | | |
| | | count := 0; |
| | | // Get the ProductMajorType list & ProductSubclassType list |
| | | traverse( listToDeal, Elements, item ){ |
| | | count := count + 1; |
| | | if( count - [Number](count/100) * 100 = 0 or count = totalcount ){ |
| | | info( "Now is dealing with the " + count.AsQUILL() + "Product " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); |
| | | } |
| | | if( not item.ProductMajorType() = "" ){ |
| | | Product_MP::CreateOrUpdate( this, |
| | | item.ProductMajorType(), |
| | |
| | | // Administrator Aug-17-2023 (created) |
| | | // list to deal |
| | | listtodeal := selectset( this, MappingProductInLane, item, not isnull( Product_MP::FindById( this, item.ProductID() ) ), not isnull( Lane::FindLaneTypeIndex( item.LineID() ) ) ); |
| | | totalcount := listtodeal.Size(); |
| | | info( "ProductInLane has " + totalcount.AsQUILL() + " rows in total" ); |
| | | |
| | | count := 0; |
| | | // Create ProductInLane |
| | | traverse( listtodeal, Elements, item ){ |
| | | count := count + 1; |
| | | if( count - [Number](count/100) * 100 = 0 or count = totalcount ){ |
| | | info( "Now is dealing with the " + count.AsQUILL() + "ProductInLane " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); |
| | | } |
| | | ProductInLane::CreateOrUpdate( this, item.ProductID(), item.LineID() ); |
| | | } |
| | | *] |
| | |
| | | } |
| | | info( "KeyProduct : " + [String]isKeyProduct ) |
| | | info( "Create purchase supply material : " + [String]createPurchaseSupplyMaterial ) |
| | | |
| | | // 初始换-0 |
| | | info( "Initial" ); |
| | | info( "Start Initial" ); |
| | | macroPlan.InitialUnitAndStockingPoint(); |
| | | |
| | | // 单位-1 |
| | | info( "UnitOfMeasure_MP::DoSync" ) |
| | | UnitOfMeasure_MP::DoSync( macroPlan ); |
| | | |
| | | // 销售部门-2 |
| | | info( "SalesSegment::DoSync" ) |
| | | SalesSegment_MP::DoSync( macroPlan, businessTypes ); |
| | | |
| | | // 库存点-3 |
| | | info( "StockingPoint::DoSync" ) |
| | | info( "Sales Segment Finished, Start Get StockingPoint From Api" ) |
| | | bodynumber := "2"; |
| | | postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber ); |
| | | address := "api-uat-sgc.tianma.cn"; |
| | |
| | | port := 443; |
| | | data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody ); |
| | | macroPlan.ApiStockingPointData( data ); |
| | | |
| | | // 货币信息-4 |
| | | info( "Currencies::DoSync" ) |
| | | info( "Get StockingPoint From Api Finished, Start Get CurrencyInfo From Api" ) |
| | | bodynumber := "1"; |
| | | postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber ); |
| | | address := "api-uat-sgc.tianma.cn"; |
| | |
| | | port := 443; |
| | | data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody ); |
| | | macroPlan.ApiCurenciesData( data ); |
| | | |
| | | //货币汇率信息-5 |
| | | info( "CurrencyRates::DoSync" ) |
| | | info( "Get CurrencyInfo From Api Finished, Start Get CurrencyRates From Api" ) |
| | | bodynumber := "5"; |
| | | postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber ); |
| | | address := "api-uat-sgc.tianma.cn"; |
| | |
| | | macroPlan.ApiCurencyRatesData( data ); |
| | | |
| | | // 产品物料-6 |
| | | info( "Product::DoSync" ) |
| | | //todo: 数据有重复,先略过 |
| | | info( "Get CurrencyRates From Api Finished, Start Product Data Broker" ) |
| | | macroPlan.Broker_OTD_Product().Execute(); |
| | | info( "Start data mapping of product" ); |
| | | info( "Product Data Broker Finished, Start Product Mapping" ); |
| | | //testproduct := construct( Strings ); |
| | | macroPlan.MappingProductData( businessTypes, false ); |
| | | |
| | | //单位转换-7 |
| | | info( "BaseConversionFactor::DoSync" ) |
| | | BaseConversionFactor::DoSync( macroPlan ); |
| | | |
| | | // Unit-9 |
| | | // 与Operation一同处理 |
| | | info( "Unit::DoSync" ) |
| | | info( "Start data broker of operation" ); |
| | | info( "BaseConversionFactor Finished, Start Operation Data Broker" ); |
| | | macroPlan.Broker_OTD_Operation().Execute(); |
| | | info( "Operation Data Broker Finished, Start Unit Mapping" ); |
| | | macroPlan.MappingUnitData( businessTypes ); |
| | | |
| | | // 工艺路线 + BOM-9 |
| | | info( "Operation&BOM::DoSync" ) |
| | | info( "Start data mapping of operation" ); |
| | | info( "Unit Finished, Start Operation Mapping" ); |
| | | macroPlan.MappingOperationData( businessTypes ); |
| | | info( "Operation Finished, Start BOM Data Broker" ); |
| | | macroPlan.Broker_OTD_BOM().Execute(); |
| | | info( "BOM Data Broker Finished, Start BOM Mapping" ); |
| | | macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial ); |
| | | |
| | | //车道信息-10 |
| | | info( "Lanes::DoSync" ) |
| | | info( "BOM Finished, Start Get Lanes From Api" ); |
| | | bodynumber := "3"; |
| | | postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber ); |
| | | address := "api-uat-sgc.tianma.cn"; |
| | |
| | | port := 443; |
| | | data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody ); |
| | | macroPlan.ApiLanesData( data ); |
| | | |
| | | //车道运输段-11 |
| | | info( "LaneLegs::DoSync" ) |
| | | info( "Get Lanes From Api Finished, Start Get LaneLegs From Api" ); |
| | | bodynumber := "4"; |
| | | postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber ); |
| | | address := "api-uat-sgc.tianma.cn"; |
| | |
| | | port := 443; |
| | | data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody ); |
| | | macroPlan.ApiLaneLegsData( data ); |
| | | // 供应网络(车道)-12 |
| | | info( "ProductInLane::DoSync" ) |
| | | macroPlan.Broker_OTD_ProductInLane().Execute(); |
| | | macroPlan.MappingProductInLaneData(); |
| | | |
| | | //// 供应网络(车道)-12 |
| | | //info( "Get Lanelegs From Api Finished, Start ProductInLane Data Broker" ); |
| | | //macroPlan.Broker_OTD_ProductInLane().Execute(); |
| | | //info( "ProductInLane Data Broker Finished, Start ProductInLane Mapping" ); |
| | | //macroPlan.MappingProductInLaneData(); |
| | | |
| | | // 在库库存数据-13 |
| | | info( "ActualPISPIP::DoSync" ) |
| | | info( "ProductInLane Finished, Start ActualPISPIP Data Broker" ); |
| | | macroPlan.Broker_OTD_ActualPISPIP().Execute(); |
| | | info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" ); |
| | | //macroPlan.MappingActualPISPIPData( businessTypes, true ); |
| | | macroPlan.MappingActualPISPIPData( businessTypes, false ); |
| | | |
| | | // 在途库存-14 |
| | | info( "ExternalSupply::DoSync" ) |
| | | info( "Start data broker of External supply" ); |
| | | info( "ActualPISPIP Finished, Start ExternalSupply Data Broker" ); |
| | | macroPlan.Broker_OTD_ExternalSupply().Execute(); |
| | | //macroPlan.MappingExternalSupplyData( businessTypes, true ); |
| | | info( "Start data mapping of External supply" ); |
| | | info( "ExternalSupply Data Broker Finished, Start ExternalSupply Mapping" ); |
| | | macroPlan.MappingExternalSupplyData( businessTypes, false ); |
| | | |
| | | // 库存成本-15 |
| | | info( "InventoryCost::DoSync" ); |
| | | InventoryValueAndCost::DoSync( macroPlan ); |
| | | // todo 制造成本-16 |
| | | info( "OperationCost::DoSync" ); |
| | | macroPlan.MappingOperationCostData( businessTypes ); |
| | | |
| | | //// todo 制造成本-16 |
| | | //info( "InventoryCost Finished, Start OperationCost Mapping" ); |
| | | //macroPlan.MappingOperationCostData( businessTypes ); |
| | | |
| | | // 订单预测-17 |
| | | info( "Forecast::DoSync" ); |
| | | Forecast::DoSync( macroPlan, businessTypes ); |
| | | |
| | | // 订单需求-18 |
| | | info( "CustomerOrder::DoSync" ); |
| | | CustomerOrder::DoSync( macroPlan, businessTypes ); |
| | | |
| | | //// todo 供应商能力 |
| | | //info( "ProviderCapacity::DoSync" ) |
| | | |
| | | //// todo 供应商回复 |
| | | //info( "ProviderReply::DoSync" ) |
| | | *] |
| | |
| | | result := construct( Operations ); |
| | | if( not isnull( routing ) and not isnull( routing.LastStep() ) ) { |
| | | result := selectset( routing.LastStep(), Operation, op, true ); |
| | | info( 'routingID: '+routingId+isnull( result).AsQUILL()); |
| | | // info( 'routingID: '+routingId+isnull( result).AsQUILL()); |
| | | } |
| | | return &result; |
| | | *] |
| | |
| | | |
| | | // Find the product |
| | | product := Product_MP::FindById( owner, productid ); |
| | | info( productid ); |
| | | //info( productid ); |
| | | |
| | | if( isnull( product ) ){ |
| | | Product_MP::Create( owner, |
| | |
| | | TextBody: |
| | | [* |
| | | // yypsybs Aug-17-2023 (created) |
| | | info( "Start data broker of sales segment" ); |
| | | info( "UnitOfMeasure_MP Finished, Start Sales Segment Data Broker" ) |
| | | macroPlan.Broker_OTD_SalesSegment().Execute(); |
| | | info( "Start data mapping of sales segment" ); |
| | | info( "Sales Segment Data Broker Finished, Start Sales Segment Mapping" ) |
| | | macroPlan.MappingSalesSegmentData( businessTypes ); |
| | | *] |
| | | } |
| | |
| | | TextBody: |
| | | [* |
| | | // yypsybs Aug-17-2023 (created) |
| | | info( "Inital Finished, Start UnitOfMeasure_MP Data Broker" ) |
| | | macroPlan.Broker_OTD_UnitOfMeasure().Execute(); |
| | | info( "UnitOfMeasure_MP Data Broker Finished, Start UnitOfMeasure_MP Mapping" ) |
| | | macroPlan.MappingUnitOfMeasureData(); |
| | | *] |
| | | } |