Inheritance: EntityBase
Exemple #1
0
 protected override void BarCodeScan()
 {
     base.BarCodeScan();
     this.lblMessage.Text = "拣货单" + this.resolver.Code + "上线成功!";
     this.lblMessage.Visible = true;
     this.lblResult.Text = string.Empty;
     Transformer transformer = new Transformer();
     transformer.OrderNo = this.resolver.Code;          //当前上线的Picklist
     transformer.ItemDescription = this.resolver.Result;//替代上线时间(当前上线的Picklist的时间)
     //倒序
     List<Transformer> transformers = new List<Transformer>();
     transformers.Add(transformer);
     transformers.AddRange(this.transformerList);
     this.transformerList = transformers;
     this.gvListDataBind();
 }
Exemple #2
0
 protected override void gvListDataBind()
 {
     List<Transformer> transformerList = new List<Transformer>();
     if (this.resolver.Transformers != null)
     {
         foreach (Transformer transformer in this.resolver.Transformers)
         {
             if (transformer != null)
             {
                 Transformer newTransformer = new Transformer();
                 newTransformer = transformer;
                 newTransformer.AdjustQty = newTransformer.Qty - newTransformer.CurrentQty;
                 if (newTransformer.AdjustQty > 0)
                 {
                     transformerList.Add(newTransformer);
                 }
             }
         }
     }
     base.gvListDataBind();
     this.dgList.DataSource = transformerList;
     ts.MappingName = transformerList.GetType().Name;
 }
Exemple #3
0
 /// <summary>
 /// 查找最大序号的TransformerDetail所在的行和列
 /// </summary>
 /// <param name="transformerList"></param>
 /// <returns></returns>
 private static int[] FindMaxSeqTransformerDetailRowAndColumnIndex(Transformer[] transformerList)
 {
     int maxSeq = FindMaxSeq(transformerList);
     if (transformerList != null)
     {
         for (int i = 0; i < transformerList.Length; i++)
         {
             if (transformerList[i].TransformerDetails != null)
             {
                 for (int j = 0; j < transformerList[i].TransformerDetails.Length; j++)
                 {
                     if (transformerList[i].TransformerDetails[j].Sequence == maxSeq)
                     {
                         return new int[] { i, j };
                     }
                 }
             }
         }
     }
     return null;
 }
Exemple #4
0
 private static void ProcessTransformer(Transformer[] transformerList)
 {
     if (transformerList != null && transformerList.Length > 0)
     {
         foreach (Transformer transformer in transformerList)
         {
             if (transformer != null && transformer.TransformerDetails != null)
             {
                 transformer.CurrentQty = AccumlationCurrentQty(transformer.TransformerDetails);
                 transformer.Cartons = GetSumCartons(transformer.TransformerDetails);
             }
         }
     }
 }
Exemple #5
0
 private static int FindMaxSeq(Transformer[] transformers)
 {
     int maxSeq = 0;
     if (transformers != null)
     {
         foreach (Transformer transformer in transformers)
         {
             if (transformer.TransformerDetails != null)
             {
                 foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                 {
                     if (transformerDetail.Sequence > maxSeq)
                     {
                         maxSeq = transformerDetail.Sequence;
                     }
                 }
             }
         }
     }
     return maxSeq;
 }
Exemple #6
0
        private static void DeepCopyResolver(Resolver sourceResolver, Resolver targetResolver)
        {
            CopyProperty(sourceResolver, targetResolver);
            List<Transformer> transformers = new List<Transformer>();
            if (sourceResolver != null && sourceResolver.Transformers != null)
            {
                foreach (var st in sourceResolver.Transformers)
                {
                    Transformer transformer = new Transformer();
                    CopyProperty(st, transformer);

                    #region TransformerDetail
                    List<TransformerDetail> transformerDetails = new List<TransformerDetail>();
                    if (st.TransformerDetails != null && st.TransformerDetails.Length > 0)
                    {
                        foreach (var std in st.TransformerDetails)
                        {
                            TransformerDetail transformerDetail = new TransformerDetail();
                            CopyProperty(std, transformerDetail);
                            transformerDetails.Add(transformerDetail);
                        }
                    }
                    if (transformerDetails.Count > 0)
                    {
                        transformer.TransformerDetails = transformerDetails.ToArray();
                    }
                    #endregion

                    transformers.Add(transformer);
                }
                if (transformers.Count > 0)
                {
                    targetResolver.Transformers = transformers.ToArray();
                }
            }
        }
Exemple #7
0
 private static void AddTransformerDetail(Transformer transformer, TransformerDetail transformerDetail)
 {
     if (transformer == null || transformerDetail.CurrentQty == 0)
     {
         return;
     }
     if (transformerDetail != null)
     {
         List<TransformerDetail> transformerDetails = new List<TransformerDetail>();
         if (transformer.TransformerDetails != null)
         {
             transformerDetails = transformer.TransformerDetails.ToList();
         }
         transformerDetails.Add(transformerDetail);
         transformer.TransformerDetails = transformerDetails.ToArray();
         transformer.CurrentQty += transformerDetail.CurrentQty;
         transformer.Cartons++;
     }
 }
Exemple #8
0
        private static void AddTransformerDetail(Resolver resolver, TransformerDetail transformerDetail)
        {
            if (transformerDetail != null && transformerDetail.CurrentQty > 0)
            {
                List<Transformer> transformers = new List<Transformer>();
                if (resolver.Transformers != null)
                {
                    transformers = resolver.Transformers.ToList();
                }
                //检查重复扫描
                //CheckMatchHuExist(resolver, transformerDetail.HuId);

                //自动生成序号
                int seq = FindMaxSeq(transformers.ToArray());
                transformerDetail.Sequence = seq + 1;
                //匹配:严格匹配ItemCode/UomCode/UnitCount/StorageBinCode/LotNo
                var query = 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
                if (query.Count() == 0)
                {
                    query = 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
                if (query.Count() == 0)
                {
                    query = transformers.Where
                    (t => (string.Equals(t.ItemCode, transformerDetail.ItemCode, StringComparison.OrdinalIgnoreCase)
                           && string.Equals(t.UomCode, transformerDetail.UomCode, StringComparison.OrdinalIgnoreCase)
                           ));
                }
                if (query.Count() > 0)
                {
                    List<Transformer> transformerList = query.ToList();
                    foreach (var transformer in transformerList)
                    {
                        if (transformer.Qty > transformer.CurrentQty || resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_STOCKTAKING)
                        {
                            List<TransformerDetail> transformerDetails = new List<TransformerDetail>();
                            foreach (var t in transformers)
                            {
                                if (t.TransformerDetails != null && t.TransformerDetails.Length > 0)
                                {
                                    foreach (var td in t.TransformerDetails)
                                    {
                                        if (td.HuId != null && td.HuId.ToLower() == transformerDetail.HuId.ToLower())
                                        {
                                            transformerDetails.Add(td);
                                        }
                                    }
                                }
                            }
                            if (transformerDetails.Count() == 1 && transformerDetails.Single().CurrentQty == 0M)
                            {
                                transformerDetails.Single().CurrentQty = transformerDetail.CurrentQty;
                                transformerDetails.Single().Sequence = transformerDetail.Sequence;
                                transformer.CurrentQty += transformerDetail.CurrentQty;
                                transformer.Cartons++;
                            }
                            else
                            {
                                AddTransformerDetail(transformer, transformerDetail);
                            }
                            break;
                        }
                    }
                }
                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.LotNo = transformerDetail.LotNo;
                    transformer.StorageBinCode = transformerDetail.StorageBinCode;
                    transformer.Cartons = 1;
                    transformer.Sequence = transformers.Count > 0 ? transformers.Max(t => t.Sequence) + 1 : 0;

                    AddTransformerDetail(transformer, transformerDetail);
                    transformers.Add(transformer);
                }
                //else
                //{
                //    //throw new Exception("Error on: Sconit_CS.Utility");
                //}
                resolver.Transformers = transformers.ToArray();
            }
            ProcessTransformer(resolver.Transformers);
            resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
        }
Exemple #9
0
        public static Transformer[] SumCurrentQty(Transformer[] transformerArray)
        {
            foreach (Transformer transformer in transformerArray)
            {
                transformer.CurrentQty = 0;
                transformer.Cartons = 0;
                foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                {
                    transformer.CurrentQty += transformerDetail.CurrentQty;
                    if (transformerDetail.CurrentQty != 0)
                    {
                        transformer.Cartons++;
                    }
                }

            }
            return transformerArray;
        }