| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534 |
- 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 CoreFS.CA06;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using System.Collections;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.SaleOrder.Dialog;
- using Infragistics.Win;
- using Core.StlMes.Client.SaleOrder.ReviewForm;
- using Core.Mes.Client.Comm.Format;
- namespace Core.StlMes.Client.SaleOrder.OrderForm
- {
- /// <summary>
- /// 合同审批提报
- /// </summary>
- public partial class frmOrderApproval : FrmBase
- {
- public frmOrderApproval()
- {
- InitializeComponent();
- }
- bool queryAll = false; //所有生效
- bool queryPass = false; //价格放行通过的合同
- string saleOrg = "";
- /// <summary>
- /// 价格评审窗体是否打开 (原来模态形式,现在用非模态形式打开)
- /// </summary>
- private bool isOpened = false;
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- case "doPrice":
- doPriceN();
- break;
- case "ChgePrice":
- ChgePrice();
- break;
- case "doReport":
- DoReport();
- break;
- case "doCancel":
- DoCancel();
- break;
- case "BackDelivery":
- if (saleOrg != "100102")
- BackToDelivery();
- else
- {
- BackToDeliveryIE();
- }
- break;
- case "BackEdit":
- BackEdit(); //现货合同退回
- break;
- //case "BackDeliveryIE":
- // BackToDeliveryIE();
- // break;
- //分界面按钮
- case "doThrough":
- DoOrderPass();
- break;
- case "doRollback":
- DoOrderRollBack();
- break;
- case "Export":
- GridHelper.ulGridToExcel(ultraGridHead, "合同审批提报");
- break;
- case "doClose":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 审批退回
- /// </summary>
- private void DoOrderRollBack()
- {
- ultraGridHead.UpdateData();
- ArrayList parm = new ArrayList();
- int count = 0;
- foreach (UltraGridRow row in ultraGridHead.Rows)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- string ordPk = row.Cells["ORD_PK"].Value.ToString();
- count += 1;
- parm.Add(ordPk);
- }
- }
- if (count == 0)
- {
- MessageBox.Show("请选择需要审批退回的数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (MessageUtil.ShowQuestion("确认审批退回?").ToString().ToLower().Equals("yes"))
- {
- string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
- string name = UserInfo.GetUserName(); //操作人
- dept = dept + "-" + UserInfo.GetDepartment(); //部门-科室
- //主管审批退回:12020222
- if (this.CustomInfo.Contains("director"))
- {
- 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.CopyOrderApproval";
- ccp.MethodName = "reviewBack";
- ccp.ServerParams = new object[] { parm, name, dept, reviewMemo, saleOrg };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- return;
- else
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
- return;
- }
- }
- doQuery();
- }
- else if (this.CustomInfo.Contains("manager"))
- {
- 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.CopyOrderApproval";
- ccp.MethodName = "reviewBackManager";
- ccp.ServerParams = new object[] { parm, name, dept, reviewMemo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- return;
- else
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
- return;
- }
- }
- doQuery();
- }
- }
- }
- /// <summary>
- /// 审批通过
- /// </summary>
- private void DoOrderPass()
- {
- ultraGridHead.UpdateData();
- ArrayList parm = new ArrayList();
- int count = 0;
- foreach (UltraGridRow row in ultraGridHead.Rows)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- if (row.Cells["ORDER_STS"].Value.ToString() == "12020251")
- {
- MessageUtil.ShowWarning("合同已经评审通过!");
- return;
- }
- count += 1;
- string ordPk = row.Cells["ORD_PK"].Value.ToString();
- parm.Add(ordPk);
- }
- }
- if (count == 0)
- {
- MessageBox.Show("请选择需要操作的数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
- string name = UserInfo.GetUserName(); //操作人
- dept = dept + "-" + UserInfo.GetDepartment(); //部门-科室
- if (MessageUtil.ShowQuestion("确认审批通过?").ToString().ToLower().Equals("yes"))
- {
- //主管审批通过:12020222
- if (this.CustomInfo.Contains("director"))
- {
- dlgReviewMemo dlg = new dlgReviewMemo();
- dlg.ReviewFlag = 1;
- 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.CopyOrderApproval";
- ccp.MethodName = "reviewPass";
- ccp.ServerParams = new object[] { parm, name, dept, reviewMemo, saleOrg };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- return;
- else
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
- return;
- }
- //if ("100101".Equals(saleOrg))
- if (this.CustomInfo.Equals("director-120504"))// 天淮系统审批价格法务
- {
- automaticExamine(parm, "SYSTEM", dept, reviewMemo);
- }
- }
- doQuery();
- }
- else if (this.CustomInfo.Contains("manager"))
- {
- //评审说明
- dlgReviewMemo dlg = new dlgReviewMemo();
- dlg.ReviewFlag = 1;
- 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.CopyOrderApproval";
- ccp.MethodName = "reviewPassManager";
- ccp.ServerParams = new object[] { parm, name, dept, reviewMemo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- return;
- else
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
- return;
- }
- }
- doQuery();
- }
- }
- }
- private void automaticExamine(ArrayList parm, string name, string dept, string reviewMemo)
- {
- // 主管经理审批
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
- ccp.MethodName = "reviewPassManager";
- ccp.ServerParams = new object[] { parm, name, dept, reviewMemo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning("主管经理审批自动审批失败!");
- return;
- }
- // 价格审批
- foreach (var ordPk in parm)
- {
- SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
- sop.DealName = name;
- sop.DealUnitcode = UserInfo.GetDeptid();
- sop.DealUnitdesc = UserInfo.GetDepartment();
- sop.DealDeptcode = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
- sop.DealDeptdesc = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
- CoreClientParam ccp1 = new CoreClientParam();
- ccp1.IfShowErrMsg = false;
- ccp1.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
- ccp1.MethodName = "passPrice";
- ccp1.ServerParams = new object[] { ordPk, name, "营销管理部-价格管理科", JSONFormat.Format(sop), "", new ArrayList() };
- ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
- if (ccp1.ReturnCode == -1)
- {
- MessageUtil.ShowWarning("价格审批自动审批失败!");
- return;
- }
- }
- // 法务审批
- CoreClientParam ccp2 = new CoreClientParam();
- ccp2.IfShowErrMsg = false;
- ccp2.ServerName = "com.steering.pss.sale.order.CoreOrderReviewLaw";
- ccp2.MethodName = "lawReviewPass";
- ccp2.ServerParams = new object[] { parm, name, "销售总公司-合同管理科", reviewMemo };
- ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
- if (ccp2.ReturnCode == -1)
- {
- MessageUtil.ShowWarning("法务审批自动审批失败!");
- return;
- }
- }
- /// <summary>
- /// 定价内容
- /// </summary>
- private void doPrice()
- {
- UltraGridRow ugr = ultraGridHead.ActiveRow;
- if (ugr == null)
- {
- }
- if (ultraGridHead.ActiveRow == null)
- {
- MessageBox.Show("请选择合同头数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- frmOrderPriceDetails opDetails = new frmOrderPriceDetails();
- opDetails.ob = this.ob;
- // opDetails.OrdPk = ultraGridHead.ActiveRow.Cells["ORD_PK"].Value.ToString();
- ArrayList parms = new ArrayList();
- ArrayList priceNoParms = new ArrayList();
- foreach (UltraGridRow row in ultraGridHead.Rows)
- {
- if (row.Selected || row.Activated)
- {
- parms.Add(row.Cells["ORD_PK"].Value.ToString());
- priceNoParms.Add(row.Cells["PRICE_NO"].Value.ToString());
- }
- }
- //string[] strs = priceNoParms.Cast<string>().Distinct().ToArray();
- int selectedCount = ultraGridHead.Rows.AsQueryable().Where(a => a.Selected == true).Count();
- int count = ultraGridHead.Rows.AsQueryable().Where(a => a.Selected == true
- && ultraGridHead.ActiveRow.Cells["PRICE_NO"].Value.ToString() == a.Cells["PRICE_NO"].Value.ToString()).Count();
- if (selectedCount == count)
- {
- opDetails.ShowDialog();
- }
- else
- {
- MessageBox.Show("选中合同头定价编号不一致,无法进行定价维护。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- }
- /// <summary>
- /// 修正合同头状态
- /// </summary>
- /// <param name="ordPk"></param>
- private void UpdateHeadStatus(string ordPk, string hStatus, string hStatusDesc)
- {
- //获取当前选中合同头主键,修正当前合同头主键下面全部合同行,全部交货行状态为交货期评审通过。
- //执行数据库相关操作
- CoreClientParam ccp = new CoreClientParam();
- //服务端的包名+类名
- ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
- //类里的方法名
- ccp.MethodName = "UpdateHeadStatus";
- //带一个审批人和时间。
- ccp.ServerParams = new object[] { ordPk, hStatus, hStatusDesc, UserInfo.GetUserName() };
- try
- {
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- MessageBox.Show("错误提示:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- else
- {
- //MessageBox.Show("提报成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- doQuery();
- foreach (UltraGridRow row in ultraGridHead.Rows)
- {
- if (ordPk.Equals(row.Cells["ORD_PK"].Value.ToString()))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- /// <summary>
- /// 查询功能
- /// </summary>
- private void doQuery()
- {
- string orderNo = ultraTextOrder.Text.Trim();
- string orderStart = "";
- string orderEnd = "";
- if (uchkDate.Checked)
- {
- orderStart = ultraDateTimeSta.DateTime.ToString("yyyy-MM-dd") + " 00:00:01";
- orderEnd = ultraDateTimeEnd.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
- }
- else
- {
- orderStart = "1000-01-01 00-00-01";
- orderEnd = "9999-01-01 23-59-59";
- }
- if (!ultraCheckOrder.Checked)
- {
- orderNo = "";
- }
- DataTable dt = new DataTable();
- //合同头状态为“交货期评审通过/审批退回(业务主管或主管经理)/价格评审失败/法务评审失败/待提报审批/待审批”的合同
- List<String> list = null;
- if (this.CustomInfo.Contains("approval"))
- {
- if (queryAll == false && queryPass == false)
- {
- list = new List<string>() { "12020212", "12020221", "12020223", "12020231", "12020241", "12020213", "12020220", orderNo, saleOrg, orderStart, orderEnd };
- }
- else if (queryAll == true)
- {
- list = new List<string>() { orderNo, saleOrg, orderStart, orderEnd };
- }
- else if (queryPass == true)
- {
- list = new List<string>() { orderNo, saleOrg, orderStart, orderEnd };
- }
- }
- //主管
- else if (this.CustomInfo.Contains("director")) //queryAll在此处无效 只为跟服务端统一
- {
- list = new List<string>() { "12020220", "12020220", "12020220", "12020220", "12020220", "12020220", "12020220", orderNo, saleOrg, orderStart, orderEnd };
- //展示内容:待审批12020220
- }
- //经理
- else if (this.CustomInfo.Contains("manager")) //queryAll在此处无效 只为跟服务端统一
- {
- list = new List<string>() { "12020222", "12020222", "12020222", "12020222", "12020222", "12020222", "12020220", orderNo, saleOrg, orderStart, orderEnd };
- }
- else
- {
- return;
- }
- string[] arr = this.ValidDataPurviewIds;
- string supp = this.CustomInfo.Contains("120504") ? "120504" : "";
- dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetQuery", new Object[] { list, this.CustomInfo, arr, saleOrg, queryAll, queryPass, supp }, this.ob);
- if (dt.Rows.Count <= 0)
- {
- this.orderLine.Rows.Clear();
- this.slmOrderModelItem.Rows.Clear();
- this.slmOrderPrice.Rows.Clear();
- }
- GridHelper.CopyDataToDatatable(ref dt, ref this.orderHead, true);
- //列自适应
- //GridHelper.RefreshAndAutoSizeExceptColumns(ultraGridHead, new UltraGridColumn[] { });
- }
- /// <summary>
- /// 查询定位功能
- /// </summary>
- private void doQuery(string ord_pk)
- {
- dataSetOrder.Clear();
- string orderNo = ultraTextOrder.Text.Trim();
- //string orderSts = "'120210','120211','120212','120213'";
- string orderStart = ultraDateTimeSta.DateTime.ToShortDateString();
- string orderEnd = ultraDateTimeEnd.DateTime.ToShortDateString();
- if (!uchkDate.Checked)
- {
- orderStart = ultraDateTimeSta.MinDate.ToShortDateString();
- orderEnd = ultraDateTimeSta.MaxDate.ToShortDateString();
- }
- if (!ultraCheckOrder.Checked)
- {
- orderNo = "";
- }
- DataTable dt = new DataTable();
- if (this.CustomInfo.Contains("doQueryReport"))
- {
- dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetQuery", new Object[] { orderNo, orderStart, orderEnd, "12020204", "12020205", "", "" }, this.ob);
- }
- if (this.CustomInfo.Contains("doQueryReports"))
- {
- dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetQuery", new Object[] { orderNo, orderStart, orderEnd, "12020205", "12020206", "12020207", "" }, this.ob);
- }
- GridHelper.CopyDataToDatatable(ref dt, ref this.orderHead, true);
- foreach (UltraGridRow row in ultraGridHead.Rows)
- {
- if ("1".Equals(row.Cells["CUSTOMER_MODEL_FL"].Value))
- {
- row.Cells["CUSTOMER_MODEL_FL"].Value = true;
- }
- else
- {
- row.Cells["CUSTOMER_MODEL_FL"].Value = false;
- }
- if ("1".Equals(row.Cells["VALIDFLAG"].Value))
- {
- row.Cells["VALIDFLAG"].Value = true;
- row.Appearance.ForeColor = Color.Black;
- }
- else
- {
- row.Cells["VALIDFLAG"].Value = false;
- row.Appearance.ForeColor = Color.Red;
- }
- if (ord_pk.Equals(row.Cells["ORD_PK"].Value.ToString()))
- {
- row.Activate();
- }
- }
- if (dt.Rows.Count <= 0)
- {
- this.orderHead.Rows.Clear();
- }
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptRows(ultraGridHead, new UltraGridColumn[] {
- });
- }
- private void ultraCheckOrder_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckOrder.Checked)
- {
- this.ultraTextOrder.ReadOnly = false;
- }
- else
- {
- this.ultraTextOrder.ReadOnly = true;
- }
- }
- private void uchkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (uchkDate.Checked)
- {
- ultraDateTimeSta.ReadOnly = false;
- ultraDateTimeEnd.ReadOnly = false;
- }
- else
- {
- ultraDateTimeSta.ReadOnly = true;
- ultraDateTimeEnd.ReadOnly = true;
- }
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- }
- private void ultraGridLine_AfterRowActivate(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 单纯审批提报
- /// </summary>
- /// <param name="ord_pk"></param>
- /// <param name="orderstsType"></param>
- /// <param name="orderstsDesc"></param>
- /// <param name="name"></param>
- /// <param name="time"></param>
- /// <param name="oldOrdersts"></param>
- /// <returns></returns>
- private bool orderstsUpdate(string ord_pk, string orderstsType, string orderstsDesc, string oldOrdersts)
- {
- ArrayList parms = new ArrayList();
- parms.Add(orderstsType);
- parms.Add(orderstsDesc);
- //加入审批人和审批时间
- parms.Add(UserInfo.GetUserName());
- parms.Add(ord_pk);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
- ccp.MethodName = "doUpdateHeadOrder";
- ccp.ServerParams = new object[] { parms };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return false;
- }
- else
- {
- ArrayList parmsHead = new ArrayList();
- parmsHead.Add(orderstsType);
- parmsHead.Add(orderstsDesc);
- parmsHead.Add(oldOrdersts);
- parmsHead.Add("合同审批管理(frmOrderApproval.cs)");
- parmsHead.Add(ord_pk);
- parms = new ArrayList();
- parms.Add(orderstsType);
- parms.Add(oldOrdersts);
- parms.Add("合同审批管理(frmOrderApproval.cs)");
- parms.Add(ord_pk);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.order.CoreOrderManager";
- ccp.MethodName = "upOrderHeadLineDelivery";
- ccp.ServerParams = new object[] { parms, parmsHead };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return false;
- }
- return true;
- }
- }
- private bool orderstsUpdateMeMo(string ord_pk, string orderstsType, string orderstsDesc, string MeMo, string oldOrdersts)
- {
- ArrayList parms = new ArrayList();
- parms.Add(orderstsType);
- parms.Add(orderstsDesc);
- parms.Add(MeMo);
- parms.Add(ord_pk);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
- ccp.MethodName = "doUpdateHeadOrderMeMo";
- ccp.ServerParams = new object[] { parms };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return false;
- }
- else
- {
- ArrayList parmsHead = new ArrayList();
- parmsHead.Add(orderstsType);
- parmsHead.Add(orderstsDesc);
- parmsHead.Add(oldOrdersts);
- parmsHead.Add("合同评审管理(frmOrderApproval.cs),评审回退");
- parmsHead.Add(ord_pk);
- parms = new ArrayList();
- parms.Add(orderstsType);
- parms.Add(oldOrdersts);
- parms.Add("合同评审管理(frmOrderApproval.cs),评审回退");
- parms.Add(ord_pk);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.order.CoreOrderManager";
- ccp.MethodName = "upOrderHeadLineDelivery";
- ccp.ServerParams = new object[] { parms, parmsHead };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return false;
- }
- return true;
- }
- }
- private void frmOrderApproval_Load(object sender, EventArgs e)
- {
- InitTime();
- if (this.CustomInfo != "approval" && this.CustomInfo != "approval-120504")
- {
- chkQueryAll.Visible = false;
- chkPass.Visible = false;
- }
- utSaleorg.ValueList = ClsBaseInfo.GetSaleOrgByValid(this.ValidDataPurviewIds);
-
- saleOrg = ClsBaseInfo.GetSaleOrg(UserInfo.GetDeptid());
- utSaleorg.Value=saleOrg;
- if (saleOrg == "100102")
- {
- chkPass.Visible = false;
- ultraGridHead.DisplayLayout.Bands[0].Groups[0].Hidden = true;
- }
- if (utSaleorg.ValueList.ValueListItems.Count > 1)
- {
- ultraLabel30.Visible = true;
- utSaleorg.Visible = true;
- }
- }
- private void ultraGridHead_AfterRowActivate(object sender, EventArgs e)
- {
- ultraGridHead.UpdateData();
- UltraGridRow ugr = ultraGridHead.ActiveRow;
- if (ugr != null)
- {
- String ordPk = ugr.Cells["ORD_PK"].Value.ToString();
- String orderModelNo = ugr.Cells["ORDER_MODEL_NO"].Value.ToString();
- String priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
- if (ultraTabControl1.SelectedTab.Key.Equals("1"))
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetLineOrder", new Object[] { ordPk }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.orderLine, true);
- }
- else if (ultraTabControl1.SelectedTab.Key.Equals("2"))
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetModelItem", new Object[] { orderModelNo }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.slmOrderModelItem, true);
- }
- else if (ultraTabControl1.SelectedTab.Key.Equals("3"))
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.GetOrderPriceList", new Object[] { priceNo, ordPk }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.slmOrderPrice, true);
- }
- else if (ultraTabControl1.SelectedTab.Key.Equals("4"))
- {
- textBox1.Text = getPriceBase(ordPk);
- }
- else
- {
- designStatus1.DoQuery(ultraGridHead.ActiveRow.Cells["ORDER_NO"].Value.ToString(), this.ob);
- }
- foreach (UltraGridCell cell in ugr.Cells)
- {
- if (!cell.Column.Key.Equals("CHK"))
- cell.Activation = Activation.ActivateOnly;
- }
- }
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptRows(ultraGridLine, new UltraGridColumn[] {
- });
- }
- private void ultraDateTimeSta_ValueChanged(object sender, EventArgs e)
- {
- ultraDateTimeSta.FormatString = "yyyy-MM-dd";
- }
- /// <summary>
- /// 初始时间控件 2015/06/18
- /// </summary>
- private void InitTime()
- {
- ultraDateTimeSta.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1);
- ultraDateTimeEnd.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddHours(24).AddSeconds(-1);
- }
- /// <summary>
- /// 查询合同头状态/定价编号 2015/06/18
- /// </summary>
- /// <param name="ordPk">合同头号</param>
- /// <returns></returns>
- private String[] getOrderHeadStatus(String ordPk)
- {
- String[] status = null;
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.getOrdPkStatus", new Object[] { ordPk }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- status = new String[2];
- status[0] = dt.Rows[0][0].ToString();
- status[1] = dt.Rows[0][1].ToString();
- }
- return status;
- }
- /// <summary>
- /// 获取价格评审单的状态
- /// </summary>
- /// <param name="priceNo"></param>
- /// <returns></returns>
- private String getOrderPriceStatus(String priceNo)
- {
- String status = "";
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.getOrderPriceStatus", new Object[] { priceNo }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- status = dt.Rows[0][0].ToString();
- }
- return status;
- }
- /// <summary>
- /// 提报审批
- /// </summary>
- private void DoReport()
- {
- ultraGridHead.UpdateData();
- ArrayList parm = new ArrayList();
- int count = 0;
- string pk = "";
- foreach (UltraGridRow ugr in ultraGridHead.Rows)
- {
- if (ugr.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- count += 1;
- ArrayList list = new ArrayList();
- string ordPk = ugr.Cells["ORD_PK"].Value.ToString().Trim();
- string orderNo = ugr.Cells["ORDER_NO"].Value.ToString().Trim();
- string orderType = ugr.Cells["ORDER_TYP"].Value.ToString().Trim();
- //合同头状态
- String[] statuses = getOrderHeadStatus(ordPk);
- if (statuses == null)
- {
- MessageUtil.ShowWarning("合同" + orderNo + "状态异常,不能提报审批");
- return;
- }
- string status = statuses[0];
- string priceNo = statuses[1];
- int flag = 0; //是否需要进行价格维护
- if (orderType == "120104")
- {
- flag = 1; //预排合同不需要定价
- }
- else
- {
- if (orderNo.StartsWith("TH"))
- {
- flag = 1; // 天淮成品合同不需要定价,取天管合同价格,维护内部价格
- } else if (saleOrg.Equals("100102"))
- {
- flag = 1; //国贸公司跳过价格维护
- }
- else
- {
- if (priceNo.Length > 0)
- {
- string sts = getOrderPriceStatus(priceNo);
- if (sts != "W")
- {
- MessageUtil.ShowWarning("价格评审不是待审状态,无法提报!");
- return;
- }
- flag = 1;
- }
- else
- {
- flag = 0;
- }
- }
- }
- DataTable dt1 = ServerHelper.GetData("com.steering.pss.glbusiness.FrmTHOrderManage.getThBcOrder", new object[] { orderNo }, this.ob);
- if (dt1 != null && dt1.Rows.Count > 0 && ("002001042001012".Equals(UserInfo.GetDeptid()) || UserInfo.GetUserName() == "admin"))
- {
- flag = 1;
- }
- if ("天津钢管制造有限公司".Equals(ugr.Cells["CUSTOMER_NM"].Value.ToString().Trim()) && "江苏天淮钢管有限公司".Equals(ugr.Cells["SUPPLY_UNIT_NM"].Value.ToString().Trim()))
- {
- flag = 1;
- }
- //合同头状态为“交货期评审通过/待提报审批”的合同;而且必须有定价内容
- if ((status.Equals("12020212") || status.Equals("12020213")) && flag > 0)
- {
- list.Add(ordPk);
- list.Add(orderType);
- pk = ordPk;
- parm.Add(list);
- }
- else
- {
- if (!status.Equals("12020212") && !status.Equals("12020213"))
- {
- if (saleOrg == "100102")
- {
- MessageUtil.ShowWarning("合同" + orderNo + "处于待审批或者已审批通过,不必重复提报审批");
- return;
- }
- else
- {
- MessageUtil.ShowWarning("合同" + orderNo + "需要重新维护定价或者已处于待审批,不能提报审批");
- return;
- }
- }
- if (flag == 0)
- {
- MessageUtil.ShowWarning("合同" + orderNo + "没有定价内容,不能提报审批");
- return;
- }
- }
- }
- }
- if (count == 0)
- {
- MessageUtil.ShowWarning("请选择需要提报审批的数据");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确认提报审批") == DialogResult.Yes)
- {
- CoreClientParam ccp = new CoreClientParam();
- dlgReviewMemo dlg = new dlgReviewMemo();
- dlg.ReviewFlag = 1;
- dlg.ReviewSatus = "提报审批";
- dlg.ShowDialog();
- string reviewMemo = dlg.ReviewMemo;
- if (dlg.DialogResult != DialogResult.OK)
- return;
- string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
- dept = dept + "-" + UserInfo.GetDepartment();
- ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
- ccp.MethodName = "doExport";
- ccp.ServerParams = new object[] { parm, reviewMemo, UserInfo.GetUserName(), dept, saleOrg };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- MessageUtil.ShowTips("提报审批成功!");
- doQuery();
- activeRow(ultraGridHead, pk);
- }
- }
- private void activeRow(UltraGrid ug, String value)
- {
- foreach (UltraGridRow ugr in ug.Rows)
- {
- if (ugr.Cells["ORD_PK"].Value.ToString().Equals(value))
- {
- ugr.Activate();
- }
- }
- }
- /// <summary>
- /// 撤销提报
- /// </summary>
- private void DoCancel()
- {
- if (saleOrg == "100102")
- {
- MessageUtil.ShowWarning("此功能对国贸合同没有操作权限!");
- return;
- }
- ultraGridHead.UpdateData();
- ArrayList parm = new ArrayList();
- int count = 0;
- string pk = "";
- foreach (UltraGridRow ugr in ultraGridHead.Rows)
- {
- if (ugr.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- ArrayList list = new ArrayList();
- count += 1;
- String ordPk = ugr.Cells["ORD_PK"].Value.ToString().Trim();
- String orderNo = ugr.Cells["ORDER_NO"].Value.ToString().Trim();
- String orderType = ugr.Cells["ORDER_TYP"].Value.ToString().Trim();
- //合同头状态
- String[] statuses = getOrderHeadStatus(ordPk);
- if (statuses == null)
- {
- MessageUtil.ShowWarning("合同" + orderNo + "状态异常,不能审批");
- return;
- }
- String status = statuses[0];
- if (status.Equals("12020220"))
- {
- list.Add(ordPk);
- list.Add(orderType);
- pk = ordPk;
- parm.Add(list);
- }
- else
- {
- MessageUtil.ShowWarning("合同" + orderNo + "状态不是待审批状态,不能撤销提报");
- return;
- }
- }
- }
- if (count == 0)
- {
- MessageUtil.ShowWarning("请选择需要撤销审批的数据");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确认撤销提报") == DialogResult.Yes)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
- ccp.MethodName = "doCancel";
- ccp.ServerParams = new object[] { parm, saleOrg };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- MessageUtil.ShowTips("撤销提报成功!");
- doQuery();
- activeRow(ultraGridHead, pk);
- }
- }
- /// <summary>
- /// 定价内容
- /// </summary>
- private void doPriceN()
- {
- if (saleOrg == "100102")
- {
- MessageUtil.ShowWarning("此功能国贸合同没有操作权限!");
- return;
- }
- UltraGridRow ugr = ultraGridHead.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择需要定价的合同");
- return;
- }
- string ordPk = ugr.Cells["ORD_PK"].Value.ToString().Trim();
- string[] statuses = getOrderHeadStatus(ordPk);
- string orderType = ugr.Cells["ORDER_TYP"].Value.ToString().Trim();
- if (orderType.Equals("120104"))
- {
- MessageUtil.ShowWarning("预排合同不需要维护价格!");
- return;
- }
- if (statuses == null)
- {
- MessageUtil.ShowWarning("合同状态异常,不能维护定价");
- return;
- }
- string status = statuses[0];
- ArrayList list = new ArrayList() { "12020212", "12020213", "12020221", "12020223", "12020231", "12020241" };
- if (list.Contains(status))
- {
- //frmOrderPriceDetails opDetails = new frmOrderPriceDetails();
- //opDetails.OrdPk = ordPk;
- //opDetails.Ob = this.ob;
- //opDetails.ShowDialog();
- if (isOpened == true)
- {
- return;
- }
- FrmPriceConfirm fpc = new FrmPriceConfirm(this.ob, ordPk);
- fpc.FormUse = "2";
- fpc.Size = new Size(1000, 680);
- fpc.SaleOrg = ugr.Cells["SALE_ORG"].Value.ToString();
- fpc.Text = "价格维护";
- isOpened = true;
- fpc.FrmClosedRefreshHandle += fpc_FrmClosedRefreshHandle;
- fpc.Show();
- }
- else
- {
- MessageUtil.ShowWarning("合同已审批,不能定价维护");
- return;
- }
- }
- void fpc_FrmClosedRefreshHandle(string ordPk)
- {
- isOpened = false;
- doQuery();
- foreach (UltraGridRow ugrn in ultraGridHead.Rows)
- {
- if (ugrn.Cells["ORD_PK"].Value.ToString().Equals(ordPk))
- {
- ugrn.Activate();
- }
- }
- }
- /// <summary>
- /// 查询定价内容
- /// </summary>
- /// <param name="priceNo"></param>
- /// <returns></returns>
- private String getPriceBase(String ordPk)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderReviewLaw.queryPriceInfo", new Object[] { ordPk }, ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- return dt.Rows[0][0].ToString();
- }
- else
- {
- return "";
- }
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- ultraGridHead.UpdateData();
- UltraGridRow ugr = ultraGridHead.ActiveRow;
- if (ugr != null)
- {
- String ordPk = ugr.Cells["ORD_PK"].Value.ToString();
- String orderModelNo = ugr.Cells["ORDER_MODEL_NO"].Value.ToString();
- String priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
- if (e.Tab.Key.Equals("1"))
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetLineOrder", new Object[] { ordPk }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.orderLine, true);
- }
- else if (e.Tab.Key.Equals("2"))
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetModelItem", new Object[] { orderModelNo }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.slmOrderModelItem, true);
- }
- else if (e.Tab.Key.Equals("3"))
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.GetOrderPriceList", new Object[] { priceNo, ordPk }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.slmOrderPrice, true);
- }
- else if (e.Tab.Key.Equals("4"))
- {
- textBox1.Text = getPriceBase(ordPk);
- }
- else
- {
- designStatus1.DoQuery(ultraGridHead.ActiveRow.Cells["ORDER_NO"].Value.ToString(), this.ob);
- }
- }
- }
- /// <summary>
- /// 会退到交货期评审通过
- /// </summary>
- private void BackToDelivery()
- {
- if (saleOrg == "100102")
- {
- MessageUtil.ShowWarning("此功能只针对于国内贸易部!");
- return;
- }
- //主管 ,经理 价格 法务 评审失败的状态 可以直接会退到交货期评审通过
- UltraGridRow ugr = ultraGridHead.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择需要退回交货期的合同!");
- return;
- }
- string ordPk = ugr.Cells["ORD_PK"].Value.ToString();
- string sts = "";
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.getOrderHeadStatus", new object[] { ordPk }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- sts = dt.Rows[0][0].ToString();
- }
- if (ugr.Cells["SUPPLY_UNIT_NM"].Text.Equals("江苏天淮钢管有限公司") && !ugr.Cells["FST_DRAWEE_UNIT_NM"].Text.Equals("江苏天淮钢管有限公司"))
- {
- MessageUtil.ShowWarning("天淮成品合同无法退回交货期!");
- return;
- }
- if (sts != "12020301" && Convert.ToInt32(sts) < 12020301 && Convert.ToInt32(sts) >= 12020212)
- {
- if (MessageUtil.ShowYesNoAndQuestion("是否退回到交货期状态?") == DialogResult.No) return;
- string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
- dept = dept + "-" + UserInfo.GetDepartment();
- string name = UserInfo.GetUserName();
- 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.CopyOrderApproval";
- ccp.MethodName = "backToDelivery";
- ccp.ServerParams = new object[] { ordPk, dept, name, reviewMemo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("回退成功!");
- doQuery();
- }
- }
- else
- {
- MessageUtil.ShowWarning("合同已生效或者处于交货期通过之前的状态,不能直接退回交货期");
- return;
- }
- }
- //回退交货期 国贸
- private void BackToDeliveryIE()
- {
- if (saleOrg != "100102")
- {
- MessageUtil.ShowWarning("此功能只针对于国际贸易部!");
- return;
- }
- //国贸 待审批 审批通过的状态 可以直接会退到交货期评审通过
- UltraGridRow ugr = ultraGridHead.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择需要退回交货期的合同!");
- return;
- }
- string ordPk = ugr.Cells["ORD_PK"].Value.ToString();
- string sts = "";
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.getOrderHeadStatus", new object[] { ordPk }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- sts = dt.Rows[0][0].ToString();
- }
- if (sts != "12020301" && Convert.ToInt32(sts) < 12020301 && Convert.ToInt32(sts) >= 12020212)
- {
- if (MessageUtil.ShowYesNoAndQuestion("是否退回到交货期状态?") == DialogResult.No) return;
- string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
- dept = dept + "-" + UserInfo.GetDepartment();
- string name = UserInfo.GetUserName();
- 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.CopyOrderApproval";
- ccp.MethodName = "backToDeliveryIE";
- ccp.ServerParams = new object[] { ordPk, dept, name, reviewMemo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("回退成功!");
- doQuery();
- }
- }
- else
- {
- MessageUtil.ShowWarning("合同已生效或者处于交货期通过之前的状态,不能直接退回交货期!");
- return;
- }
- }
- private void ultraTextOrder_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- doQuery();
- }
- private void frmOrderApproval_Shown(object sender, EventArgs e)
- {
- if (saleOrg == "100102") //国贸
- {
- if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
- toolMenu.Toolbars[0].Tools["doPrice"].InstanceProps.Visible = DefaultableBoolean.False;
- if (toolMenu.Toolbars[0].Tools.Exists("doCancel"))
- toolMenu.Toolbars[0].Tools["doCancel"].InstanceProps.Visible = DefaultableBoolean.False;
- if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
- toolMenu.Toolbars[0].Tools["ChgePrice"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (this.CustomInfo.Contains("approval")) //用于审批提报界面
- {
- if (queryPass != true)
- {
- if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
- this.ToolBarItemEnable(this, "ChgePrice", false);
- if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
- this.ToolBarItemEnable(this, "doPrice", true);
- }
- else
- {
- if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
- this.ToolBarItemEnable(this, "ChgePrice", true);
- if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
- this.ToolBarItemEnable(this, "doPrice", false);
- }
- }
- }
- private void chkQueryAll_CheckedChanged(object sender, EventArgs e)
- {
- if (chkQueryAll.Checked)
- {
- chkPass.Checked = false;
- queryAll = true;
- doQuery();
- }
- else
- {
- queryAll = false;
- doQuery();
- }
- }
- private void chkPass_CheckedChanged(object sender, EventArgs e)
- {
- if (chkPass.Checked)
- {
- chkQueryAll.Checked = false;
- queryPass = true;
- doQuery();
- if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
- this.ToolBarItemEnable(this, "ChgePrice", true);
- if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
- this.ToolBarItemEnable(this, "doPrice", false);
- }
- else
- {
- queryPass = false;
- doQuery();
- if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
- this.ToolBarItemEnable(this, "ChgePrice", false);
- if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
- this.ToolBarItemEnable(this, "doPrice", true);
- }
- }
- private void ChgePrice()
- {
- if (saleOrg == "100102")
- {
- MessageUtil.ShowWarning("此功能国贸合同没有操作权限!");
- return;
- }
- UltraGridRow ugr = ultraGridHead.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择需要定价的合同");
- return;
- }
- String ordPk = ugr.Cells["ORD_PK"].Value.ToString().Trim();
- String[] statuses = getOrderHeadStatus(ordPk);
- if (statuses == null)
- {
- MessageUtil.ShowWarning("合同状态异常,不能价格维护");
- return;
- }
- String status = statuses[0];
- if (Convert.ToInt32(status == "" ? "0" : status) >= 12020232)
- {
- if (isOpened)
- {
- return;
- }
- FrmPriceConfirm fpc = new FrmPriceConfirm(this.ob, ordPk);
- fpc.FormUse = "3";
- fpc.Size = new Size(1000, 680);
- fpc.SaleOrg = ugr.Cells["SALE_ORG"].Value.ToString();
- fpc.Text = "价格维护";
- fpc.FrmClosedRefreshHandle += fpc_FrmClosedRefreshHandle;
- isOpened = true;
- fpc.Show();
- }
- else
- {
- MessageUtil.ShowWarning("不是价格放行的合同,不能价格维护!\n若要维护价格,请点击定价维护!");
- return;
- }
- }
- /// <summary>
- /// 现货退回
- /// </summary>
- private void BackEdit()
- {
- UltraGridRow ugr = ultraGridHead.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择需要退回的现货合同!");
- return;
- }
- string ordPk = ugr.Cells["ORD_PK"].Value.ToString();
- string ordType = "";
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.getOrderType", new object[] { ordPk }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- ordType = dt.Rows[0][0].ToString();
- }
- if (ordType == "120102" || ordType == "120105")
- {
- //2015-10-30 修改了现货合同的逻辑 不存在现货合同的退回情况 现货合同的基本信息不存在修改情况 因为是根据选择的炉号生成的现货合同
- //MessageUtil.ShowWarning("现货合同不允许退回!");
- //return;
- if (MessageUtil.ShowYesNoAndQuestion("是否将现货合同退回到录入状态?") == DialogResult.No) return;
- string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
- dept = dept + "-" + UserInfo.GetDepartment();
- string name = UserInfo.GetUserName();
- 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.CopyOrderApproval";
- ccp.MethodName = "backEdit";
- ccp.ServerParams = new object[] { ordPk, dept, name, reviewMemo, saleOrg };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("回退成功!");
- doQuery();
- }
- }
- else
- {
- MessageUtil.ShowWarning("您选择的合同不是现货合同或者贸易合同,无法退回!");
- return;
- }
- }
- private void utSaleorg_ValueChanged(object sender, EventArgs e)
- {
- if (utSaleorg.SelectedIndex == -1)
- utSaleorg.SelectedIndex = 0;
- saleOrg = utSaleorg.Value.ToString();
- doQuery();
- }
- }
- }
|