Exemplo n.º 1
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.º 2
0
        private void InitData(SOInvoiceInfo soInvoice, DataTable table)
        {
            int         rowCount = soInvoice.InvoiceInfoList.Count;
            DataRow     row      = null;
            InvoiceInfo invoice  = null;

            for (int i = 0; i < rowCount; i++)
            {
                invoice                  = soInvoice.InvoiceInfoList[i];
                row                      = table.NewRow();
                row["InvoiceDate"]       = invoice.InvoiceDate;
                row["InvoiceCurPageNum"] = invoice.InvoiceCurPageNum;
                row["InvoiceSumPageNum"] = invoice.InvoiceSumPageNum;
                row["ReceiveName"]       = invoice.ReceiveName;
                row["ReceiveContact"]    = invoice.ReceiveContact;
                row["ReceiveAddress1"]   = invoice.ReceiveAddress1;
                row["ReceiveAddress2"]   = invoice.ReceiveAddress2;
                row["ReceivePhone"]      = invoice.ReceivePhone;
                row["InvoiceNote"]       = invoice.InvoiceNote;
                row["CustomerSysNo"]     = invoice.CustomerSysNo;
                row["PayTypeName"]       = invoice.PayTypeName;
                row["InvoiceSeqEx"]      = invoice.InvoiceSeqEx;
                row["SOSysNo"]           = invoice.SOSysNo;
                row["TotalWeight"]       = invoice.TotalWeight == 0 ? string.Empty : invoice.TotalWeight.ToString();
                row["ServicePhone"]      = string.IsNullOrWhiteSpace(invoice.ServicePhone) ? "400-820-4400" : invoice.ServicePhone;
                row["Importance"]        = invoice.Importance;
                row["RMBConvert"]        = invoice.RMBConvert;
                row["ShipTypeName"]      = invoice.ShipTypeName;

                //发票明细
                DataTable itemTable = CreateItemsPrintData();
                InitItemData(invoice.Items, itemTable);

                DataTable otherTable = CreateOtherPrintData();
                InitOtherData(invoice.Items, otherTable);

                row["Items"]  = itemTable;
                row["Others"] = otherTable;
                table.Rows.Add(row);
            }
        }
Exemplo n.º 3
0
        private List <InvoiceItem> notSplitInvoiceItems = null;                                                               //未拆分的发票明细Items


        /// <summary>
        /// 根据订单发票实体对象获取对应的要打印的发票List
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public SOInvoiceInfo GetNew(SOInvoiceInfo entity)
        {
            if (entity.SOInfo.SOSysNo == 0)
            {
                //throw new BizException("SOInfo.SOSysNo不能为空");
                ThrowBizException("InvoiceReport_SOInfoSOSysNoNotNull");
            }
            if (entity.SOInfo.StockSysNo == 0)
            {
                //throw new BizException("SOInfo.StockSysNo不能为空");
                ThrowBizException("InvoiceReport_SOInfoStockSysNoNoNotNull");
            }

            //获取订单发票Master信息(其中包括业务模式、是否拆分发票、其他费用等字段)
            this.soMaster = DA.GetSOInvoiceMaster(entity.SOInfo.SOSysNo.Value
                                                  , entity.SOInfo.StockSysNo.Value
                                                  , "NEG"
                                                  , "MET");
            //数据校验
            if (soMaster == null)
            {
                //throw new BizException(string.Format("此订单号({0})分仓号({1})在拆分单中没有记录",
                //    entity.SOInfo.SOSysNo.ToString(),
                //    entity.SOInfo.StockSysNo.ToString()));
                ThrowBizException("InvoiceReport_NotExistOrderIDStockIDInSplit", entity.SOInfo.SOSysNo.ToString(), entity.SOInfo.StockSysNo.ToString());
            }
            if (soMaster.InvoiceType == null || soMaster.ShippingType == null || soMaster.StockType == null)
            {
                //throw new BizException(string.Format("此订单号({0})分仓号({1})的业务模式相关字段为NULL值",
                //  this.soMaster.SOSysNo.ToString(),
                //  this.soMaster.StockSysNo.ToString()));
                ThrowBizException("InvoiceReport_NotExistFieldOrderIDStockIDInSplit", this.soMaster.SOSysNo.ToString(), this.soMaster.StockSysNo.ToString());
            }
            //判断MKT PlACE II需求的业务模式
            if (!this.IsAllowGetPrintIncoiceinfo())
            {
                //throw new BizException(string.Format("此订单号({0})分仓号({1})的业务模式不支持发票打印",
                //    this.soMaster.SOSysNo.ToString(),
                //    this.soMaster.StockSysNo.ToString()));
                ThrowBizException("InvoiceReport_NotSurportInvoicePrintOfOrderIDStockID", this.soMaster.SOSysNo.ToString(), this.soMaster.StockSysNo.ToString());
            }
            else
            {
                //判断业务模式5的发票金额是否小于零,不打印
                if (this.soMaster.BussinessMode == 5 && this.soMaster.InvoiceAmt <= 0)
                {
                    //throw new BizException(string.Format("此订单号({0})分仓号({1})的业务模式为“商家仓储泰隆优选配送”+“商家开票”模式,但发票金额为零元,不支持发票打印",
                    // this.soMaster.SOSysNo.ToString(),
                    // this.soMaster.StockSysNo.ToString()));
                    ThrowBizException("InvoiceReport_NotSurportInvoicePrintOfOrderIDStockIDWhenAmountIsZero", this.soMaster.SOSysNo.ToString(), this.soMaster.StockSysNo.ToString());
                }
                //判断业务模式5的发票是否发生拆分,不支持
                if (this.soMaster.BussinessMode == 5 && this.soMaster.IsMultiInvoice)
                {
                    //throw new BizException(string.Format("此订单号({0})分仓号({1})的业务模式为“商家仓储泰隆优选配送”+“商家开票”模式,但存在拆分发票的异常数据,不支持发票打印",
                    //this.soMaster.SOSysNo.ToString(),
                    //this.soMaster.StockSysNo.ToString()));
                    ThrowBizException("InvoiceReport_NotSurportInvoicePrintOfOrderIDStockIDWhenDataError", this.soMaster.SOSysNo.ToString(), this.soMaster.StockSysNo.ToString());
                }
            }
            //获取联通3G卡产品Items
            if (htUnion3GCardItems.Count == 0)
            {
                htUnion3GCardItems = this.GetUnion3GSIMCardItems();
            }

            //获取发票实体列表
            entity.InvoiceInfoList = this.GetListInvoiceInfo();

            //未拆分的发票明细Items清空
            this.notSplitInvoiceItems = new List <InvoiceItem>();

            return(entity);
        }
Exemplo n.º 4
0
 public SOInvoiceInfo GetNew(SOInvoiceInfo entity)
 {
     return(ObjectFactory <InvoiceReportProcessor> .Instance.GetNew(entity));
 }
 public SOInvoiceInfo GetNew(SOInvoiceInfo entity)
 {
     return(ObjectFactory <InvoiceReportAppService> .Instance.GetNew(entity));
 }