| | |
| | | strMsg :=""; |
| | | |
| | | try{ |
| | | if( Owner.MappingBOM(relsize )>0) |
| | | if( GlobData.Global_MappingOperationBOM(relsize )>0) |
| | | { |
| | | // 得到下一级数据 |
| | | AllData:= selectset( GlobData, Global_MappingOperationBOM,object,object.ComponentCode()=ParentSKU); |
| | | AllData:= selectset( GlobData, Global_MappingOperationBOM,object,object.ProductCode()=ParentSKU); |
| | | ObjProduct := null( Product_MP,constcontent ); |
| | | ObjUnit := null( Unit,constcontent ); |
| | | MaterialType:=""; |
| | |
| | | traverse( AllData,Elements,Obj,not isnull( Obj)) |
| | | { |
| | | // 得到当前已存在的物料信息(订单ID + SKU) |
| | | ObjMaterial := select( Owner,H_MaterialInfo,ObjM,ObjM.ForecastID()=ForecastId and ObjM.SKU()=Obj.ProductCode()); |
| | | ObjMaterial := select( Owner,H_MaterialInfo,ObjM,ObjM.ForecastID()=ForecastId and ObjM.SKU()=Obj.ComponentCode()); |
| | | if( isnull( ObjMaterial)) |
| | | { |
| | | // 物料类型 |
| | | MaterialType := Obj.ProductType(); |
| | | // 得到物料信息 |
| | | ObjProduct:= H_FunctionClass::SM_GetProductInfo(Owner,Obj.ProductCode()); |
| | | ObjProduct:= H_FunctionClass::SM_GetProductInfo(Owner,Obj.ComponentCode()); |
| | | if( not isnull( ObjProduct)) |
| | | { |
| | | MaterialType:= ObjProduct.ParentID(); |
| | | MaterialName:=ObjProduct.Name(); |
| | | } |
| | | ObjUnit:= H_FunctionClass::SM_GetUnitBySKU( Owner,Obj.ProductCode()); |
| | | ObjUnit:= H_FunctionClass::SM_GetUnitBySKU( Owner,Obj.ComponentCode()); |
| | | if( not isnull( ObjUnit)) |
| | | { |
| | | StockPoint:= ObjUnit.Name(); |
| | | } |
| | | Owner.H_MaterialInfo(relnew,ParentSKU := Obj.ComponentCode(),SKU := Obj.ProductCode(),ForecastID := ForecastId,OrgCode := Obj.OrganCode(),VCode := VCode |
| | | Owner.H_MaterialInfo(relnew,ParentSKU := ParentSKU,SKU := Obj.ComponentCode(),ForecastID := ForecastId,OrgCode := Obj.OrganCode(),VCode := VCode |
| | | ,ID := H_FunctionClass::SM_GenerateID( "MI"),MaterialType := MaterialType,NeedDate := NDate |
| | | ,NeedQty := [Number](ProductQty/NRate*NComponentsUsed).Round( 0),Unit := Obj.UnitOfMeasureName() |
| | | ,StockPoint :=StockPoint,MaterialName := MaterialName ); |