| | |
| | | MaterialType:= ObjProduct.ParentID(); |
| | | MaterialName:=ObjProduct.Name(); |
| | | } |
| | | ObjUnit:= H_FunctionClass::SM_GetUnitBySKU( Owner,Obj.ComponentCode()); |
| | | ObjUnit:= H_FunctionClass::SM_GetUnitBySKU( Owner,Obj.ComponentCode(),GlobData); |
| | | if( not isnull( ObjUnit)) |
| | | { |
| | | StockPoint:= ObjUnit.Name(); |
| | |
| | | // 没有BOM 添加测试数据 |
| | | else |
| | | { |
| | | //error( "BOM 数据获取失败,无法扩展原材料信息!"); |
| | | nCount :=Owner.H_MaterialInfo(relsize ); |
| | | Owner.H_MaterialInfo(relnew,ParentSKU := ParentSKU,SKU := "SKU"+ nCount.AsQUILL() ,ForecastID := ForecastId,OrgCode := "ORG_000",VCode := VCode |
| | | ,ID := H_FunctionClass::SM_GenerateID( "MI"),MaterialType := "原材料",NeedDate := NDate |
| | |
| | | #parent: #root |
| | | StaticMethod SM_GetUnitBySKU ( |
| | | MacroPlan Owner, |
| | | String SKU |
| | | String SKU, |
| | | GlobalOTDTable GlobData |
| | | ) as Unit |
| | | { |
| | | Description: '通过SKU获取库存点信息' |
| | |
| | | Obj :=null( Unit,constcontent ); |
| | | if( not isnull( Owner) and SKU.Length()>0) |
| | | { |
| | | OrgCode := select( Owner,MappingBOM,ObjM,ObjM.ProductCode()=SKU); |
| | | OrgCode := select( GlobData,Global_MappingOperationBOM,ObjM,ObjM.ProductCode()=SKU); |
| | | if( not isnull( OrgCode)) |
| | | { |
| | | Obj := select( Owner,Unit,ObjU,ObjU.ID()= OrgCode.OrganCode()); |
| | |
| | | *创建人:yunying |
| | | *创建时间:20230-09-24 |
| | | *描述:系统内订单冲减调用函数,IsNew=true时,重新处理预测信息,IsNew=false时,用预测累计信息。 |
| | | *参数:IsNew 是否时新的计算表示 |
| | | * Operator 操作人 |
| | | * OperatorType 操作类型[反签,授权,ERP订单],这里应该是ERP订单 |
| | | *备注:客户全部使用客户名称,不要使用客户ID,预测原始数据没有客户ID信息 |
| | | *****************************************************************************/ |
| | | // 初始化结果 |
| | | bStatus := false; |
| | |
| | | nHaveForecastQty :=0; //有预测数量 |
| | | nNoHaveForecastQty:=0;//五预测数量 |
| | | OrderQuantity := 0; //剩余订单数量 |
| | | // 获取预测数量(客户+SKU+月份 理论是没有物料预测) |
| | | // 获取预测数量(客户名称+SKU+月份 理论是没有物料预测) |
| | | OrderForecast := select(Owner, H_OrderForecastRealQty , Obj, Obj.SKU() = ObjOrder.ProductID() |
| | | and Obj.CustomCode() = ObjOrder.CustomerName() |
| | | and Obj.CustomName() = ObjOrder.CustomerName() |
| | | and Obj.Month().Format( "YM2") =ObjOrder.EndDate().Format( "YM2")); |
| | | if ( not isnull(OrderForecast)) |
| | | { |
| | |
| | | nReverseQtyOld := ObjReverse.ReverseRealQty(); |
| | | nReverseQtyNew := nReverseQtyOld; |
| | | } |
| | | // 获取授权数量(客户ID+SKU) |
| | | // 获取授权数量(客户名称+SKU) |
| | | ObjAuthorize := select(Owner, H_AuthorizeRealQty , Obj, Obj.SKU() = ObjOrder.ProductID() |
| | | and Obj.CustomID() = ObjOrder.CustomerName()); |
| | | and Obj.CustomName() = ObjOrder.CustomerName()); |
| | | if ( not isnull(ObjAuthorize)) |
| | | { |
| | | nAuthorizeQtyOld := ObjAuthorize.AuthorizeRealQty(); |
| | |
| | | { |
| | | strMsg :="填产后订单冲减发生错误,请联系系统管理员!"; |
| | | // 记录错误日志 |
| | | // Owner.H_ErrorLogs(relnew,EClassName := "H_FunctionClass",EDateTime := DateTime::ActualGMTTime(),EFunctionName := "SM_OrderHedgingEx", |
| | | // DeveloperInformation := e.DeveloperInformation(),ErrorNr := e.ErrorNr(),DetailedInformation := e.DetailedInformation(), |
| | | // GeneralInformation := e.GeneralInformation()); |
| | | Owner.H_ErrorLogs(relnew,EClassName := "H_FunctionClass",EDateTime := DateTime::ActualGMTTime(),EFunctionName := "SM_OrderHedgingEx", |
| | | DeveloperInformation := e.DeveloperInformation(),ErrorNr := e.ErrorNr(),DetailedInformation := e.DetailedInformation(), |
| | | GeneralInformation := e.GeneralInformation()); |
| | | } |
| | | return JSON::Object().Add( "Status",bStatus) |
| | | .Add( "Count",nCount) |