コード例 #1
0
        public bool SetExport(MNIBDBDataContext ctx)
        {
            //ResetExport();

            if (Product == null)
            {
                // MessageBox.Show("Please elect Product");
                return(false);
            }


            List <ExportDetail> srdetails;

            if (SourceTransaction == "Sales Order")
            {
                if (CurrentHarvester == null && Barcode == null)
                {
                    MessageBox.Show("Please Enter Harvester or Barcode if items already Recieved.");
                    return(false);
                }
                if (CurrentHarvester != null)
                {
                    srdetails = ctx.ExportDetails.Where(x => x.ReceiptNumber.StartsWith(CurrentHarvester.Intials) &&
                                                        x.ReceiptNumber.Contains(Product.ProductId) &&
                                                        x.ReceiptNumber.Contains(ExportDate.ToString("yyyyMMdd"))).ToList();
                }
                else
                {
                    srdetails = ctx.ExportDetails.Where(x => x.ReceiptNumber.Contains(Barcode)).ToList();
                }
            }
            else
            {
                if (string.IsNullOrEmpty(TransactionNumber))
                {
                    // MessageBox.Show("Please Enter ExportNumber");
                    return(false);
                }
                srdetails = ctx.ExportDetails.Where(x => x.ReceiptNumber.Contains(TransactionNumber.ToString()) &&
                                                    x.ReceiptNumber.Contains(Barcode)).ToList();
            }

            //if (sr.ExportId == Export?.ExportId) return true;
            if (srdetails.Any()) //
            {
                // if (!VeifyBoxWeight()) return false;

                //ctx.ExportDetails.Where(x => x.ExportId == sr.ExportId).OrderByDescending(x => x.ExportDetailId).ToList().ForEach(x => ExportDetails.Add(x));

                srdetails.ForEach(x => ExportDetails.Add(x));
                var sr = ctx.Exports.FirstOrDefault(x => x.ExportId == srdetails.First().ExportId);
                Export = sr;
                // TotalWeight = (float) sr.TotalWeight;
                // OnPropertyChanged(nameof(TotalWeight));
                return(true);
            }

            return(false);
        }
コード例 #2
0
        public ExportCounterpariesData(IUnitOfWork uow)
        {
            this.Objects = new List <ObjectNode>();
            this.UoW     = uow;

            this.Version    = "1.0";
            this.ExportDate = DateTime.Now;
            Xml             = new XElement(
                "ExchangeFile",
                new XAttribute("FormatVersion", Version),
                new XAttribute("Generated", ExportDate.ToString("s"))
                );
        }
コード例 #3
0
        public XElement ToXml()
        {
            var xml = new XElement("ФайлОбмена",
                                   new XAttribute("ВерсияФормата", Version),
                                   new XAttribute("ДатаВыгрузки", ExportDate.ToString("s")),
                                   new XAttribute("НачалоПериодаВыгрузки", StartPeriodDate.ToString("s")),
                                   new XAttribute("ОкончаниеПериодаВыгрузки", EndPeriodDate.ToString("s")),
                                   new XAttribute("ИмяКонфигурацииИсточника", SourceName),
                                   new XAttribute("ИдПравилКонвертации", ConversionRulesId),
                                   new XAttribute("Комментарий", Comment)
                                   );

            xml.Add(ExchangeRules.ToXml());
            Objects.ForEach(obj => xml.Add(obj.ToXml()));
            return(xml);
        }
コード例 #4
0
 private string GetReceiptNumber(ExportDetail rd)
 {
     return(SourceTransaction == "Sales Order"? CurrentHarvester.Intials + "-" + ExportDate.ToString("yyyyMMdd") + "-" + Export.ProductNumber + "-" + (rd.LineNumber).ToString()
         : TransactionNumber + "-" + Barcode + "-" + (rd.LineNumber).ToString());
 }
コード例 #5
0
 private string GetReceiptNumber(ExportDetail rd)
 {
     return(SourceTransaction == "Sales Order" && CurrentHarvester != null ? CurrentHarvester?.Intials + ExportDate.ToString("yyyyMMdd") + rd.ProductCode + "." + (rd.LineNumber).ToString()
         : Barcode + "." + TransactionNumber + "-" + (rd.LineNumber).ToString());
 }