コード例 #1
0
ファイル: UCDevanning.cs プロジェクト: Novthirteen/yfkey-scms
        protected override void gvHuListDataBind()
        {
            base.gvHuListDataBind();
            TransformerDetail[] transformerArray = new TransformerDetail[] { };
            this.lblBarCode.Text = "大箱";
            if (this.resolver.Transformers != null
                && this.resolver.Transformers.Length > 0
                && this.resolver.Transformers[0].TransformerDetails != null)
            {
                transformerArray = this.resolver.Transformers[0].TransformerDetails;
            }
            if (this.resolver.IOType == BusinessConstants.IO_TYPE_OUT)
            {
                if (isHasOutDetail)
                {
                    transformerArray = this.resolver.Transformers[1].TransformerDetails;
                }
                this.lblBarCode.Text = "小箱";
            }
            ts.MappingName = transformerArray.GetType().Name;
            this.dgList.DataSource = transformerArray;
            //ts = new DataGridTableStyle();
            //ts.GridColumnStyles.Add(columnHuId);
            //ts.GridColumnStyles.Add(columnStorageBinCode);
            //ts.GridColumnStyles.Add(columnCurrentQty);
            //ts.GridColumnStyles.Add(columnItemDescription);

            //this.dgList.TableStyles.Clear();
            //this.dgList.TableStyles.Add(ts);

            //this.ResumeLayout();
            //this.tbBarCode.Text = string.Empty;
        }
コード例 #2
0
ファイル: Utility.cs プロジェクト: Novthirteen/yfkey-scms
 private static int GetSumCartons(TransformerDetail[] transformerDetails)
 {
     var q = (from td in transformerDetails
              where td.CurrentQty != 0 && td.HuId != null && td.HuId.Trim() != string.Empty
              select td).Count();
     return q;
 }
コード例 #3
0
ファイル: Utility.cs プロジェクト: Novthirteen/yfkey-scms
        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();
                }
            }
        }
コード例 #4
0
ファイル: Utility.cs プロジェクト: Novthirteen/yfkey-scms
 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++;
     }
 }
コード例 #5
0
ファイル: Utility.cs プロジェクト: Novthirteen/yfkey-scms
        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;
        }
コード例 #6
0
ファイル: Utility.cs プロジェクト: Novthirteen/yfkey-scms
 private static decimal AccumlationCurrentQty(TransformerDetail[] transformerDetails)
 {
     if (transformerDetails == null)
     {
         return 0m;
     }
     var q = (from td in transformerDetails
              select td.CurrentQty).Sum();
     return q;
 }
コード例 #7
0
ファイル: Utility.cs プロジェクト: Novthirteen/yfkey-scms
 public static Resolver MergeResolver(Resolver resolver, Resolver originalResolver)
 {
     if (originalResolver.BarcodeHead == BusinessConstants.BARCODE_HEAD_DEFAULT
         && resolver.Transformers != null)
     {
         foreach (Transformer t in originalResolver.Transformers)
         {
             if (t.TransformerDetails != null)
             {
                 foreach (TransformerDetail td in t.TransformerDetails)
                 {
                     if (td.CurrentQty > 0)
                     {
                         TransformerDetail transformerDetail = new TransformerDetail();
                         CopyProperty(td, transformerDetail);
                         AddTransformerDetail(resolver, transformerDetail);
                     }
                 }
             }
         }
         //Transformer[] transformers = resolver.Transformers;
         //DeepCopyResolver(originalResolver, resolver);
         //resolver.Transformers = transformers;
     }
     else if (originalResolver.BarcodeHead == BusinessConstants.BARCODE_HEAD_LOCATION
         || originalResolver.BarcodeHead == BusinessConstants.BARCODE_HEAD_BIN)
     {
         Transformer[] transformers = resolver.Transformers;
         DeepCopyResolver(originalResolver, resolver);
         resolver.Transformers = transformers;
     }
     else
     {
         DeepCopyResolver(originalResolver, resolver);
     }
     resolver.BarcodeHead = originalResolver.BarcodeHead;
     return resolver;
 }