Inheritance: EntityBase
        public static Transformer ConvertOrderLocationTransactionToTransformer(OrderLocationTransaction orderLocationTransaction)
        {
            if (orderLocationTransaction == null)
                return null;

            Transformer transformer = new Transformer();
            transformer.OrderLocTransId = orderLocationTransaction.Id;
            transformer.OrderNo = orderLocationTransaction.OrderDetail.OrderHead.OrderNo;
            transformer.Sequence = orderLocationTransaction.OrderDetail.Sequence;
            transformer.ItemCode = orderLocationTransaction.OrderDetail.Item.Code;
            transformer.ItemDescription = orderLocationTransaction.Item.Description;

            transformer.ItemBrand = orderLocationTransaction.Item.Brand;
            transformer.ItemSpec = orderLocationTransaction.Item.Spec;
            if (orderLocationTransaction.Item.ItemCategory != null)
            {
                transformer.ItemCategoryCode = orderLocationTransaction.Item.ItemCategory.Code;
                transformer.ItemCategoryDesc1 = orderLocationTransaction.Item.ItemCategory.Desc1;
                transformer.ItemCategoryDesc2 = orderLocationTransaction.Item.ItemCategory.Desc2;
            }

            transformer.ReferenceItemCode = orderLocationTransaction.OrderDetail.ReferenceItemCode;
            transformer.UomCode = orderLocationTransaction.OrderDetail.Uom.Code;
            transformer.UnitCount = orderLocationTransaction.OrderDetail.UnitCount;
            transformer.LocationFromCode = orderLocationTransaction.OrderDetail.DefaultLocationFrom != null ?
                orderLocationTransaction.OrderDetail.DefaultLocationFrom.Code : null;
            transformer.LocationToCode = orderLocationTransaction.OrderDetail.DefaultLocationTo != null ?
                orderLocationTransaction.OrderDetail.DefaultLocationTo.Code : null;
            transformer.OrderedQty = orderLocationTransaction.OrderDetail.OrderedQty;
            transformer.ShippedQty = orderLocationTransaction.OrderDetail.ShippedQty.HasValue ? orderLocationTransaction.OrderDetail.ShippedQty.Value : 0;
            transformer.ReceivedQty = orderLocationTransaction.OrderDetail.ReceivedQty.HasValue ? orderLocationTransaction.OrderDetail.ReceivedQty.Value : 0;
            transformer.OddShipOption = orderLocationTransaction.OrderDetail.OddShipOption;
            return transformer;
        }
        public static Transformer ConvertTransformerDetailToTransformer(TransformerDetail transformerDetail)
        {
            if (transformerDetail == null)
                return null;

            Transformer transformer = new Transformer();
            transformer.ItemCode = transformerDetail.ItemCode;
            transformer.ItemDescription = transformerDetail.ItemDescription;

            transformer.ItemBrand = transformerDetail.ItemBrand;
            transformer.ItemSpec = transformerDetail.ItemSpec;
            transformer.ItemCategoryCode = transformerDetail.ItemCategoryCode;
            transformer.ItemCategoryDesc1 = transformerDetail.ItemCategoryDesc1;
            transformer.ItemCategoryDesc2 = transformerDetail.ItemCategoryDesc2;

            transformer.UomCode = transformerDetail.UomCode;
            transformer.UnitCount = transformerDetail.UnitCount;
            transformer.Qty = transformerDetail.Qty;
            transformer.CurrentQty = transformerDetail.CurrentQty;
            transformer.LocationCode = transformerDetail.LocationCode;
            transformer.LocationFromCode = transformerDetail.LocationFromCode;
            transformer.LocationToCode = transformerDetail.LocationToCode;
            transformer.LotNo = transformerDetail.LotNo;
            transformer.LocationLotDetId = transformerDetail.LocationLotDetId;
            transformer.OrderLocTransId = transformerDetail.OrderLocTransId;
            transformer.StorageBinCode = transformerDetail.StorageBinCode;

            return transformer;
        }
Esempio n. 3
0
 public void AddTransformer(Transformer transformer)
 {
     if (transformer != null)
     {
         if (this.Transformers == null)
         {
             this.Transformers = new List<Transformer>();
         }
         this.Transformers.Add(transformer);
     }
 }
        public static Transformer ConvertFlowDetailToTransformer(FlowDetail flowDetail)
        {
            if (flowDetail == null)
                return null;

            Transformer transformer = new Transformer();
            transformer.ItemCode = flowDetail.Item.Code;
            transformer.ItemDescription = flowDetail.Item.Description;
            transformer.ReferenceItemCode = flowDetail.ReferenceItemCode;
            transformer.UomCode = flowDetail.Uom.Code;
            transformer.UnitCount = flowDetail.UnitCount;
            transformer.LocationFromCode = flowDetail.DefaultLocationFrom != null ? flowDetail.DefaultLocationFrom.Code : null;
            transformer.LocationToCode = flowDetail.DefaultLocationTo != null ? flowDetail.DefaultLocationTo.Code : null;

            return transformer;
        }
        public static Transformer ConvertItemToTransformer(Item item)
        {
            if (item == null)
                return null;

            Transformer transformer = new Transformer();
            transformer.ItemCode = item.Code;
            transformer.ItemDescription = item.Description;
            transformer.UomCode = item.Uom.Code;
            transformer.UnitCount = item.UnitCount;

            return transformer;
        }
        public static Transformer ConvertInspectOrderToTransformer(InspectOrder inspectOrder)
        {
            Transformer transformer = new Transformer();
            foreach (InspectOrderDetail inspectDetail in inspectOrder.InspectOrderDetails)
            {
                TransformerDetail transformerDetail = new TransformerDetail();

                transformerDetail.QualifiedQty = inspectDetail.QualifiedQty.HasValue ? inspectDetail.QualifiedQty.Value : 0;
                transformerDetail.RejectedQty = inspectDetail.RejectedQty.HasValue ? inspectDetail.RejectedQty.Value : 0;
                transformerDetail.CurrentQty = 0;
                transformerDetail.CurrentRejectQty = 0;
                transformerDetail.HuId = inspectOrder.IsDetailHasHu ? inspectDetail.LocationLotDetail.Hu.HuId : null;
                transformerDetail.Id = inspectDetail.Id;
                transformerDetail.ItemCode = inspectDetail.LocationLotDetail.Item.Code;
                transformerDetail.ItemDescription = inspectDetail.LocationLotDetail.Item.Description;
                transformerDetail.LocationCode = inspectDetail.LocationFrom.Code;
                transformerDetail.LocationLotDetId = inspectDetail.LocationLotDetail.Id;
                transformerDetail.LotNo = inspectDetail.LocationLotDetail.LotNo;
                if (inspectDetail.LocationLotDetail.Hu != null)
                {
                    transformerDetail.Qty = inspectDetail.InspectQty / inspectDetail.LocationLotDetail.Hu.UnitQty;
                    transformerDetail.UomCode = inspectDetail.LocationLotDetail.Hu.Uom.Code;
                    transformerDetail.UnitCount = inspectDetail.LocationLotDetail.Hu.UnitCount;
                }
                else
                {
                    transformerDetail.Qty = inspectDetail.InspectQty;
                    transformerDetail.UomCode = inspectDetail.LocationLotDetail.Item.Uom.Code;
                    transformerDetail.UnitCount = inspectDetail.LocationLotDetail.Item.UnitCount;
                }
                transformerDetail.LocationFromCode = inspectDetail.LocationFrom.Code;
                transformerDetail.LocationToCode = inspectDetail.LocationTo.Code;

                transformer.AddTransformerDetail(transformerDetail);
            }
            return transformer;
        }
        public static List<Transformer> ConvertInspectDetailToTransformer(IList<InspectOrderDetail> inspectOrderDetailList)
        {
            List<Transformer> transformerList = new List<Transformer>();
            if (inspectOrderDetailList != null && inspectOrderDetailList.Count > 0)
            {
                foreach (InspectOrderDetail inspectDetail in inspectOrderDetailList)
                {
                    bool isExist = false;
                    foreach (Transformer transformer in transformerList)
                    {
                        if (inspectDetail.LocationLotDetail.Item.Code == transformer.ItemCode
                            && inspectDetail.LocationFrom.Code == transformer.LocationFromCode
                            && inspectDetail.LocationTo.Code == transformer.LocationToCode)
                        {
                            TransformerDetail transformerDetail = ConvertInspectDetailToTransformerDetail(inspectDetail);

                            transformer.AddTransformerDetail(transformerDetail);
                            transformer.Qty += transformerDetail.Qty;
                            isExist = true;
                            break;
                        }
                    }

                    if (!isExist)
                    {
                        Transformer transformer = new Transformer();

                        transformer.Id = inspectDetail.Id;
                        transformer.ItemCode = inspectDetail.LocationLotDetail.Item.Code;
                        transformer.ItemDescription = inspectDetail.LocationLotDetail.Item.Description;

                        if (inspectDetail.LocationLotDetail.Hu != null)
                        {
                            transformer.UomCode = inspectDetail.LocationLotDetail.Hu.Uom.Code;
                            transformer.UnitCount = inspectDetail.LocationLotDetail.Hu.UnitCount;
                        }
                        else
                        {
                            transformer.UomCode = inspectDetail.LocationLotDetail.Item.Uom.Code;
                            transformer.UnitCount = inspectDetail.LocationLotDetail.Item.UnitCount;
                        }
                        transformer.LocationFromCode = inspectDetail.LocationFrom.Code;
                        transformer.LocationToCode = inspectDetail.LocationTo.Code;
                        transformer.Qty = inspectDetail.InspectedQty;
                        transformer.CurrentQty = 0;

                        if (inspectDetail.LocationLotDetail.Hu != null || inspectDetail.LocationLotDetail.LotNo != null)
                        {
                            transformer.AddTransformerDetail(ConvertInspectDetailToTransformerDetail(inspectDetail));
                        }
                        transformerList.Add(transformer);
                    }
                }
            }
            ProcessTransformer(transformerList);
            return transformerList;
        }
        public static Transformer ConvertFlowDetailToTransformer(FlowDetail flowDetail)
        {
            if (flowDetail == null)
                return null;

            Transformer transformer = new Transformer();
            transformer.ItemCode = flowDetail.Item.Code;
            transformer.ItemDescription = flowDetail.Item.Description;

            transformer.ItemBrand = flowDetail.Item.Brand;
            transformer.ItemSpec = flowDetail.Item.Spec;
            if (flowDetail.Item.ItemCategory != null)
            {
                transformer.ItemCategoryCode = flowDetail.Item.ItemCategory.Code;
                transformer.ItemCategoryDesc1 = flowDetail.Item.ItemCategory.Desc1;
                transformer.ItemCategoryDesc2 = flowDetail.Item.ItemCategory.Desc2;
            }

            transformer.ReferenceItemCode = flowDetail.ReferenceItemCode;
            transformer.UomCode = flowDetail.Uom.Code;
            transformer.UnitCount = flowDetail.UnitCount;
            transformer.LocationFromCode = flowDetail.DefaultLocationFrom != null ? flowDetail.DefaultLocationFrom.Code : null;
            transformer.LocationToCode = flowDetail.DefaultLocationTo != null ? flowDetail.DefaultLocationTo.Code : null;

            return transformer;
        }
 public static decimal GetSumCurrentQty(Transformer transformer)
 {
     decimal currentQty = 0;
     if (transformer != null && transformer.TransformerDetails != null && transformer.TransformerDetails.Count > 0)
     {
         foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
         {
             currentQty += transformerDetail.CurrentQty;
         }
     }
     return currentQty;
 }
Esempio n. 10
0
 public static List<Transformer> ConvertProductLineInProcessLocationDetailsToTransformers(IList<ProductLineInProcessLocationDetail> productLineIpList)
 {
     if (productLineIpList == null)
     {
         return null;
     }
     List<Transformer> transformers = new List<Transformer>();
     foreach (ProductLineInProcessLocationDetail productLineIp in productLineIpList)
     {
         Transformer transformer = new Transformer();
         transformer.Operation = productLineIp.Operation.HasValue ? productLineIp.Operation.Value : 0;
         transformer.ItemCode = productLineIp.Item.Code;
         transformer.ItemDescription = productLineIp.Item.Description;
         transformer.UomCode = productLineIp.Item.Uom.Code;
         transformer.UnitCount = productLineIp.Item.UnitCount;
         transformer.Qty = productLineIp.Qty;//累计回冲量
         transformer.OrderedQty = productLineIp.BackflushQty;//总投量
         transformer.LocationCode = productLineIp.LocationFrom == null ? string.Empty : productLineIp.LocationFrom.Code;
         transformers.Add(transformer);
     }
     return transformers;
 }
Esempio n. 11
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;
        }
Esempio n. 12
0
 public int FindMaxSeq(Transformer transformer)
 {
     int maxSeq = 0;
     if (transformer.TransformerDetails != null)
     {
         foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
         {
             if (transformerDetail.Sequence > maxSeq)
             {
                 maxSeq = transformerDetail.Sequence;
             }
         }
     }
     return maxSeq;
 }
Esempio n. 13
0
        /// <summary>
        /// 用于创建订单类型的 增加明细.如:退货,移库,上下架,投料,盘点等
        /// 检查重复扫描
        /// 自动生成序号
        /// 匹配
        /// 自动新增明细未加控制
        /// </summary>
        /// <param name="transformerDetail"></param>
        public void AddTransformerDetail(TransformerDetail transformerDetail)
        {
            if (transformerDetail != null)
            {
                if (this.Transformers == null)
                {
                    this.Transformers = new List<Transformer>();
                }
                //检查重复扫描
                var oldtd =
                    from transformer in this.Transformers
                    from oldtransformerDetail in transformer.TransformerDetails
                    where oldtransformerDetail.HuId.ToLower() == transformerDetail.HuId.ToLower()
                    select oldtransformerDetail;
                if (oldtd.Count() == 1 && oldtd.Single().CurrentQty != 0M)
                {
                    throw new BusinessErrorException("Warehouse.Error.HuReScan", transformerDetail.HuId);
                }
                //自动生成序号
                var seq = from t in this.Transformers
                          from td in t.TransformerDetails
                          select td.Sequence;
                transformerDetail.Sequence = seq.Count() > 0 ? seq.Max() + 1 : 0;
                //匹配
                var query = this.Transformers.Where
                    (t => (t.ItemCode == transformerDetail.ItemCode
                           && t.UnitCount == transformerDetail.UnitCount
                           && t.UomCode == transformerDetail.UomCode
                           && t.StorageBinCode == transformerDetail.StorageBinCode
                           && t.LocationCode == transformerDetail.LocationCode
                           && t.LocationFromCode == transformerDetail.LocationFromCode
                           && t.LocationToCode == transformerDetail.LocationToCode));
                if (query.Count() == 1)
                {
                    Transformer transformer = query.Single();
                    if (oldtd.Count() == 1 && oldtd.Single().CurrentQty == 0M)
                    {
                        oldtd.Single().CurrentQty = transformerDetail.CurrentQty;
                        oldtd.Single().Sequence = transformerDetail.Sequence;
                    }
                    else
                    {
                        transformer.AddTransformerDetail(transformerDetail);
                    }
                    transformer.CurrentQty += transformerDetail.CurrentQty;
                    transformer.Qty += transformerDetail.Qty;
                    transformer.Cartons++;
                }
                else if (query.Count() == 0)
                {
                    Transformer transformer = new Transformer();
                    transformer.ItemCode = transformerDetail.ItemCode;
                    transformer.ItemDescription = transformerDetail.ItemDescription;

                    transformer.ItemBrand = transformerDetail.ItemBrand;
                    transformer.ItemSpec = transformerDetail.ItemSpec;
                    transformer.ItemCategoryCode = transformerDetail.ItemCategoryCode;
                    transformer.ItemCategoryDesc1 = transformerDetail.ItemCategoryDesc1;
                    transformer.ItemCategoryDesc2 = transformerDetail.ItemCategoryDesc2;

                    transformer.UomCode = transformerDetail.UomCode;
                    transformer.UnitCount = transformerDetail.UnitCount;
                    transformer.CurrentQty = transformerDetail.CurrentQty;
                    transformer.Qty = transformerDetail.Qty;
                    transformer.LocationCode = transformerDetail.LocationCode;
                    transformer.LocationFromCode = transformerDetail.LocationFromCode;
                    transformer.LocationToCode = transformerDetail.LocationToCode;
                    transformer.LotNo = transformerDetail.LotNo;
                    transformer.StorageBinCode = transformerDetail.StorageBinCode;
                    transformer.Cartons = 1;
                    transformer.Sequence = this.Transformers.Count > 0 ? this.Transformers.Max(t => t.Sequence) + 1 : 0;

                    transformer.AddTransformerDetail(transformerDetail);
                    this.Transformers.Add(transformer);
                }
                else
                {
                    throw new TechnicalException("com.Sconit.Entity.MasterData.Resolver:Line 147");
                }
            }
            this.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
        }
        public static Transformer ConvertItemToTransformer(Item item)
        {
            if (item == null)
                return null;

            Transformer transformer = new Transformer();
            transformer.ItemCode = item.Code;
            transformer.ItemDescription = item.Description;

            transformer.ItemBrand = item.Brand;
            transformer.ItemSpec = item.Spec;
            if (item.ItemCategory != null)
            {
                transformer.ItemCategoryCode = item.ItemCategory.Code;
                transformer.ItemCategoryDesc1 = item.ItemCategory.Desc1;
                transformer.ItemCategoryDesc2 = item.ItemCategory.Desc2;
            }

            transformer.UomCode = item.Uom.Code;
            transformer.UnitCount = item.UnitCount;

            return transformer;
        }
Esempio n. 15
0
        public static Transformer ConvertMaterialInToTransformer(MaterialIn materialIn)
        {
            if (materialIn == null)
            {
                return null;
            }

            Transformer transformer = new Transformer();
            transformer.Operation = materialIn.Operation.HasValue ? materialIn.Operation.Value : 0;
            transformer.ItemCode = materialIn.RawMaterial.Code;
            transformer.ItemDescription = materialIn.RawMaterial.Description;
            transformer.UomCode = materialIn.RawMaterial.Uom.Code;
            transformer.UnitCount = materialIn.RawMaterial.UnitCount;
            transformer.Qty = 0M;
            transformer.CurrentQty = 0M;
            transformer.LocationCode = materialIn.Location == null ? string.Empty : materialIn.Location.Code;

            return transformer;
        }
Esempio n. 16
0
        public void MatchRepack(Resolver resolver)
        {
            string huId = resolver.Input;
            if (huId == string.Empty)
            {
                throw new BusinessErrorException("Common.Business.Hu.NotExist");
            }

            //为了转成统一对象,只能写死,第一个为投入,第二个为产出
            #region 翻箱前
            if (resolver.IOType == BusinessConstants.IO_TYPE_IN)
            {
                if (resolver.Transformers != null && resolver.Transformers.Count == 2)
                {
                    Transformer inTransformer = resolver.Transformers[0];
                    if (inTransformer == null)
                    {
                        inTransformer = new Transformer();
                    }
                    if (inTransformer.TransformerDetails == null)
                    {
                        inTransformer.TransformerDetails = new List<TransformerDetail>();
                    }

                    if (resolver.Transformers[1] == null)
                    {
                        resolver.Transformers[1] = new Transformer();
                    }
                    if (resolver.Transformers[1].TransformerDetails == null)
                    {
                        resolver.Transformers[1].TransformerDetails = new List<TransformerDetail>();
                    }

                    #region 拆箱输入只能一条
                    if (resolver.ModuleType == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING)
                    {
                        if (inTransformer.TransformerDetails.Count > 0)
                        {
                            throw new BusinessErrorException("MasterData.Inventory.Repack.Devanning.MoreThanOneInput");
                        }
                    }
                    #endregion

                    //校验重复扫描
                    if (inTransformer.TransformerDetails != null && inTransformer.TransformerDetails.Count > 0)
                    {
                        foreach (TransformerDetail inTransformDetail in inTransformer.TransformerDetails)
                        {
                            if (inTransformDetail.HuId == huId)
                            {
                                throw new BusinessErrorException("Repack.Error.HuReScan", huId);
                            }
                        }
                    }
                    LocationLotDetail locationLotDetail = locationLotDetailMgr.CheckLoadHuLocationLotDetail(huId, resolver.UserCode);
                    if (inTransformer.LocationFromCode == null || inTransformer.LocationFromCode == string.Empty)
                    {
                        inTransformer.LocationFromCode = locationLotDetail.Location.Code;
                    }
                    if (locationLotDetail.Location.Code != inTransformer.LocationFromCode)
                    {
                        throw new BusinessErrorException("Repack.Error.Location.NotEqual");
                    }
                    //翻箱 拆箱 不允许操作不合格品
                    if (locationLotDetail.Location.Code == "Inspect")
                    {
                        throw new BusinessErrorException("Repack.Error.Location.Inspect",huId);
                    }
                    RepackDetail repackDetail = new RepackDetail();
                    repackDetail.LocationLotDetail = locationLotDetail;
                    repackDetail.Hu = locationLotDetail.Hu;
                    repackDetail.IOType = BusinessConstants.IO_TYPE_IN;
                    repackDetail.Qty = repackDetail.Hu.Qty * repackDetail.Hu.UnitQty;
                    inTransformer.AddTransformerDetail(TransformerHelper.ConvertRepackDetailToTransformerDetail(repackDetail));
                    resolver.Transformers[0] = inTransformer;
                    if (resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_DEVANNING)
                    {
                        resolver.AntiResolveHu = locationLotDetail.Hu.AntiResolveHu;
                        resolver.IOType = BusinessConstants.IO_TYPE_OUT;
                        resolver.BinCode = locationLotDetail.StorageBin == null ? string.Empty : locationLotDetail.StorageBin.Code;
                    }
                }
            }
            #endregion

            #region 翻箱后
            else if (resolver.IOType == BusinessConstants.IO_TYPE_OUT)
            {
                if (resolver.Transformers != null && resolver.Transformers.Count == 2)
                {
                    Transformer outTransformer = resolver.Transformers[1];
                    Transformer inTransformer = resolver.Transformers[0];
                    if (outTransformer == null)
                    {
                        outTransformer = new Transformer();
                    }
                    if (outTransformer.TransformerDetails == null)
                    {
                        outTransformer.TransformerDetails = new List<TransformerDetail>();
                    }

                    #region 拆箱必须先扫描输入
                    if (resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_DEVANNING)
                    {
                        if (inTransformer.TransformerDetails.Count == 0)
                        {
                            throw new BusinessErrorException("Devanning.Error.Input.Empty");
                        }
                    }
                    #endregion

                    #region 校验重复扫描
                    if (outTransformer.TransformerDetails != null && outTransformer.TransformerDetails.Count > 0)
                    {
                        foreach (TransformerDetail inTransformDetail in outTransformer.TransformerDetails)
                        {
                            if (inTransformDetail.HuId == huId)
                            {
                                throw new BusinessErrorException("Repack.Error.HuReScan", huId);
                            }
                        }
                    }
                    #endregion

                    #region 根据投入的反向解析hu选项来判断产出
                    Hu hu = null;
                    if (resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_DEVANNING)  //只有拆箱支持解析条码
                    {
                        TransformerDetail inTransformerDetail = inTransformer.TransformerDetails[0];
                        Hu inputHu = huMgr.LoadHu(inTransformerDetail.HuId);

                        hu = this.ResolveHu(resolver.AntiResolveHu, huId, inputHu.Uom, inputHu.ManufactureParty);
                    }
                    else if (resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_REPACK)
                    {
                        hu = huMgr.CheckAndLoadHu(huId);
                    }
                    #endregion
                    TransformerDetail transformerDetail = TransformerHelper.ConvertHuToTransformerDetail(hu);
                    transformerDetail.IOType = resolver.IOType;

                    outTransformer.AddTransformerDetail(transformerDetail);
                    resolver.Transformers[1] = outTransformer;
                }
            }
            #endregion

            resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
            // return transformerList;
        }
Esempio n. 17
0
        public static Transformer ConvertOrderDetailToTransformer(OrderDetail orderDetail)
        {
            if (orderDetail == null)
            {
                return null;
            }
            Transformer transformer = new Transformer();
            transformer.ItemCode = orderDetail.Item.Code;
            transformer.ItemDescription = orderDetail.Item.Description;
            transformer.ReferenceItemCode = orderDetail.ReferenceItemCode;
            transformer.UomCode = orderDetail.Uom.Code;
            transformer.UnitCount = orderDetail.UnitCount;
            transformer.LocationFromCode = orderDetail.DefaultLocationFrom != null ? orderDetail.DefaultLocationFrom.Code : null;
            transformer.LocationToCode = orderDetail.DefaultLocationTo != null ? orderDetail.DefaultLocationTo.Code : null;
            transformer.OrderedQty = orderDetail.OrderedQty;
            transformer.Qty = orderDetail.OrderedQty;
            transformer.CurrentQty = orderDetail.GoodsReceiptLotSize.HasValue ? orderDetail.GoodsReceiptLotSize.Value : 0;
            transformer.ReceivedQty = orderDetail.ReceivedQty.HasValue ? orderDetail.ReceivedQty.Value : 0;
            transformer.RejectedQty = orderDetail.RejectedQty.HasValue ? orderDetail.RejectedQty.Value : 0;
            transformer.ScrapQty = orderDetail.ScrapQty.HasValue ? orderDetail.ScrapQty.Value : 0;
            transformer.Sequence = orderDetail.Sequence;
            transformer.ShippedQty = orderDetail.ShippedQty.HasValue ? orderDetail.ShippedQty.Value : 0;
            transformer.Id = orderDetail.Id;

            return transformer;
        }
Esempio n. 18
0
        private bool ProcessTransformerByLotNo(Resolver resolver, Transformer transformer, Hu hu, int locationLotDetId)
        {
            if (transformer.Qty - transformer.CurrentQty >= hu.Qty
                && transformer.LotNo != null && transformer.LotNo.ToUpper() == hu.LotNo.ToUpper())
            {
                #region 如果是拣货/订单发货,要匹配库位和库格是否相同
                if (resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_PICKLIST ||
                    resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_SHIPORDER)
                {
                    if (this.locationMgr.IsHuOcuppyByPickList(hu.HuId))
                    {
                        //判断条码是否被拣货单占用
                        throw new BusinessErrorException("Order.Error.PickUp.HuOcuppied", hu.HuId);
                    }

                    if (hu.StorageBin != null && hu.StorageBin.Trim() != string.Empty &&
                        transformer.StorageBinCode != null &&
                        hu.StorageBin == transformer.StorageBinCode.Trim())
                    {
                        //有库格按照库格匹配
                    }
                    else if (hu.StorageBin != null && hu.StorageBin.Trim() != string.Empty
                            && hu.Location != null && hu.Location.Trim() != string.Empty &&
                         (transformer.StorageBinCode == null || transformer.StorageBinCode.Trim() == string.Empty) &&
                          transformer.LocationFromCode == hu.Location)
                    {
                        //都没有库格按照库位匹配
                    }
                    else
                    {
                        return false;
                    }
                }
                #endregion

                TransformerDetail NewTransformerDetail = TransformerHelper.ConvertHuToTransformerDetail(hu);
                if (resolver.BinCode != null && resolver.BinCode.Trim() != string.Empty)
                {
                    NewTransformerDetail.StorageBinCode = resolver.BinCode;
                }
                NewTransformerDetail.LocationLotDetId = locationLotDetId;
                NewTransformerDetail.Sequence = this.FindMaxSeq(resolver.Transformers) + 1;
                transformer.AddTransformerDetail(NewTransformerDetail);
                TransformerHelper.ProcessTransformer(transformer);
                return true;
            }
            return false;
        }
Esempio n. 19
0
 public static int GetSumCartons(Transformer transformer)
 {
     int count = 0;
     if (transformer != null && transformer.TransformerDetails != null && transformer.TransformerDetails.Count > 0)
     {
         foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
         {
             if (transformerDetail.HuId != null && transformerDetail.HuId.Trim() != string.Empty && transformerDetail.CurrentQty != 0)
                 count++;
         }
     }
     return count;
 }
Esempio n. 20
0
        /// <summary>
        /// 用于创建订单类型的 增加明细.如:退货,移库,上下架,投料,盘点等
        /// 检查重复扫描
        /// 自动生成序号
        /// 匹配
        /// 自动新增明细未加控制
        /// </summary>
        /// <param name="transformerDetail"></param>
        public void AddTransformerDetail(TransformerDetail transformerDetail)
        {
            if (transformerDetail != null)
            {
                if (this.Transformers == null)
                {
                    this.Transformers = new List<Transformer>();
                }
                //检查重复扫描
                var oldtd =
                    from transformer in this.Transformers
                    from oldtransformerDetail in transformer.TransformerDetails
                    where oldtransformerDetail.HuId.ToLower() == transformerDetail.HuId.ToLower()
                    select oldtransformerDetail;
                if (oldtd.Count() == 1 && oldtd.Single().CurrentQty != 0M)
                {
                    throw new BusinessErrorException("Warehouse.Error.HuReScan", transformerDetail.HuId);
                }
                //自动生成序号
                var seq = from t in this.Transformers
                          from td in t.TransformerDetails
                          select td.Sequence;
                transformerDetail.Sequence = seq.Count() > 0 ? seq.Max() + 1 : 0;
                //匹配
                var query = this.Transformers.Where
                    (t => (t.ItemCode == transformerDetail.ItemCode
                           && t.UnitCount == transformerDetail.UnitCount
                           && t.UomCode == transformerDetail.UomCode
                           && t.StorageBinCode == transformerDetail.StorageBinCode
                           && t.LocationCode == transformerDetail.LocationCode
                           && t.LocationFromCode == transformerDetail.LocationFromCode
                           && t.LocationToCode == transformerDetail.LocationToCode));
                if (query.Count() == 1)
                {
                    Transformer transformer = query.Single();
                    if (oldtd.Count() == 1 && oldtd.Single().CurrentQty == 0M)
                    {
                        oldtd.Single().CurrentQty = transformerDetail.CurrentQty;
                        oldtd.Single().Sequence = transformerDetail.Sequence;
                    }
                    else
                    {
                        transformer.AddTransformerDetail(transformerDetail);
                    }
                    transformer.CurrentQty += transformerDetail.CurrentQty;
                    transformer.Qty += transformerDetail.Qty;
                    transformer.Cartons++;
                }
                else if (query.Count() == 0)
                {
                    Transformer transformer = new Transformer();
                    transformer.ItemCode = transformerDetail.ItemCode;
                    transformer.ItemDescription = transformerDetail.ItemDescription;
                    transformer.UomCode = transformerDetail.UomCode;
                    transformer.UnitCount = transformerDetail.UnitCount;
                    transformer.CurrentQty = transformerDetail.CurrentQty;
                    transformer.Qty = transformerDetail.Qty;
                    transformer.LocationCode = transformerDetail.LocationCode;
                    transformer.LocationFromCode = transformerDetail.LocationFromCode;
                    transformer.LocationToCode = transformerDetail.LocationToCode;
                    transformer.LotNo = transformerDetail.LotNo;
                    transformer.StorageBinCode = transformerDetail.StorageBinCode;
                    transformer.Cartons = 1;
                    transformer.Sequence = this.Transformers.Count > 0 ? this.Transformers.Max(t => t.Sequence) + 1 : 0;

                    transformer.AddTransformerDetail(transformerDetail);
                    this.Transformers.Add(transformer);
                }
                else
                {
                    throw new TechnicalException("com.Sconit.Entity.MasterData.Resolver:Line 147");
                }
            }

            //if (transformerDetail != null && transformerDetail.CurrentQty > 0)
            //{
            //    this.Transformers = this.Transformers == null ? new List<Transformer>() : this.Transformers;

            //    //检查重复扫描
            //    //CheckMatchHuExist(resolver, transformerDetail.HuId);

            //    //自动生成序号
            //    int seq = FindMaxSeq(this.Transformers);
            //    transformerDetail.Sequence = seq + 1;

            //    //匹配:严格匹配ItemCode/UomCode/UnitCount/StorageBinCode/LotNo
            //    var query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               && (t.UnitCount == transformerDetail.UnitCount || t.UnitCount == transformerDetail.Qty)
            //               && string.Equals(t.StorageBinCode, transformerDetail.StorageBinCode, StringComparison.OrdinalIgnoreCase)
            //               && (t.LotNo == null || t.LotNo.Trim() == string.Empty || (string.Equals(t.LotNo, transformerDetail.LotNo, StringComparison.OrdinalIgnoreCase)))
            //              ));
            //    //匹配:如果没有匹配上,降低条件,匹配ItemCode/UomCode/UnitCount/StorageBinCode
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               && (t.UnitCount == transformerDetail.UnitCount || t.UnitCount == transformerDetail.Qty)
            //               && string.Equals(t.StorageBinCode, transformerDetail.StorageBinCode, StringComparison.OrdinalIgnoreCase)
            //               ));
            //    }
            //    //匹配:如果没有匹配上,降低条件,匹配ItemCode/UomCode/UnitCount
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               && (t.UnitCount == transformerDetail.UnitCount || t.UnitCount == transformerDetail.Qty)
            //               ));
            //    }
            //    //匹配:如果没有匹配上,降低条件,匹配ItemCode/UomCode/StorageBinCode
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.StorageBinCode, transformerDetail.StorageBinCode, StringComparison.OrdinalIgnoreCase)
            //               ));
            //    }
            //    //匹配:如果还是没有匹配上,再降低条件,匹配ItemCode/UomCode
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               ));
            //    }
            //    //匹配:如果还是没有匹配上,再降低条件,匹配ItemCode
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)));
            //    }
            //    //如果没有匹配的Transformer,新增Transformer和TransformerDetail
            //    if (query.Count() == 0)
            //    {
            //        Transformer transformer = new Transformer();
            //        transformer.ItemCode = transformerDetail.ItemCode;
            //        transformer.ItemDescription = transformerDetail.ItemDescription;
            //        transformer.UomCode = transformerDetail.UomCode;
            //        transformer.UnitCount = transformerDetail.UnitCount;
            //        transformer.CurrentQty = transformerDetail.CurrentQty;
            //        transformer.Qty = transformerDetail.Qty;
            //        transformer.LocationCode = transformerDetail.LocationCode;
            //        transformer.LotNo = transformerDetail.LotNo;
            //        transformer.StorageBinCode = transformerDetail.StorageBinCode;
            //        transformer.Cartons = 1;
            //        transformer.Sequence = this.Transformers.Count > 0 ? this.Transformers.Max(t => t.Sequence) + 1 : 0;

            //        transformer.AddTransformerDetail(transformerDetail);
            //        this.Transformers.Add(transformer);
            //    }
            //    //如果有匹配的Transformer,新增与之相匹配的TransformerDetail
            //    else if (query.Count() == 1)
            //    {
            //        int tdSeq = query.Select(q => q.Sequence).Single();
            //        bool match = false;
            //        for (int i = 0; i < this.Transformers.Count; i++)
            //        {
            //            if (this.Transformers[i].Sequence == tdSeq)
            //            {
            //                //已有条码
            //                if (this.Transformers[i].TransformerDetails != null && this.Transformers[i].TransformerDetails.Count > 0)
            //                {
            //                    foreach (var td in this.Transformers[i].TransformerDetails)
            //                    {
            //                        if (td.HuId != null && td.HuId.ToLower() == transformerDetail.HuId.ToLower())
            //                        {
            //                            if (td.CurrentQty == 0M)
            //                            {
            //                                td.CurrentQty = transformerDetail.CurrentQty;
            //                                td.Sequence = transformerDetail.Sequence;
            //                                this.Transformers[i].CurrentQty += transformerDetail.CurrentQty;
            //                                this.Transformers[i].Cartons++;
            //                                match = true;
            //                            }
            //                            else
            //                            {
            //                                throw new BusinessErrorException("Warehouse.Error.HuReScan", transformerDetail.HuId);
            //                            }
            //                            break;
            //                        }
            //                    }
            //                }
            //                //没有条码
            //                if (!match)
            //                {
            //                    this.Transformers[i].AddTransformerDetail(transformerDetail);
            //                    this.Transformers[i].CurrentQty += transformerDetail.CurrentQty;
            //                    this.Transformers[i].Cartons++;
            //                    break;
            //                }
            //            }
            //        }
            //    }
            //}
            this.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
        }
Esempio n. 21
0
 public static void ProcessTransformer(Transformer transformer)
 {
     if (transformer != null && transformer.TransformerDetails != null)
     {
         transformer.CurrentQty = GetSumCurrentQty(transformer);
         transformer.Cartons = GetSumCartons(transformer);
     }
 }
Esempio n. 22
0
        /// <summary>
        /// 用于创建订单类型的 增加明细.如:退货,移库,上下架,投料,盘点等
        /// 检查重复扫描
        /// 自动生成序号
        /// 匹配
        /// 自动新增明细未加控制
        /// </summary>
        /// <param name="transformerDetail"></param>
        public void AddTransformerDetail(TransformerDetail transformerDetail)
        {
            if (transformerDetail != null)
            {
                if (this.Transformers == null)
                {
                    this.Transformers = new List <Transformer>();
                }
                //检查重复扫描
                var oldtd =
                    from transformer in this.Transformers
                    from oldtransformerDetail in transformer.TransformerDetails
                    where oldtransformerDetail.HuId.ToLower() == transformerDetail.HuId.ToLower()
                    select oldtransformerDetail;
                if (oldtd.Count() == 1 && oldtd.Single().CurrentQty != 0M)
                {
                    throw new BusinessErrorException("Warehouse.Error.HuReScan", transformerDetail.HuId);
                }
                //自动生成序号
                var seq = from t in this.Transformers
                          from td in t.TransformerDetails
                          select td.Sequence;
                transformerDetail.Sequence = seq.Count() > 0 ? seq.Max() + 1 : 0;
                //匹配
                var query = this.Transformers.Where
                                (t => (t.ItemCode == transformerDetail.ItemCode &&
                                       t.UnitCount == transformerDetail.UnitCount &&
                                       t.UomCode == transformerDetail.UomCode &&
                                       t.StorageBinCode == transformerDetail.StorageBinCode &&
                                       t.LocationCode == transformerDetail.LocationCode &&
                                       t.LocationFromCode == transformerDetail.LocationFromCode &&
                                       t.LocationToCode == transformerDetail.LocationToCode));
                if (query.Count() == 1)
                {
                    Transformer transformer = query.Single();
                    if (oldtd.Count() == 1 && oldtd.Single().CurrentQty == 0M)
                    {
                        oldtd.Single().CurrentQty = transformerDetail.CurrentQty;
                        oldtd.Single().Sequence   = transformerDetail.Sequence;
                    }
                    else
                    {
                        transformer.AddTransformerDetail(transformerDetail);
                    }
                    transformer.CurrentQty += transformerDetail.CurrentQty;
                    transformer.Qty        += transformerDetail.Qty;
                    transformer.Cartons++;
                }
                else if (query.Count() == 0)
                {
                    Transformer transformer = new Transformer();
                    transformer.ItemCode         = transformerDetail.ItemCode;
                    transformer.ItemDescription  = transformerDetail.ItemDescription;
                    transformer.UomCode          = transformerDetail.UomCode;
                    transformer.UnitCount        = transformerDetail.UnitCount;
                    transformer.CurrentQty       = transformerDetail.CurrentQty;
                    transformer.Qty              = transformerDetail.Qty;
                    transformer.LocationCode     = transformerDetail.LocationCode;
                    transformer.LocationFromCode = transformerDetail.LocationFromCode;
                    transformer.LocationToCode   = transformerDetail.LocationToCode;
                    transformer.LotNo            = transformerDetail.LotNo;
                    transformer.StorageBinCode   = transformerDetail.StorageBinCode;
                    transformer.Cartons          = 1;
                    transformer.Sequence         = this.Transformers.Count > 0 ? this.Transformers.Max(t => t.Sequence) + 1 : 0;

                    transformer.AddTransformerDetail(transformerDetail);
                    this.Transformers.Add(transformer);
                }
                else
                {
                    throw new TechnicalException("com.Sconit.Entity.MasterData.Resolver:Line 147");
                }
            }

            //if (transformerDetail != null && transformerDetail.CurrentQty > 0)
            //{
            //    this.Transformers = this.Transformers == null ? new List<Transformer>() : this.Transformers;

            //    //检查重复扫描
            //    //CheckMatchHuExist(resolver, transformerDetail.HuId);

            //    //自动生成序号
            //    int seq = FindMaxSeq(this.Transformers);
            //    transformerDetail.Sequence = seq + 1;

            //    //匹配:严格匹配ItemCode/UomCode/UnitCount/StorageBinCode/LotNo
            //    var query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               && (t.UnitCount == transformerDetail.UnitCount || t.UnitCount == transformerDetail.Qty)
            //               && string.Equals(t.StorageBinCode, transformerDetail.StorageBinCode, StringComparison.OrdinalIgnoreCase)
            //               && (t.LotNo == null || t.LotNo.Trim() == string.Empty || (string.Equals(t.LotNo, transformerDetail.LotNo, StringComparison.OrdinalIgnoreCase)))
            //              ));
            //    //匹配:如果没有匹配上,降低条件,匹配ItemCode/UomCode/UnitCount/StorageBinCode
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               && (t.UnitCount == transformerDetail.UnitCount || t.UnitCount == transformerDetail.Qty)
            //               && string.Equals(t.StorageBinCode, transformerDetail.StorageBinCode, StringComparison.OrdinalIgnoreCase)
            //               ));
            //    }
            //    //匹配:如果没有匹配上,降低条件,匹配ItemCode/UomCode/UnitCount
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               && (t.UnitCount == transformerDetail.UnitCount || t.UnitCount == transformerDetail.Qty)
            //               ));
            //    }
            //    //匹配:如果没有匹配上,降低条件,匹配ItemCode/UomCode/StorageBinCode
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.StorageBinCode, transformerDetail.StorageBinCode, StringComparison.OrdinalIgnoreCase)
            //               ));
            //    }
            //    //匹配:如果还是没有匹配上,再降低条件,匹配ItemCode/UomCode
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
            //               && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
            //               ));
            //    }
            //    //匹配:如果还是没有匹配上,再降低条件,匹配ItemCode
            //    if (query.Count() == 0)
            //    {
            //        query = this.Transformers.Where
            //        (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)));
            //    }
            //    //如果没有匹配的Transformer,新增Transformer和TransformerDetail
            //    if (query.Count() == 0)
            //    {
            //        Transformer transformer = new Transformer();
            //        transformer.ItemCode = transformerDetail.ItemCode;
            //        transformer.ItemDescription = transformerDetail.ItemDescription;
            //        transformer.UomCode = transformerDetail.UomCode;
            //        transformer.UnitCount = transformerDetail.UnitCount;
            //        transformer.CurrentQty = transformerDetail.CurrentQty;
            //        transformer.Qty = transformerDetail.Qty;
            //        transformer.LocationCode = transformerDetail.LocationCode;
            //        transformer.LotNo = transformerDetail.LotNo;
            //        transformer.StorageBinCode = transformerDetail.StorageBinCode;
            //        transformer.Cartons = 1;
            //        transformer.Sequence = this.Transformers.Count > 0 ? this.Transformers.Max(t => t.Sequence) + 1 : 0;

            //        transformer.AddTransformerDetail(transformerDetail);
            //        this.Transformers.Add(transformer);
            //    }
            //    //如果有匹配的Transformer,新增与之相匹配的TransformerDetail
            //    else if (query.Count() == 1)
            //    {
            //        int tdSeq = query.Select(q => q.Sequence).Single();
            //        bool match = false;
            //        for (int i = 0; i < this.Transformers.Count; i++)
            //        {
            //            if (this.Transformers[i].Sequence == tdSeq)
            //            {
            //                //已有条码
            //                if (this.Transformers[i].TransformerDetails != null && this.Transformers[i].TransformerDetails.Count > 0)
            //                {
            //                    foreach (var td in this.Transformers[i].TransformerDetails)
            //                    {
            //                        if (td.HuId != null && td.HuId.ToLower() == transformerDetail.HuId.ToLower())
            //                        {
            //                            if (td.CurrentQty == 0M)
            //                            {
            //                                td.CurrentQty = transformerDetail.CurrentQty;
            //                                td.Sequence = transformerDetail.Sequence;
            //                                this.Transformers[i].CurrentQty += transformerDetail.CurrentQty;
            //                                this.Transformers[i].Cartons++;
            //                                match = true;
            //                            }
            //                            else
            //                            {
            //                                throw new BusinessErrorException("Warehouse.Error.HuReScan", transformerDetail.HuId);
            //                            }
            //                            break;
            //                        }
            //                    }
            //                }
            //                //没有条码
            //                if (!match)
            //                {
            //                    this.Transformers[i].AddTransformerDetail(transformerDetail);
            //                    this.Transformers[i].CurrentQty += transformerDetail.CurrentQty;
            //                    this.Transformers[i].Cartons++;
            //                    break;
            //                }
            //            }
            //        }
            //    }
            //}
            this.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
        }