Exemplo n.º 1
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            string param        = requestPostData["ConsignSysNo"];
            int    ConsignSysNo = 0;

            DataTable table      = CreatePrintData();
            DataTable errorTable = new DataTable();

            try
            {
                if (!int.TryParse(param, out ConsignSysNo))
                {
                    throw new BizException(string.Format("非法的结算单号{0}", param));
                }

                InitData(ConsignSysNo, table);
            }
            catch (BizException ex)
            {
                InitErrorTable(ex, errorTable);
            }

            tableVariables.Add("Error", errorTable);
            tableVariables.Add("ConsignLeasePrint", table);
        }
Exemplo n.º 2
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            string param      = requestPostData["GroupSysNo"];
            int    GroupSysNo = 0;

            DataTable table      = CreatePrintData();
            DataTable errorTable = new DataTable();

            try
            {
                if (!int.TryParse(param, out GroupSysNo))
                {
                    throw new BizException(string.Format(ResouceManager.GetMessageString("MKT.Promotion.GroupBuying", "GroupBuying_IllegalGroupID"), param));
                }

                InitData(GroupSysNo, table);
            }
            catch (BizException ex)
            {
                InitErrorTable(ex, errorTable);
            }

            tableVariables.Add("Error", errorTable);
            tableVariables.Add("ConsignLeasePrint", table);
        }
Exemplo n.º 3
0
        public void BuildData(NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            int           soSysNo        = 0;
            int           warhouseNumber = 0;
            string        param          = requestPostData["SOSysNo"];
            string        param1         = requestPostData["WareHouseNumber"];
            SOInvoiceInfo soInvoice      = null;
            bool          hasError       = false;

            DataTable table      = CreatePrintData();
            DataTable errorTable = new DataTable();

            try
            {
                if (!int.TryParse(param, out soSysNo))
                {
                    throw new BizException(string.Format(ResouceManager.GetMessageString("Invoice.InvoicePrint", "InvoicePrint_IllegalOrderID"), param));
                }
                if (!int.TryParse(param1, out warhouseNumber))
                {
                    throw new BizException(string.Format(ResouceManager.GetMessageString("Invoice.InvoicePrint", "InvoicePrint_IllegalStockID"), param1));
                }

                soInvoice = ObjectFactory <InvoiceReportProcessor> .Instance.GetNew(new SOInvoiceInfo
                {
                    SOInfo = new SOInfo
                    {
                        SOSysNo    = soSysNo,
                        StockSysNo = warhouseNumber
                    },
                    InvoiceInfoList = new List <InvoiceInfo>()
                });
            }
            catch (BizException ex)
            {
                hasError = true;
                InitErrorTable(ex, errorTable);
            }

            if (!hasError)
            {
                InitData(soInvoice, table);
            }
            tableVariables.Add("Error", errorTable);
            tableVariables.Add("PrintInvoiceDetail", table);
        }
Exemplo n.º 4
0
        public void BuildData(NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            if (requestPostData != null)
            {
                variables.Add("TotalAmount", HttpUtility.UrlDecode(requestPostData["TotalAmount"]));
            }
            int       count;
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("VendorName");
            dataTable.Columns.Add("InvoiceTime");
            dataTable.Columns.Add("InputTime");
            dataTable.Columns.Add("TotalAmt");
            dataTable.Columns.Add("InvoiceNumber");

            if (int.TryParse(requestPostData["InvoiceCount"], out count))
            {
                DataRow row;
                for (int i = 0; i < count; i++)
                {
                    row = dataTable.NewRow();
                    row["VendorName"]    = HttpUtility.UrlDecode(requestPostData["V" + i]);
                    row["InvoiceTime"]   = HttpUtility.UrlDecode(requestPostData["I" + i]);
                    row["InputTime"]     = HttpUtility.UrlDecode(requestPostData["T" + i]);
                    row["TotalAmt"]      = HttpUtility.UrlDecode(requestPostData["A" + i]);
                    row["InvoiceNumber"] = HttpUtility.UrlDecode(requestPostData["N" + i]);
                    dataTable.Rows.Add(row);
                }
            }
            tableVariables.Add("InvoiceDetailList", dataTable);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 操作人、
        /// 处理的订单总数量、
        /// 已解决的订单数量、
        /// 未解决的订单数量、
        /// 解决率(已解决的数量/订单总数量*100%)
        /// </summary>
        /// <param name="reports"></param>
        void SendMail(List <InternalMemoReport> reports)
        {
            KeyValueVariables replaceContent = new KeyValueVariables();

            replaceContent.AddKeyValue("#Time#", DateTime.Now.ToString());

            DataTable tableList = new DataTable();

            tableList.Columns.AddRange(new DataColumn[]
            {
                new DataColumn("UserName"),
                new DataColumn("Count"),
                new DataColumn("ResolvedCount"),
                new DataColumn("UnResolvedCount"),
                new DataColumn("ResolvedRate")
            });
            foreach (var item in reports)
            {
                tableList.Rows.Add(item.UserName, item.Count, item.ResolvedCount, item.UnResolvedCount, item.ResolvedRate);
            }
            KeyTableVariables tableContent = new KeyTableVariables();

            tableContent.Add("tbData", tableList);

            ExternalDomainBroker.SendEmail(m_emailTO, m_emailCC, "", "SO_InternalMemoReport", replaceContent, tableContent, false, true);
        }
Exemplo n.º 6
0
        public void BuildData(NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            string sysNo = requestPostData["SysNo"];

            if (!string.IsNullOrEmpty(sysNo))
            {
                int refundSysNo;

                if (int.TryParse(sysNo, out refundSysNo))
                {
                    var     refundInfo = GetRefundInfo(refundSysNo);
                    decimal?totalAmt   = refundInfo.Items.Sum(p =>
                    {
                        if (!p.IsPoint)
                        {
                            return(p.TotalAmount);
                        }
                        return(0);
                    });
                    if (refundInfo.CashAmount != null && refundInfo.CashAmount != 0)
                    {
                        variables.Add("JsFunction", "sf();");
                        variables.Add("SOSysNo", refundInfo.SOSysNo);
                        variables.Add("Now", DateTime.Now.ToShortDateString());
                        variables.Add("AuditUserName", refundInfo.AuditUserName);
                        variables.Add("ReceiveName", refundInfo.ReceiveName);
                        variables.Add("CustomerSysNo", refundInfo.CustomerSysNo);
                        variables.Add("CustomerName", refundInfo.CustomerName);
                        variables.Add("ReceiveAddress", refundInfo.ReceiveAddress);
                        variables.Add("ReceivePhone", refundInfo.ReceivePhone);
                        variables.Add("InvoiceNote", refundInfo.InvoiceNote);
                        variables.Add("PayTypeName", refundInfo.PayTypeName);
                        variables.Add("ShipTypeName", refundInfo.ShipTypeName);
                        variables.Add("RefundID", refundInfo.RefundID);
                        variables.Add("TotalAmount", ToLowerChineseMoney(totalAmt.Value));
                        variables.Add("ChineseTotalAmount", ToUpperChineseMoney(totalAmt.Value));
                    }

                    DataTable t = new DataTable();
                    t.Columns.Add("ProductID");
                    t.Columns.Add("ProductName");
                    t.Columns.Add("PrintPrice");
                    t.Columns.Add("PrintQuantity");
                    t.Columns.Add("PrintTotalAmount");

                    if (refundInfo.Items != null)
                    {
                        refundInfo.Items.ForEach(p =>
                        {
                            t.Rows.Add(p.ProductID, p.ProductName, p.Price, p.Quantity, p.PrintTotalAmount);
                        });
                    }

                    tableVariables.Add("RefundItems", t);
                }
            }
        }
Exemplo n.º 7
0
        public void PriceChangedSendMail(SOInfo soInfo)
        {
            try
            {
                List <SOInternalMemoInfo> memoList = ObjectFactory <SOInternalMemoProcessor> .Instance.GetBySOSysNo(soInfo.SysNo.Value);

                List <int> productSysNoList = (from item in soInfo.Items
                                               select item.ProductSysNo.Value).ToList();
                List <ECCentral.BizEntity.IM.ProductInfo> productList = ExternalDomainBroker.GetProductInfoListByProductSysNoList(productSysNoList);
                if (productList != null)
                {
                    DataTable dtMemo = new DataTable();
                    dtMemo.Columns.AddRange(new DataColumn[]
                    {
                        new DataColumn("LogTime"),
                        new DataColumn("Content"),
                        new DataColumn("Note")
                    });
                    productList.ForEach(p =>
                    {
                        SOItemInfo item = soInfo.Items.Find(i => i.ProductSysNo.Value == p.SysNo);
                        if (item != null)
                        {
                            KeyValueVariables keyValueVariables = new KeyValueVariables();
                            KeyTableVariables keyTableVariables = new KeyTableVariables();
                            string pmEmailAddress  = p.ProductBasicInfo.ProductManager.UserInfo.EmailAddress;
                            StringBuilder mailBody = new StringBuilder();
                            keyValueVariables.Add("SOSysNo", soInfo.SysNo.Value);
                            keyValueVariables.Add("ProductID", item.ProductID);
                            keyValueVariables.Add("ProductName", item.ProductName);
                            keyValueVariables.Add("Quantity", item.Quantity);
                            keyValueVariables.Add("Weight", item.Weight);
                            keyValueVariables.Add("Price", item.Price);
                            keyValueVariables.Add("GainAveragePoint", item.GainAveragePoint);
                            keyValueVariables.Add("PromotionAmount", item.PromotionAmount);
                            keyValueVariables.Add("Warranty", item.Warranty);
                            if (memoList != null && memoList.Count > 0 && dtMemo.Rows.Count == 0)
                            {
                                foreach (SOInternalMemoInfo internalMemo in memoList)
                                {
                                    DataRow dr    = dtMemo.NewRow();
                                    dr["LogTime"] = internalMemo.LogTime.HasValue ? internalMemo.LogTime.Value.ToString(SOConst.DateTimeFormat) : String.Empty;
                                    dr["Content"] = internalMemo.Content;
                                    dr["Note"]    = internalMemo.Note;
                                    dtMemo.Rows.Add(dr);
                                }
                            }
                            keyValueVariables.Add("MemoListDisplay", dtMemo.Rows.Count > 0);
                            keyTableVariables.Add("MemoList", dtMemo);
                            ExternalDomainBroker.SendInternalEmail("SO_Product_PriceChanged", keyValueVariables, keyTableVariables);
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.HandleException(ex);
            }
        }
Exemplo n.º 8
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();
            string sysNo = requestPostData["SysNo"];

            if (sysNo != null && sysNo.Trim() != String.Empty)
            {
                sysNo = System.Web.HttpUtility.UrlDecode(sysNo);
                int requestSysNo = int.TryParse(sysNo, out requestSysNo) ? requestSysNo : int.MinValue;

                if (requestSysNo > int.MinValue)
                {
                    AdjustRequestInfo requestInfo = ObjectFactory <AdjustRequestAppService> .Instance.GetAdjustRequestInfoBySysNo(requestSysNo);

                    variables.Add("SelfCompanyName", ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Company_Name"));
                    variables.Add("SelfCompanyAddress", ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Company_Address"));
                    variables.Add("SelfCompanyPhone", ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Company_Phone"));
                    variables.Add("SelfCompanyWebAddress", ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Company_Url"));
                    variables.Add("CreateUser", requestInfo.CreateUser.UserDisplayName);
                    variables.Add("CreateDate", requestInfo.CreateDate.HasValue ? requestInfo.CreateDate.Value.ToString(SOConst.LongTimeFormat) : string.Empty);
                    variables.Add("AuditUser", requestInfo.AuditUser.UserDisplayName);
                    variables.Add("AuditDate", requestInfo.AuditDate.HasValue ? requestInfo.AuditDate.Value.ToString(SOConst.LongTimeFormat) : string.Empty);
                    variables.Add("RequestSysNo", requestInfo.RequestID);
                    variables.Add("Stock", requestInfo.Stock == null ? "" : requestInfo.Stock.StockName);
                    variables.Add("Status", requestInfo.RequestStatus.ToDisplayText());
                    variables.Add("OutStockUser", requestInfo.OutStockUser.UserDisplayName);
                    variables.Add("OutStockDate", requestInfo.OutStockDate.HasValue ? requestInfo.OutStockDate.Value.ToString(SOConst.LongTimeFormat) : string.Empty);
                    variables.Add("Note", requestInfo.Note);

                    DataTable dtProduct = new DataTable();
                    dtProduct.Columns.AddRange(new System.Data.DataColumn[]
                    {
                        new DataColumn("ProductID"),
                        new DataColumn("ProductName"),
                        new DataColumn("Price"),
                        new DataColumn("Quantity"),
                        new DataColumn("Amount")
                    });
                    decimal totalAmount = 0M;
                    requestInfo.AdjustItemInfoList.ForEach(p =>
                    {
                        totalAmount             += p.AdjustQuantity * p.AdjustCost;
                        DataRow drProduct        = dtProduct.NewRow();
                        drProduct["ProductID"]   = p.AdjustProduct.ProductID;
                        drProduct["ProductName"] = p.AdjustProduct.ProductBasicInfo.ProductTitle;
                        drProduct["Price"]       = p.AdjustCost.ToString("N2");
                        drProduct["Quantity"]    = p.AdjustQuantity;
                        drProduct["Amount"]      = (p.AdjustQuantity * p.AdjustCost).ToString("N2");
                        dtProduct.Rows.Add(drProduct);
                    });
                    variables.Add("TotalAmount", totalAmount.ToString("N2"));
                    tableVariables.Add("ProductList", dtProduct);
                }
            }
        }
Exemplo n.º 9
0
        public void SendProductRingEmail(string emailTemplate, List <ProductRingDetailInfo> detailList)
        {
            if (null != detailList && detailList.Count > 0)
            {
                DataTable dtProduct = new DataTable();
                dtProduct.Columns.AddRange(new DataColumn[]
                {
                    new DataColumn("ProductID"),
                    new DataColumn("ProductName"),
                    new DataColumn("BatchNumber"),
                    new DataColumn("ActualQty"),
                    new DataColumn("LeftRingDays"),
                });

                KeyTableVariables keyTablesVariables = new KeyTableVariables();
                KeyValueVariables keyValueVariables  = new KeyValueVariables();

                keyValueVariables.Add("Receiver", detailList[0].Email);

                detailList.ForEach(p =>
                {
                    DataRow dr         = dtProduct.NewRow();
                    dr["ProductID"]    = p.ProductID;
                    dr["ProductName"]  = p.ProductName;
                    dr["BatchNumber"]  = p.BatchNumber;
                    dr["ActualQty"]    = p.ActualQty;
                    dr["LeftRingDays"] = p.LeftRingDays;

                    dtProduct.Rows.Add(dr);
                });

                keyTablesVariables.Add("ProductList", dtProduct);

                ExternalDomainBroker.SendInternalEmail(detailList[0].Email.Trim(), emailTemplate, keyValueVariables, keyTablesVariables);
                //ExternalDomainBroker.SendExternalEmail(detailList[0].Email, emailTemplate, keyValueVariables, keyTablesVariables,"zh-CN");
            }
        }
Exemplo n.º 10
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();
            string sysNo = requestPostData["SysNo"];

            if (sysNo != null && sysNo.Trim() != String.Empty)
            {
                sysNo = System.Web.HttpUtility.UrlDecode(sysNo);
                int requestSysNo = int.TryParse(sysNo, out requestSysNo) ? requestSysNo : int.MinValue;

                if (requestSysNo > int.MinValue)
                {
                    PriceChangeMaster requestInfo = ObjectFactory <PriceChangeAppService> .Instance.GetPriceChangeBySysNo(requestSysNo);

                    if (requestInfo.PriceType == BizEntity.Invoice.RequestPriceType.SalePrice)
                    {
                        variables.Add("PrintTitle", "销售变价单");
                    }
                    else if (requestInfo.PriceType == BizEntity.Invoice.RequestPriceType.PurchasePrice)
                    {
                        variables.Add("PrintTitle", "采购变价单");
                    }
                    variables.Add("SysNo", requestInfo.SysNo.ToString().Trim().PadLeft(8, '0'));
                    variables.Add("RealBeginDate", requestInfo.RealBeginDate.HasValue ? requestInfo.RealBeginDate.Value.ToLongDateString().Trim() : string.Empty);
                    variables.Add("BeginDate", requestInfo.BeginDate.HasValue ? requestInfo.BeginDate.Value.ToLongDateString().Trim() : string.Empty);
                    variables.Add("EndDate", requestInfo.EndDate.HasValue ? requestInfo.EndDate.Value.ToLongDateString().Trim() : string.Empty);
                    variables.Add("BillInDate", DateTime.Now.ToLongDateString());
                    variables.Add("IsPurchasePrice", requestInfo.PriceType == BizEntity.Invoice.RequestPriceType.PurchasePrice);
                    variables.Add("IsSalePrice", requestInfo.PriceType == BizEntity.Invoice.RequestPriceType.SalePrice);

                    DataTable dtProduct = new DataTable();
                    dtProduct.Columns.AddRange(new System.Data.DataColumn[]
                    {
                        new DataColumn("ProductID"),
                        new DataColumn("ProductName"),
                        new DataColumn("OldPrice"),
                        new DataColumn("NewPrice"),
                        new DataColumn("DiffPrice"),

                        new DataColumn("OldShowPrice"),
                        new DataColumn("NewShowPrice"),

                        new DataColumn("OldInstockPrice"),
                        new DataColumn("NewInstockPrice"),
                        new DataColumn("DiffInstockPrice"),

                        new DataColumn("IsPurchasePrice"),
                        new DataColumn("IsSalePrice")
                    });

                    if (requestInfo.ItemList != null)
                    {
                        requestInfo.ItemList.ForEach(p =>
                        {
                            DataRow drProduct        = dtProduct.NewRow();
                            drProduct["ProductID"]   = p.ProductID;
                            drProduct["ProductName"] = p.ProductName.Trim();
                            drProduct["OldPrice"]    = p.OldPrice.ToString("N2");
                            drProduct["NewPrice"]    = p.NewPrice == 0 ? "---" : p.NewPrice.ToString("N2");
                            drProduct["DiffPrice"]   = (p.NewPrice - p.OldPrice).ToString("N2");

                            drProduct["OldShowPrice"]     = p.OldShowPrice.ToString("N2");
                            drProduct["NewShowPrice"]     = p.NewShowPrice == 0 ? "---" : p.NewShowPrice.ToString("N2");
                            drProduct["OldInstockPrice"]  = p.OldInstockPrice.ToString("N2");
                            drProduct["NewInstockPrice"]  = p.NewInstockPrice == 0 ? "---" : p.NewInstockPrice.ToString("N2");
                            drProduct["DiffInstockPrice"] = (p.NewInstockPrice - p.OldInstockPrice).ToString("N2");

                            drProduct["IsPurchasePrice"] = requestInfo.PriceType == BizEntity.Invoice.RequestPriceType.PurchasePrice;
                            drProduct["IsSalePrice"]     = requestInfo.PriceType == BizEntity.Invoice.RequestPriceType.SalePrice;

                            dtProduct.Rows.Add(drProduct);
                        });
                    }

                    tableVariables.Add("ProductList", dtProduct);
                }
            }
        }
Exemplo n.º 11
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            CostChangeAppService CostChangeAppServiceInstance = ObjectFactory <CostChangeAppService> .Instance;

            //获取参数
            string costChangeSysNoStr = requestPostData["CostChangeSysNo"];
            int    costChangeSysNo    = int.Parse(costChangeSysNoStr);

            CostChangeInfo costChangeInfo = CostChangeAppServiceInstance.LoadCostChangeInfo(costChangeSysNo);

            //变价单编号
            variables.AddKeyValue("CostChangeinfoSysNo", costChangeInfo.SysNo.Value.ToString());
            //合同号
            variables.AddKeyValue("ContractNo", "");

            //供应商
            VendorAppService VendorAppServiceInstance = ObjectFactory <VendorAppService> .Instance;

            var        vendorNo   = costChangeInfo.CostChangeBasicInfo.VendorSysNo;
            VendorInfo vendorInfo = VendorAppServiceInstance.LoadVendorInfoBySysNo(vendorNo);
            var        vendorName = vendorInfo.VendorBasicInfo.VendorNameLocal;

            variables.AddKeyValue("VendorName", vendorName);

            //部门
            variables.AddKeyValue("DepartmentName", "商品部");

            //制表时间
            var curentDataStr = DateTime.Now.Date.ToString("yyyy-MM-dd");

            variables.AddKeyValue("CurentDate", curentDataStr);

            DataTable dt = new DataTable();

            //商品ID
            dt.Columns.Add("ProductID");
            //商品名称
            dt.Columns.Add("ProductName");
            //税率
            dt.Columns.Add("TaxRange");
            //变价数量
            dt.Columns.Add("ChangeCount");
            //原进价
            dt.Columns.Add("OldPrice");
            //新进价
            dt.Columns.Add("NewPrice");
            //变价金额
            dt.Columns.Add("ChaneAmount");
            //变价税金
            dt.Columns.Add("ChaneTax");
            //采购单编号
            dt.Columns.Add("OrderNo");
            //备注
            dt.Columns.Add("Memo");

            tableVariables.Add("tableCostChangeDetial", dt);

            Func <PurchaseOrderTaxRate, decimal, decimal> Shuijin = (a, b) =>
            {
                return(((decimal)(((int)a) / 100.00)) * b / ((decimal)(((int)a) / 100.00) + 1));
            };

            Func <PurchaseOrderTaxRate, decimal, decimal> Jiakuan = (a, b) =>
            {
                return(b / ((decimal)(((int)a) / 100.00) + 1));
            };


            //采购单实体
            PurchaseOrderAppService purchaseOrderAppServiceInstance = ObjectFactory <PurchaseOrderAppService> .Instance;

            var totalAmount = 0m;

            foreach (var sub in costChangeInfo.CostChangeItems)
            {
                DataRow row = null;
                row = dt.NewRow();

                var taxAndAmount = (sub.NewPrice - sub.OldPrice) * sub.ChangeCount;
                var po           = purchaseOrderAppServiceInstance.LoadPurchaseOrderInfo(sub.POSysNo);
                var taxRateType  = po.PurchaseOrderBasicInfo.TaxRateType.Value;//增值税类型

                //商品ID
                row["ProductID"] = sub.ProductID;
                //商品名称
                row["ProductName"] = sub.ProductName;
                //税率
                row["TaxRange"] = ((int)taxRateType).ToString();//通过采购单 来获取 税率
                //变价数量
                row["ChangeCount"] = sub.ChangeCount;
                //原进价
                row["OldPrice"] = sub.OldPrice.ToString("C");
                //新进价
                row["NewPrice"] = sub.NewPrice.ToString("C");
                //不含税金额(价款)
                row["ChaneAmount"] = Jiakuan(taxRateType, taxAndAmount).ToString("C");
                //变价税金
                row["ChaneTax"] = Shuijin(taxRateType, taxAndAmount).ToString("C");
                //采购单编号
                row["OrderNo"] = sub.POSysNo;
                //备注
                row["Memo"] = "";

                dt.Rows.Add(row);
                totalAmount += taxAndAmount;
            }

            //制单人
            variables.AddKeyValue("CreateUser", costChangeInfo.CostChangeBasicInfo.InUserStr);
            //审核人
            variables.AddKeyValue("AuditUser", costChangeInfo.CostChangeBasicInfo.AuditUserStr);
            //合计
            variables.AddKeyValue("TotalAmount", totalAmount.ToString("C"));
        }
Exemplo n.º 12
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();
            string            getPOSysNo        = requestPostData["POSysNo"];
            string            getPrintAccessory = requestPostData["PrintAccessory"];
            string            getPageTitle      = requestPostData["PrintTitle"];
            PurchaseOrderInfo poInfo            = new PurchaseOrderInfo();


            if (!string.IsNullOrEmpty(getPOSysNo))
            {
                int poSysNo = Convert.ToInt32(getPOSysNo);
                poInfo = PurchaseOrderProcessor.LoadPO(poSysNo);
                poInfo.EIMSInfo.EIMSInfoList = PurchaseOrderProcessor.LoadPOEIMSInfoForPrint(poSysNo);

                #region [构建供应商和采购单的基本信息]
                string getPrintTitle = string.Empty;
                if (poInfo.PurchaseOrderBasicInfo.ConsignFlag == PurchaseOrderConsignFlag.Consign)
                {
                    getPrintTitle = string.Format("采购单({0})", EnumHelper.GetDisplayText(poInfo.PurchaseOrderBasicInfo.ConsignFlag));
                }
                else
                {
                    if (poInfo.PurchaseOrderBasicInfo.PurchaseOrderType.HasValue && poInfo.PurchaseOrderBasicInfo.PurchaseOrderType != PurchaseOrderType.Normal)
                    {
                        getPrintTitle = string.Format("采购单({0})", EnumHelper.GetDisplayText(poInfo.PurchaseOrderBasicInfo.PurchaseOrderType));
                    }
                    else
                    {
                        getPrintTitle = "采购单";
                    }
                }

                variables.Add("PageTitle", HttpUtility.UrlDecode(getPageTitle));
                variables.Add("PrintTitle", getPrintTitle);

                WarehouseInfo getStockInfo   = InventoryBizInteract.GetWarehouseInfoBySysNo(poInfo.PurchaseOrderBasicInfo.StockInfo.SysNo.Value);
                string        getStockName   = getStockInfo.WarehouseName;
                string        CompanyName    = "";
                string        CompanyAddress = "";
                string        ComapnyTel     = "";
                string        CompanyWebsite = "";
                string        StockAddress   = getStockInfo.ReceiveAddress;
                string        StockContact   = getStockInfo.ReceiveContact;
                string        StockTel       = getStockInfo.ReceiveContactPhoneNumber;
                string        ETATime        = poInfo.PurchaseOrderBasicInfo.ETATimeInfo == null || !poInfo.PurchaseOrderBasicInfo.ETATimeInfo.ETATime.HasValue ? string.Empty : poInfo.PurchaseOrderBasicInfo.ETATimeInfo.ETATime.Value.ToString("yyyy-MM-dd HH:mm:ss");
                switch (poInfo.PurchaseOrderBasicInfo.StockInfo.SysNo)
                {
                //case 50:
                //    if (poInfo.PurchaseOrderBasicInfo.ITStockInfo != null && poInfo.PurchaseOrderBasicInfo.ITStockInfo.SysNo.HasValue)
                //    {
                //        string getITStockInfoName = InventoryBizInteract.GetWarehouseInfoBySysNo(poInfo.PurchaseOrderBasicInfo.ITStockInfo.SysNo.Value).WarehouseName;
                //        getStockName = string.Format("经中转到{0}", getITStockInfoName);
                //    }

                //    break;
                case 51:
                    //上海
                    break;

                case 52:
                    //香港:
                    CompanyAddress = "";
                    ComapnyTel     = "";
                    break;

                case 53:
                    //日本:
                    break;

                //case 54:
                //    //成都:
                //    CompanyAddress = "成都双流县大件路西南航空港新地物流园区(西南民大新校区对面)";
                //    ComapnyTel = "15982082844";
                //    break;
                //case 55:
                //    //武汉:
                //    CompanyAddress = "武汉市东西湖区革新大道(四明路与五环路之间)长江物流园C库10号门";
                //    ComapnyTel = "13339983123";
                //    break;
                //case 59:
                //    //上海市闵行:
                //    CompanyAddress = "上海市闵行区虹梅南路3988号2号库";
                //    ComapnyTel = "13122693665";
                //    break;
                default:
                    break;
                }
                variables.Add("StockName", getStockName);
                variables.Add("ETATime", ETATime);
                variables.Add("CompanyName", CompanyName);
                variables.Add("CompanyAddress", CompanyAddress);
                variables.Add("CompanyTel", ComapnyTel);
                variables.Add("CompanyWebSite", CompanyWebsite);

                string getSerialNumber = string.Empty;
                if (poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.InStocked)
                {
                    getSerialNumber = CommonBizInteract.GetSystemConfigurationValue("PONumber", poInfo.CompanyCode);
                    if (!string.IsNullOrEmpty(getSerialNumber))
                    {
                        //TODO:此方法尚未实现:
                        CommonBizInteract.UpdateSystemConfigurationValue("PONumber", (Convert.ToInt32(getSerialNumber) + 1).ToString(), poInfo.CompanyCode);
                    }
                    string getOldSerialNumber = PurchaseOrderProcessor.GetWareHouseReceiptSerialNumber(poInfo.SysNo.Value);
                    //更新PO单当前的流水号:
                    PurchaseOrderProcessor.UpdateWareHouseReceiptSerialNumber(poInfo.SysNo.Value, getSerialNumber);
                    if (!string.IsNullOrEmpty(getOldSerialNumber))
                    {
                        getSerialNumber = string.Format("{0}({1})", getSerialNumber, getOldSerialNumber);
                    }
                }
                else
                {
                    getSerialNumber = "无";
                }

                variables.Add("PrintSerialNumber", getSerialNumber);
                variables.Add("PurchaseOrderID", poInfo.PurchaseOrderBasicInfo.PurchaseOrderID);
                variables.Add("PrintTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                variables.Add("VendorNameAndSysNo", string.Format("{0}({1})", poInfo.VendorInfo.VendorBasicInfo.VendorNameLocal, poInfo.VendorInfo.SysNo.Value));
                variables.Add("VendorAddress", poInfo.VendorInfo.VendorBasicInfo.Address);
                variables.Add("StockAddress", StockAddress);
                variables.Add("StockContact", StockContact);
                variables.Add("StockTel", StockTel);

                string getInStockDate = string.Empty;
                //if (poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.InStocked)
                //{
                //    getInStockDate = poInfo.PurchaseOrderBasicInfo.InTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
                //}
                //if (poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.PartlyInStocked)
                //{
                //    getInStockDate = poInfo.PurchaseOrderBasicInfo.InTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
                //}
                if (poInfo.PurchaseOrderBasicInfo.InTime.HasValue)
                {
                    getInStockDate = poInfo.PurchaseOrderBasicInfo.InTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
                }
                variables.Add("InStockDate", getInStockDate);
                variables.Add("CreateUserName", CommonBizInteract.GetUserFullName(poInfo.PurchaseOrderBasicInfo.CreateUserSysNo.Value.ToString(), true));
                variables.Add("PayTypeName", poInfo.VendorInfo.VendorFinanceInfo.PayPeriodType.PayTermsName);
                variables.Add("VendorContact", poInfo.VendorInfo.VendorBasicInfo.Contact);
                variables.Add("VendorPhoneAndFax", poInfo.VendorInfo.VendorBasicInfo.Phone + " FAX : " + poInfo.VendorInfo.VendorBasicInfo.Fax);
                variables.Add("ShipTypeName", poInfo.PurchaseOrderBasicInfo.ShippingType.ShippingTypeName);
                variables.Add("CurrencyName", poInfo.PurchaseOrderBasicInfo.CurrencyName);
                variables.Add("Memo", poInfo.PurchaseOrderBasicInfo.MemoInfo.Memo);
                variables.Add("InStockMemo", poInfo.PurchaseOrderBasicInfo.MemoInfo.InStockMemo);

                string  getTotalAmt         = string.Empty;
                string  getTotalReturnPoint = string.Empty;
                decimal?eimsAmt             = 0.00m;
                decimal?totalInPage         = 0;
                poInfo.POItems.ForEach(x =>
                {
                    totalInPage += x.PurchaseQty * x.OrderPrice;
                });
                poInfo.EIMSInfo.EIMSInfoList.ForEach(x =>
                {
                    eimsAmt += x.EIMSAmt.HasValue ? x.EIMSAmt.Value : 0m;
                });
                if (eimsAmt > 0.00m)
                {
                    getTotalAmt         = poInfo.PurchaseOrderBasicInfo.CurrencySymbol + Convert.ToDecimal(totalInPage - eimsAmt).ToString("f2");
                    getTotalReturnPoint = "产品总价:" + poInfo.PurchaseOrderBasicInfo.CurrencySymbol + totalInPage.Value.ToString("f2") + " &nbsp;&nbsp; " + "使用返点:" + eimsAmt.Value.ToString("f2");
                }
                else
                {
                    getTotalAmt         = poInfo.PurchaseOrderBasicInfo.CurrencySymbol + totalInPage.Value.ToString("f2");
                    getTotalReturnPoint = "";
                }

                variables.Add("TotalReturnPoint", getTotalReturnPoint);
                variables.Add("TotalAmt", getTotalAmt);
                #endregion

                #region [构建商品列表信息]

                bool needShowInStockQty = ((poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.PartlyInStocked || poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.InStocked || poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.SystemClosed || poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.ManualClosed) == true ? true : false);
                variables.Add("NeedShowInStockQty", needShowInStockQty);

                int     purchaseQtyTotal = 0;
                int     quantityTotal    = 0;
                decimal amountTotal      = 0.00m;

                DataTable tblProductInfo = new DataTable();
                tblProductInfo.Columns.Add("ProductID");
                tblProductInfo.Columns.Add("ProductMode");
                tblProductInfo.Columns.Add("BMCode");
                tblProductInfo.Columns.Add("BriefName");
                tblProductInfo.Columns.Add("OrderPrice");
                tblProductInfo.Columns.Add("PurchaseQty");
                tblProductInfo.Columns.Add("InStockQty");
                tblProductInfo.Columns.Add("ProductPriceSummary");
                tblProductInfo.Columns.Add("NeedShowInStockQtyHtml");

                tblProductInfo.Columns.Add("TaxRateType");

                poInfo.POItems.ForEach(x =>
                {
                    DataRow dr                   = tblProductInfo.NewRow();
                    dr["ProductID"]              = x.ProductID + (x.IsVirtualStockProduct == true ? "[虚库商品]" : string.Empty);
                    dr["ProductMode"]            = x.ProductMode;
                    dr["BMCode"]                 = x.BMCode;
                    dr["NeedShowInStockQtyHtml"] = needShowInStockQty;
                    dr["BriefName"]              = x.BriefName;
                    dr["OrderPrice"]             = poInfo.PurchaseOrderBasicInfo.CurrencySymbol + x.OrderPrice.Value.ToString("f2");
                    dr["PurchaseQty"]            = x.PurchaseQty;
                    dr["InStockQty"]             = x.Quantity;
                    dr["ProductPriceSummary"]    = (needShowInStockQty ? (x.Quantity.Value * x.OrderPrice.Value).ToString("f2") : (x.PurchaseQty.Value * x.OrderPrice.Value).ToString("f2"));
                    dr["TaxRateType"]            = ((int)poInfo.PurchaseOrderBasicInfo.TaxRateType.Value).ToString();//税率
                    tblProductInfo.Rows.Add(dr);

                    purchaseQtyTotal += x.PurchaseQty.Value;
                    quantityTotal    += x.Quantity.Value;
                    amountTotal      += (needShowInStockQty ? x.Quantity.Value * x.OrderPrice.Value : x.PurchaseQty.Value * x.OrderPrice.Value);
                });

                tableVariables.Add("tblProductList", tblProductInfo);
                //总和:
                variables.Add("PurchaseQtyTotal", purchaseQtyTotal);
                variables.Add("NeedShowInStockQtySummary", needShowInStockQty);
                variables.Add("QuantityTotal", needShowInStockQty ? quantityTotal.ToString() : string.Empty);
                variables.Add("AmountTotal", amountTotal.ToString("f2"));

                #endregion

                #region 构建合计信息

                Func <PurchaseOrderTaxRate, decimal, decimal> Shuijin = (a, b) =>
                {
                    return(((decimal)(((int)a) / 100.00)) * b / ((decimal)(((int)a) / 100.00) + 1));
                };

                Func <PurchaseOrderTaxRate, decimal, decimal> Jiakuan = (a, b) =>
                {
                    return(b / ((decimal)(((int)a) / 100.00) + 1));
                };

                Func <decimal?, decimal> IsNullDecimal = (a) =>
                {
                    if (a != null && a.HasValue)
                    {
                        return(a.Value);
                    }
                    else
                    {
                        return(0m);
                    }
                };

                var taxAndCost    = IsNullDecimal(poInfo.PurchaseOrderBasicInfo.TotalActualPrice);
                var taxAndCostStr = taxAndCost.ToString("C");
                var allCost       = Jiakuan(poInfo.PurchaseOrderBasicInfo.TaxRateType.Value, taxAndCost);
                var allCostStr    = allCost.ToString("C");
                var allTax        = Shuijin(poInfo.PurchaseOrderBasicInfo.TaxRateType.Value, taxAndCost);
                var allTaxStr     = allTax.ToString("C");

                variables.Add("AllCost", allCostStr);
                variables.Add("AllTax", allTaxStr);
                variables.Add("TaxAndCost", taxAndCostStr);
                #endregion

                #region [构建配件信息]
                if (getPrintAccessory == "1")
                {
                    DataTable dtPOAccessories    = PurchaseOrderProcessor.GetPurchaseOrderAccessories(poInfo.SysNo.Value);
                    DataTable tblAccessoriesList = new DataTable();
                    tblAccessoriesList.Columns.Add("ProductID");
                    tblAccessoriesList.Columns.Add("AccessoryIDAndName");
                    tblAccessoriesList.Columns.Add("Qty");

                    bool needShowAccessoriesList = dtPOAccessories == null || dtPOAccessories.Rows.Count <= 0 ? false : true;
                    variables.Add("NeedShowAccessoriesList", needShowAccessoriesList);
                    if (needShowAccessoriesList)
                    {
                        foreach (DataRow dr in dtPOAccessories.Rows)
                        {
                            DataRow drRow = tblAccessoriesList.NewRow();
                            drRow["ProductID"]          = dr["ProductID"].ToString();
                            drRow["AccessoryIDAndName"] = dr["AccessoriesID"].ToString() + "]" + dr["AccessoriesIDAndName"].ToString();
                            drRow["Qty"] = dr["Qty"].ToString();
                            tblAccessoriesList.Rows.Add(drRow);
                        }
                    }
                    tableVariables.Add("tblAccessoriesList", tblAccessoriesList);
                }
                else
                {
                    variables.Add("NeedShowAccessoriesList", false);
                }
                #endregion

                #region [构建返点信息]

                decimal eimsAmtTotal             = 0.00m;
                decimal usedThisPlaceAmountTotal = 0.00m;

                bool needShowEIMSList = poInfo.EIMSInfo == null || poInfo.EIMSInfo.EIMSInfoList.Count <= 0 ? false : true;
                variables.Add("NeedShowEIMSList", needShowEIMSList);
                DataTable tblEIMSList = new DataTable();
                tblEIMSList.Columns.Add("EIMSNo");
                tblEIMSList.Columns.Add("EIMSName");
                tblEIMSList.Columns.Add("EIMSTotalAmt");
                tblEIMSList.Columns.Add("RelateNotReceivedAmount");
                tblEIMSList.Columns.Add("ReceivedAmount");
                tblEIMSList.Columns.Add("EIMSAmt");
                tblEIMSList.Columns.Add("UseThisPlaceAmount");
                tblEIMSList.Columns.Add("LeaveUseThisPlaceAmount");

                if (needShowEIMSList)
                {
                    foreach (var item in poInfo.EIMSInfo.EIMSInfoList)
                    {
                        DataRow dr = tblEIMSList.NewRow();
                        dr["EIMSNo"]                  = item.EIMSSysNo;
                        dr["EIMSName"]                = item.EIMSName;
                        dr["EIMSTotalAmt"]            = item.EIMSTotalAmt.HasValue ? item.EIMSTotalAmt.Value.ToString("f2") : "0.00";
                        dr["RelateNotReceivedAmount"] = (item.RelateAmount - item.ReceivedAmount).HasValue ? (item.RelateAmount - item.ReceivedAmount).Value.ToString("f2") : "0.00";
                        dr["ReceivedAmount"]          = item.ReceivedAmount.HasValue ? item.ReceivedAmount.Value.ToString("f2") : "0.00";
                        dr["EIMSAmt"]                 = item.EIMSAmt.HasValue ? item.EIMSAmt.Value.ToString("f2") : "0.00";
                        dr["UseThisPlaceAmount"]      = (item.EIMSAmt - item.LeftAmt).HasValue ? (item.EIMSAmt - item.LeftAmt).Value.ToString("f2") : "0.00";
                        dr["LeaveUseThisPlaceAmount"] = (item.EIMSTotalAmt - item.RelateAmount).HasValue ? (item.EIMSTotalAmt - item.RelateAmount).Value.ToString("f2") : "0.00";

                        tblEIMSList.Rows.Add(dr);

                        eimsAmtTotal             += item.EIMSAmt.HasValue ? item.EIMSAmt.Value : 0;
                        usedThisPlaceAmountTotal += Convert.ToDecimal(dr["UseThisPlaceAmount"].ToString());
                    }
                }
                tableVariables.Add("tblEIMSList", tblEIMSList);
                //总和:
                variables.Add("EimsAmtTotal", eimsAmtTotal.ToString("f2"));
                variables.Add("UsedThisPlaceAmountTotal", usedThisPlaceAmountTotal.ToString("f2"));

                #endregion
            }
        }
Exemplo n.º 13
0
        private void SendEmailToCustomerForSOInfo(SOInfo soInfo, string emailTemplateID)
        {
            try
            {
                ECCentral.BizEntity.Customer.CustomerBasicInfo customerInfo = GetCustomerBaseInfo(soInfo.BaseInfo.CustomerSysNo.Value);
                string customerEmail = customerInfo.Email == null ? null : customerInfo.Email.Trim();

                if (customerEmail == null)
                {
                    return;
                }
                KeyValueVariables keyValueVariables = new KeyValueVariables();
                KeyTableVariables keyTableVariables = new KeyTableVariables();

                #region 填充基本属性
                keyValueVariables.Add("SOSysNo", soInfo.BaseInfo.SysNo.Value.ToString());
                keyValueVariables.Add("SOID", soInfo.BaseInfo.SOID);
                keyValueVariables.Add("CustomerName", customerInfo.CustomerName);
                keyValueVariables.Add("CustomerID", customerInfo.CustomerID);
                keyValueVariables.Add("OrderTime", soInfo.BaseInfo.CreateTime.Value.ToString(SOConst.DateTimeFormat));
                keyValueVariables.Add("InvoiceHeader", soInfo.InvoiceInfo.Header);
                keyValueVariables.Add("ReceiveName", soInfo.ReceiverInfo.Name);
                ECCentral.BizEntity.Common.AreaInfo areaInfo = ExternalDomainBroker.GetAreaInfoByDistrictSysNo(soInfo.ReceiverInfo.AreaSysNo.Value);
                keyValueVariables.Add("ProvinceName", areaInfo.ProvinceName);
                keyValueVariables.Add("CityName", areaInfo.CityName);
                keyValueVariables.Add("DistrictName", areaInfo.DistrictName);
                keyValueVariables.Add("ReceiveAddress", soInfo.ReceiverInfo.Address);
                keyValueVariables.Add("ReceiveZip", soInfo.ReceiverInfo.Zip);
                keyValueVariables.Add("ReceivePhone", String.IsNullOrEmpty(soInfo.ReceiverInfo.Phone) ? soInfo.ReceiverInfo.MobilePhone : soInfo.ReceiverInfo.Phone);
                ECCentral.BizEntity.Common.PayType payType = ExternalDomainBroker.GetPayTypeBySysNo(soInfo.BaseInfo.PayTypeSysNo.Value);
                keyValueVariables.Add("PayType", payType.PayTypeName);
                ECCentral.BizEntity.Common.ShippingType shippingType = ExternalDomainBroker.GetShippingTypeBySysNo(soInfo.ShippingInfo.ShipTypeSysNo.Value);
                keyValueVariables.Add("ShipType", shippingType.ShippingTypeName);
                keyValueVariables.Add("ShipPeriod", shippingType.Period);
                keyValueVariables.Add("CashPay", soInfo.BaseInfo.CashPay.ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("ShipPrice", soInfo.BaseInfo.ShipPrice.Value.ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("PremiumAmount", soInfo.BaseInfo.PremiumAmount.Value.ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("ReceivableAmount", soInfo.BaseInfo.ReceivableAmount.ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("GainPoint", soInfo.BaseInfo.GainPoint.Value);
                keyValueVariables.Add("Weight", soInfo.ShippingInfo.Weight);

                string changeAmount = (soInfo.BaseInfo.OriginalReceivableAmount - soInfo.BaseInfo.ReceivableAmount).ToString(SOConst.DecimalFormat);
                keyValueVariables.Add("ChangeAmount", changeAmount);
                keyValueVariables.Add("ChangeAmountDisplay", changeAmount != (0M).ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("GiftCardPay", soInfo.BaseInfo.GiftCardPay.Value.ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("GiftCardDisplay", soInfo.BaseInfo.GiftCardPay != 0);
                keyValueVariables.Add("PointPay", soInfo.BaseInfo.PointPayAmount);
                keyValueVariables.Add("PointPayDisplay", soInfo.BaseInfo.PointPay != 0);
                keyValueVariables.Add("PrePay", soInfo.BaseInfo.PrepayAmount.Value.ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("PrePayDisplay", soInfo.BaseInfo.PrepayAmount != 0);
                keyValueVariables.Add("PayPrice", soInfo.BaseInfo.PayPrice.Value.ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("PayPriceDisplay", soInfo.BaseInfo.PayPrice != 0);
                keyValueVariables.Add("PromotionAmount", Math.Abs(soInfo.BaseInfo.PromotionAmount.Value).ToString(SOConst.DecimalFormat));
                keyValueVariables.Add("PromotionDisplay", soInfo.BaseInfo.PromotionAmount != 0);
                keyValueVariables.Add("NowYear", DateTime.Now.Year);
                keyValueVariables.Add("TariffAmt", soInfo.BaseInfo.TariffAmount.HasValue?soInfo.BaseInfo.TariffAmount.Value.ToString(SOConst.DecimalFormat) : 0M.ToString(SOConst.DecimalFormat));
                #endregion

                //int weight = 0;

                #region 替换邮件模板内连接追踪代码
                ReplaceCM_MMC(emailTemplateID, keyValueVariables);
                #endregion

                #region 填充商品
                string imgSrc   = string.Empty;
                string pagePath = string.Empty;
                soInfo.Items.ForEach(item =>
                {
                    //weight += item.Weight.Value * item.Quantity.Value;
                    string tbKey        = String.Format("Items_{0}", item.ProductType.ToString());
                    pagePath            = "http://www.kjt.com/product/detail/" + item.ProductSysNo;
                    imgSrc              = "http://image.kjt.com/neg/P60/" + item.ProductID + ".jpg";
                    DataTable tableList = null;
                    if (!keyTableVariables.ContainsKey(tbKey))
                    {
                        tableList = new DataTable();
                        tableList.Columns.AddRange(new DataColumn[]
                        {
                            new DataColumn("ProductID"),
                            new DataColumn("ProductName"),
                            new DataColumn("Price"),
                            new DataColumn("Quantity"),
                            new DataColumn("Amount"),
                            new DataColumn("PagePath"),
                            new DataColumn("ImgSrc")
                        });
                        keyTableVariables.Add(tbKey, tableList);
                    }
                    else
                    {
                        tableList = keyTableVariables[tbKey];
                    }
                    //连接增加追踪代码
                    ReplaceProductCM_MMC(emailTemplateID, ref pagePath, item.ProductID);
                    tableList.Rows.Add(new string[]
                    {
                        item.ProductType == SOProductType.Coupon ? null : item.ProductID,
                        item.ProductName,
                        item.OriginalPrice.Value.ToString(SOConst.DecimalFormat),
                        item.Quantity.Value.ToString(),
                        (item.Quantity.Value * item.OriginalPrice.Value).ToString(SOConst.DecimalFormat),
                        pagePath,
                        imgSrc
                    });
                });
                #endregion

                #region 组合销售
                List <SOPromotionInfo> comboPromotionList = soInfo.SOPromotions.FindAll(p => { return(p.PromotionType == SOPromotionType.Combo); });
                keyValueVariables.Add("PromotionInfoDisplay", soInfo.BaseInfo.PromotionAmount != 0);
                if (comboPromotionList != null)
                {
                    DataTable comboTable = new DataTable();
                    comboTable.Columns.AddRange(new DataColumn[]
                    {
                        new DataColumn("ComboName"),
                        new DataColumn("ComboDiscount"),
                        new DataColumn("ComboTime"),
                        new DataColumn("ComboTotalDiscount")
                    });
                    keyTableVariables.Add("ComboList", comboTable);
                    List <ECCentral.BizEntity.MKT.ComboInfo> comboInfoList = ExternalDomainBroker.GetComboList(comboPromotionList.Select <SOPromotionInfo, int>(p => p.PromotionSysNo.Value).ToList <int>());
                    if (comboInfoList != null)
                    {
                        comboPromotionList.ForEach(promotion =>
                        {
                            ECCentral.BizEntity.MKT.ComboInfo comboInfo = comboInfoList.FirstOrDefault(cb => cb.SysNo == promotion.PromotionSysNo);
                            comboTable.Rows.Add(new string[]
                            {
                                comboInfo == null ? null : comboInfo.Name.Content,
                                (promotion.DiscountAmount.Value / promotion.Time.Value).ToString(SOConst.DecimalFormat),
                                promotion.Time.Value.ToString(),
                                promotion.DiscountAmount.Value.ToString(SOConst.DecimalFormat)
                            });
                        });
                    }
                }
                #endregion

                #region 填充推荐商品信息
                string result = string.Empty;
                //测试订单号:388280
                List <CommendatoryProductsInfo> list = ObjectFactory <ISODA> .Instance.GetCommendatoryProducts(int.Parse(soInfo.BaseInfo.SOID));

                if (list != null && list.Count > 0)
                {
                    result = "<br /><table width=\"650px\" style=\"border-collapse: collapse; border: 1px solid #ddd;\" cellspacing=\"0\" cellpadding=\"0\">\n" +
                             "<tr style=\"background:#fff;\">\n" +
                             "<td style=\"width:30px; padding:10px 0 0 10px;\"><img src=\"http://c1.neweggimages.com.cn/NeweggPic2/Marketing/201108/chuhuo/images/icon_4.jpg\" /></td>\n" +
                             "<td style=\"text-align:left; padding:10px 0 0 5px;\"><span style=\"font-family:\"微软雅黑\";font-size:16px; display:inline-block; padding:0; padding-left:5px;\"><strong>我们猜您可能还对下面的商品感兴趣</strong></span></td>\n" +
                             "</tr>\n" +
                             "</table>\n" +
                             "<div style=\"padding-top:10px;border-collapse: collapse; border: 1px solid #ddd;width:648px\">" +
                             "<table cellspacing=\"0\" cellpadding=\"0\" style=\"padding-bottom:10px;border-collapse: collapse; border:0;\">\n" +
                             "<tr style=\" background:#fff;\">\n" +
                             "[RevommendProductList1]\n" +
                             "</tr>\n" +
                             "<tr style=\"background:#fff;\">\n" +
                             "[RevommendProductList2]\n" +
                             "</tr>\n" +
                             "</table>\n" +
                             "</div>";
                    string item1 = string.Empty,
                           item2 = string.Empty;

                    IEnumerator <CommendatoryProductsInfo> rator = list.Take(3).GetEnumerator();
                    while (rator.MoveNext())
                    {
                        CommendatoryProductsInfo entity = rator.Current;
                        item1 += ReplaceCommendatoryProduct(entity, emailTemplateID);
                    }
                    rator = list.Skip(3).Take(3).GetEnumerator();
                    while (rator.MoveNext())
                    {
                        CommendatoryProductsInfo entity = rator.Current;
                        item2 += ReplaceCommendatoryProduct(entity, emailTemplateID);
                    }

                    result = result.Replace("[RevommendProductList1]", item1)
                             .Replace("[RevommendProductList2]", item2);

                    keyValueVariables.Add("CommendatoryProducts", result);
                }
                #endregion

                #region 填充备注信息
                string memo = string.Empty;
                if (!string.IsNullOrEmpty(soInfo.BaseInfo.MemoForCustomer))
                {
                    memo = @"<table border='0' cellpadding='5' cellspacing='0' style='width: 650px; border-collapse: collapse;font-size: 9pt;'>
                                <tr>
                                    <td style='border: 1px solid #ddd; color: #FF4E00; font-size: 10.5pt; font-weight: bold; background: #F2F2F2;'>
                                        备注信息
                                    </td>
                                </tr>
                                <tr>
                                    <td id='Memo' style='border: 1px solid #ddd;'>
                                        " + soInfo.BaseInfo.MemoForCustomer + @"
                                    </td>
                                </tr>
                            </table>";
                    keyValueVariables.Add("Memo", memo);
                }
                #endregion

                ExternalDomainBroker.SendExternalEmail(customerEmail, emailTemplateID, keyValueVariables, keyTableVariables, customerInfo.FavoriteLanguageCode);
            }
            catch (Exception ex)
            {
                ExceptionHelper.HandleException(ex);
            }
        }
Exemplo n.º 14
0
        public ActionResult BuildEmailTemplate()
        {
            KeyValueVariables keyValues = new KeyValueVariables();

            keyValues.Add("StockName", "香港九龙仓");
            keyValues.Add("ETATime", DateTime.Now.Date);
            keyValues.Add("CompanyName", "公司名称");
            keyValues.Add("CompanyAddress", "公司地址");
            keyValues.Add("CompanyTel", "123456789");
            keyValues.Add("CompanyWebSite", "http://www.xxx.com");
            keyValues.Add("StockAddress", "仓库地址");
            keyValues.Add("StockContact", "仓库联系人");
            keyValues.Add("StockTel", "仓库电话");
            keyValues.Add("displayNo", "");


            keyValues.Add("numberString", "1231312312312321");
            keyValues.Add("shipTypeString", "默认 配送方式");


            keyValues.Add("totalInPage", "5000.00");
            keyValues.Add("totalAmt", "18000.00");
            keyValues.Add("totalReturnPoint", "100");
            keyValues.Add("PMName", "产品经理姓名");
            keyValues.Add("CurrencyName", "港币");

            keyValues.Add("entity.POID", "123");
            keyValues.Add("DateTime.Now", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            keyValues.Add("vendor.VendorName", "供应商名称");
            keyValues.Add("vendor.SysNo", "123");
            keyValues.Add("vendor.Address", "供应商联系地址");
            keyValues.Add("vendor.Contact", "供应商联系人");
            keyValues.Add("vendor.Fax", "0123445");
            keyValues.Add("entity.InTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            keyValues.Add("entity.PayTypeName", "默认支付方式");
            keyValues.Add("entity.Memo", "备注信息备注信息备注信息备注信息备注信息");
            keyValues.Add("entity.InStockMemo", "入库备注入库备注入库备注入库备注入库备注入库备注入库备注");
            keyValues.Add("SendTimeString", DateTime.Now.ToString());

            KeyTableVariables keyTables            = new KeyTableVariables();
            DataTable         productAccessoryList = new DataTable();

            productAccessoryList.Columns.Add("ProductID");
            productAccessoryList.Columns.Add("AccessoriesID");
            productAccessoryList.Columns.Add("AccessoriesIDAndName");
            productAccessoryList.Columns.Add("Qty");


            DataTable productItemList = new DataTable();

            productItemList.Columns.Add("item.ProductID");
            productItemList.Columns.Add("item.IsVirtualStockProduct");
            productItemList.Columns.Add("item.ProductMode");
            productItemList.Columns.Add("item.BriefName");
            productItemList.Columns.Add("item.CurrencySymbol");
            productItemList.Columns.Add("item.OrderPrice");
            productItemList.Columns.Add("item.PurchaseQty");
            productItemList.Columns.Add("item.Quantity");
            productItemList.Columns.Add("item.PurchaseQtyOrderPrice");
            productItemList.Columns.Add("item.QuantityOrderPrice");


            for (int i = 0; i < 5; i++)
            {
                DataRow dr = productItemList.NewRow();
                dr["item.ProductID"]             = "ProductID-" + i.ToString();
                dr["item.IsVirtualStockProduct"] = "IsVirtualStockProduct-" + i;
                dr["item.ProductMode"]           = "ProductMode-" + i;
                dr["item.BriefName"]             = "BriefName-" + i;
                dr["item.CurrencySymbol"]        = "港币";
                dr["item.OrderPrice"]            = (i + 1) * 100;
                dr["item.PurchaseQty"]           = (i + 1) * 5;
                dr["item.Quantity"] = (i + 1) * 5;
                dr["item.PurchaseQtyOrderPrice"] = ((i + 1) * 5 * 100).ToString("#########0.00");
                dr["item.QuantityOrderPrice"]    = ((i + 1) * 5 * 100).ToString("#########0.00");
                productItemList.Rows.Add(dr);
            }

            for (int i = 0; i < 5; i++)
            {
                DataRow dr = productAccessoryList.NewRow();
                dr["ProductID"]            = "ProductID-" + i;
                dr["AccessoriesID"]        = "AccessoriesID-" + i;
                dr["AccessoriesIDAndName"] = "AccessoriesIDAndName-" + i;
                dr["Qty"] = (i + 1) * 5;
                productAccessoryList.Rows.Add(dr);
            }

            keyTables.Add("tblProductItemsList", productItemList);
            keyTables.Add("tblProductAccessoryList", productAccessoryList);

            MailTemplate template = MailHelper.BuildMailTemplate("PO_AutoCloseMail", keyValues, keyTables);

            return(Content(template.Body));
        }
Exemplo n.º 15
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();
            string sysNo = requestPostData["SysNo"];

            if (sysNo != null && sysNo.Trim() != String.Empty)
            {
                sysNo = System.Web.HttpUtility.UrlDecode(sysNo);
                int requestSysNo = int.TryParse(sysNo, out requestSysNo) ? requestSysNo : int.MinValue;

                if (requestSysNo > int.MinValue)
                {
                    AdjustRequestInfo requestInfo = ObjectFactory <AdjustRequestAppService> .Instance.GetAdjustRequestInfoBySysNo(requestSysNo);

                    DataTable dtInvoice = new DataTable();
                    dtInvoice.Columns.AddRange(new DataColumn[]
                    {
                        new DataColumn("OutStockDate"),
                        new DataColumn("ReceiveName"),
                        new DataColumn("Contact"),
                        new DataColumn("Address"),
                        new DataColumn("Phone"),
                        new DataColumn("Note"),
                        new DataColumn("CustomerID"),
                        new DataColumn("RequestSysNo"),
                        new DataColumn("UpperAmount"),
                        new DataColumn("ProductList", typeof(DataTable))
                    });
                    tableVariables.Add("InvoiceList", dtInvoice);
                    DataRow dr = dtInvoice.NewRow();
                    dr["ReceiveName"]  = requestInfo.InvoiceInfo.ReceiveName;
                    dr["Contact"]      = requestInfo.InvoiceInfo.ContactAddress;
                    dr["Address"]      = requestInfo.InvoiceInfo.ContactShippingAddress;
                    dr["Phone"]        = requestInfo.InvoiceInfo.ContactPhoneNumber;
                    dr["CustomerID"]   = requestInfo.InvoiceInfo.CustomerID;
                    dr["RequestSysNo"] = requestInfo.SysNo;
                    dr["OutStockDate"] = requestInfo.OutStockDate.HasValue ? requestInfo.OutStockDate.Value.ToString(SOConst.DateFormat) : string.Empty;
                    dr["Note"]         = requestInfo.InvoiceInfo.Note;
                    DataTable dtProduct = new DataTable();
                    dtProduct.Columns.AddRange(new System.Data.DataColumn[]
                    {
                        new DataColumn("ProductID"),
                        new DataColumn("ProductName"),
                        new DataColumn("Price"),
                        new DataColumn("Quantity"),
                        new DataColumn("Amount")
                    });

                    decimal totalAmount = 0M;
                    int     i           = 0;
                    requestInfo.AdjustItemInfoList.ForEach(p =>
                    {
                        i++;
                        totalAmount             += p.AdjustQuantity * p.AdjustCost;
                        DataRow drProduct        = dtProduct.NewRow();
                        drProduct["ProductID"]   = p.AdjustProduct.ProductID;
                        drProduct["ProductName"] = p.AdjustProduct.ProductBasicInfo.ProductBriefTitle;
                        drProduct["Price"]       = p.AdjustCost.ToString("N2");
                        drProduct["Quantity"]    = p.AdjustQuantity;
                        drProduct["Amount"]      = (p.AdjustQuantity * p.AdjustCost).ToString("N2");
                        dtProduct.Rows.Add(drProduct);

                        if (i % 6 == 0 || i == requestInfo.AdjustItemInfoList.Count)
                        {
                            dr["ProductList"] = dtProduct;
                            dr["UpperAmount"] = MoneyUtility.GetChineseMoney(totalAmount);
                            dtInvoice.Rows.Add(dr);
                            if (i != requestInfo.AdjustItemInfoList.Count - 1)
                            {
                                dtProduct   = dtProduct.Clone();
                                DataRow tdr = dtInvoice.NewRow();
                                // dtInvoice.Rows.Add(tdr);
                                tdr["ReceiveName"]  = dr["ReceiveName"];
                                tdr["Contact"]      = dr["Contact"];
                                tdr["Address"]      = dr["Address"];
                                tdr["Phone"]        = dr["Phone"];
                                tdr["CustomerID"]   = dr["CustomerID"];
                                tdr["RequestSysNo"] = dr["RequestSysNo"];
                                tdr["OutStockDate"] = dr["OutStockDate"];
                                tdr["Note"]         = dr["Note"];
                                dr = tdr;
                                dtProduct.Rows.Clear();
                            }
                        }
                    });
                }
            }
        }
Exemplo n.º 16
0
        public void BuildData(NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            int    sysNo       = 0;
            string sysNoString = requestPostData["SysNo"];
            bool   isNum       = int.TryParse(sysNoString, out sysNo);

            if (isNum && sysNo > 0)
            {
                ObjectFactory <RequestAppService> .Instance.PrintLabels(sysNo);

                CustomerInfo customer;
                SOBaseInfo   soBaseInfo;
                DeliveryInfo deliveryInfo;
                string       deliveryUserName, businessModel;

                var requestView = ObjectFactory <RequestAppService> .Instance.LoadWithRegistersBySysNo(sysNo, out customer, out soBaseInfo, out deliveryInfo, out deliveryUserName, out businessModel);

                if (requestView != null && requestView.Registers != null && requestView.Registers.Count > 0)
                {
                    List <Register> regiserSysNoBarCodeList = new List <Register>();
                    requestView.Registers.ForEach(item =>
                    {
                        string barCode = Convert.ToBase64String(BarCode39Helper.DrawImage(13, item.SysNo.ToString().PadLeft(12, '0')));

                        regiserSysNoBarCodeList.Add(new Register
                        {
                            RegisterSysNoPrintCode = barCode
                        });
                    });

                    if (requestView.InvoiceType.HasValue && requestView.StockType.HasValue && requestView.ShippingType.HasValue)
                    {
                        if (requestView.InvoiceType != InvoiceType.SELF || requestView.StockType != StockType.SELF || requestView.ShippingType != ECCentral.BizEntity.Invoice.DeliveryType.SELF)
                        {
                            var merchantInfo = ObjectFactory <IPOBizInteract> .Instance.GetVendorInfoSysNo(requestView.MerchantSysNo.Value);

                            string briefName = merchantInfo.VendorBasicInfo.VendorBriefName ?? (merchantInfo.VendorBasicInfo.VendorNameLocal ?? "");
                            if (briefName.Length > 5)
                            {
                                briefName = briefName.Substring(0, 6);
                            }

                            DataTable t = new DataTable();
                            t.Columns.Add("RegisterSysNoPrintCode");

                            regiserSysNoBarCodeList.ForEach(p => {
                                t.Rows.Add(p.RegisterSysNoPrintCode);
                            });

                            variables.Add("RequestID", requestView.RequestID);
                            variables.Add("MerchantName", briefName);

                            tableVariables.Add("RegisterView", t);
                        }
                    }
                }
            }
        }
Exemplo n.º 17
0
        public virtual string GetMailContentForAutoClosePOJob(int poSysNo)
        {
            string            returnString = string.Empty;
            PurchaseOrderInfo getPOInfo    = PurchaseOrderProcessor.LoadPO(poSysNo);

            if (null != getPOInfo)
            {
                WarehouseInfo getStockInfo      = InventoryBizInteract.GetWarehouseInfoBySysNo(getPOInfo.PurchaseOrderBasicInfo.StockInfo.SysNo.Value);
                string        getStockName      = getStockInfo.WarehouseName;
                string        getCompanyName    = "网信(香港)有限公司";
                string        getCompanyAddress = "香港九龙湾启祥道20号大昌行集团大厦8楼";
                string        getComapnyTel     = "(852)27683388";
                string        getCompanyWebsite = "";
                string        getStockAddress   = getStockInfo.ReceiveAddress;
                string        getStockContact   = getStockInfo.ReceiveContact;
                string        getStockTel       = getStockInfo.ReceiveContactPhoneNumber;
                switch (getPOInfo.PurchaseOrderBasicInfo.StockInfo.SysNo)
                {
                case 50:
                case 51:
                    break;

                case 52:
                    //香港:
                    getCompanyAddress = "香港九龙湾启祥道20号大昌行集团大厦8楼";
                    getComapnyTel     = "(852)27683388";
                    break;

                case 53:
                    ////广州:
                    //getCompanyAddress = "广东省广州市天河区中山大道西779号";
                    //getComapnyTel = "020-85559980,020-85559981";
                    break;

                //case 54:
                //    //成都:
                //    getCompanyAddress = "成都双流县大件路西南航空港新地物流园区(西南民大新校区对面)";
                //    getComapnyTel = "15982082844";
                //    break;
                //case 55:
                //    //武汉:
                //    getCompanyAddress = "武汉市东西湖区革新大道(四明路与五环路之间)长江物流园C库10号门";
                //    getComapnyTel = "13339983123";
                //    break;
                //case 59:
                //    //上海市闵行:
                //    getCompanyAddress = "上海市闵行区虹梅南路3988号2号库";
                //    getComapnyTel = "13122693665";
                //    break;
                default:
                    break;
                }

                KeyValueVariables keyValues = new KeyValueVariables();
                keyValues.Add("StockName", getPOInfo.PurchaseOrderBasicInfo.StockInfo.StockName);
                keyValues.Add("ETATime", getPOInfo.PurchaseOrderBasicInfo.ETATimeInfo.ETATime.Value.ToLongTimeString());
                keyValues.Add("CompanyName", getCompanyName);
                keyValues.Add("CompanyAddress", getCompanyAddress);
                keyValues.Add("CompanyTel", getComapnyTel);
                keyValues.Add("CompanyWebSite", getCompanyWebsite);
                keyValues.Add("StockAddress", getStockAddress);
                keyValues.Add("StockContact", getStockContact);
                keyValues.Add("StockTel", getStockTel);
                keyValues.Add("displayNo", "");


                string getOldSNNumber = PurchaseOrderProcessor.GetWareHouseReceiptSerialNumber(poSysNo);
                string numberString   = getOldSNNumber.Trim();
                if (getPOInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.InStocked)
                {
                    string number = "0";

                    if (getOldSNNumber.Trim().Equals("") == false)
                    {
                        number = getOldSNNumber.Trim();
                    }
                    numberString = number;
                }
                else
                {
                    numberString = "无";
                }
                keyValues.Add("numberString", numberString);
                keyValues.Add("shipTypeString", getPOInfo.PurchaseOrderBasicInfo.ShippingType.ShippingTypeName);

                decimal totalInPagedec = 0;
                string  totalInPage    = string.Empty;
                foreach (PurchaseOrderItemInfo item in getPOInfo.POItems)
                {
                    totalInPagedec += (item.Quantity.HasValue ? item.Quantity.Value : 0) * (item.OrderPrice.HasValue ? item.OrderPrice.Value : 0);
                }
                totalInPage = getPOInfo.PurchaseOrderBasicInfo.CurrencySymbol + totalInPagedec.ToString("#########0.00");
                keyValues.Add("totalInPage", totalInPage);

                string totalAmt         = string.Empty;
                string totalReturnPoint = string.Empty;
                if (getPOInfo.PurchaseOrderBasicInfo.PM_ReturnPointSysNo > 0)
                {
                    totalAmt         = getPOInfo.PurchaseOrderBasicInfo.CurrencySymbol + Convert.ToDecimal(Convert.ToDecimal(getPOInfo.PurchaseOrderBasicInfo.TotalAmt.ToString()) - Convert.ToDecimal(getPOInfo.PurchaseOrderBasicInfo.UsingReturnPoint)).ToString("#########0.00");
                    totalReturnPoint = "产品总价:" + getPOInfo.PurchaseOrderBasicInfo.CurrencySymbol + Convert.ToDecimal(getPOInfo.PurchaseOrderBasicInfo.TotalAmt.ToString()).ToString("#########0.00") + " &nbsp;&nbsp; " + "使用返点:" + (Convert.ToDecimal(getPOInfo.PurchaseOrderBasicInfo.UsingReturnPoint)).ToString("#########0.00");
                }
                else
                {
                    totalAmt         = getPOInfo.PurchaseOrderBasicInfo.CurrencySymbol + Convert.ToDecimal(getPOInfo.PurchaseOrderBasicInfo.TotalAmt.ToString()).ToString("#########0.00");
                    totalReturnPoint = "";
                }
                keyValues.Add("totalAmt", totalAmt);
                keyValues.Add("totalReturnPoint", totalReturnPoint);
                keyValues.Add("PMName", getPOInfo.PurchaseOrderBasicInfo.ProductManager.UserInfo.UserName);
                keyValues.Add("CurrencyName", ObjectFactory <ICommonBizInteract> .Instance.GetCurrencyInfoBySysNo(getPOInfo.PurchaseOrderBasicInfo.CurrencyCode.Value).CurrencyName);

                keyValues.Add("entity.POID", getPOInfo.PurchaseOrderBasicInfo.PurchaseOrderID);
                keyValues.Add("DateTime.Now", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                keyValues.Add("vendor.VendorName", getPOInfo.VendorInfo.VendorBasicInfo.VendorNameLocal);
                keyValues.Add("vendor.SysNo", getPOInfo.VendorInfo.SysNo.Value.ToString());
                keyValues.Add("vendor.Address", getPOInfo.VendorInfo.VendorBasicInfo.Address);
                keyValues.Add("vendor.Contact", getPOInfo.VendorInfo.VendorBasicInfo.Contact);
                keyValues.Add("vendor.Fax", getPOInfo.VendorInfo.VendorBasicInfo.Fax);
                keyValues.Add("entity.InTime", getPOInfo.PurchaseOrderBasicInfo.InTime.HasValue ? getPOInfo.PurchaseOrderBasicInfo.InTime.Value.ToString() : "");
                keyValues.Add("entity.PayTypeName", getPOInfo.PurchaseOrderBasicInfo.PayType.PayTypeName);
                keyValues.Add("entity.Memo", getPOInfo.PurchaseOrderBasicInfo.MemoInfo.Memo);
                keyValues.Add("entity.InStockMemo", getPOInfo.PurchaseOrderBasicInfo.MemoInfo.InStockMemo);
                keyValues.Add("SendTimeString", DateTime.Now.ToString());

                KeyTableVariables keyTables            = new KeyTableVariables();
                DataTable         productAccessoryList = new DataTable();

                DataTable productItemList = new DataTable();
                productItemList.Columns.Add("item.ProductID");
                productItemList.Columns.Add("item.IsVirtualStockProduct");
                productItemList.Columns.Add("item.ProductMode");
                productItemList.Columns.Add("item.BriefName");
                productItemList.Columns.Add("item.CurrencySymbol");
                productItemList.Columns.Add("item.OrderPrice");
                productItemList.Columns.Add("item.PurchaseQty");
                productItemList.Columns.Add("item.Quantity");
                productItemList.Columns.Add("item.PurchaseQtyOrderPrice");
                productItemList.Columns.Add("item.QuantityOrderPrice");

                getPOInfo.POItems.ForEach(x =>
                {
                    DataRow dr                       = productItemList.NewRow();
                    dr["item.ProductID"]             = x.ProductID;
                    dr["item.IsVirtualStockProduct"] = x.IsVirtualStockProduct;
                    dr["item.ProductMode"]           = x.ProductMode;
                    dr["item.BriefName"]             = x.BriefName;
                    dr["item.CurrencySymbol"]        = x.CurrencySymbol;
                    dr["item.OrderPrice"]            = x.OrderPrice.Value.ToString("#########0.00");
                    dr["item.PurchaseQty"]           = x.PurchaseQty.Value.ToString();
                    dr["item.Quantity"]              = x.Quantity.Value.ToString();
                    dr["item.PurchaseQtyOrderPrice"] = (x.PurchaseQty.Value * x.OrderPrice.Value).ToString("#########0.00");
                    dr["item.QuantityOrderPrice"]    = (x.Quantity.Value * x.OrderPrice.Value).ToString("#########0.00");
                    productItemList.Rows.Add(dr);
                });

                DataTable dt = PurchaseOrderProcessor.GetPurchaseOrderAccessories(poSysNo);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow sr in dt.Rows)
                    {
                        DataRow dr = productAccessoryList.NewRow();
                        dr["ProductID"]            = dr["ProductID"].ToString();
                        dr["AccessoriesID"]        = dr["AccessoriesID"].ToString();
                        dr["AccessoriesIDAndName"] = dr["AccessoriesIDAndName"].ToString();
                        dr["Qty"] = dr["Qty"].ToString();
                        productAccessoryList.Rows.Add(dr);
                    }
                }
                keyTables.Add("tblProductItemsList", productItemList);
                keyTables.Add("tblProductAccessoryList", productItemList);

                MailMessage mailMsg = new MailMessage();
                EmailTemplateHelper.BuildEmailBodyByTemplate(mailMsg, "PO_AutoCloseMail", keyValues, keyTables, Thread.CurrentThread.CurrentCulture.Name);
                returnString = mailMsg.Body;
                return(returnString);
            }
            else
            {
                throw new BizException("未找到相关PO单数据!");
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 拆单邮件
        /// </summary>
        /// <param name="masterSOInfo"></param>
        /// <param name="subSOList"></param>
        public void SendSplitSOEmail(SOInfo masterSOInfo, List <SOInfo> subSOList)
        {
            try
            {
                ECCentral.BizEntity.Customer.CustomerBasicInfo customerInfo = GetCustomerBaseInfo(masterSOInfo.BaseInfo.CustomerSysNo.Value);
                string customerEmail = customerInfo.Email == null ? null : customerInfo.Email.Trim();

                if (customerEmail == null)
                {
                    return;
                }
                #region 填充基本信息
                KeyValueVariables keyValueVariables = new KeyValueVariables();
                KeyTableVariables keyTableVariables = new KeyTableVariables();
                keyValueVariables.Add("CustomerID", customerInfo.CustomerID);
                keyValueVariables.Add("CustomerName", customerInfo.CustomerName);
                keyValueVariables.Add("ReceiveName", masterSOInfo.InvoiceInfo.Header);
                keyValueVariables.Add("ReceiveContact", masterSOInfo.ReceiverInfo.Name);
                ECCentral.BizEntity.Common.AreaInfo areaInfo = ExternalDomainBroker.GetAreaInfoByDistrictSysNo(masterSOInfo.ReceiverInfo.AreaSysNo.Value);
                keyValueVariables.Add("ProvinceName", areaInfo.ProvinceName);
                keyValueVariables.Add("CityName", areaInfo.CityName);
                keyValueVariables.Add("DistrictName", areaInfo.DistrictName);
                keyValueVariables.Add("ReceiveAddress", masterSOInfo.ReceiverInfo.Address);
                keyValueVariables.Add("ReceiveZip", masterSOInfo.ReceiverInfo.Zip);
                keyValueVariables.Add("ReceivePhone", String.IsNullOrEmpty(masterSOInfo.ReceiverInfo.Phone) ? masterSOInfo.ReceiverInfo.MobilePhone : masterSOInfo.ReceiverInfo.Phone);

                keyValueVariables.Add("SOSysNo", masterSOInfo.SysNo.Value);
                keyValueVariables.Add("SubSOSysNoList", String.Join(",", subSOList.Select <SOInfo, int>(subSOInfo => subSOInfo.SysNo.Value).ToArray()));
                keyValueVariables.Add("Memo", masterSOInfo.BaseInfo.Memo);
                keyValueVariables.Add("NowYear", DateTime.Now.Year);
                #endregion 填充基本信息

                #region 替换邮件模板内连接追踪代码
                ReplaceCM_MMC("SO_Splited", keyValueVariables);
                #endregion

                #region 填充拆单信息
                string pagePath = string.Empty;
                string imgSrc   = string.Empty;

                int i = 1;
                ECCentral.BizEntity.Common.PayType      payType      = ExternalDomainBroker.GetPayTypeBySysNo(masterSOInfo.BaseInfo.PayTypeSysNo.Value);
                ECCentral.BizEntity.Common.ShippingType shippingType = ExternalDomainBroker.GetShippingTypeBySysNo(masterSOInfo.ShippingInfo.ShipTypeSysNo.Value);

                DataTable subSO = new DataTable();
                subSO.Columns.AddRange(new DataColumn[]
                {
                    new DataColumn("GainPoint"),
                    new DataColumn("SubSOIndex"),
                    new DataColumn("PayType"),
                    new DataColumn("SOSysNo"),
                    new DataColumn("OrderTime"),
                    new DataColumn("ShipType"),
                    new DataColumn("ShipPeriod"),
                    new DataColumn("CashPay"),
                    new DataColumn("ShipPrice"),
                    new DataColumn("PremiumAmount"),
                    new DataColumn("ReceivableAmount"),
                    new DataColumn("ChangeAmount"),
                    new DataColumn("ChangeAmountDisplay"),
                    new DataColumn("GiftCardPay"),
                    new DataColumn("GiftCardDisplay"),
                    new DataColumn("PointPay"),
                    new DataColumn("PointPayDisplay"),
                    new DataColumn("PrePay"),
                    new DataColumn("PrePayDisplay"),
                    new DataColumn("PayPrice"),
                    new DataColumn("PayPriceDisplay"),
                    new DataColumn("PromotionAmount"),
                    new DataColumn("PromotionDisplay"),
                    new DataColumn("Weight"),
                    new DataColumn("SOItem", typeof(DataTable))
                });
                subSOList.ForEach(subSOInfo =>
                {
                    DataTable subSOItemList = new DataTable();
                    subSOItemList.Columns.AddRange(new DataColumn[]
                    {
                        new DataColumn("ProductID"),
                        new DataColumn("ProductName"),
                        new DataColumn("Price"),
                        new DataColumn("Quantity"),
                        new DataColumn("Amount"),
                        new DataColumn("PagePath"),
                        new DataColumn("ImgSrc")
                    });
                    subSOInfo.Items.ForEach(subSOItem =>
                    {
                        pagePath = "http://www.kjt.com/product/detail/" + subSOItem.ProductSysNo;
                        imgSrc   = "http://image.kjt.com/neg/P60/" + subSOItem.ProductID + ".jpg";
                        ReplaceProductCM_MMC("SO_Splited", ref pagePath, subSOItem.ProductID);
                        subSOItemList.Rows.Add(new string[]
                        {
                            subSOItem.ProductID,
                            subSOItem.ProductName,
                            subSOItem.OriginalPrice.Value.ToString(SOConst.DecimalFormat),
                            subSOItem.Quantity.Value.ToString(),
                            (subSOItem.Quantity.Value * subSOItem.OriginalPrice.Value).ToString(SOConst.DecimalFormat),
                            pagePath,
                            imgSrc
                        });
                    });

                    string changeAmount = (subSOInfo.BaseInfo.OriginalReceivableAmount - subSOInfo.BaseInfo.ReceivableAmount).ToString(SOConst.DecimalFormat);
                    subSO.Rows.Add(new object[]
                    {
                        subSOInfo.BaseInfo.GainPoint,
                        i++,
                        payType.PayTypeName,
                        subSOInfo.BaseInfo.SOID,
                        subSOInfo.BaseInfo.CreateTime.Value.ToString(SOConst.DateTimeFormat),
                        shippingType.ShippingTypeName,
                        shippingType.Period,
                        subSOInfo.BaseInfo.CashPay.ToString(SOConst.DecimalFormat),
                        subSOInfo.BaseInfo.ShipPrice.Value.ToString(SOConst.DecimalFormat),
                        subSOInfo.BaseInfo.PremiumAmount.Value.ToString(SOConst.DecimalFormat),
                        subSOInfo.BaseInfo.ReceivableAmount.ToString(SOConst.DecimalFormat),
                        changeAmount,
                        changeAmount != (0M).ToString(SOConst.DecimalFormat),
                        subSOInfo.BaseInfo.GiftCardPay.Value.ToString(SOConst.DecimalFormat),
                        subSOInfo.BaseInfo.GiftCardPay != 0,
                        subSOInfo.BaseInfo.PointPay,
                        subSOInfo.BaseInfo.PointPay != 0,
                        subSOInfo.BaseInfo.PrepayAmount.Value.ToString(SOConst.DecimalFormat),
                        subSOInfo.BaseInfo.PrepayAmount != 0,
                        subSOInfo.BaseInfo.PayPrice.Value.ToString(SOConst.DecimalFormat),
                        subSOInfo.BaseInfo.PayPrice != 0,
                        subSOInfo.BaseInfo.PromotionAmount.Value.ToString(SOConst.DecimalFormat),
                        subSOInfo.BaseInfo.PromotionAmount != 0,
                        subSOInfo.ShippingInfo.Weight,
                        subSOItemList
                    });

                    KeyTableVariables subSOItemTableVariables = new KeyTableVariables();
                });
                #endregion

                keyTableVariables.Add("SubSOList", subSO);

                ExternalDomainBroker.SendExternalEmail(customerEmail, "SO_Splited", keyValueVariables, keyTableVariables, customerInfo.FavoriteLanguageCode);
            }
            catch (Exception ex)
            {
                ExceptionHelper.HandleException(ex);
            }
        }
Exemplo n.º 19
0
        public void BuildData(NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            //if (requestPostData != null)
            //{
            //    variables.Add("TotalCount", HttpUtility.UrlDecode("TotalCount"));
            //}
            int       count;
            DataTable dt = new DataTable();

            dt.Columns.Add("SysNo");
            dt.Columns.Add("TradeInId");
            dt.Columns.Add("SoSysNo");
            dt.Columns.Add("CustomerSysNo");
            dt.Columns.Add("CustomerName");
            dt.Columns.Add("ReceiveAddress");
            dt.Columns.Add("receivePhone");
            dt.Columns.Add("Licence");
            dt.Columns.Add("Rebate");
            dt.Columns.Add("ReviseRebate");
            dt.Columns.Add("BankName");
            dt.Columns.Add("BranchBankName");
            dt.Columns.Add("BankAccount");
            dt.Columns.Add("Status");
            dt.Columns.Add("InUser");
            dt.Columns.Add("InDateStr");
            dt.Columns.Add("ConfirmUser");
            dt.Columns.Add("ConfirmDateStr");

            if (int.TryParse(requestPostData["TotalCount"], out count))
            {
                DataRow row;
                for (int i = 0; i < count; i++)
                {
                    row                   = dt.NewRow();
                    row["SysNo"]          = HttpUtility.UrlDecode(requestPostData["SysNo" + i]);
                    row["TradeInId"]      = HttpUtility.UrlDecode(requestPostData["TradeInId" + i]);
                    row["SoSysNo"]        = HttpUtility.UrlDecode(requestPostData["SoSysNo" + i]);
                    row["CustomerSysNo"]  = HttpUtility.UrlDecode(requestPostData["CustomerSysNo" + i]);
                    row["CustomerName"]   = HttpUtility.UrlDecode(requestPostData["CustomerName" + i]);
                    row["ReceiveAddress"] = HttpUtility.UrlDecode(requestPostData["ReceiveAddress" + i]);
                    row["receivePhone"]   = HttpUtility.UrlDecode(requestPostData["receivePhone" + i]);
                    row["Licence"]        = HttpUtility.UrlDecode(requestPostData["Licence" + i]);
                    row["Rebate"]         = HttpUtility.UrlDecode(requestPostData["Rebate" + i]);
                    row["ReviseRebate"]   = HttpUtility.UrlDecode(requestPostData["ReviseRebate" + i]);
                    row["BankName"]       = HttpUtility.UrlDecode(requestPostData["BankName" + i]);
                    row["BranchBankName"] = HttpUtility.UrlDecode(requestPostData["BranchBankName" + i]);
                    row["BankAccount"]    = HttpUtility.UrlDecode(requestPostData["BankAccount" + i]);
                    row["Status"]         = HttpUtility.UrlDecode(requestPostData["Status" + i]);
                    row["InUser"]         = HttpUtility.UrlDecode(requestPostData["InUser" + i]);
                    row["InDateStr"]      = HttpUtility.UrlDecode(requestPostData["InDateStr" + i]);
                    row["ConfirmUser"]    = HttpUtility.UrlDecode(requestPostData["ConfirmUser" + i]);
                    row["ConfirmDateStr"] = HttpUtility.UrlDecode(requestPostData["ConfirmDateStr" + i]);
                    dt.Rows.Add(row);
                }
            }

            tableVariables.Add("OldChangeNewList", dt);
        }
Exemplo n.º 20
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();
            string soSysNos = requestPostData["SOSysNoList"];

            if (soSysNos != null && soSysNos.Trim() != String.Empty)
            {
                string[] noList = System.Web.HttpUtility.UrlDecode(soSysNos).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

                List <int> soSysNoList = new List <int>();
                noList.ForEach(no =>
                {
                    int tno = 0;
                    if (int.TryParse(no, out tno))
                    {
                        soSysNoList.Add(tno);
                    }
                });

                if (soSysNoList.Count > 0)
                {
                    List <SOInfo> soInfoList = ObjectFactory <SOProcessor> .Instance.GetSOBySOSysNoList(soSysNoList);

                    System.Data.DataTable dtSO = new System.Data.DataTable();
                    dtSO.Columns.AddRange(new System.Data.DataColumn[]
                    {
                        new DataColumn("BarCodeImage"),
                        new DataColumn("SelfCompanyName"),
                        new DataColumn("SelfCompanyAddress"),
                        new DataColumn("SelfCompanyPhone"),
                        new DataColumn("SelfCompanyWebAddress"),
                        new DataColumn("OriginalReceivableAmount"),
                        new DataColumn("SOSysNo"),
                        new DataColumn("Pager"),
                        new DataColumn("SheetNumberDisplay", typeof(bool)),
                        new DataColumn("SheetNumber"),
                        new DataColumn("InvoiceHeader"),
                        new DataColumn("ReceiveAddress"),
                        new DataColumn("ReceiveName"),
                        new DataColumn("ReceivePhone"),
                        new DataColumn("VATDisplay"),
                        new DataColumn("VATNo"),
                        new DataColumn("CompanyName"),
                        new DataColumn("CompanyAddress"),
                        new DataColumn("CompanyPhone"),
                        new DataColumn("OpenAccountBank"),
                        new DataColumn("SOStatus"),
                        new DataColumn("PayType"),
                        new DataColumn("ShipType"),
                        new DataColumn("CreateUser"),
                        new DataColumn("CreateDate"),
                        new DataColumn("OutTime"),
                        new DataColumn("AuditUser"),
                        new DataColumn("AuditDate"),
                        new DataColumn("Memo"),
                        new DataColumn("Note"),
                        new DataColumn("InvoiceNote"),
                        new DataColumn("ReceivableAmount"),
                        new DataColumn("ProductList", typeof(DataTable)),
                        new DataColumn("ComboList", typeof(DataTable)),
                        new DataColumn("ShipPriceDisplay", typeof(bool)),
                        new DataColumn("ShipPrice"),
                        new DataColumn("PremiumAmountDisplay", typeof(bool)),
                        new DataColumn("PremiumAmount"),
                        new DataColumn("PayPriceDisplay", typeof(bool)),
                        new DataColumn("PayPrice"),
                        new DataColumn("PointPayDisplay", typeof(bool)),
                        new DataColumn("PointPay"),
                        new DataColumn("ChangeAmountDisplay", typeof(bool)),
                        new DataColumn("ChangeAmount"),
                    });

                    tableVariables.Add("OrderList", dtSO);

                    Dictionary <int, ECCentral.BizEntity.Inventory.WarehouseInfo> dicStock = new Dictionary <int, BizEntity.Inventory.WarehouseInfo>();
                    soInfoList.ForEach(soInfo =>
                    {
                        #region 订单基本属性
                        DataRow dr = dtSO.NewRow();
                        ECCentral.BizEntity.Common.PayType payType           = ExternalDomainBroker.GetPayTypeBySysNo(soInfo.BaseInfo.PayTypeSysNo.Value);
                        ECCentral.BizEntity.Common.ShippingType shippingType = ExternalDomainBroker.GetShippingTypeBySysNo(soInfo.ShippingInfo.ShipTypeSysNo.Value);
                        dr["BarCodeImage"]             = GetBarCodeUrl(soInfo.SysNo.ToString());
                        dr["SelfCompanyName"]          = ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Company_Name");
                        dr["SelfCompanyAddress"]       = ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Company_Address");
                        dr["SelfCompanyPhone"]         = ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Company_Phone");
                        dr["SelfCompanyWebAddress"]    = ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Company_Url");
                        dr["OriginalReceivableAmount"] = soInfo.BaseInfo.PayWhenReceived.Value ? ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(soInfo.BaseInfo.OriginalReceivableAmount) : 0M;
                        dr["SOSysNo"]                   = soInfo.SysNo;
                        dr["Pager"]                     = "";
                        dr["SheetNumberDisplay"]        = soInfo.InvoiceInfo.IsVAT.Value;
                        dr["InvoiceHeader"]             = soInfo.InvoiceInfo.Header;
                        AreaInfo receiveAreaInfo        = ExternalDomainBroker.GetAreaInfoByDistrictSysNo(soInfo.ReceiverInfo.AreaSysNo.Value);
                        dr["ReceiveAddress"]            = receiveAreaInfo == null ? soInfo.ReceiverInfo.Address : String.Format("{0},{1},{2},{3}{4}", receiveAreaInfo.ProvinceName, receiveAreaInfo.CityName, receiveAreaInfo.DistrictName, soInfo.ReceiverInfo.Address, soInfo.ReceiverInfo.Zip);
                        dr["ReceiveName"]               = soInfo.ReceiverInfo.Name;
                        soInfo.ReceiverInfo.MobilePhone = soInfo.ReceiverInfo.MobilePhone == null ? string.Empty : soInfo.ReceiverInfo.MobilePhone.Trim();
                        soInfo.ReceiverInfo.Phone       = soInfo.ReceiverInfo.Phone == null ? string.Empty : soInfo.ReceiverInfo.Phone.Trim();
                        string phone                    = soInfo.ReceiverInfo.MobilePhone == soInfo.ReceiverInfo.Phone ? soInfo.ReceiverInfo.MobilePhone : String.Format("{0},{1}", soInfo.ReceiverInfo.MobilePhone, soInfo.ReceiverInfo.Phone);
                        dr["ReceivePhone"]              = phone.Trim(',');
                        dr["VATDisplay"]                = soInfo.InvoiceInfo.IsVAT.Value;
                        dr["SOStatus"]                  = soInfo.BaseInfo.Status.ToDisplayText();
                        dr["PayType"]                   = payType.PayTypeName;
                        dr["ShipType"]                  = shippingType.ShippingTypeName.StartsWith("(*) ") ? shippingType.ShippingTypeName.Substring(4) : shippingType.ShippingTypeName;
                        dr["CreateDate"]                = soInfo.BaseInfo.CreateTime.Value.ToString(SOConst.DateFormat);
                        //dr["OutTime"] = soInfo.ShippingInfo.OutTime.Value.ToString(SOConst.DateFormat);
                        dr["OutTime"]          = soInfo.ShippingInfo.OutTime.HasValue ? soInfo.ShippingInfo.OutTime.Value.ToString(SOConst.DateFormat) : "";
                        dr["Memo"]             = soInfo.BaseInfo.Memo;
                        dr["Note"]             = soInfo.BaseInfo.Note;
                        dr["InvoiceNote"]      = soInfo.InvoiceInfo.InvoiceNote;
                        dr["ReceivableAmount"] = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(soInfo.BaseInfo.ReceivableAmount);
                        UserInfo userInfo      = soInfo.BaseInfo.SalesManSysNo.HasValue ? ExternalDomainBroker.GetUserInfoBySysNo(soInfo.BaseInfo.SalesManSysNo.Value) : null;
                        string defaultUserName = ResouceManager.GetMessageString(CommonConst.MessagePath_Common, "Res_Creater_Name");
                        dr["CreateUser"]       = userInfo == null ? defaultUserName : userInfo.UserDisplayName;
                        if (soInfo.StatusChangeInfoList != null && soInfo.StatusChangeInfoList.Count > 0)
                        {
                            SOStatusChangeInfo statusChangeInfo = soInfo.StatusChangeInfoList.FirstOrDefault <SOStatusChangeInfo>(info => info.OldStatus == SOStatus.Origin);
                            if (statusChangeInfo != null)
                            {
                                dr["AuditDate"] = statusChangeInfo.ChangeTime.Value.ToString(SOConst.DateFormat);
                                userInfo        = soInfo.BaseInfo.SalesManSysNo.HasValue ? ExternalDomainBroker.GetUserInfoBySysNo(statusChangeInfo.OperatorSysNo.Value) : null;
                                dr["AuditUser"] = userInfo == null ? defaultUserName : userInfo.UserDisplayName;
                            }
                        }

                        #endregion

                        #region 填充增值税发票相关信息
                        if (soInfo.InvoiceInfo.IsVAT.Value)
                        {
                            dr["VATNo"]           = soInfo.InvoiceInfo.VATInvoiceInfo.TaxNumber;
                            dr["CompanyName"]     = soInfo.InvoiceInfo.VATInvoiceInfo.CompanyName;
                            dr["CompanyAddress"]  = soInfo.InvoiceInfo.VATInvoiceInfo.CompanyAddress;
                            dr["CompanyPhone"]    = soInfo.InvoiceInfo.VATInvoiceInfo.CompanyPhone;
                            dr["OpenAccountBank"] = soInfo.InvoiceInfo.VATInvoiceInfo.BankAccount;
                            string number         = ExternalDomainBroker.GetSystemConfigurationValue("SOVatNumber", soInfo.CompanyCode);
                            string flownumber     = "";
                            string updateNumber   = string.Empty;

                            if (number == string.Empty)
                            {
                                number     = "0";
                                flownumber = "1";
                            }
                            else
                            {
                                flownumber = Convert.ToString(int.Parse(number) + 1);
                            }
                            //老系统中的第三个参数User.SysNo由后台添加
                            //commonBizInteract.UpdateSystemConfigurationValue("SOVatNumber", flownumber, soInfo.CompanyCode);

                            //加入SO单以前的流水号
                            string oldInvoiceNumber = soInfo.InvoiceInfo.InvoiceNo;
                            if (oldInvoiceNumber != null)
                            {
                                if (oldInvoiceNumber.Trim().Length > 0)
                                {
                                    updateNumber = oldInvoiceNumber.ToString().Trim() + "," + number;
                                }
                                else
                                {
                                    updateNumber = number;
                                }
                            }
                            //CommonService.UpdateSoMaster(soMastInfo.SystemNumber, updateNumber);

                            dr["SheetNumber"] = number;
                        }
                        #endregion

                        #region  填充商品
                        DataTable dtProduct = new DataTable();
                        dtProduct.Columns.AddRange(new System.Data.DataColumn[]
                        {
                            new DataColumn("ProductID"),
                            new DataColumn("ProductName"),
                            new DataColumn("Price"),
                            new DataColumn("Quantity"),
                            new DataColumn("Amount"),
                            new DataColumn("Tax"),
                            new DataColumn("Stock")
                        });
                        soInfo.Items.ForEach(p =>
                        {
                            if (!dicStock.ContainsKey(p.StockSysNo.Value))
                            {
                                dicStock.Add(p.StockSysNo.Value, ExternalDomainBroker.GetWarehouseInfo(p.StockSysNo.Value));
                            }
                            DataRow drProduct        = dtProduct.NewRow();
                            drProduct["ProductID"]   = p.ProductType == SOProductType.Coupon || p.ProductType == SOProductType.ExtendWarranty ? p.ProductSysNo.ToString() : p.ProductID;
                            drProduct["ProductName"] = p.ProductName;
                            drProduct["Price"]       = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(p.OriginalPrice.Value);
                            drProduct["Quantity"]    = p.Quantity;
                            drProduct["Amount"]      = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(p.Quantity.Value * p.OriginalPrice.Value);
                            drProduct["Tax"]         = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(p.TariffAmount.Value);
                            drProduct["Stock"]       = dicStock[p.StockSysNo.Value] == null ? String.Empty : dicStock[p.StockSysNo.Value].WarehouseName;
                            dtProduct.Rows.Add(drProduct);
                        });
                        dr["ProductList"] = dtProduct;
                        #endregion

                        #region 促销优惠:组合销售
                        List <SOPromotionInfo> comboList = (from promotion in soInfo.SOPromotions
                                                            where promotion.PromotionType == SOPromotionType.Combo
                                                            select promotion).ToList();
                        if (comboList.Count > 0)
                        {
                            List <ECCentral.BizEntity.MKT.ComboInfo> comboInfoList = ExternalDomainBroker.GetComboList(comboList.Select <SOPromotionInfo, int>(p => p.PromotionSysNo.Value).ToList <int>());
                            DataTable dtCombo = new DataTable();
                            dtCombo.Columns.AddRange(new System.Data.DataColumn[]
                            {
                                new DataColumn("ProductName"),
                                new DataColumn("Quantity"),
                                new DataColumn("Amount"),
                            });
                            comboList.ForEach(combo =>
                            {
                                ECCentral.BizEntity.MKT.ComboInfo comboInfo = comboInfoList.FirstOrDefault(cb => cb.SysNo == combo.PromotionSysNo);
                                DataRow drCombo        = dtCombo.NewRow();
                                drCombo["ProductName"] = comboInfo.Name.Content;
                                drCombo["Quantity"]    = combo.Time;
                                drCombo["Amount"]      = combo.DiscountAmount.Value.ToString(SOConst.DecimalFormat);
                                dtCombo.Rows.Add(drCombo);
                            });
                            dr["ComboList"] = dtCombo;
                        }
                        #endregion

                        #region 运费
                        dr["ShipPriceDisplay"] = soInfo.BaseInfo.ShipPrice.HasValue && soInfo.BaseInfo.ShipPrice > 0M;
                        if (soInfo.BaseInfo.ShipPrice > 0)
                        {
                            dr["ShipPrice"] = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(soInfo.BaseInfo.ShipPrice.Value);
                        }
                        #endregion

                        #region 保价费
                        dr["PremiumAmountDisplay"] = soInfo.BaseInfo.PremiumAmount.HasValue && soInfo.BaseInfo.PremiumAmount > 0M;
                        if (soInfo.BaseInfo.PremiumAmount > 0)
                        {
                            dr["PremiumAmount"] = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(soInfo.BaseInfo.PremiumAmount.Value);
                        }
                        #endregion

                        #region 手续费
                        dr["PayPriceDisplay"] = soInfo.BaseInfo.PayPrice.HasValue && soInfo.BaseInfo.PayPrice > 0M;
                        if (soInfo.BaseInfo.PayPrice > 0)
                        {
                            dr["PayPrice"] = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(soInfo.BaseInfo.PayPrice.Value);
                        }
                        #endregion

                        #region 积分抵扣
                        dr["PointPayDisplay"] = soInfo.BaseInfo.PointPay.HasValue && soInfo.BaseInfo.PointPay > 0;
                        if (soInfo.BaseInfo.PointPay > 0)
                        {
                            dr["PointPay"] = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(soInfo.BaseInfo.PointPayAmount.Value);
                        }
                        #endregion

                        #region 去零头
                        decimal fen = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(soInfo.BaseInfo.OriginalReceivableAmount) - soInfo.BaseInfo.ReceivableAmount;
                        dr["ChangeAmountDisplay"] = fen > 0M;
                        if (fen > 0)
                        {
                            dr["ChangeAmount"] = ECCentral.Service.SO.BizProcessor.UtilityHelper.ToMoney(fen);
                        }
                        #endregion

                        dtSO.Rows.Add(dr);
                    });
                }
            }
        }