Esempio n. 1
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Initialize()
        {
            #region 页面内容

            using (ContractProvider contProvider = new ContractProvider())
            {
                var area = contProvider.GetBaseParam("AR", "");
                LocalGlobal.BindListItems(rcarea, area.DefaultView, "Description", "Description", true);
                var payType = contProvider.GetBaseParam("PY", "");
                LocalGlobal.BindListItems(rcterm, payType.DefaultView, "Description", "Description", true);
                var tradeCond = contProvider.GetBaseParam("TC", "");
                LocalGlobal.BindListItems(rctrc, tradeCond.DefaultView, "Description", "Description", true);
                var curr = contProvider.GetBaseParam("CY", "");
                LocalGlobal.BindListItems(rccur, curr.DefaultView, "Description", "Description", true);
                var tax = contProvider.GetBaseParam("TX", "");
                LocalGlobal.BindListItems(rctax, tax.DefaultView, "Description", "Description", true);
                var sales = contProvider.GetBaseParam("CK", "");
                LocalGlobal.BindListItems(rcsalr, sales.DefaultView, "Description", "Description", true);
            }

            #endregion

            if (this.CurrentID.Length == 0)
            {
                //新增
            }
            else
            {
                //编辑
                this.BindItem();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Initialize()
        {
            #region 页面内容

            #endregion

            if (this.CurrentID.Length == 0)
            {
                //新增
                ORDNO.Text        = LocalGlobal.NewOrno(true);
                ORDNAME.Text      = "加工定做合同";
                SIGNDATE.Text     = DateTime.Now.ToString("yyyy-MM-dd");
                DELIVERYDATE.Text = DateTime.Now.ToString("yyyy-MM-dd");

                if (CurrentType == "2")
                {
                    SCH_YF.Text = "0";
                    SCH_JD.Text = "0";
                    SCH_TH.Text = "100";
                    SCH_ZB.Text = "0";
                }
            }
            else
            {
                //编辑
                this.BindItem();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindList()
        {
            using (ContractProvider contProvider = new ContractProvider())
            {
                string dFrom = string.IsNullOrWhiteSpace(DateFrom.Text.Trim()) ? string.Empty :
                               LocalGlobal.ConvertDateFormat(DateFrom.Text.Trim()).ToString("yyyyMMdd");
                string dTo = string.IsNullOrWhiteSpace(DateTo.Text.Trim()) ? string.Empty :
                             LocalGlobal.ConvertDateFormat(DateTo.Text.Trim()).ToString("yyyyMMdd");

                decimal   totalAmt = 0;
                DataTable table    = contProvider.GetShipKpDetailList(this.CurrentType, ORDNO.Text.Trim(), CUSTNO.Text.Trim(), CUSTNAME.Text.Trim(), dFrom, dTo);

                table.Columns.Add("NoKpAmt");     //未开票金额
                table.Columns.Add("ShipNoKpQty"); //已交货未开票数量
                table.Columns.Add("ShipNoKpAmt"); //已交货未开票金额
                table.Columns.Add("KpNoShipQty"); //已开票未交货数量
                table.Columns.Add("KpNoShipAmt"); //已开票未交货金额
                foreach (DataRow row in table.Rows)
                {
                    var unitPrice = Util.ToDecimal(row["UNITPRICE"].ToString()); //单价
                    var amt       = Util.ToDecimal(row["amt"].ToString());       //明细 总价
                    var shipqty   = Util.ToDecimal(row["shipqty"].ToString());   //已交货数量
                    var kpqty     = Util.ToDecimal(row["kpqty"].ToString());     //已开票数量
                    var kpamt     = Util.ToDecimal(row["kpamt"].ToString());     //已开票金额

                    //未开票金额
                    row["NoKpAmt"] = (amt - kpamt) < 0 ? "" : (amt - kpamt).ToString();
                    //已交货未开票数量
                    row["ShipNoKpQty"] = (shipqty - kpqty) < 0 ? "" : (shipqty - kpqty).ToString();
                    //已交货未开票金额
                    row["ShipNoKpAmt"] = (unitPrice * shipqty - kpamt) < 0 ? "" : (unitPrice * shipqty - kpamt).ToString();
                    //已开票未交货数量
                    row["KpNoShipQty"] = (kpqty - shipqty) < 0 ? "" : (kpqty - shipqty).ToString();
                    //已开票未交货金额
                    row["KpNoShipAmt"] = (kpamt - unitPrice * shipqty) < 0 ? "" : (kpamt - unitPrice * shipqty).ToString();

                    switch (this.CurrentType)
                    {
                    case 0:     //全部
                    case 3:     //未开票未交货
                    case 4:     //已开票已交货
                        totalAmt += amt;
                        break;

                    case 1:     //已开票未交货
                        totalAmt += Util.ToDecimal(row["KpNoShipAmt"].ToString());
                        break;

                    case 2:     //已交货未开票
                        totalAmt += Util.ToDecimal(row["ShipNoKpAmt"].ToString());
                        break;
                    }
                }

                TotalAmt.Text = totalAmt.ToString();

                List.DataSource = table;
            }
            List.DataBind();
        }
Esempio n. 4
0
        /// <summary>
        /// 新增PRList临时行
        /// </summary>
        protected void CreateButton_Click(object sender, EventArgs e)
        {
            var table = ViewState["ViewDT"] as DataTable;

            foreach (GridViewRow row in List.Rows)
            {
                HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                if (rowCheckControl.Checked)
                {
                    var newRow = table.NewRow();
                    newRow["prlnedm"]  = "N";
                    newRow["prltno"]   = row.Cells[2].Text.Trim();
                    newRow["bomnam"]   = row.Cells[3].Text.Trim();
                    newRow["bommat"]   = row.Cells[4].Text.Trim();
                    newRow["prlrule"]  = row.Cells[5].Text.Trim();
                    newRow["prlsoseq"] = row.Cells[1].Text.Trim();
                    newRow["bomreq"]   = row.Cells[6].Text.Trim();
                    newRow["prlum"]    = row.Cells[7].Text.Trim();
                    newRow["PRLQTY"]   = Util.ToInt(row.Cells[6].Text.Trim()) - LocalGlobal.GetBomQty(ORDNO.Text.Trim(), row.Cells[1].Text.Trim(), "F");

                    //保存临时数据后重新绑定gridview
                    table.Rows.Add(newRow);
                }
            }

            ViewState["ViewDT"] = table;
            BindTempData();
        }
Esempio n. 5
0
        /// <summary>
        /// 行绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void List_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
            //数据行
            case DataControlRowType.DataRow:
                #region 数据绑定


                #endregion
                break;

            case DataControlRowType.Footer:
                DropDownList UM = (DropDownList)e.Row.FindControl("UM");
                using (ContractProvider contProvider = new ContractProvider())
                {
                    var table = contProvider.GetBaseParam("UM", "");
                    LocalGlobal.BindListItems(UM, table.DefaultView, "code", "code", false);
                }
                break;

            case DataControlRowType.EmptyDataRow:
            case DataControlRowType.Header:
            case DataControlRowType.Separator:
            case DataControlRowType.Pager:
            default:
                break;
            }
        }
Esempio n. 6
0
 protected void ExportButton_Click(object sender, EventArgs e)
 {
     this.List.AllowPaging = false;
     this.BindList();
     LocalGlobal.ToExcel(this.List, "请购查询");
     this.List.AllowPaging = true;
     this.BindList();
 }
Esempio n. 7
0
 protected void ExportButton_Click(object sender, EventArgs e)
 {
     this.List.AllowPaging        = false;
     this.List.Columns[0].Visible = false;
     this.BindList();
     LocalGlobal.ToExcel(this.List, "合同台帐");
     this.List.AllowPaging = true;
     this.BindList();
     this.List.Columns[0].Visible = true;
 }
Esempio n. 8
0
        /// <summary>
        /// 确定
        /// </summary>
        protected void OKButton_Click(object sender, EventArgs e)
        {
            if (ORDNO.Text.Trim().Length == 0 || Seq.Text.Trim().Length == 0)
            {
                this.ShowErrorMessage("参数错误");
                return;
            }

            SqlConnection con = LocalGlobal.DbConnect();

            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();

            cmd.Connection  = con;
            cmd.Transaction = tran;

            try
            {
                using (ContractProvider contProvider = new ContractProvider())
                {
                    string orno  = ORDNO.Text.Trim();
                    string orSeq = Seq.Text.Trim();

                    cmd.CommandText = contProvider.DeleteZbSkSql(orno, this.CurrentStNo, orSeq);
                    cmd.ExecuteNonQuery();

                    var table = ViewState["ViewDT"] as DataTable;
                    int seq = 0; decimal total = 0;
                    foreach (DataRow row in table.Rows)
                    {
                        seq++;
                        cmd.CommandText = contProvider.InsertZbSkSql(orno, orSeq, seq.ToString(), this.CurrentStNo, row["zbskamt"].ToString(), row["zbskdate"].ToString());

                        cmd.ExecuteNonQuery();

                        total += Util.ToDecimal(row["zbskamt"].ToString());
                    }

                    cmd.CommandText = contProvider.UpdateZbSkAmtSql(orno, orSeq, this.CurrentStNo, total.ToString());
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception error)
            {
                tran.Rollback();
                this.ShowErrorMessage("保存失败!" + error.Message);
                return;
            }

            tran.Commit();

            //回调
            this.DialogCallback("'CloseRefresh'", "window");
        }
Esempio n. 9
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindList()
        {
            using (PurProvider purProvider = new PurProvider())
            {
                string    dateFrom = LocalGlobal.ConvertDateFormat(DateFrom.Text.Trim()).ToString("yyyyMMdd");
                string    dateTo   = LocalGlobal.ConvertDateFormat(DateTo.Text.Trim()).ToString("yyyyMMdd");
                DataTable table    = purProvider.ShipQuery(ORDNO.Text.Trim(), CUSTNO.Text.Trim(), dateFrom, dateTo);

                List.DataSource = table;
            }
            List.DataBind();
        }
Esempio n. 10
0
        /// <summary>
        /// 否决
        /// </summary>
        protected void RejectButton_Click(object sender, EventArgs e)
        {
            SqlConnection con = LocalGlobal.DbConnect();

            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();

            cmd.Connection  = con;
            cmd.Transaction = tran;

            using (PurProvider purProvider = new PurProvider())
            {
                try
                {
                    bool flag = false;
                    foreach (GridViewRow row in DetailList.Rows)
                    {
                        HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                        if (rowCheckControl.Checked)
                        {
                            string prNo = row.Cells[1].Text.Trim();
                            string seq  = row.Cells[2].Text.Trim();

                            cmd.CommandText = purProvider.RejectPr(prNo, seq);
                            cmd.ExecuteNonQuery();

                            flag = true;
                        }
                    }

                    if (flag)
                    {
                        tran.Commit();
                        this.BindList();
                    }
                    else
                    {
                        this.ShowInfoMessage(this.GetGlobalResourceString("NotSelectMessage"));
                        tran.Rollback();
                        return;
                    }
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    this.ShowErrorMessage("提交失败。" + error.Message);
                    return;
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindList()
        {
            using (ContractProvider contProvider = new ContractProvider())
            {
                string dFrom = string.IsNullOrWhiteSpace(DateFrom.Text.Trim()) ? string.Empty :
                               LocalGlobal.ConvertDateFormat(DateFrom.Text.Trim()).ToString("yyyyMMdd");
                string dTo = string.IsNullOrWhiteSpace(DateTo.Text.Trim()) ? string.Empty :
                             LocalGlobal.ConvertDateFormat(DateTo.Text.Trim()).ToString("yyyyMMdd");

                List.DataSource = contProvider.GetContractList(ORDNO.Text.Trim(), CUSTNO.Text.Trim(), CUSTNAME.Text.Trim(), dFrom, dTo);
            }
            List.DataBind();

            this.List.SelectedIndex = -1;
            DetailList.DataSource   = null;
            DetailList.DataBind();
        }
Esempio n. 12
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OKButton_Click(object sender, EventArgs e)
        {
            using (ContractProvider contProvider = new ContractProvider())
            {
                var dateModel = LocalGlobal.GetDateModel();

                string aDate = LocalGlobal.ConvertDateFormat(ActualDate.Text.Trim()).ToString("yyyyMMdd");
                if (this.CurrentItem.Length == 0)
                {
                    //新增
                    if (contProvider.GetArprocessDetailItem(this.CurrentID, cboItem.SelectedValue.Trim(), Seq.Text.Trim()) == null) //不存在
                    {
                        try
                        {
                            contProvider.InsertArprocessDetail(Seq.Text.Trim(), CurrentID, cboItem.SelectedValue.Trim(), SAmt.Text.Trim(), Per.Text.Trim(), aDate, ActualAmt.Text.Trim(), cboType.SelectedValue.Trim(), Remark.Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        }
                        catch (Exception error)
                        {
                            this.ShowErrorMessage(this.GetGlobalResourceString("CreateErrorMessage") + error.Message);
                            return;
                        }
                    }
                    else
                    {
                        this.ShowWarningMessage(this.GetGlobalResourceString("ExistedErrorMessage"));
                        return;
                    }
                }
                else
                {
                    //编辑
                    try
                    {
                        contProvider.UpdateArprocessDetail(CurrentID, CurrentItem, CurrentSeq, aDate, ActualAmt.Text.Trim(), cboType.SelectedValue.Trim(), Remark.Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                    }
                    catch (Exception error)
                    {
                        this.ShowErrorMessage(this.GetGlobalResourceString("UpdateErrorMessage") + error.Message);
                        return;
                    }
                }
            }
            //回调
            this.DialogCallback("'CloseRefresh'", "window");
        }
Esempio n. 13
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindList()
        {
            using (PurProvider purProvider = new PurProvider())
            {
                string    dateFrom = LocalGlobal.ConvertDateFormat(DateFrom.Text.Trim()).ToString("yyyyMMdd");
                string    dateTo   = LocalGlobal.ConvertDateFormat(DateTo.Text.Trim()).ToString("yyyyMMdd");
                DataTable table    = purProvider.PurQuery(PRNoFrom.Text.Trim(), PRNoTo.Text.Trim(), OrNoFrom.Text.Trim(), OrNoTo.Text.Trim(), VenFrom.Text.Trim(), VenTo.Text.Trim(), dateFrom, dateTo, DrawNoFrom.Text.Trim(), DrawNoTo.Text.Trim(), PrlNo.Text.Trim(), PrlName.Text.Trim());

                List.DataSource = table;

                decimal amt = 0;
                foreach (DataRow row in table.Rows)
                {
                    amt += Util.ToDecimal(row["PRLPACST"].ToString()) * Util.ToDecimal(row["PRLQTY"].ToString());
                }

                SumAmt.Text = amt.ToString();
            }
            List.DataBind();
        }
Esempio n. 14
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Initialize()
        {
            #region 页面内容

            using (PurProvider purProvider = new PurProvider())
            {
                var bomType = purProvider.GetBaseParam("PT", "");
                LocalGlobal.BindListItems(BomType, bomType.DefaultView, "Description", "code", true);
            }
            this.ORDNO.Text    = string.Empty;
            this.DRAWNO.Text   = string.Empty;
            this.PRNo.Text     = string.Empty;
            this.PRStatus.Text = string.Empty;
            //this.BomType.SelectedIndex = -1;

            #endregion

            //绑定列表
            //this.BindList();
        }
Esempio n. 15
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindList()
        {
            using (PurProvider purProvider = new PurProvider())
            {
                string prNo = PRNo.Text.Trim();
                if (prNo.Length > 0)
                {
                    PRStatus.Text = LocalGlobal.GetPRStatus(prNo);

                    DataTable table = purProvider.GetMatPRDetailList(prNo);
                    ViewState["ViewDT"] = table;
                    BindTempData();
                }
                else
                {
                    this.Initialize();
                    List.DataSource = null;
                    List.DataBind();
                }
            }
        }
Esempio n. 16
0
        /// <summary>
        /// 确定
        /// </summary>
        protected void OKButton_Click(object sender, EventArgs e)
        {
            var totalPer = Util.ToDecimal(SCH_YF.Text.Trim()) + Util.ToDecimal(SCH_JD.Text.Trim()) + Util.ToDecimal(SCH_TH.Text.Trim()) + Util.ToDecimal(SCH_ZB.Text.Trim());

            if (totalPer != 100)
            {
                this.ShowErrorMessage("比例输入不正确,请确保各项总额为100!");
                return;
            }

            var signDate     = LocalGlobal.ConvertDateFormat(SIGNDATE.Text.Trim()).ToString("yyyyMMdd");
            var deliverDate  = LocalGlobal.ConvertDateFormat(DELIVERYDATE.Text.Trim()).ToString("yyyyMMdd");
            var deliverDateS = LocalGlobal.ConvertDateFormat(DELIVERYDATE.Text.Trim()).ToString("yyyy-MM-dd");
            var dateModel    = LocalGlobal.GetDateModel();

            SqlConnection con = LocalGlobal.DbConnect();

            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();

            cmd.Connection  = con;
            cmd.Transaction = tran;

            try
            {
                using (ContractProvider contProvider = new ContractProvider())
                {
                    string stno = string.Empty, whCode = string.Empty;
                    if (CurrentType == "2")           //直接开票
                    {
                        stno = LocalGlobal.NewSTNo(); //发货单号

                        var wh = contProvider.GetBaseParam("WH", "1");
                        if (wh != null && wh.Rows.Count > 0)
                        {
                            whCode = wh.Rows[0]["description"].ToString().Trim();
                        }
                    }

                    string orno = string.Empty;
                    if (this.CurrentID.Length == 0)  //新增
                    {
                        orno = LocalGlobal.NewOrno(false);

                        #region 合同、收款进度头表

                        cmd.CommandText = contProvider.InsertContractSql(orno, ORDNAME.Text.Trim(), CUSTNO.Text.Trim(), CUSTNAME.Text.Trim(), CURR.SelectedValue.Trim(), signDate, deliverDate, PROTECTTERM.SelectedValue.Trim(), SCH_YF.Text.Trim(), SCH_JD.Text.Trim(), SCH_TH.Text.Trim(), SCH_ZB.Text.Trim(), ORDAMT.Text.Trim(), Remark.Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();

                        cmd.CommandText = contProvider.InsertArprocessSql(orno, ORDNAME.Text.Trim(), CUSTNO.Text.Trim(), CUSTNAME.Text.Trim(), CURR.SelectedValue.Trim(), ORDAMT.Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();

                        #endregion

                        #region 收款进度明细

                        cmd.CommandText = contProvider.InsertArprocessDetailSql(orno, "T1", Util.ToDecimal(ORDAMT.Text.Trim()), Util.ToDecimal(SCH_YF.Text.Trim()), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.InsertArprocessDetailSql(orno, "T2", Util.ToDecimal(ORDAMT.Text.Trim()), Util.ToDecimal(SCH_JD.Text.Trim()), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.InsertArprocessDetailSql(orno, "T3", Util.ToDecimal(ORDAMT.Text.Trim()), Util.ToDecimal(SCH_TH.Text.Trim()), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.InsertArprocessDetailSql(orno, "T4", Util.ToDecimal(ORDAMT.Text.Trim()), Util.ToDecimal(SCH_ZB.Text.Trim()), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.InsertArprocessDetailSql(orno, "T5", Util.ToDecimal(ORDAMT.Text.Trim()), 0, LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();

                        #endregion
                    }
                    else   //编辑
                    {
                        orno = ORDNO.Text.Trim();

                        #region 合同、收款进度头表

                        cmd.CommandText = contProvider.UpdateContractSql(orno, ORDNAME.Text.Trim(), CUSTNO.Text.Trim(), CUSTNAME.Text.Trim(), CURR.SelectedValue.Trim(), signDate, deliverDate, PROTECTTERM.SelectedValue.Trim(), SCH_YF.Text.Trim(), SCH_JD.Text.Trim(), SCH_TH.Text.Trim(), SCH_ZB.Text.Trim(), ORDAMT.Text.Trim(), Remark.Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();

                        cmd.CommandText = contProvider.UpdateArprocessSql(orno, ORDNAME.Text.Trim(), CUSTNO.Text.Trim(), CUSTNAME.Text.Trim(), CURR.SelectedValue.Trim(), ORDAMT.Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();

                        #endregion

                        #region 收款进度明细

                        cmd.CommandText = contProvider.UpdateArprocessDetailSql(orno, "T1", Util.ToDecimal(ORDAMT.Text.Trim()), Util.ToDecimal(SCH_YF.Text.Trim()), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.UpdateArprocessDetailSql(orno, "T2", Util.ToDecimal(ORDAMT.Text.Trim()), Util.ToDecimal(SCH_JD.Text.Trim()), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.UpdateArprocessDetailSql(orno, "T3", Util.ToDecimal(ORDAMT.Text.Trim()), Util.ToDecimal(SCH_TH.Text.Trim()), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.UpdateArprocessDetailSql(orno, "T4", Util.ToDecimal(ORDAMT.Text.Trim()), Util.ToDecimal(SCH_ZB.Text.Trim()), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        cmd.ExecuteNonQuery();

                        #endregion
                    }

                    if (CurrentType == "2") //直接开票
                    {
                        cmd.CommandText = contProvider.DeleteKpSql(orno);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.DeleteShipSql(orno);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = contProvider.DeleteTransDetailSql(orno);
                        cmd.ExecuteNonQuery();
                    }

                    #region 合同明细

                    cmd.CommandText = contProvider.DeleteContractDetailSql(orno);
                    cmd.ExecuteNonQuery();

                    //bool flag = true;
                    //if (List.Rows.Count == 1) //只有一行数据,判断是否是空行
                    //{
                    //    var name = ((DataBoundLiteralControl)List.Rows[0].Cells[2].Controls[0]).Text.Trim();
                    //    if (name.Length == 0) //自动创建的空行
                    //    {
                    //        flag = false;
                    //    }
                    //}
                    //if (flag)
                    //{
                    //    for (int i = 0; i < List.Rows.Count; i++)
                    //    {
                    //        var row = List.Rows[i];
                    //        cmd.CommandText = contProvider.InsertContractDetailSql(orno, ((Label)row.FindControl("SEQ")).Text.Trim(), ((DataBoundLiteralControl)row.Cells[2].Controls[0]).Text.Trim(), ((DataBoundLiteralControl)row.Cells[4].Controls[0]).Text.Trim(), ((DataBoundLiteralControl)row.Cells[3].Controls[0]).Text.Trim(), ((DataBoundLiteralControl)row.Cells[5].Controls[0]).Text.Trim(), ((DataBoundLiteralControl)row.Cells[6].Controls[0]).Text.Trim(), ((DataBoundLiteralControl)row.Cells[7].Controls[0]).Text.Trim(), ((DataBoundLiteralControl)row.Cells[8].Controls[0]).Text.Trim());

                    //        cmd.ExecuteNonQuery();
                    //    }
                    //}

                    var table = ViewState["ViewDT"] as DataTable;
                    int seq   = 0;
                    foreach (DataRow row in table.Rows)
                    {
                        seq++;
                        cmd.CommandText = contProvider.InsertContractDetailSql(orno, seq.ToString(), row["ITEMNO"].ToString().Trim(), row["ORDQTY"].ToString(), row["DRAWNO"].ToString(), row["UM"].ToString(), row["UNITPRICE"].ToString(), row["AMT"].ToString(), row["Remark"].ToString());

                        cmd.ExecuteNonQuery();

                        #region 直接开票

                        if (CurrentType == "2") //直接开票
                        {
                            //1.扣减库存,写出库记录
                            cmd.CommandText = contProvider.InsertShipSql(stno, seq.ToString(), orno, row["DRAWNO"].ToString().Trim(), CUSTNO.Text.Trim(), CUSTNAME.Text.Trim(), row["ITEMNO"].ToString(), row["UM"].ToString(), row["ORDQTY"].ToString(), row["ORDQTY"].ToString(), row["ORDQTY"].ToString(), deliverDate, "1");
                            cmd.ExecuteNonQuery();

                            var invTable = contProvider.GetInventoryByItem(whCode, row["DRAWNO"].ToString().Trim());
                            if (invTable != null && invTable.Rows.Count > 0)
                            {
                                cmd.CommandText = contProvider.UpdateInventorySql(whCode, row["DRAWNO"].ToString().Trim(), row["ORDQTY"].ToString());
                                cmd.ExecuteNonQuery();
                            }
                            else
                            {
                                cmd.CommandText = contProvider.InsertInventorySql(whCode, row["DRAWNO"].ToString().Trim(), "", "", row["ITEMNO"].ToString(), row["ORDQTY"].ToString(), row["UM"].ToString());
                                cmd.ExecuteNonQuery();
                            }

                            cmd.CommandText = contProvider.InsertTransDetailSql(orno, row["DRAWNO"].ToString().Trim(), whCode, row["ORDQTY"].ToString(), stno, orno.Substring(0, 7), "B");
                            cmd.ExecuteNonQuery();

                            //2.开票
                            cmd.CommandText = contProvider.InsertKpSql(orno, seq.ToString(), "1", FP.Text.Trim(), row["ORDQTY"].ToString(), row["AMT"].ToString(), deliverDateS);
                            cmd.ExecuteNonQuery();
                        }

                        #endregion
                    }

                    #endregion
                }
            }
            catch (Exception error)
            {
                tran.Rollback();
                this.ShowErrorMessage("保存失败!" + error.Message);
                return;
            }

            tran.Commit();

            //回调
            this.DialogCallback("'CloseRefresh'", "window");
        }
Esempio n. 17
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            #region 检测

            if (ORDNO.Text.Trim().Length <= 0)
            {
                this.ShowWarningMessage("请输入工令号");
                return;
            }

            #endregion

            SqlConnection con = LocalGlobal.DbConnect();
            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();
            cmd.Connection  = con;
            cmd.Transaction = tran;

            string shipNo = LocalGlobal.NewSTNo(); //出货单号

            using (PurProvider purProvider = new PurProvider())
            {
                try
                {
                    int seq = 0;
                    foreach (GridViewRow row in List.Rows)
                    {
                        HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                        if (rowCheckControl.Checked)
                        {
                            seq++;

                            #region 检测

                            string noShipQty = row.Cells[6].Text.Trim();                            //未出货数量
                            string planQty   = ((TextBox)row.FindControl("shipqplan")).Text.Trim(); //计划出货数量
                            string shipDate  = ((TextBox)row.FindControl("shipdate")).Text.Trim();  //出货日期

                            if (shipDate.Length <= 0)
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("请填写出货日期!");
                                return;
                            }
                            if (Util.ToInt(planQty) <= 0)
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("出货数量必须大于0!");
                                return;
                            }
                            if (Util.ToInt(planQty) > Util.ToInt(noShipQty))
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("出货数量不能大于未出货数量!");
                                return;
                            }

                            string orNo   = List.DataKeys[row.RowIndex]["ordno"].ToString().Trim();
                            var    morder = purProvider.GetMOrder(orNo);
                            if (morder == null || morder.Rows.Count == 0)
                            {
                                var beiping = purProvider.GetBeiping(orNo);
                                if (beiping == null || beiping.Rows.Count == 0)
                                {
                                    tran.Rollback();
                                    this.ShowWarningMessage("任务的号码有误!");
                                    return;
                                }
                            }

                            #endregion

                            shipDate        = LocalGlobal.ConvertDateFormat(shipDate).ToString("yyyyMMdd");
                            cmd.CommandText = purProvider.InsertShipSql(shipNo, seq.ToString(), orNo, row.Cells[2].Text.Trim(), CustNo.Text.Trim(), CustName.Text.Trim(), row.Cells[3].Text.Trim(), row.Cells[5].Text.Trim(), row.Cells[4].Text.Trim(), planQty, "0", shipDate, "0");
                            cmd.ExecuteNonQuery();
                        }
                    }

                    if (seq <= 0)
                    {
                        this.ShowInfoMessage(this.GetGlobalResourceString("NotSelectMessage"));
                        tran.Rollback();
                        return;
                    }
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    this.ShowErrorMessage("保存失败。" + error.Message);
                    return;
                }

                tran.Commit();
                ShipNo.Text = shipNo;
                this.BindList();
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 保存
        /// </summary>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            #region 检测

            int count = 0;
            foreach (GridViewRow row in PRList.Rows)
            {
                HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                if (rowCheckControl.Checked)
                {
                    count++;

                    string prDate = ((TextBox)row.FindControl("PRLPDTE")).Text.Trim();
                    if (LocalGlobal.ConvertDateFormat(prDate) <= DateTime.Today)
                    {
                        this.ShowInfoMessage("日期须在明天以后!");
                        return;
                    }
                }
            }

            if (count <= 0)
            {
                this.ShowInfoMessage(this.GetGlobalResourceString("NotSelectMessage"));
                return;
            }

            #endregion

            SqlConnection con = LocalGlobal.DbConnect();
            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();
            cmd.Connection  = con;
            cmd.Transaction = tran;

            var    dateModel = LocalGlobal.GetDateModel();
            string prNo      = string.Empty;

            using (PurProvider purProvider = new PurProvider())
            {
                try
                {
                    if (PRNo.Text.Trim().Length == 0)               //新增
                    {
                        prNo = purProvider.GetMaxPRNo().ToString(); //生成新的请购单号
                        if (DRAWNO.Text.Trim().Length == 0)
                        {
                            DRAWNO.Text = " ";
                        }
                    }
                    else
                    {
                        //修改请购单
                        prNo = PRNo.Text.Trim();

                        //先删除再添加
                        cmd.CommandText = purProvider.DeletePRSql(prNo);
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = purProvider.DeletePRDetailSql(prNo);
                        cmd.ExecuteNonQuery();
                    }

                    #region Insert

                    cmd.CommandText = purProvider.InsertPRSql(prNo, ORDNO.Text.Trim(), DRAWNO.Text, "F", " ", "委外请购", LocalGlobal.CurrentUserID, dateModel.DateStr, LocalGlobal.CurrentUserID, dateModel.DateStr);
                    cmd.ExecuteNonQuery();

                    int seq = 0;
                    foreach (GridViewRow row in PRList.Rows)
                    {
                        HtmlInputCheckBox rowCheckControl    = (HtmlInputCheckBox)row.FindControl("RowCheck");
                        HtmlInputCheckBox urgentCheckControl = (HtmlInputCheckBox)row.FindControl("UrgentCheck");

                        if (rowCheckControl.Checked)
                        {
                            seq++;
                            string isUrgent   = urgentCheckControl.Checked ? "Y" : "N";
                            string prlstation = ((TextBox)row.FindControl("prlstation")).Text.Trim();
                            string prQty      = ((TextBox)row.FindControl("PRLQTY")).Text.Trim();
                            string prDate     = ((TextBox)row.FindControl("PRLPDTE")).Text.Trim();
                            prDate = LocalGlobal.ConvertDateFormat(prDate).ToString("yyyyMMdd");

                            cmd.CommandText = purProvider.InsertPRDetailSql(prNo, seq.ToString(), " ", prQty, prDate, prDate, "GT", ORDNO.Text.Trim(), "", row.Cells[3].Text.Trim(), prlstation, row.Cells[6].Text.Trim(), isUrgent, row.Cells[9].Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr, "委外请购", row.Cells[7].Text.Trim());
                            cmd.ExecuteNonQuery();
                        }
                    }

                    #endregion

                    if (PRNo.Text.Trim().Length > 0)
                    {
                        //更新状态
                        cmd.CommandText = purProvider.UpdatePRStatusSql(prNo, "UP");
                        cmd.ExecuteNonQuery();
                    }
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    this.ShowErrorMessage("保存失败。" + error.Message);
                    return;
                }

                tran.Commit();

                PRNo.Text     = prNo;
                PRStatus.Text = LocalGlobal.GetPRStatus(prNo);
                this.BindList();
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 保存
        /// </summary>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            var table = ViewState["ViewDT"] as DataTable;

            if (table == null || table.Rows.Count == 0)
            {
                return;
            }

            SqlConnection con = LocalGlobal.DbConnect();

            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();

            cmd.Connection  = con;
            cmd.Transaction = tran;

            var    dateModel = LocalGlobal.GetDateModel();
            string prNo      = string.Empty;

            using (PurProvider purProvider = new PurProvider())
            {
                try
                {
                    if (PRNo.Text.Trim().Length == 0)               //新增
                    {
                        prNo = purProvider.GetMaxPRNo().ToString(); //生成新的请购单号

                        cmd.CommandText = purProvider.InsertPRSql(prNo, "", "", "S", "RMB", "材料请购", LocalGlobal.CurrentUserID, dateModel.DateStr, "", "0");
                        cmd.ExecuteNonQuery();

                        PRStatus.Text = "NE";
                    }
                    else
                    {
                        //修改请购单
                        prNo = PRNo.Text.Trim();

                        //先删除再添加
                        cmd.CommandText = purProvider.DeletePRDetailSql(prNo);
                        cmd.ExecuteNonQuery();

                        //更新状态
                        cmd.CommandText = purProvider.UpdatePRStatusSql(prNo, "UP");
                        cmd.ExecuteNonQuery();

                        PRStatus.Text = "UP";
                    }

                    #region Insert

                    int seq = 0;
                    foreach (DataRow row in table.Rows)
                    {
                        seq++;

                        string prDate = row["PRLPDTE"].ToString().Trim();
                        prDate = LocalGlobal.ConvertDateFormat(prDate).ToString("yyyyMMdd");

                        cmd.CommandText = purProvider.InsertMatPRDetailSql(prNo, seq.ToString(), row["PRLQTY"].ToString().Trim(), prDate, prlwhs.Text.Trim(), row["prltno"].ToString(), row["prlstation"].ToString(), row["prlrule"].ToString(), row["prlum"].ToString(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr, row["prlmrk"].ToString(), row["prloutno"].ToString(), row["prlpicno"].ToString());

                        cmd.ExecuteNonQuery();
                    }

                    #endregion
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    this.ShowErrorMessage("保存失败。" + error.Message);
                    return;
                }

                tran.Commit();

                PRNo.Text = prNo;
                this.BindList();
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 提交
        /// </summary>
        protected void PostButton_Click(object sender, EventArgs e)
        {
            #region 检测

            if (PRNo.Text.Trim().Length <= 0)
            {
                this.ShowWarningMessage("请输入请购单号!");
                return;
            }

            #endregion

            SqlConnection con = LocalGlobal.DbConnect();
            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();
            cmd.Connection  = con;
            cmd.Transaction = tran;

            using (PurProvider purProvider = new PurProvider())
            {
                try
                {
                    bool flag = false;
                    foreach (GridViewRow row in List.Rows)
                    {
                        HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                        if (rowCheckControl.Checked)
                        {
                            string seq    = row.Cells[2].Text.Trim();
                            string status = row.Cells[14].Text.Trim();

                            if (status == "OK")
                            {
                                cmd.CommandText = purProvider.PostPRDetailSql(PRNo.Text.Trim(), seq.ToString());
                                cmd.ExecuteNonQuery();

                                flag = true;
                            }
                        }
                    }

                    if (flag)
                    {
                        //更新状态
                        cmd.CommandText = purProvider.UpdatePRStatusSql(PRNo.Text.Trim(), "PS");
                        cmd.ExecuteNonQuery();
                    }
                    else
                    {
                        this.ShowInfoMessage("未选中要提交的记录,请确认请购状态,或未填写价格/厂商!");
                        tran.Rollback();
                        return;
                    }
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    this.ShowErrorMessage("提交失败。" + error.Message);
                    return;
                }

                tran.Commit();
            }

            this.BindList();
        }
Esempio n. 21
0
        /// <summary>
        /// 删除
        /// </summary>
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            bool deleted   = false;
            var  dateModel = LocalGlobal.GetDateModel();

            SqlConnection con = LocalGlobal.DbConnect();

            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();

            cmd.Connection  = con;
            cmd.Transaction = tran;

            try
            {
                using (ContractProvider contProvider = new ContractProvider())
                {
                    foreach (GridViewRow row in List.Rows)
                    {
                        HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                        if (rowCheckControl.Checked)
                        {
                            string orno = List.DataKeys[row.RowIndex]["ORDNO"].ToString().Trim();

                            //合同
                            cmd.CommandText = contProvider.DeleteContractSql(orno);
                            cmd.ExecuteNonQuery();
                            cmd.CommandText = contProvider.DeleteContractDetailSql(orno);
                            cmd.ExecuteNonQuery();

                            //收款进度
                            cmd.CommandText = contProvider.DeleteArprocessSql(orno, LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                            cmd.ExecuteNonQuery();
                            cmd.CommandText = contProvider.DeleteArprocessDetailSql(orno, LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                            cmd.ExecuteNonQuery();

                            //有项被删除
                            deleted = true;
                        }
                    }
                }
            }
            catch (Exception error)
            {
                tran.Rollback();
                this.ShowErrorMessage(this.GetGlobalResourceString("DeleteErrorMessage") + error.Message);
                return;
            }

            tran.Commit();

            if (deleted)
            {
                this.BindList();
            }
            else
            {
                this.ShowInfoMessage(this.GetGlobalResourceString("NotSelectMessage"));
            }
        }
Esempio n. 22
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string shipNo = ShipNo.Text.Trim();
            string orNo   = ORDNO.Text.Trim();

            #region 检测

            if (shipNo.Length <= 0)
            {
                this.ShowWarningMessage("请输入出货单号");
                return;
            }

            #endregion

            SqlConnection con = LocalGlobal.DbConnect();
            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();
            cmd.Connection  = con;
            cmd.Transaction = tran;

            using (PurProvider purProvider = new PurProvider())
            {
                try
                {
                    //仓库
                    var    whs     = purProvider.GetBaseParam("WH", "1");
                    string whsCode = string.Empty;
                    if (whs != null && whs.Rows.Count > 0)
                    {
                        whsCode = whs.Rows[0]["description"].ToString().Trim();
                    }

                    bool flag = false;
                    foreach (GridViewRow row in List.Rows)
                    {
                        HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                        if (rowCheckControl.Checked)
                        {
                            string seq       = row.Cells[1].Text.Trim();
                            string drawNo    = row.Cells[2].Text.Trim();
                            string itemName  = row.Cells[3].Text.Trim();
                            string rQty      = row.Cells[4].Text.Trim();
                            string um        = row.Cells[5].Text.Trim();
                            string planQty   = row.Cells[6].Text.Trim();                           //计划出货数量
                            string actualQty = ((TextBox)row.FindControl("shipqact")).Text.Trim(); //出货数量

                            #region 检测

                            if (actualQty.Length <= 0)
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("请填写出货数量!");
                                return;
                            }
                            if (Util.ToInt(actualQty) <= 0)
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("出货数量必须大于0!");
                                return;
                            }
                            if (Util.ToInt(actualQty) > Util.ToInt(planQty))
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("出货数量不能大于计划出货数量!");
                                return;
                            }

                            #endregion

                            cmd.CommandText = purProvider.UpdateShipQtySql(shipNo, seq, Util.ToInt(actualQty));
                            cmd.ExecuteNonQuery();

                            var invTable = purProvider.GetInventoryByItem(whsCode, drawNo);
                            if (invTable != null && invTable.Rows.Count > 0)
                            {
                                cmd.CommandText = purProvider.UpdateInventorySql(whsCode, drawNo, actualQty);
                                cmd.ExecuteNonQuery();
                            }
                            else
                            {
                                cmd.CommandText = purProvider.InsertInventorySql(whsCode, drawNo, "", "", itemName, actualQty, um);
                                cmd.ExecuteNonQuery();
                            }

                            cmd.CommandText = purProvider.InsertTransDetailSql(orNo, drawNo, whsCode, actualQty, shipNo, orNo.Substring(0, 7), "B");
                            cmd.ExecuteNonQuery();

                            cmd.CommandText = purProvider.UpdateShipStatusSql(shipNo, seq);
                            cmd.ExecuteNonQuery();

                            decimal zbAmt = 0, limit = 0;    //质保金 质保期限
                            string  lastDate = string.Empty; //质保金到期日
                            var     conTable = purProvider.GetContractInfo(orNo, seq);
                            if (conTable != null && conTable.Rows.Count > 0)
                            {
                                decimal unitPrice = Util.ToDecimal(conTable.Rows[0]["unitprice"].ToString());
                                zbAmt = unitPrice * Util.ToDecimal(actualQty);

                                limit = Util.ToDecimal(conTable.Rows[0]["protectterm"].ToString());
                                int diff = Util.ToInt(limit * 12);
                                lastDate = LocalGlobal.ConvertDateFormat(ShipDate.Text.Trim()).AddMonths(diff).ToString("yyyy-MM-dd");
                            }

                            cmd.CommandText = purProvider.InsertZhibaojinSql(shipNo, orNo, seq, itemName, drawNo, CustNo.Text.Trim(), CustName.Text.Trim(), actualQty, zbAmt.ToString(), "0", ShipDate.Text.Trim(), DateTime.Now.ToString("HH:mm:ss"), limit.ToString(), lastDate);
                            cmd.ExecuteNonQuery();

                            flag = true;
                        }
                    }

                    if (!flag)
                    {
                        this.ShowInfoMessage(this.GetGlobalResourceString("NotSelectMessage"));
                        tran.Rollback();
                        return;
                    }
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    this.ShowErrorMessage("保存失败。" + error.Message);
                    return;
                }

                tran.Commit();

                this.ShowInfoMessage("出货成功");
                this.Initialize();
                this.BindList();
            }
        }
Esempio n. 23
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            #region 检测

            if (PRNo.Text.Trim().Length <= 0)
            {
                this.ShowWarningMessage("请输入请购单号!");
                return;
            }

            #endregion

            SqlConnection con = LocalGlobal.DbConnect();
            con.Open();
            SqlTransaction tran = con.BeginTransaction();//使用事务
            SqlCommand     cmd  = new SqlCommand();
            cmd.Connection  = con;
            cmd.Transaction = tran;

            var dateModel = LocalGlobal.GetDateModel();

            using (PurProvider purProvider = new PurProvider())
            {
                try
                {
                    bool flag = false;
                    foreach (GridViewRow row in List.Rows)
                    {
                        HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                        if (rowCheckControl.Checked)
                        {
                            string seq        = row.Cells[2].Text.Trim();
                            string price      = ((TextBox)row.FindControl("prlpacst")).Text.Trim();
                            string vendorNo   = ((TextBox)row.FindControl("prlvnd")).Text.Trim();
                            string vendorName = ((TextBox)row.FindControl("prlvndm")).Text.Trim();
                            string curr       = ((TextBox)row.FindControl("prlcur")).Text.Trim();
                            string isWeight   = IsWeight.Checked ? "Y" : "";

                            #region 检测

                            if (Util.ToDecimal(price) <= 0)
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("请填写单价");
                                return;
                            }
                            if (vendorNo.Length <= 0)
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("请填写厂商代码");
                                return;
                            }
                            if (vendorName.Length <= 0)
                            {
                                tran.Rollback();
                                this.ShowWarningMessage("请填写厂商名称");
                                return;
                            }

                            #endregion

                            cmd.CommandText = purProvider.UpdatePRDetailSql(PRNo.Text.Trim(), seq.ToString(), price, vendorNo, vendorName, curr, isWeight, dateModel.DateStr);
                            cmd.ExecuteNonQuery();

                            flag = true;
                        }
                    }

                    if (flag)
                    {
                        //更新状态
                        cmd.CommandText = purProvider.UpdatePRStatusSql(PRNo.Text.Trim(), "UP");
                        cmd.ExecuteNonQuery();
                    }
                    else
                    {
                        this.ShowInfoMessage(this.GetGlobalResourceString("NotSelectMessage"));
                        tran.Rollback();
                        return;
                    }
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    this.ShowErrorMessage("保存失败。" + error.Message);
                    return;
                }

                tran.Commit();
            }

            this.BindList();
            this.PostButton.Enabled = true;
        }