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;
        }
 public void InitPageParameter(TransformerDetail transformDetail)
 {
     tbUnitCount.Text = transformDetail.UnitCount.ToString("F2");
     tbQty.Text = "1";
     tbUnitCount.Attributes["oldValue"] = tbUnitCount.Text;
     tbQty.Attributes["oldValue"] = tbQty.Text;
     this.HuId = transformDetail.HuId;
 }
 public void AddTransformerDetail(TransformerDetail transformerDetail)
 {
     if (transformerDetail != null)
     {
         if (this.TransformerDetails == null)
         {
             this.TransformerDetails = new List <TransformerDetail>();
         }
         this.TransformerDetails.Add(transformerDetail);
     }
 }
 public void AddTransformerDetail(TransformerDetail transformerDetail)
 {
     if (transformerDetail != null)
     {
         if (this.TransformerDetails == null)
         {
             this.TransformerDetails = new List<TransformerDetail>();
         }
         this.TransformerDetails.Add(transformerDetail);
     }
 }
        public static TransformerDetail ConvertHuToTransformerDetail(Hu hu)
        {
            TransformerDetail transformerDetail = new TransformerDetail();
            transformerDetail.ItemCode = hu.Item.Code;
            transformerDetail.ItemDescription = hu.Item.Description;
            transformerDetail.UomCode = hu.Uom.Code;
            transformerDetail.UnitCount = hu.UnitCount;
            transformerDetail.HuId = hu.HuId;
            transformerDetail.LotNo = hu.LotNo;
            transformerDetail.Qty = hu.Qty;
            transformerDetail.CurrentQty = hu.Qty;
            transformerDetail.Status = hu.Status;
            transformerDetail.LocationCode = hu.Location == null ? string.Empty : hu.Location;
            transformerDetail.StorageBinCode = hu.StorageBin == null ? string.Empty : hu.StorageBin;

            return transformerDetail;
        }
Exemple #6
0
    public List<TransformerDetail> GetList()
    {
        List<TransformerDetail> transformerDetailList = new List<TransformerDetail>();
        foreach (GridViewRow gvr in GV_List.Rows)
        {
            TransformerDetail transformerDetail = new TransformerDetail();
            transformerDetail.Id = int.Parse(((HiddenField)gvr.FindControl("hfId")).Value);
            transformerDetail.HuId = ((Label)gvr.FindControl("lblHuId")).Text.Trim();
            transformerDetail.LotNo = ((Label)gvr.FindControl("lblLotNo")).Text.Trim();
            transformerDetail.ItemCode = ((Label)gvr.FindControl("lblItemCode")).Text.Trim();
            transformerDetail.ItemDescription = ((Label)gvr.FindControl("lblItemDescription")).Text.Trim();
            transformerDetail.UomCode = ((Label)gvr.FindControl("lblUOM")).Text.Trim();
            transformerDetail.Qty = decimal.Parse(((Label)gvr.FindControl("lblQty")).Text.Trim());
            transformerDetail.StorageBinCode = ((Label)gvr.FindControl("lblStorageBinCode")).Text.Trim();
            transformerDetailList.Add(transformerDetail);
        }

        return transformerDetailList;
    }
 public static List<TransformerDetail> ConvertProductLineInProcessLocationDetailsToTransformerDetails(IList<ProductLineInProcessLocationDetail> productLineIpList)
 {
     if (productLineIpList == null)
     {
         return null;
     }
     List<TransformerDetail> transformerDetails = new List<TransformerDetail>();
     foreach (ProductLineInProcessLocationDetail productLineIp in productLineIpList)
     {
         TransformerDetail transformerDetail = new TransformerDetail();
         transformerDetail.ItemCode = productLineIp.Item.Code;
         transformerDetail.ItemDescription = productLineIp.Item.Description;
         transformerDetail.UomCode = productLineIp.Item.Uom.Code;
         transformerDetail.UnitCount = productLineIp.Item.UnitCount;
         transformerDetail.Qty = productLineIp.Qty - productLineIp.BackflushQty;
         transformerDetail.CurrentQty = transformerDetail.Qty;
         transformerDetails.Add(transformerDetail);
     }
     return transformerDetails;
 }
        public static TransformerDetail ConvertOrderLocationTransactionToTransformerDetail(OrderLocationTransaction orderLocationTransaction)
        {
            if (orderLocationTransaction == null)
                return null;

            TransformerDetail transformerDetail = new TransformerDetail();
            transformerDetail.ItemCode = orderLocationTransaction.OrderDetail.Item.Code;
            transformerDetail.ItemDescription = orderLocationTransaction.Item.Description;
            transformerDetail.UomCode = orderLocationTransaction.OrderDetail.Uom.Code;
            transformerDetail.UnitCount = orderLocationTransaction.OrderDetail.UnitCount;
            transformerDetail.OrderNo = orderLocationTransaction.OrderDetail.OrderHead.OrderNo;
            transformerDetail.ReferenceItemCode = orderLocationTransaction.OrderDetail.ReferenceItemCode;
            transformerDetail.Sequence = orderLocationTransaction.OrderDetail.Sequence;
            transformerDetail.LocationFromCode = orderLocationTransaction.OrderDetail.DefaultLocationFrom != null ?
             orderLocationTransaction.OrderDetail.DefaultLocationFrom.Code : null;
            transformerDetail.LocationToCode = orderLocationTransaction.OrderDetail.DefaultLocationTo != null ?
                orderLocationTransaction.OrderDetail.DefaultLocationTo.Code : null;
            transformerDetail.OrderLocTransId = orderLocationTransaction.Id;
            return transformerDetail;
        }
        public static TransformerDetail ConvertLocationLotDetailToTransformerDetail(LocationLotDetail locationLotDetail, bool isPutAway)
        {
            TransformerDetail transformerDetail = new TransformerDetail();
            transformerDetail.Id = locationLotDetail.Id;
            transformerDetail.LocationLotDetId = locationLotDetail.Id;
            transformerDetail.ItemCode = locationLotDetail.Item.Code;
            transformerDetail.ItemDescription = locationLotDetail.Item.Description;
            if (locationLotDetail.Hu != null)
            {
                transformerDetail.UomCode = locationLotDetail.Hu.Uom.Code;
                transformerDetail.UnitCount = locationLotDetail.Hu.UnitCount;
                transformerDetail.Qty = locationLotDetail.Qty / locationLotDetail.Hu.UnitQty;
                transformerDetail.CurrentQty = locationLotDetail.Qty / locationLotDetail.Hu.UnitQty;
            }
            else
            {
                transformerDetail.UomCode = locationLotDetail.Item.Uom.Code;
                transformerDetail.UnitCount = locationLotDetail.Item.UnitCount;
                transformerDetail.Qty = locationLotDetail.Qty;
                transformerDetail.CurrentQty = locationLotDetail.Qty;
            }
            transformerDetail.HuId = locationLotDetail.Hu.HuId;
            transformerDetail.LotNo = locationLotDetail.Hu.LotNo;
            transformerDetail.LocationCode = locationLotDetail.Location.Code;
            if (isPutAway)
                transformerDetail.StorageBinCode = locationLotDetail.NewStorageBin != null ? locationLotDetail.NewStorageBin.Code : null;
            else
                transformerDetail.StorageBinCode = locationLotDetail.StorageBin != null ? locationLotDetail.StorageBin.Code : null;

            return transformerDetail;
        }
        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 TransformerDetail ConvertInspectDetailToTransformerDetail(InspectOrderDetail inspectDetail)
 {
     TransformerDetail transformerDetail = new TransformerDetail();
     transformerDetail.Id = inspectDetail.Id;
     transformerDetail.ItemCode = inspectDetail.LocationLotDetail.Item.Code;
     transformerDetail.ItemDescription = inspectDetail.LocationLotDetail.Item.Description;
     if (inspectDetail.LocationLotDetail.Hu != null)
     {
         transformerDetail.UomCode = inspectDetail.LocationLotDetail.Hu.Uom.Code;
         transformerDetail.UnitCount = inspectDetail.LocationLotDetail.Hu.UnitCount;
         transformerDetail.Qty = inspectDetail.InspectedQty / inspectDetail.LocationLotDetail.Hu.UnitQty;
     }
     else
     {
         transformerDetail.UomCode = inspectDetail.LocationLotDetail.Item.Uom.Code;
         transformerDetail.UnitCount = inspectDetail.LocationLotDetail.Item.UnitCount;
         transformerDetail.Qty = inspectDetail.InspectedQty;
     }
     transformerDetail.HuId = inspectDetail.LocationLotDetail.Hu == null ? null : inspectDetail.LocationLotDetail.Hu.HuId;
     transformerDetail.LotNo = inspectDetail.LocationLotDetail.LotNo;
     transformerDetail.CurrentQty = 0;
     return transformerDetail;
 }
Exemple #12
0
        public LocationLotDetail ConvertTransformerDetailToLocationLotDetail(TransformerDetail transformerDetail, bool isPutAway)
        {
            LocationLotDetail locationLotDetail = locationLotDetailMgr.LoadLocationLotDetail(transformerDetail.Id);
            locationLotDetail.CurrentInspectQty = locationLotDetail.Qty;
            if (isPutAway && transformerDetail.StorageBinCode != null && transformerDetail.StorageBinCode.Trim() != string.Empty)
            {
                locationLotDetail.NewStorageBin = storageBinMgr.CheckAndLoadStorageBin(transformerDetail.StorageBinCode);
            }

            return locationLotDetail;
        }
Exemple #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.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;
        }
        /// <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;
        }
        private MaterialIn ConvertTransformerDetailToMaterialIn(TransformerDetail transformerDetail)
        {
            MaterialIn materialIn = new MaterialIn();
            materialIn.HuId = transformerDetail.HuId;
            materialIn.RawMaterial = itemMgr.LoadItem(transformerDetail.ItemCode);
            materialIn.Location = locationMgr.LoadLocation(transformerDetail.LocationCode);
            materialIn.LotNo = transformerDetail.LotNo;
            materialIn.Operation = transformerDetail.Operation;
            materialIn.Qty = transformerDetail.Qty;

            return materialIn;
        }
        public static TransformerDetail ConvertRepackDetailToTransformerDetail(RepackDetail repackDetail)
        {
            TransformerDetail transformerDetail = new TransformerDetail();
            if (repackDetail.LocationLotDetail.Hu != null)
            {
                transformerDetail = ConvertHuToTransformerDetail(repackDetail.LocationLotDetail.Hu);
                transformerDetail.Qty = repackDetail.Qty / repackDetail.LocationLotDetail.Hu.UnitQty;
                transformerDetail.CurrentQty = transformerDetail.Qty;
            }
            else
            {
                transformerDetail.ItemCode = repackDetail.LocationLotDetail.Item.Code;
                transformerDetail.ItemDescription = repackDetail.LocationLotDetail.Item.Description;

                transformerDetail.UomCode = repackDetail.LocationLotDetail.Item.Uom.Code;
                transformerDetail.UnitCount = repackDetail.LocationLotDetail.Item.UnitCount;

                transformerDetail.Qty = repackDetail.Qty;
                transformerDetail.CurrentQty = repackDetail.Qty;
            }

            transformerDetail.LocationLotDetId = repackDetail.LocationLotDetail.Id;
            transformerDetail.LocationCode = repackDetail.LocationLotDetail.Location.Code;
            transformerDetail.StorageBinCode = repackDetail.StorageBinCode;
            transformerDetail.IOType = repackDetail.IOType;

            return transformerDetail;
        }
Exemple #17
0
 private int TransformerDetailSeqComparer(TransformerDetail x, TransformerDetail y)
 {
     return x.Sequence - y.Sequence;
 }
    public List<TransformerDetail> GetHuList()
    {
        List<TransformerDetail> huList = new List<TransformerDetail>();
        foreach (GridViewRow gvr in GV_List.Rows)
        {
            TransformerDetail transformerDetail = new TransformerDetail();
            transformerDetail.HuId = this.GetHuId(gvr);
            transformerDetail.LotNo = ((Label)gvr.FindControl("lblLotNo")).Text;
            transformerDetail.StorageBinCode = ((Label)gvr.FindControl("lblStorageBinCode")).Text;
            HiddenField hfQty = (HiddenField)gvr.FindControl("hfQty");
            transformerDetail.Qty = hfQty.Value != string.Empty ? decimal.Parse(hfQty.Value) : 0;
            //if ((HiddenField)gvr.FindControl("hfIsqualified") != null && ((HiddenField)gvr.FindControl("hfIsqualified")).Value != string.Empty)
            //{
            //    transformerDetail.IsQualified = bool.Parse(((HiddenField)gvr.FindControl("hfIsqualified")).Value);
            //}
            transformerDetail.CurrentQty = this.GetCurrentQty(gvr);
            if ((HiddenField)gvr.FindControl("hfId") != null && ((HiddenField)gvr.FindControl("hfId")).Value != string.Empty)
            {
                transformerDetail.Id = int.Parse(((HiddenField)gvr.FindControl("hfId")).Value);
            }
            huList.Add(transformerDetail);
        }

        return huList;
    }
Exemple #19
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;
        }