Beispiel #1
0
        public async Task InitializeAsync()
        {
            var filePath = Path.Combine("Data", "Sample_1.xml");
            var parser   = new XmlParser(new HPEParserDefinition());

            _data = await parser.ParseDocument(filePath, VariantType.HPE).ConfigureAwait(false);
        }
 static void Main() {
     var productRoot = new ProductRoot();
     var products = new List<Product>();
     products.Add(new Product() { Description = "A", Properties = new List<string> { "PropA" } });
     products.Add(new Product() { Description = "B", Properties = new List<string> { "PropB" } });
     productRoot.ProductList = products;
     Test(productRoot);
 }
        public async Task InitializeAsync()
        {
            var filePath = Path.Combine("Data", "HPInc", "pad_en_gb_global_product_L_1EQ04EA_18405003.xml");
            var parser   = new XmlParser(new HPIncParserDefinition());

            _data = await parser.ParseDocument(filePath, VariantType.HPInc).ConfigureAwait(false);

            _weightSpecification = _data.Specifications.LabeledItems.First(x => x.Name == "weightmet");
            _dimSpecification    = _data.Specifications.LabeledItems.First(x => x.Name == "dimenmet");
            _plNode  = _data.Hierarchy.First(x => x.PartnerHierarchyCode == "HPIncPL");
            _hpeNode = _data.Hierarchy.First(x => x.PartnerHierarchyCode == "HPInc");
        }
Beispiel #4
0
        public string Get(string LotSN)
        {
            ReturnModel returnModel = null;

            Lot lot = entity.Lot.Where(p => p.LotSN == LotSN).FirstOrDefault();
            MO  mo  = entity.MO.Where(p => p.MOName == LotSN).FirstOrDefault();

            if (mo != null || lot != null)
            {
                if (lot != null)
                {
                    mo = entity.MO.Where(p => p.MOId == lot.MOId).FirstOrDefault();
                }

                Product product = entity.Product.Where(p => p.ProductId == mo.ProductId).FirstOrDefault();

                ProductRoot pr = entity.ProductRoot.Where(p => p.ProductRootId == product.ProductRootId).FirstOrDefault();


                SO so = entity.SO.Where(p => p.SOName == mo.SOName).FirstOrDefault();

                Customer cus = new Customer();

                if (so != null)
                {
                    cus = entity.Customer.Where(p => p.CustomerId == so.CustomerId).FirstOrDefault();
                }

                if (mo != null)
                {
                    returnModel = new ReturnModel(new { mo, product, pr, so, cus, lot }, true);
                }
                else
                {
                    returnModel = new ReturnModel(false, "批号不存在");
                }
            }
            else
            {
                returnModel = new ReturnModel(false, "订单号不存在");
            }

            string json = JsonConvert.SerializeObject(returnModel);

            return(json);
        }
Beispiel #5
0
        public ActionResult Index(WXSaleAfterMain main)
        {
            ObjectParameter ftpparameter = new ObjectParameter("PKID", typeof(string));

            entity.SysGetObjectPKId(null, "FtpFile", ftpparameter);


            if (Request.Files.Count > 0 && !string.IsNullOrEmpty(Request.Files[0].FileName))
            {
                Request.Files[0].SaveAs(Server.MapPath("~/App_Data/") + Request.Files[0].FileName);

                int lastindex = Request.Files[0].FileName.LastIndexOf(".");

                string postfix = Request.Files[0].FileName.Substring(lastindex);

                try
                {
                    FTPHelper.FtpUploadBroken(Server.MapPath("~/App_Data/") + Request.Files[0].FileName, "MesSaleAfter", (string)ftpparameter.Value + postfix);

                    main.Filename = (string)ftpparameter.Value + postfix;
                }
                catch (Exception ex)
                {
                    ViewBag.Content = ex.Message;

                    return(View("Done"));
                }
            }

            entity.WXSaleAfterMain.Add(main);

            entity.SaveChanges();

            if (main.ServiceReason == "故障检查维修" || main.ServiceReason == "安装调试" || main.ServiceReason == "日常回访" || main.ServiceReason == "其他")
            {
                if (main.IsXJR == "否")
                {
                    ObjectParameter parameter = new ObjectParameter("PKID", typeof(string));

                    entity.SysGetObjectPKId(null, "Ter_Customer_Com_Records", parameter);

                    Ter_Customer_Com_Records tccr = new Ter_Customer_Com_Records();

                    tccr.Ter_Customer_Com_RecordsId = (string)parameter.Value;

                    tccr.MOName = main.MoID;

                    if (!string.IsNullOrEmpty(main.MoID))
                    {
                        MO mo = entity.MO.Where(p => p.MOName == main.MoID).FirstOrDefault();

                        //tccr.MOName = mo.MOName;
                        if (mo != null)
                        {
                            tccr.MachineNo = mo.SAP_CHARG;
                        }
                    }



                    int serialNumber = (int)entity.Ter_Customer_Com_Records.Max(p => p.SerialNumber);

                    tccr.SerialNumber = serialNumber + 1;



                    tccr.ComplaintTime = DateTime.Now;

                    tccr.ComplaintContent = main.ProblemDescription;

                    tccr.CustomerAddress = main.CustomerAddress;

                    tccr.CustomerContact = main.CustomerContact + "," + main.CustomerPhone;

                    tccr.CustomerName = main.CustomerName;

                    tccr.DefectType = main.ProblemType;

                    tccr.CustomerId = main.ID.ToString();

                    tccr.ProblemCompletion = "进行中";

                    tccr.CreateDate = DateTime.Now;

                    tccr.WorkflowStepId = "WFS10000033Z";

                    tccr.WorkflowStatus = "1";



                    if (!string.IsNullOrEmpty(main.Filename))
                    {
                        FtpFile ftpfile = new FtpFile();

                        ftpfile.FtpFileId = (string)ftpparameter.Value;

                        ftpfile.FtpFileName = main.Filename;

                        ftpfile.FtpDirectory = "";

                        ftpfile.FtpFileSize = 0;

                        ftpfile.PluginCommand = "TCCR";

                        ftpfile.UploadUser = main.UserName;

                        ftpfile.UploadComputer = "";

                        ftpfile.CreateDate = DateTime.Now;

                        ftpfile.PKId = (string)parameter.Value;

                        entity.FtpFile.Add(ftpfile);

                        tccr.ImageID = (string)ftpparameter.Value;
                    }

                    entity.Ter_Customer_Com_Records.Add(tccr);
                    entity.SaveChanges();
                }
                else
                {
                    ObjectParameter parameter = new ObjectParameter("PKID", typeof(string));

                    entity.SysGetObjectPKId(null, "Q_issue_Rec_ForCustomer", parameter);

                    Q_issue_Rec_ForCustomer qirf = new Q_issue_Rec_ForCustomer();

                    qirf.Q_issue_Rec_ForCustomerId = (string)parameter.Value;

                    qirf.OrderName = main.MoID;

                    if (!string.IsNullOrEmpty(main.MoID))
                    {
                        MO mo = entity.MO.Where(p => p.MOName == main.MoID).FirstOrDefault();

                        ///qirf.OrderName = mo.MOName;
                        if (mo != null)
                        {
                            qirf.MachineNo = mo.SAP_CHARG;
                        }
                    }

                    qirf.CustomerId = "CUS10000027Y";

                    ProductRoot pr = entity.ProductRoot.Where(p => p.ProductName == main.ProductID).FirstOrDefault();

                    if (pr != null)
                    {
                        qirf.ProductID = pr.DefaultProductId;
                    }

                    qirf.FeedbackDate = DateTime.Now;

                    qirf.IssueDesc = main.ProblemDescription;

                    if (!string.IsNullOrEmpty(main.Filename))
                    {
                        FtpFile ftpfile = new FtpFile();

                        ftpfile.FtpFileId = (string)ftpparameter.Value;

                        ftpfile.FtpFileName = main.Filename;

                        ftpfile.FtpDirectory = "";

                        ftpfile.FtpFileSize = 0;

                        ftpfile.PluginCommand = "QIRF";

                        ftpfile.UploadUser = main.UserName;

                        ftpfile.UploadComputer = "";

                        ftpfile.CreateDate = DateTime.Now;

                        ftpfile.PKId = (string)parameter.Value;

                        entity.FtpFile.Add(ftpfile);

                        qirf.Image4ID = (string)ftpparameter.Value;
                    }

                    qirf.WorkflowStepId = "WFS10000033X";

                    qirf.WorkflowStatus = "1";

                    entity.Q_issue_Rec_ForCustomer.Add(qirf);
                    entity.SaveChanges();
                }
            }



            ViewBag.Content = "添加售后维护单成功!";

            return(View("Done"));
        }
 public ProductExporter(ProductRoot productRoot, ICollection <IntegrationSetting> integrationSettings)
 {
     _productRoot         = productRoot;
     _integrationSettings = integrationSettings;
 }
Beispiel #7
0
        public static Item ToItem(this ProductRoot input) {
            var product = input.Product;
            var detail = input.Detail;
            var links = input.Links;
            var hierarchies = input.Hierarchy;
            var marketing = input.Marketing;
            var specifications = input.Specifications;
            var options = input.Options;
            decimal? height = null;
            decimal? width = null;
            decimal? depth = null;

            if (specifications.LabeledItems.TryFindDimensionsInSpecifications(out var dim, "dimenmet", "dimenus")) {
                if (dim != null) {
                    var dimension = dim.Value;
                    height = dimension.GetHeightInMillimeter();
                    width = dimension.GetWidthInMillimeter();
                    depth = dimension.GetDepthInMillimeter();
                }
            }

            var arr = new string[input.ProductVariants.Count + 1];
            arr[0] = "";
            for (var i = 0; i < input.ProductVariants.Count; i++) arr[i + 1] = input.ProductVariants[i].Opt;
            return new Item {
                PartnerPartNumber = input.PartnerPartNumber,
                Product = {
                    PartnerPartNumber = product.PartnerPartNumber,
                    PartNumber = product.PartNumber,
                    CategoryID = product.CategoryID,
                    CategoryName = product.CategoryName,
                    PartnerHierarchyCode = product.PartnerHierarchyCode,
                    AlternateCategoryID = input.Product.AlternateCategoryID,
                    AlternateCategoryName = product.AlternateCategoryName,
                    AlternatePartnerHierarchyCode = product.AlternatePartnerHierarchyCode,
                    Description = product.Description,
                    DescriptionLong = product.DescriptionLong ?? product.Description,
                    ChangeDate = product.ChangeDate,
                    IsEol = product.IsEol,
                    ManufacturerCode = product.ManufacturerCode,
                    ManufacturerName = product.ManufacturerName,
                    ProductCode = product.ProductCode
                },
                Detail = {
                    PartnerPartNumber = input.PartnerPartNumber,
                    Unspsc = detail.Unspsc,
                    //ProductPartnerID = detail.ProductPartnerID,
                    EndOfSupport = detail.EndOfSupport,
                    Weight = detail.Weight ??
                             specifications.LabeledItems.TryFindWeightInSpecifications("weightmet", "weightus"),
                    WeightwithPackage = detail.WeightWithPackage,
                    Volume = detail.Volume,
                    PalletSize = detail.PalletSize,
                    Width = detail.Width ?? width,
                    Height = detail.Height ?? height,
                    Depth = detail.Depth ?? depth,
                    PackQty = detail.PackQty,
                    MinimumOrderQty = detail.MinimumOrderQty,
                    IsRequireSerialNumber = detail.IsRequireSerialNumber,
                    ManufacturingCountry = detail.ManufacturingCountry,
                    CustomsStatisticsNumber = detail.CustomsStatisticsNumber,
                    ExtendedWarranty = detail.ExtendedWarranty,
                    ErpAltPartNumber = detail.ErpAltPartNumber,
                    TeleSalesFlag = detail.TeleSalesFlag,
                    ItemDefFulfillSource = detail.ItemDefFulfillSource,
                    MeterEnabled = detail.MeterEnabled,
                    SwedishChemicalTaxReduction = detail.SwedishChemicalTaxReduction,
                    WarrantyTime = detail.WarrantyTime
                },
                Link = {
                    PartnerPartNumber = input.PartnerPartNumber,
                    PdfLinkDataSheet = links.PdfLinkDataSheet,
                    PdfLinkManual = links.PdfLinkManual,
                    Images = links.SelectedImages.Select(x => new Image {
                            ContentType = x.ContentType,
                            Height = x.Height,
                            Width = x.Width,
                            Url = x.ImageUrlHttp,
                            Title = x.FullTitle
                        }
                    ).ToList()
                },
                Hierarchies = {
                    PartnerPartNumber = input.PartnerPartNumber,
                    Items = hierarchies.Select(x =>
                        new Model.Hierarchy {
                            CategoryID = x.CategoryID,
                            CategoryName = x.CategoryName,
                            Level = x.Level,
                            Name = x.Name,
                            ParentCategoryID = x.ParentCategoryID
                        }
                    ).ToList()
                },
                Marketing = {
                    PartnerPartNumber = input.PartnerPartNumber,
                    LanguageId = input.LanguageId,
                    MarketingCode = marketing.MarketingCode,
                    MarketingText = marketing.MarketingText
                },
                Specifications = {
                    PartnerPartNumber = input.PartnerPartNumber,
                    Items = specifications.LabeledItems.Select(x => new Specification {
                        GroupId = x.GroupId,
                        GroupName = x.GroupName,
                        Id = x.Id,
                        Name = x.Name,
                        Type = x.Type,
                        UnitOfMeasure = x.UnitOfMeasure,
                        Value = x.Value,
                        Label = x.Label
                    }).ToList()
                },
                Supplier = {
                    PartnerPartNumber = input.PartnerPartNumber,
                    SupplierId = product.ManufacturerCode,
                    SupplierName = product.ManufacturerName
                },
                Options = {
                    PartnerPartNumber = input.PartnerPartNumber,
                    Items = options.Items.Select(x => new Option {
                        GroupId = x.OptionGroupCode.RemoveLineEndings(),
                        GroupName = x.OptionGroupName.RemoveLineEndings(),
                        Name = x.ManufacturerCode.RemoveLineEndings(),
                        PartNumber = x.OptionPartnerPartNumber.RemoveLineEndings()
                    }).ToList()
                },
                ProductVariants = arr
            };
        }