| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using com.steering.pss.sale.orderchange.entity;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using System.Collections;
- using Core.Mes.Client.Comm.Format;
- using Core.StlMes.Client.SaleOrder.Dialog;
- namespace Core.StlMes.Client.SaleOrder.ReviewForm
- {
- public partial class FrmPriceConfirm : FrmBase
- {
- /// <summary>
- /// 关闭窗体引起主窗体刷新数据
- /// </summary>
- public delegate void FrmClosedRefresh(string ordPk);
- public event FrmClosedRefresh FrmClosedRefreshHandle;
- public FrmPriceConfirm()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private string ordPk;
- private string saleOrg;
- public string SaleOrg
- {
- get { return saleOrg; }
- set { saleOrg = value; }
- }
- /// <summary>
- /// 窗体的用途 等于0时 表示价格评审的弹窗(只查出销售、钢贸的数据) 等于1时 表示后续价格修改国贸 的数据 等于2时 表示第一次业务员录入价格 等于3时 业务员第二次N次维护价格
- /// </summary>
- private string formUse = "0";
- /// <summary>
- /// 窗体的用途
- /// 等于0时 表示价格评审的弹窗(只查出销售、钢贸的数据)-----弃用大部分功能---保留评审通过、评审不通过功能--第一次评审 涉及到合同状态
- /// 等于1时 表示后续价格修改(变更) 销售钢贸 国贸 的数据 ------后改为只针对国贸数据维护
- /// 等于2时 表示第一次业务员录入价格
- /// 等于3时 表示第二次N次业务员录入价格
- /// 等于4时 针对国贸数据确认 或者价格变更的确认(不涉及到合同的状态)
- /// </summary>
- public string FormUse
- {
- get { return formUse; }
- set { formUse = value; }
- }
- public FrmPriceConfirm(OpeBase _ob, string ordPk)
- {
- InitializeComponent();
- this.ob = _ob;
- this.ordPk = ordPk;
- }
- private void FrmPriceConfirm_Load(object sender, EventArgs e)
- {
- /* foreach (UltraGridColumn ugc in gdPrice.DisplayLayout.Bands[0].Columns)
- {
- ugc.SortIndicator = SortIndicator.Disabled;
- }*/
- QueryOrder();
- if (FormUse == "1" && SaleOrg == "100102")
- {
- gdPrice.DisplayLayout.Bands[0].Columns["OUT_PRICE"].Hidden = true;
- }
- if (FormUse == "2" || FormUse == "3" || FormUse == "1")
- {
- this.ultraToolbarsManager1.Toolbars[0].Tools["Pass"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- this.ultraToolbarsManager1.Toolbars[0].Tools["Back"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- }
- else if (FormUse == "0" || FormUse == "4")
- {
- this.ultraToolbarsManager1.Toolbars[0].Tools["Save"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- this.ultraToolbarsManager1.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- this.ultraToolbarsManager1.Toolbars[0].Tools["Print"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- this.ultraToolbarsManager1.Toolbars[0].Tools["PrintFJ"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- this.ultraToolbarsManager1.Toolbars[0].Tools["PrintC"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- this.ultraToolbarsManager1.Toolbars[0].Tools["Delete"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- gdPrice.DisplayLayout.Bands[0].Columns["TRANS_PRICE"].CellAppearance.BackColor = Color.White;
- gdPrice.DisplayLayout.Bands[0].Columns["PAK_PRICE"].CellAppearance.BackColor = Color.White;
- gdPrice.DisplayLayout.Bands[0].Columns["BALNCE_PRICE_ORG"].CellAppearance.BackColor = Color.White;
- }
- if (saleOrg != "100102")
- {
- this.ultraToolbarsManager1.Toolbars[0].Tools["Print"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
- this.ultraToolbarsManager1.Toolbars[0].Tools["PrintC"].SharedPropsInternal.Caption = "打印审批单";
- }
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Query":
- QueryOrder();
- break;
- case "Save": //保存价格
- SaveData();
- break;
- case "Confirm": //确认价格
- DoConfirm();
- break;
- case "Print": //打印短流程
- Print();
- break;
- case "PrintFJ": //打印附件
- PrintFJ();
- break;
- case "PrintC": //打印长流程
- PrintC();
- break;
- case "Export":
- GridHelper.ulGridToExcel(gdPrice, "价格确认");
- break;
- case "Pass": //评审通过
- DoPassPrice();
- break;
- case "Back": //评审不通过
- DoBackPrice();
- break;
- case "Delete": //作废
- DoDelete();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 打印审批单短流程
- /// </summary>
- private void Print()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePriceConfirm.getOrderPriceNo", new object[] { ordPk }, ob);
- string priceNo = "";
- if (dt != null && dt.Rows.Count > 0)
- {
- priceNo = dt.Rows[0][0].ToString();
- }
- string strUrl = "";
- if (saleOrg == "100101")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalShort.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
- }
- else if (saleOrg == "100105")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalShort.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
- }
- else if (saleOrg == "100103")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalGMShort.cpt" + "&PRICE_NO=" + priceNo;
- }
- if (strUrl == "")
- {
- MessageUtil.ShowWarning("合同销售组织异常,无法打印!");
- return;
- }
- FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strUrl);
- fBug.Text = "打印价格审批单(短流程)";
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Show();
- }
- /// <summary>
- /// 打印附件
- /// </summary>
- private void PrintFJ()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePriceConfirm.getOrderPriceNo", new object[] { ordPk }, ob);
- string priceNo = "";
- if (dt != null && dt.Rows.Count > 0)
- {
- priceNo = dt.Rows[0][0].ToString();
- }
- string strUrl = "";
- if (saleOrg == "100101")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalAtta.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
- }
- else if (saleOrg == "100103")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalAttaGM.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
- }
- if (gdPrice.ActiveRow.Cells["SUPPLY_UNIT"].Value.ToString() == "120504")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalAttaTH.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
- }
- if (strUrl == "")
- {
- MessageUtil.ShowWarning("合同销售组织异常,无法打印!");
- return;
- }
- FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strUrl);
- fBug.Text = "打印价格审批单附件";
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Show();
- }
- /// <summary>
- /// 打印审批单长流程
- /// </summary>
- private void PrintC()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePriceConfirm.getOrderPriceNo", new object[] { ordPk }, ob);
- string priceNo = "";
- if (dt != null && dt.Rows.Count > 0)
- {
- priceNo = dt.Rows[0][0].ToString();
- }
- string strUrl = "";
- if (saleOrg != "100102")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalLong.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
- }
- else if (saleOrg == "100105")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalLong.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
- }
- if (saleOrg == "100103")
- {
- strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalGMLong.cpt" + "&PRICE_NO=" + priceNo;
- }
- if (strUrl == "")
- {
- MessageUtil.ShowWarning("合同销售组织异常,无法打印!");
- return;
- }
- FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strUrl);
- fBug.Text = "打印价格审批单(长流程)";
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Show();
- }
- /// <summary>
- /// 查询合同信息
- /// </summary>
- private void QueryOrder()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePriceConfirm.getOrderInfo", new object[] { this.ordPk }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- UltraGridColumn[] col = new UltraGridColumn[] { gdPrice.DisplayLayout.Bands[0].Columns["PRICE_BASE"] };
- GridHelper.RefreshAndAutoSizeExceptColumns(gdPrice, col);
- }
- /// <summary>
- /// 修改价格保存
- /// </summary>
- private void SaveData()
- {
- //对于0 2 3 时 修改价格都差不多 等于2 加入了合同状态 2和3 去掉了评审功能 都用了0的保存方法。
- gdPrice.UpdateData();
- UltraGridRow ugr = gdPrice.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择需要修改的记录!");
- return;
- }
- string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
- //这里需要判断 priceNo的状态
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow row in gdPrice.Rows)
- {
- string containTax = row.Cells["CONTAIN_TAX"].Value.ToString();
- string balPrice = row.Cells["BALNCE_PRICE"].Value.ToString();
- string balorgPrice = row.Cells["BALNCE_PRICE_ORG"].Value.ToString();
- string outPrice = row.Cells["OUT_PRICE"].Value.ToString();
- string traPrice = row.Cells["TRANS_PRICE"].Value.ToString();
- string pakPrice = row.Cells["PAK_PRICE"].Value.ToString();
- string tonPrice = row.Cells["TON_PRICE"].Value.ToString();
- string keepType = row.Cells["KEEP_TYPE"].Value.ToString();
- string ddzy = row.Cells["DDZY"].Value.ToString();
- if (!String.IsNullOrEmpty(balPrice))
- {
- if (!StringUtil.Is_Below_zero(balPrice))
- {
- MessageUtil.ShowWarning("结算价请输入大于0的数字!");
- row.Activate();
- return;
- }
- }
- else
- {
- MessageUtil.ShowWarning("请输入结算价!");
- row.Activate();
- return;
- }
- //内部结算价不强制输入
- if (!String.IsNullOrEmpty(balorgPrice))
- {
- if (!StringUtil.Is_Below_zero(balorgPrice))
- {
- MessageUtil.ShowWarning("内部结算价请输入大于0的数字!");
- row.Activate();
- return;
- }
- }
- if (FormUse != "1" || SaleOrg != "100102") //价格后续N次修改变更 国贸不管出厂价
- {
- if (!String.IsNullOrEmpty(outPrice))
- {
- if (!StringUtil.Is_Below_zero(outPrice))
- {
- MessageUtil.ShowWarning("出厂价请输入大于0的数字!");
- row.Activate();
- return;
- }
- }
- else
- {
- MessageUtil.ShowWarning("请输入出厂!");
- row.Activate();
- return;
- }
- }
- //运费不强制输入
- if (!String.IsNullOrEmpty(traPrice))
- {
- if (!StringUtil.IsNumber(traPrice))
- {
- MessageUtil.ShowWarning("运费请输入数字!");
- row.Activate();
- return;
- }
- }
- //吊装费不强制输入
- if (!String.IsNullOrEmpty(pakPrice))
- {
- if (!StringUtil.IsNumber(pakPrice))
- {
- MessageUtil.ShowWarning("吊装费请输入大于0的数字!");
- row.Activate();
- return;
- }
- }
- //吨价不强制输入
- if (!String.IsNullOrEmpty(tonPrice))
- {
- if (!StringUtil.IsNumber(pakPrice))
- {
- MessageUtil.ShowWarning("吨价请输入大于0的数字!");
- row.Activate();
- return;
- }
- }
- //保价类型不能为空
- if (String.IsNullOrEmpty(keepType))
- {
- MessageUtil.ShowWarning("请选择保价类型!");
- row.Activate();
- return;
- }
- if (containTax.Equals("含税") && keepType.Equals("0"))
- {
- MessageUtil.ShowWarning("合同行含税,请选择保价类型为保总价!");
- row.Activate();
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(balPrice);
- list.Add(outPrice);
- list.Add(traPrice);
- list.Add(pakPrice);
- list.Add(row.Cells["ORD_LN_PK"].Value.ToString());
- list.Add(balorgPrice);
- list.Add(tonPrice);
- list.Add(keepType);
- list.Add(ddzy);
- parm.Add(list);
- }
- if (txtPriceInfo.Text.Trim() == "")
- {
- MessageUtil.ShowWarning("请输入定价说明!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否保存价格?") == DialogResult.No) return;
- SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
- sop.PriceBase = txtPriceInfo.Text.Trim();
- sop.CreateName = UserInfo.GetUserName();
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
- ccp.MethodName = "savePrice";
- ccp.ServerParams = new object[] { ordPk, parm, JSONFormat.Format(sop), saleOrg, FormUse, UserInfo.GetUserName() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- {
- return;
- }
- else
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowWarning("修改成功!");
- QueryOrder();
- }
- }
- private void gdPrice_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = gdPrice.ActiveRow;
- if (ugr == null)
- return;
- txtPriceInfo.Text = ugr.Cells["PRICE_BASE"].Value.ToString();
- if (ugr.Cells["PRICE_STATUS_CODE"].Value.ToString() == "W" && this.FormUse != "0" && FormUse != "1")
- {
- ugr.Activation = Activation.ActivateOnly;
- return;
- }
- else
- {
- ugr.Activation = Activation.AllowEdit;
- }
- if (FormUse == "0" || FormUse == "4")
- {
- ugr.Cells["TRANS_PRICE"].Activation = Activation.ActivateOnly;
- ugr.Cells["PAK_PRICE"].Activation = Activation.ActivateOnly;
- ugr.Cells["BALNCE_PRICE_ORG"].Activation = Activation.ActivateOnly;
- }
- }
- /// <summary>
- /// 价格确认
- /// </summary>
- private void DoConfirm()
- {
- //先判断是否有价格评审单号,再判断价格评审单号的状态
- UltraGridRow ugr = gdPrice.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("不存在需要确认的合同行!");
- return;
- }
- string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
- if (priceNo == "")
- {
- MessageUtil.ShowWarning("该合同尚未启动价格评审,不能确认!");
- return;
- }
- string priceStatus = ugr.Cells["PRICE_STATUS_CODE"].Value.ToString();
- if (priceStatus != "" && priceStatus != "L")
- {
- if (priceStatus == "W")
- {
- MessageUtil.ShowWarning("该合同价格正在评审中,不必重复确认!");
- return;
- }
- else if (priceStatus == "S")
- {
- MessageUtil.ShowWarning("该合同价格评审已通过,不必重复确认!");
- return;
- }
- else if (priceStatus == "F")
- {
- MessageUtil.ShowWarning("该合同价格评审不通过,请先修改价格,再确认价格!");
- return;
- }
- else if (priceStatus == "D")
- {
- MessageUtil.ShowWarning("该合同价格评审单无效,请先修改价格,再确认价格!");
- return;
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认价格?") == DialogResult.No) return;
- SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
- sop.ReportName = UserInfo.GetUserName();
- sop.ReportUnitcode = UserInfo.GetDeptid();
- sop.ReportUnitdesc = UserInfo.GetDepartment();
- sop.ReportDeptcode = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
- sop.ReportDeptdesc = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
- ccp.MethodName = "confirmPrice";
- ccp.ServerParams = new object[] { ordPk, JSONFormat.Format(sop) };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("确认成功,请打印价格审批单进行线外流程!");
- QueryOrder();
- }
- }
- /// <summary>
- /// 作废变更单,以便重新启动价格评审
- /// </summary>
- public void DoDelete()
- {
- //先判断是否有价格评审单号,再判断价格评审单号的状态
- UltraGridRow ugr = gdPrice.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("不存在需要删除价格评审的合同行!");
- return;
- }
- string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
- if (priceNo == "")
- {
- MessageUtil.ShowWarning("该合同尚未启动价格评审,不能作废评审单!");
- return;
- }
- string priceStatus = ugr.Cells["PRICE_STATUS_CODE"].Value.ToString();
- if (priceStatus != "" && priceStatus != "L")
- {
- if (priceStatus == "S")
- {
- MessageUtil.ShowWarning("该合同价格评审已通过,不能作废!");
- return;
- }
- else if (priceStatus == "F")
- {
- MessageUtil.ShowWarning("该合同价格评审已不通过,不能作废!");
- return;
- }
- else if (priceStatus == "D")
- {
- MessageUtil.ShowWarning("该合同价格评审已经无效,不能作废!");
- return;
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认作废价格评审单?") == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
- ccp.MethodName = "deletePrice";
- ccp.ServerParams = new object[] { ordPk, UserInfo.GetUserName() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("作废成功!");
- QueryOrder();
- }
- }
- /// <summary>
- /// 价格评审通过
- /// </summary>
- public void DoPassPrice()
- {
- //先判断是否有价格评审单号,再判断价格评审单号的状态
- UltraGridRow ugr = gdPrice.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("不存在需要价格评审通过的合同行!");
- return;
- }
- gdPrice.UpdateData();
- string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
- if (priceNo == "")
- {
- MessageUtil.ShowWarning("该合同尚未启动价格评审,不能评审通过!");
- return;
- }
- string priceStatus = ugr.Cells["PRICE_STATUS_CODE"].Value.ToString();
- if (priceStatus != "")
- {
- if (priceStatus == "L")
- {
- MessageUtil.ShowWarning("该合同价格尚未确认,不能评审通过!");
- return;
- }
- else if (priceStatus == "S")
- {
- MessageUtil.ShowWarning("该合同价格评审已通过,不能重复评审!");
- return;
- }
- else if (priceStatus == "F")
- {
- MessageUtil.ShowWarning("该合同价格评审不通过,请再次启动价格评审!");
- return;
- }
- else if (priceStatus == "D")
- {
- MessageUtil.ShowWarning("该合同价格评审无效,请再次启动价格评审!");
- return;
- }
- }
- else
- {
- MessageUtil.ShowWarning("价格评审状态异常!");
- return;
- }
- //暂时放个口子 评审人员可以修改价格
- ArrayList price = new ArrayList();
- foreach (UltraGridRow row in gdPrice.Rows)
- {
- string balPrice = row.Cells["BALNCE_PRICE"].Value.ToString();
- string balPriceorg = row.Cells["BALNCE_PRICE_ORG"].Value.ToString();
- string outPrice = row.Cells["OUT_PRICE"].Value.ToString();
- string traPrice = row.Cells["TRANS_PRICE"].Value.ToString();
- string pakPrice = row.Cells["PAK_PRICE"].Value.ToString();
- string tonPrice = row.Cells["TON_PRICE"].Value.ToString();
- string keepType = row.Cells["KEEP_TYPE"].Value.ToString();
- string ddzy = row.Cells["DDZY"].Value.ToString();
- if (!String.IsNullOrEmpty(balPrice))
- {
- if (!StringUtil.Is_Below_zero(balPrice))
- {
- MessageUtil.ShowWarning("结算价请输入大于0的数字!");
- row.Activate();
- return;
- }
- }
- else
- {
- MessageUtil.ShowWarning("请输入结算价!");
- row.Activate();
- return;
- }
- if ((FormUse != "1" && FormUse != "4") || SaleOrg != "100102") //价格后续N次修改变更 国贸不管出厂价
- {
- if (!String.IsNullOrEmpty(outPrice))
- {
- if (!StringUtil.Is_Below_zero(outPrice))
- {
- MessageUtil.ShowWarning("出厂价请输入大于0的数字!");
- row.Activate();
- return;
- }
- }
- else
- {
- MessageUtil.ShowWarning("请输入出厂价!");
- row.Activate();
- return;
- }
- }
- ArrayList list = new ArrayList();
- list.Add(balPrice);
- list.Add(outPrice);
- list.Add(traPrice);
- list.Add(pakPrice);
- list.Add(row.Cells["ORD_LN_PK"].Value.ToString());
- list.Add(balPriceorg);
- list.Add(tonPrice);
- list.Add(keepType);
- list.Add(keepType);
- list.Add(ddzy);
- price.Add(list);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认价格评审通过?") == DialogResult.No) return;
- SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
- sop.DealName = UserInfo.GetUserName();
- sop.DealUnitcode = UserInfo.GetDeptid();
- sop.DealUnitdesc = UserInfo.GetDepartment();
- sop.DealDeptcode = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
- sop.DealDeptdesc = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
- string name = UserInfo.GetUserName();
- string dept = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
- dept = dept + "-" + UserInfo.GetDepartment();
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
- ccp.MethodName = "passPrice";
- ccp.ServerParams = new object[] { ordPk, name, dept, JSONFormat.Format(sop), FormUse, price };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("价格评审通过!");
- DialogResult = DialogResult.OK;
- this.Close();
- }
- }
- /// <summary>
- /// 价格评审不通过(不再调用原来的价格评审的‘评审不通过‘,合同状态将继续卡在这里 而不是退回给业务员了。
- /// </summary>
- public void DoBackPrice()
- {
- //先判断是否有价格评审单号,再判断价格评审单号的状态
- UltraGridRow ugr = gdPrice.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("不存在需要价格评审不通过的合同行!");
- return;
- }
- string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
- if (priceNo == "")
- {
- MessageUtil.ShowWarning("该合同尚未启动价格评审,不能评审不通过!");
- return;
- }
- string priceStatus = ugr.Cells["PRICE_STATUS_CODE"].Value.ToString();
- if (priceStatus != "")
- {
- if (priceStatus == "L")
- {
- MessageUtil.ShowWarning("该合同价格尚未确认,不能评审不通过!");
- return;
- }
- else if (priceStatus == "S")
- {
- MessageUtil.ShowWarning("该合同价格评审已通过,不能重复评审!");
- return;
- }
- else if (priceStatus == "F")
- {
- MessageUtil.ShowWarning("该合同价格评审已不通过,请再次启动价格评审!");
- return;
- }
- else if (priceStatus == "D")
- {
- MessageUtil.ShowWarning("该合同价格评审已经无效,请再次启动价格评审!");
- return;
- }
- }
- else
- {
- MessageUtil.ShowWarning("价格评审状态异常!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认价格评审不通过?") == DialogResult.No) return;
- SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
- sop.DealName = UserInfo.GetUserName();
- sop.DealUnitcode = UserInfo.GetDeptid();
- sop.DealUnitdesc = UserInfo.GetDepartment();
- sop.DealDeptcode = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
- sop.DealDeptdesc = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
- string name = UserInfo.GetUserName();
- string dept = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
- dept = dept + "-" + UserInfo.GetDepartment();
- dlgReviewMemo dlg = new dlgReviewMemo();
- dlg.ReviewFlag = 0;
- dlg.ReviewSatus = "评审不通过";
- dlg.ShowDialog();
- string reviewMemo = dlg.ReviewMemo;
- if (dlg.DialogResult != DialogResult.OK)
- return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
- ccp.MethodName = "backPrice";
- ccp.ServerParams = new object[] { ordPk, JSONFormat.Format(sop), FormUse, name, dept, reviewMemo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("价格评审不通过完成!");
- DialogResult = DialogResult.OK;
- this.Close();
- }
- }
- private void gdPrice_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- if (e.Row.Cells["PRICE_STATUS_CODE"].Value.ToString().Trim() == "D")
- {
- e.Row.Cells["PRICE_STATUS"].Appearance.BackColor = Color.Red;
- }
- }
- private void FrmPriceConfirm_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (FormUse == "2")
- {
- UltraGridRow ugr = gdPrice.ActiveRow;
- if (ugr != null)
- {
- if (ugr.Cells["PRICE_STATUS_CODE"].Value.ToString().Equals("L"))
- {
- if (MessageUtil.ShowYesNoAndQuestion("价格评审单尚未确认,合同无法提报审批,是否退出?") == DialogResult.No)
- e.Cancel = true;
- }
- }
- }
- else if (FormUse == "3")
- {
- UltraGridRow ugr = gdPrice.ActiveRow;
- if (ugr != null)
- {
- if (ugr.Cells["PRICE_STATUS_CODE"].Value.ToString().Equals("L"))
- {
- if (MessageUtil.ShowYesNoAndQuestion("价格评审单尚未确认,无法启动价格评审,是否退出?") == DialogResult.No)
- e.Cancel = true;
- }
- }
- }
- if (FrmClosedRefreshHandle != null)
- FrmClosedRefreshHandle(this.ordPk);
- }
- /// <summary>
- /// 维护一行价格 之后的行的价格一样 当时勾选的行不受影响也不影响其他行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gdPrice_CellChange(object sender, CellEventArgs e)
- {
- try
- {
- gdPrice.UpdateData();
- }
- catch { }
- if (e.Cell.Column.Key.Equals("BALNCE_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
- {
- if (e.Cell.Value.ToString() == "")
- return;
- int rCount = e.Cell.Row.Index;
- for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
- {
- UltraGridRow row = gdPrice.Rows[i];
- if (!Convert.ToBoolean(row.Cells["CHK"].Value))
- row.Cells["BALNCE_PRICE"].Value = e.Cell.Value;
- }
- }
- else if (e.Cell.Column.Key.Equals("OUT_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
- {
- if (e.Cell.Value.ToString() == "")
- return;
- int rCount = e.Cell.Row.Index;
- for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
- {
- UltraGridRow row = gdPrice.Rows[i];
- if (!Convert.ToBoolean(row.Cells["CHK"].Value))
- row.Cells["OUT_PRICE"].Value = e.Cell.Value;
- }
- }
- else if (e.Cell.Column.Key.Equals("TRANS_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
- {
- if (e.Cell.Value.ToString() == "")
- return;
- int rCount = e.Cell.Row.Index;
- for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
- {
- UltraGridRow row = gdPrice.Rows[i];
- if (!Convert.ToBoolean(row.Cells["CHK"].Value))
- row.Cells["TRANS_PRICE"].Value = e.Cell.Value;
- }
- }
- else if (e.Cell.Column.Key.Equals("PAK_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
- {
- if (e.Cell.Value.ToString() == "")
- return;
- int rCount = e.Cell.Row.Index;
- for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
- {
- UltraGridRow row = gdPrice.Rows[i];
- if (!Convert.ToBoolean(row.Cells["CHK"].Value))
- row.Cells["PAK_PRICE"].Value = e.Cell.Value;
- }
- }
- else if (e.Cell.Column.Key.Equals("BALNCE_PRICE_ORG") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
- {
- if (e.Cell.Value.ToString() == "")
- return;
- int rCount = e.Cell.Row.Index;
- for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
- {
- UltraGridRow row = gdPrice.Rows[i];
- if (!Convert.ToBoolean(row.Cells["CHK"].Value))
- row.Cells["BALNCE_PRICE_ORG"].Value = e.Cell.Value;
- }
- }
- else if (e.Cell.Column.Key.Equals("TON_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
- {
- if (e.Cell.Value.ToString() == "")
- return;
- int rCount = e.Cell.Row.Index;
- for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
- {
- UltraGridRow row = gdPrice.Rows[i];
- if (!Convert.ToBoolean(row.Cells["CHK"].Value))
- row.Cells["TON_PRICE"].Value = e.Cell.Value;
- }
- }
- else if (e.Cell.Column.Key.Equals("KEEP_TYPE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
- {
- if (e.Cell.Value.ToString() == "")
- return;
- int rCount = e.Cell.Row.Index;
- for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
- {
- UltraGridRow row = gdPrice.Rows[i];
- if (!Convert.ToBoolean(row.Cells["CHK"].Value))
- row.Cells["KEEP_TYPE"].Value = e.Cell.Value;
- }
- }
- else if (e.Cell.Column.Key.Equals("CHK"))
- {
- this.toolTips.ShowAlways = true;
- this.toolTips.SetToolTip(gdPrice, "勾选的行维护数据时不更新其他行也不被其他行的数据所更新");
- this.toolTips.ToolTipTitle = "提示";
- }
- }
- private void gdPrice_CellDataError(object sender, CellDataErrorEventArgs e)
- {
- e.RaiseErrorEvent = false; // 阻止弹出错误提示窗口
- e.RestoreOriginalValue = true; // 恢复原始值
- e.StayInEditMode = true; // 继续保留在编辑模式
- }
- }
- }
|