コード例 #1
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        try
        {
            IList <TransportationActBill> transportationActBillList = this.ucNewList.PopulateSelectedData();
            IList <TransportationBill>    transportationBillList    = TheTransportationBillMgr.CreateTransportationBill(transportationActBillList, this.CurrentUser);
            this.ShowSuccessMessage("Transportation.TransportationBill.CreateSuccessfully", transportationBillList[0].BillNo);

            if (this.IsRelease.Checked)
            {
                TheTransportationBillMgr.ReleaseTransportationBill(transportationBillList[0].BillNo, this.CurrentUser);
                this.ShowSuccessMessage("Transportation.TransportationBill.ReleaseSuccessfully", transportationBillList[0].BillNo);
            }
            this.PageCleanUp();
            CreateEvent(transportationBillList[0].BillNo, null);
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
コード例 #2
0
    /// <summary>
    /// 文件上传 taskno:181695
    /// djin 2013-9-2
    /// </summary>
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        HSSFWorkbook excel = new HSSFWorkbook(fileUpload.PostedFile.InputStream);
        Sheet        sheet = excel.GetSheetAt(0);
        IEnumerator  rows  = sheet.GetRowEnumerator();

        //Row custrow = sheet.GetRow(2);
        // string sup = custrow.GetCell(1).StringCellValue;//客户代码
        //Supplier su = TheSupplierMgr.LoadSupplier(sup);
        //Row row_startdate = sheet.GetRow(3);
        //string startdate = row_startdate.GetCell(1).StringCellValue;//开始日期
        //Row row_enddate = sheet.GetRow(4);
        //string enddate = row_enddate.GetCell(1).StringCellValue;//结束日期
        //startdate = startdate == string.Empty ? DateTime.Now.AddMonths(-1).ToShortDateString() : startdate;
        //enddate = enddate == string.Empty ? DateTime.Now.ToShortDateString() : enddate;
        ImportHelper.JumpRows(rows, 1);
        IList <TransportationActBill> tactbillList = new List <TransportationActBill>();
        Hashtable th     = new Hashtable();
        string    supply = string.Empty;

        while (rows.MoveNext())
        {
            Row    curow     = (HSSFRow)rows.Current;
            string shiporder = curow.GetCell(0).StringCellValue;
            if (th.ContainsKey(shiporder))
            {
                continue;                           //避免重复
            }
            // decimal cur = decimal.Parse(curow.GetCell(1).NumericCellValue.ToString());
            if (shiporder != string.Empty)
            {
                IList <TransportationActBill> tactbill = TheTransportationActBillMgr.GetTransportationActBill(shiporder);

                if (tactbill.Count > 0)
                {
                    foreach (TransportationActBill tbill in tactbill)
                    {
                        if (!string.IsNullOrEmpty(supply))
                        {
                            if (tbill.BillAddress.Party.Code != supply)
                            {
                                ShowErrorMessage("行" + curow.RowNum.ToString() + "供应商的代码不一致!");
                                return;
                            }
                        }
                        else
                        {
                            supply = tbill.BillAddress.Party.Code;
                        }
                        if (tbill.Status == "Create")
                        {
                            tbill.CurrentBillQty    = tbill.BillQty - tbill.BilledQty;
                            tbill.CurrentBillAmount = tbill.CurrentBillQty * tbill.UnitPrice;
                            tactbillList.Add(tbill);
                        }
                    }
                }
                else
                {
                    ShowErrorMessage("行" + curow.RowNum.ToString() + "还没有计价!");
                    return;
                }
            }
            else
            {
                ShowErrorMessage("行" + curow.RowNum.ToString() + "无运单号!");
                return;
            }
        }
        if (tactbillList.Count > 0)
        {
            try
            {
                IList <TransportationBill> transportationBillList = TheTransportationBillMgr.CreateTransportationBill(tactbillList, this.CurrentUser);
                if (transportationBillList != null && transportationBillList.Count > 0)
                {
                    ExportResult(transportationBillList);
                    btnBack_Click(sender, e);
                }
            }
            catch (BusinessErrorException ex)
            {
                ShowErrorMessage(ex);
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message);
            }
        }
        else
        {
            ShowErrorMessage("账单创建失败!");
        }
    }