AddTransformer() public method

public AddTransformer ( Transformer transformer ) : void
transformer Transformer
return void
Example #1
0
        public void MatchHuByItem(Resolver resolver, Hu hu)
        {
            if (hu == null)
            {
                throw new BusinessErrorException("Hu.Error.HuIdNotExist", resolver.Input);
            }

            //校验重复扫描
            if (this.CheckMatchHuScanExist(resolver))
            {
                throw new BusinessErrorException("Warehouse.Error.HuReScan", resolver.Input);
            }
            if (!MatchByItem(resolver, hu))
            {
                if (!resolver.AllowCreateDetail)
                {
                    throw new BusinessErrorException("Warehouse.HuMatch.NotMatch", resolver.Input);
                }
                else //允许新增明细
                {
                    Flow flow = flowMgr.LoadFlow(resolver.Code, false);
                    string locationCode = string.Empty;
                    if (resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_RECEIVERETURN)
                    {
                        locationCode = flow.LocationTo.Code;
                    }
                    else
                    {
                        locationCode = flow.LocationFrom == null ? string.Empty : flow.LocationFrom.Code;
                    }
                    if (hu.Location != locationCode)
                    {
                        throw new BusinessErrorException("Common.Business.Error.HuNoInventory", hu.Location, resolver.Input);
                    }

                    TransformerDetail transformerDetail = Utility.TransformerHelper.ConvertHuToTransformerDetail(hu);
                    Transformer transformer = new Transformer();
                    transformer.ItemCode = hu.Item.Code;
                    transformer.ItemDescription = hu.Item.Description;
                    transformer.UnitCount = hu.Item.UnitCount;
                    transformer.UomCode = hu.Uom.Code;
                    transformer.LocationFromCode = hu.Location;
                    transformer.LocationToCode = flow.LocationTo == null ? string.Empty : flow.LocationTo.Code;

                    transformer.AddTransformerDetail(transformerDetail);
                    resolver.AddTransformer(transformer);
                    TransformerHelper.ProcessTransformer(transformer);
                }
            }
            resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
        }
Example #2
0
 /// <summary>
 /// 初始化检验 Transformers和TransformerDetails
 /// </summary>
 /// <param name="resolver"></param>
 /// <returns></returns>
 private void FillInspect(Resolver resolver)
 {
     InspectOrder inspectOrder = inspectOrderMgr.LoadInspectOrder(resolver.Code, true);
     Transformer transformer = TransformerHelper.ConvertInspectOrderToTransformer(inspectOrder);
     resolver.AddTransformer(transformer);
     resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
     resolver.Result = languageMgr.TranslateMessage("MasterData.Inventory.CurrentInspectOrder", resolver.UserCode, resolver.Code);
 }