| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using Infragistics.Win;
- using System.Collections;
- using System.Linq;
- using Core.StlMes.Client.SaleComm;
- using Core.Mes.Client.Comm.Server;
- using Infragistics.Win.UltraWinEditors;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.SaleOrder.ReviewForm;
- namespace Core.StlMes.Client.SaleOrder
- {
- public partial class frmOrderProducer : FrmBase
- {
- //定位
- string prdcrIndex = "";
- public frmOrderProducer()
- {
- InitializeComponent();
- }
- DataTable dtMain = new DataTable(); //监制主表
- DataTable dtVice = new DataTable(); //监制从表
- //witch Tab
- private string tabNum = "1";
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- case "doAdd":
- doAdd();
- break;
- case "doAddHt":
- doAddHt();
- break;
- case "doFect":
- doFect();
- break;
- case "doFeckBack":
- doFectBack();
- break;
- case "doFeckBoss":
- doFectBoss();
- break;
- case "Export":
- exportData();
- break;
- case "Copy":
- CopyData();
- break;
- case "Paste":
- PasteData();
- break;
- case "doClose":
- this.Close();
- break;
- }
- }
- public void doAddHt()
- {
- ultraGrid2.UpdateData();
- if (ultraGrid2.Rows.Count == 0)
- {
- MessageBox.Show("没有需要保存的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int mflag = 0; //主表标识
- int flag = 0; //从表标识
- ArrayList mlist = new ArrayList(); //主表修改参数
- ArrayList clist = new ArrayList(); // 从表修改参数
- ArrayList dlist = new ArrayList(); //从表需要清空的参数
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Value))
- {
- string prdcrNo = row.Cells["PRDCR_NO"].Value.ToString();
- string prdcrNoIndex = row.Cells["PRDCR_INDEX"].Value.ToString();
- string status = GetPrdcrStatus(prdcrNo, prdcrNoIndex);
- //改流程注释下面限制
- if (status == "W")
- {
- MessageUtil.ShowWarning("您所选记录,监制处于待确认状态,不能修改!");
- row.Activate();
- return;
- }
- if (row.Cells["PRDCR_DESC"].Text.Trim() == "")
- {
- MessageUtil.ShowWarning("请选择监制说明!");
- return;
- }
- mflag += 1;
- ArrayList list = new ArrayList();
- list.Add(row.Cells["PRDCR_DESC"].Value.ToString());
- list.Add(this.txtPrdcrFile.Text);
- list.Add(UserInfo.GetUserName());
- list.Add(prdcrNo.Substring(0, 32).ToString());
- mlist.Add(list);
- foreach (UltraGridRow crow in row.ChildBands[0].Rows)
- {
- if (Convert.ToBoolean(crow.Cells["XZ"].Value))
- {
- ArrayList parm = new ArrayList();
- if (crow.Cells["PRDCR_PRC_DESC"].Value.ToString() == "")
- {
- MessageBox.Show("请选择监制类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (crow.Cells["PRDCR_ADVC_DAY"].Value.ToString() == "")
- {
- MessageBox.Show("请输入提前天数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (crow.Cells["PDEPT_NO"].Value.ToString() == "")
- {
- MessageBox.Show("请选择监制单位1!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (crow.Cells["PRDCR_MAN"].Value.ToString() == "")
- {
- MessageBox.Show("请选择监制人员1!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (Convert.ToBoolean(crow.Cells["XZ"].Value))
- {
- parm.Add("1");
- }
- else
- {
- parm.Add("0");
- }
- parm.Add(crow.Cells["PRDCR_PRC_DESC"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_ADVC_DAY"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NO"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NAME"].Value.ToString());
- parm.Add(crow.Cells["PHONE"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_MAN"].Text);
- parm.Add(crow.Cells["PRDCR_MAN_PHONE"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NO2"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NAME2"].Value.ToString());
- parm.Add(crow.Cells["PHONE2"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_MAN2"].Text);
- parm.Add(crow.Cells["PRDCR_MAN_PHONE2"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NO3"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NAME3"].Value.ToString());
- parm.Add(crow.Cells["PHONE3"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_MAN3"].Text);
- parm.Add(crow.Cells["PRDCR_MAN_PHONE3"].Value.ToString());
- parm.Add(crow.Cells["MEMO"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_NO"].Value.ToString().Substring(0, 32));
- flag += 1;
- clist.Add(parm);
- }
- }
- }
- }
- if (mflag == 0)
- {
- MessageUtil.ShowWarning("请选择需要保存的制程!");
- return;
- }
- if (flag == 0)
- {
- MessageUtil.ShowWarning("一个制程下请至少维护一条监制信息!");
- return;
- }
- if (MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CoreOrderProducer";
- ccp.MethodName = "doAddHt";
- ccp.ServerParams = new object[] { mlist, clist };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("保存成功!");
- doQuery();
- }
- }
- private void exportData()
- {
- if(tabNum=="1"){
- GridHelper.ulGridToExcel(this.ultraGrid1, "监制要求管理");
- }
- else
- {
- GridHelper.ulGridToExcel(this.ultraGrid3, "监制要求查看");
- }
- }
- /// <summary>
- /// 行复制
- /// </summary>
- /// <param name="srcRow"></param>
- /// <param name="desRow"></param>
- private void CopyRowToRow(DataRow srcRow, DataRow desRow)
- {
- for (int i = 0; i < srcRow.Table.Columns.Count; i++)
- {
- string columnName = srcRow.Table.Columns[i].ColumnName;
- desRow[columnName] = srcRow[columnName];
- }
- }
- /// <summary>
- /// 复制选择的数据
- /// </summary>
- private void CopyData()
- {
- // ultraGrid2
- ultraGrid2.UpdateData();
- UltraGridRow ugr = ultraGrid2.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择一条制程主表记录或者从表记录进行复制!");
- return;
- }
- if (ugr.HasParent())
- {
- ugr = ugr.ParentRow;
- }
- dtMain = OrderProducer_Main.Copy();
- dtMain.Clear();
- dtVice = OrderProducer_Tain.Copy();
- dtVice.Clear();
- DataRow mRow = dtMain.NewRow();
- CopyRowToRow(((DataRowView)ugr.ListObject).Row, mRow);
- dtMain.Rows.Add(mRow);
- //复制子表
- foreach (UltraGridRow uRow in ugr.ChildBands[0].Rows)
- {
- DataRow vRow = dtVice.NewRow();
- if (uRow.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- CopyRowToRow(((DataRowView)uRow.ListObject).Row, vRow);
- dtVice.Rows.Add(vRow);
- }
- }
- }
- /// <summary>
- /// 粘贴复制的数据
- /// </summary>
- private void PasteData()
- {
- if (dtMain == null || dtMain.Rows.Count <= 0 || dtVice == null || dtVice.Rows.Count <= 0)
- {
- MessageUtil.ShowWarning("没有数据,请复制后再进行粘贴操作!");
- return;
- }
- UltraGridRow ugr = ultraGrid2.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择一条制程主表记录或者从表记录来粘贴你复制的数据!");
- return;
- }
- if (ugr.HasParent())
- {
- ugr = ugr.ParentRow;
- }
- //粘贴主记录 OrderProducer_Main OrderProducer_Tain
- //OrderProducer_Main.BeginInit();
- DataRow mRow = dtMain.Rows[0];
- ugr.Cells["PRDCR_DESC"].Value = mRow["PRDCR_DESC"].ToString();
- //粘贴从表
- foreach (UltraGridRow uRow in ugr.ChildBands[0].Rows)
- {
- foreach (DataRow dr in dtVice.Rows)
- {
- if (uRow.Cells["PROCESS_DESC"].Value.ToString() == dr["PROCESS_DESC"].ToString()
- && uRow.Cells["PROCESS_DESC_C"].Value.ToString() == dr["PROCESS_DESC_C"].ToString()
- && uRow.Cells["STATION_DESC"].Value.ToString() == dr["STATION_DESC"].ToString())
- {
- uRow.Cells["PRDCR_PRC_DESC"].Value = dr["PRDCR_PRC_DESC"].ToString();
- uRow.Cells["PRDCR_ADVC_DAY"].Value = dr["PRDCR_ADVC_DAY"].ToString();
- uRow.Cells["PDEPT_NO"].Value = dr["PDEPT_NO"].ToString();
- uRow.Cells["PHONE"].Value = dr["PHONE"].ToString();
- uRow.Cells["PRDCR_MAN"].Value = dr["PRDCR_MAN"].ToString();
- uRow.Cells["PRDCR_MAN_PHONE"].Value = dr["PRDCR_MAN_PHONE"].ToString();
- uRow.Cells["PDEPT_NO2"].Value = dr["PDEPT_NO2"].ToString();
- uRow.Cells["PHONE2"].Value = dr["PHONE2"].ToString();
- uRow.Cells["PRDCR_MAN2"].Value = dr["PRDCR_MAN2"].ToString();
- uRow.Cells["PRDCR_MAN_PHONE2"].Value = dr["PRDCR_MAN_PHONE2"].ToString();
- uRow.Cells["PDEPT_NO3"].Value = dr["PDEPT_NO3"].ToString();
- uRow.Cells["PHONE3"].Value = dr["PHONE3"].ToString();
- uRow.Cells["PRDCR_MAN3"].Value = dr["PRDCR_MAN3"].ToString();
- uRow.Cells["PRDCR_MAN_PHONE3"].Value = dr["PRDCR_MAN_PHONE3"].ToString();
- uRow.Cells["MEMO"].Value = dr["MEMO"].ToString();
- uRow.Cells["XZ"].Value = true;
- }
- }
- }
- ultraGrid2.UpdateData();
- }
- /// <summary>
- /// 监制通过
- /// </summary>
- public void doFectBoss()
- {
- ultraGrid1.UpdateData();
- int rCount = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Value))
- {
- rCount += 1;
- string prdcrNo = row.Cells["PRDCR_NO"].Value.ToString();
- List<string> status = GetPrdcrAllStatus(prdcrNo);
- if (status.Contains("S"))
- {
- MessageUtil.ShowWarning("您所选记录监制已经审批通过!");
- return;
- }
- list.Add(row.Cells["PRDCR_NO"].Value.ToString());
- }
- }
- if (rCount == 0)
- {
- MessageBox.Show("请选择您要审批通过的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("是否审批通过?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CoreOrderProducer";
- ccp.MethodName = "coreOrderProducerDeptProsu";
- ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- doQuery();
- }
- }
- /// <summary>
- /// 监制退回
- /// </summary>
- public void doFectBack()
- {
- ultraGrid1.UpdateData();
- int rCount = 0;
- ArrayList list = new ArrayList();
- DataTable dt = MakeDataTable();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Value))
- {
- rCount += 1;
- string orderNo = row.Cells["ORDER_NO"].Value.ToString();
- string prdcrNo = row.Cells["PRDCR_NO"].Value.ToString();
- List<string> status = GetPrdcrAllStatus(prdcrNo);
- if (status.Contains("S"))
- {
- string orderSts = GetOrderStatus(orderNo);
- if (orderSts == "12020402") //提报完毕
- {
- MessageUtil.ShowWarning("您所选合同已经提报,监制无法退回!");
- return;
- }
- }
-
- DataTable dt1 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getOrderLinePrdcr", new Object[] { prdcrNo }, this.ob);
- foreach (DataRow t in dt1.Rows)
- {
- DataRow dr = dt.NewRow();
- dr["ORDER_NO"] = row.Cells["ORDER_NO"].Value.ToString();
- dr["ORDER_SEQ"] = row.Cells["ORDER_SEQ"].Value.ToString();
- dr["MSC_PLINE"] = t["MSC_PLINE"].ToString();
- dr["MSC_PLINE_DESC"] = t["MSC_PLINE_DESC"].ToString();
- dr["PSC_DESC"] = row.Cells["PSC_DESC"].Value.ToString();
- dr["STD_NAME"] = row.Cells["STD_NAME"].Value.ToString();
- dr["PRODUCNAME"] = row.Cells["PRODUCNAME"].Value.ToString();
- //dr["STD_STYLE_DESC"] = row.Cells["STD_STYLE_DESC"].Value.ToString();
- dr["MODEL_DESC"] = row.Cells["MODEL_DESC"].Value.ToString();
- dr["PRDCR_NO"] = t["PRDCR_NO"].ToString();
- dr["PRDCR_INDEX"] = t["PRDCR_INDEX"].ToString();
- dt.Rows.Add(dr);
- }
- }
- }
- if (rCount == 0)
- {
- MessageBox.Show("请选择您要审批退回的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("是否审批退回?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return;
- FrmOrderPrdcrBack fop = new FrmOrderPrdcrBack();
- fop.Dt = dt;
- fop.ShowDialog();
- dt = fop.Dt;
- if (fop.DialogResult != DialogResult.OK)
- return;
- foreach (DataRow dr in dt.Rows)
- {
- ArrayList parm = new ArrayList();
- parm.Add(UserInfo.GetUserName());
- parm.Add(dr["FAIL_RSN"].ToString());
- parm.Add(dr["PRDCR_INDEX"].ToString());
- parm.Add(dr["PRDCR_NO"].ToString());
- list.Add(parm);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CoreOrderProducer";
- ccp.MethodName = "coreOrderProducerDeptProBa";
- ccp.ServerParams = new object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageBox.Show("退回操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- doQuery();
- }
- }
- /// <summary>
- /// 提报监制
- /// </summary>
- public void doFect()
- {
- ultraGrid1.UpdateData();
- int rCount = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Value))
- {
- rCount += 1;
- string prdcrNo = row.Cells["PRDCR_NO"].Value.ToString();
- List<string> status = GetPrdcrAllStatus(prdcrNo);
- if (status.Contains("L"))
- {
- MessageUtil.ShowWarning("您所选记录,监制尚未维护!");
- return;
- }
- else if (status.Contains("W"))
- {
- MessageUtil.ShowWarning("您所选记录,监制已经提报!");
- return;
- }
- else if (status.Contains("S"))
- {
- MessageUtil.ShowWarning("您所选记录,监制已经生效!");
- return;
- }
- else if (status.Contains("F"))
- {
- MessageUtil.ShowWarning("您所选记录,存在回退的监制,请修改!");
- return;
- }
- list.Add(row.Cells["PRDCR_NO"].Value.ToString());
- }
- }
- if (rCount == 0)
- {
- MessageBox.Show("请选择您要提报的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("是否审批提报?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CoreOrderProducer";
- ccp.MethodName = "coreOrderProducerDeptProFe";
- ccp.ServerParams = new object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageBox.Show("提报成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- doQuery();
- }
- }
- /// <summary>
- /// 保存
- /// </summary>
- public void doAdd()
- {
- ultraGrid2.UpdateData();
- if (ultraGrid2.Rows.Count == 0)
- {
- MessageBox.Show("没有需要保存的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int mflag = 0; //主表标识
- int flag = 0; //从表标识
- ArrayList mlist = new ArrayList(); //主表修改参数
- ArrayList clist = new ArrayList(); // 从表修改参数
- ArrayList dlist = new ArrayList(); //从表需要清空的参数
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Value))
- {
- string prdcrNo = row.Cells["PRDCR_NO"].Value.ToString();
- string prdcrNoIndex = row.Cells["PRDCR_INDEX"].Value.ToString();
- string status = GetPrdcrStatus(prdcrNo, prdcrNoIndex);
- //改流程注释下面限制
- if (status == "W")
- {
- MessageUtil.ShowWarning("您所选记录,监制处于待确认状态,不能修改!");
- row.Activate();
- return;
- }
- //if (status == "S")
- //{
- // MessageUtil.ShowWarning("您所选记录,监制已经生效,不能修改!");
- // row.Activate();
- // return;
- //}
- if (row.Cells["PRDCR_DESC"].Text.Trim() == "")
- {
- MessageUtil.ShowWarning("请选择监制说明!");
- return;
- }
- mflag += 1;
- ArrayList list = new ArrayList();
- list.Add(row.Cells["PRDCR_DESC"].Value.ToString());
- list.Add(this.txtPrdcrFile.Text);
- list.Add(UserInfo.GetUserName());
- list.Add(prdcrNo);
- list.Add(prdcrNoIndex);
- mlist.Add(list);
- foreach (UltraGridRow crow in row.ChildBands[0].Rows)
- {
- if (Convert.ToBoolean(crow.Cells["XZ"].Value))
- {
- ArrayList parm = new ArrayList();
- if (crow.Cells["PRDCR_PRC_DESC"].Value.ToString() == "")
- {
- MessageBox.Show("请选择监制类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (crow.Cells["PRDCR_ADVC_DAY"].Value.ToString() == "")
- {
- MessageBox.Show("请输入提前天数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (crow.Cells["PDEPT_NO"].Value.ToString() == "")
- {
- MessageBox.Show("请选择监制单位1!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (crow.Cells["PRDCR_MAN"].Value.ToString() == "")
- {
- MessageBox.Show("请选择监制人员1!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (Convert.ToBoolean(crow.Cells["XZ"].Value))
- {
- parm.Add("1");
- }
- else
- {
- parm.Add("0");
- }
- parm.Add(crow.Cells["PRDCR_PRC_DESC"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_ADVC_DAY"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NO"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NAME"].Value.ToString());
- parm.Add(crow.Cells["PHONE"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_MAN"].Text);
- parm.Add(crow.Cells["PRDCR_MAN_PHONE"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NO2"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NAME2"].Value.ToString());
- parm.Add(crow.Cells["PHONE2"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_MAN2"].Text);
- parm.Add(crow.Cells["PRDCR_MAN_PHONE2"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NO3"].Value.ToString());
- parm.Add(crow.Cells["PDEPT_NAME3"].Value.ToString());
- parm.Add(crow.Cells["PHONE3"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_MAN3"].Text);
- parm.Add(crow.Cells["PRDCR_MAN_PHONE3"].Value.ToString());
- parm.Add(crow.Cells["MEMO"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_NO"].Value.ToString());
- parm.Add(crow.Cells["PRDCR_INDEX"].Value.ToString());
- parm.Add(crow.Cells["STATION_CODE"].Value.ToString());
- flag += 1;
- clist.Add(parm);
- }
- else
- {
- //未监制的工序点
- ArrayList al = new ArrayList();
- al.Add(crow.Cells["PRDCR_NO"].Value.ToString());
- al.Add(crow.Cells["PRDCR_INDEX"].Value.ToString());
- al.Add(crow.Cells["STATION_CODE"].Value.ToString());
- dlist.Add(al);
- }
- }
- }
- }
- if (mflag == 0)
- {
- MessageUtil.ShowWarning("请选择需要保存的制程!");
- return;
- }
- if (flag == 0)
- {
- MessageUtil.ShowWarning("一个制程下请至少维护一条监制信息!");
- return;
- }
- if (MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CoreOrderProducer";
- ccp.MethodName = "save";
- ccp.ServerParams = new object[] { mlist, clist, dlist };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("保存成功!");
- doQuery();
- }
- }
- public void doQuery()
- {
- //创建时间
- string date = "";
- string From = "1000-01-01 00:00:01";
- string End = "9999-12-31 23:59:59";
- if (che_date.Checked)
- {
- if (Convert.ToDateTime(date_starte.Value) > Convert.ToDateTime(date_end.Value))
- {
- MessageBox.Show("请输入的日期范围不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- From = Convert.ToDateTime(date_starte.Value).ToString("yyyy-MM-dd") + " 00:00:01";
- End = Convert.ToDateTime(date_end.Value).ToString("yyyy-MM-dd") + " 23:59:59";
- }
- date = " AND T.CREATE_TIME>= TO_DATE('" + From + "' ,'YYYY-MM-DD HH24:MI:SS') AND T.CREATE_TIME <= TO_DATE( '" + End + "','YYYY-MM-DD HH24:MI:SS')";
- ultraGrid1.UpdateData();
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- string prdcrNo = "";
- if (ugr != null)
- {
- prdcrNo = ugr.Cells["PRDCR_NO"].Value.ToString();
- }
- //合同号
- string order = "";
- if (che_order.Checked)
- {
- if (te_order.Text == "")
- {
- MessageBox.Show("请输入合同号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else
- {
- order = te_order.Text;
- }
- }
- //监制的要求状态
- var status = dept_stuts.Checked ? cho_stuts.CheckedItems.Select(p => p.DataValue.ToString()).ToArray() : new string[] { "M", "W", "S", "F", "L" };
- if (tabNum == "1")
- {
- dataSet2.Clear();
- }
- else if (tabNum == "2")
- {
- dataSet4.Clear();
- }
- string[] arr = this.ValidDataPurviewIds;
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.CoreOrderProducerHeadQuery", new Object[] { date, order, status, arr, this.CustomInfo, tabNum }, this.ob);
- if (tabNum == "1")
- {
- GridHelper.CopyDataToDatatable(ref dt, ref this.OrderProduSql, true);
- }
- else if (tabNum == "2")
- {
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- }
- if (tabNum == "1")
- {
- if (prdcrNo != "")
- {
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.Cells["PRDCR_NO"].Value.ToString().Equals(prdcrNo))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- }
- private void che_date_CheckedChanged(object sender, EventArgs e)
- {
- date_starte.Enabled = che_date.Checked;
- date_end.Enabled = che_date.Checked;
- }
- private void dept_stuts_CheckedChanged(object sender, EventArgs e)
- {
- cho_stuts.Enabled = dept_stuts.Checked;
- }
- private void che_order_CheckedChanged(object sender, EventArgs e)
- {
- te_order.Enabled = che_order.Checked;
- }
- ValueList vlistManageNo = new ValueList();
- ValueList vlistManageNo1 = new ValueList();
- private void frmOrderProducer_Load(object sender, EventArgs e)
- {
- date_starte.Value = DateTime.Now.AddDays(-30).ToShortDateString();
- date_end.Value = DateTime.Now.ToShortDateString();
- UltraComboEditor uce = new UltraComboEditor();
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getPrdcrDesc", null, this.ob);
- uce.DataSource = dt;
- this.Controls.Add(uce);
- uce.Visible = false;
- uce.DisplayMember = "BASENAME";
- uce.ValueMember = "BASECODE";
- ultraGrid2.DisplayLayout.Bands[0].Columns["PRDCR_DESC"].EditorComponent = uce;
- ultraGrid2.DisplayLayout.Bands[0].Columns["PRDCR_DESC"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- ultraGrid4.DisplayLayout.Bands[0].Columns["PRDCR_DESC"].EditorComponent = uce;
- ultraGrid4.DisplayLayout.Bands[0].Columns["PRDCR_DESC"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- if (this.CustomInfo == "2")
- {
- dept_stuts.Checked = true;
- cho_stuts.Value = "W";
- }
- DataTable dt3 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.CoreOrderProducerPdeptBase", null, this.ob);
- vlistManageNo = GeneralValuelist(ref dt3, "PDEPT_NO", "PDEPT_NAME");
- DataTable dt4 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.CoreOrderProducerPrcBase", null, this.ob);
- vlistManageNo1 = GeneralValuelist(ref dt4, "BASECODE", "BASENAME");
- }
- public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
- {
- if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
- {
- return null;
- }
- ArrayList alist = new ArrayList();
- ValueList vlist = new ValueList();
- for (int i = 0; i < table.Rows.Count; i++)
- {
- try
- {
- if (!alist.Contains(table.Rows[i][strKey]))
- {
- alist.Add(table.Rows[i][strKey]);
- vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
- }
- }
- catch { }
- }
- return vlist;
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- if (ugr != null)
- {
- this.Cursor = Cursors.WaitCursor;
- for (int i = 0; i < ugr.Cells.Count; i++)
- {
- if (!ugr.Cells[i].Column.Key.Equals("CHK"))
- ugr.Cells[i].Activation = Activation.ActivateOnly;
- }
- doQueryProducer();
- }
- this.Cursor = Cursors.Default;
- }
- public void doQueryProducer()
- {
- ultraGrid1.UpdateData();
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- if (ugr == null)
- return;
- //查询合同监制从表
- string prdcrNo = ugr.Cells["PRDCR_NO"].Value.ToString();
- DataTable dt1 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getOrderLinePrdcr", new Object[] { prdcrNo }, this.ob);
- DataTable dt2 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getOrderLinePrdcrLst", new Object[] { prdcrNo }, this.ob);
- OrderProducer_Tain.Clear();
- GridHelper.CopyDataToDatatable(ref dt1, ref this.OrderProducer_Main, true);
- GridHelper.CopyDataToDatatable(ref dt2, ref this.OrderProducer_Tain, true);
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- for (int j = 0; j < ultraGrid2.Rows[i].ChildBands[0].Rows.Count; j++)
- {
- ultraGrid2.Rows[i].ChildBands[0].Rows[j].Cells["PDEPT_NO"].ValueList = vlistManageNo;
- ultraGrid2.Rows[i].ChildBands[0].Rows[j].Cells["PDEPT_NO2"].ValueList = vlistManageNo;
- ultraGrid2.Rows[i].ChildBands[0].Rows[j].Cells["PDEPT_NO3"].ValueList = vlistManageNo;
- ultraGrid2.Rows[i].ChildBands[0].Rows[j].Cells["PRDCR_PRC_DESC"].ValueList = vlistManageNo1;
- }
- }
- }
- private void ultraGrid2_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- ultraGrid2.UpdateData();
- if (e.Cell.Column.Key.Equals("CHK"))
- {
- e.Cell.Row.ExpandAll();
- if (e.Cell.Row.Cells["CHK"].Value.ToString().ToUpper() != "TRUE")
- {
- e.Cell.Row.Cells["PRDCR_DESC"].Activation = Activation.ActivateOnly;
- }
- else
- {
- e.Cell.Row.Cells["PRDCR_DESC"].Activation = Activation.AllowEdit;
- }
- }
- else if (e.Cell.Column.Key.Equals("PRDCR_DESC")) //监制说明
- {
- string code = e.Cell.Value.ToString();
- //获取这个CODE下的所有工序点。
- DataTable stDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getPrdcrStationCode", new object[] { code }, this.ob);
- List<string> list = new List<string>();
- if (stDt != null && stDt.Rows.Count > 0)
- {
- for (int i = 0; i < stDt.Rows.Count; i++)
- list.Add(stDt.Rows[i][0].ToString());
- }
- for (int j = 0; j < e.Cell.Row.ChildBands[0].Rows.Count; j++)
- {
- if (list.Contains(e.Cell.Row.ChildBands[0].Rows[j].Cells["STATION_CODE"].Value.ToString()))
- e.Cell.Row.ChildBands[0].Rows[j].Cells["XZ"].Value = true;
- else
- e.Cell.Row.ChildBands[0].Rows[j].Cells["XZ"].Value = false;
- }
- }
- else if (e.Cell.Column.Key.Equals("PRDCR_PRC_DESC"))
- {
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- row.Cells["PRDCR_PRC_DESC"].Value = e.Cell.Value;
- }
- }
- }
- else if (e.Cell.Column.Key.Equals("PRDCR_ADVC_DAY"))
- {
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- row.Cells["PRDCR_ADVC_DAY"].Value = e.Cell.Value;
- }
- }
- }
- else if (e.Cell.Column.Key == "PDEPT_NO" || e.Cell.Column.Key == "PDEPT_NO2" || e.Cell.Column.Key == "PDEPT_NO3")
- {
- string unit = "";
- if (e.Cell.Column.Key == "PDEPT_NO")
- {
- unit = e.Cell.Value.ToString();
- e.Cell.Row.Cells["PDEPT_NAME"].Value = e.Cell.Text;
- DataTable personDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { unit }, this.ob); //监制人
- ValueList vl = GeneralValuelist(ref personDt, "PHONE", "NAME_");
- e.Cell.Row.Cells["PRDCR_MAN"].ValueList = vl;
- e.Cell.Row.Cells["PRDCR_MAN"].Value = "";
- e.Cell.Row.Cells["PRDCR_MAN_PHONE"].Value = "";
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PDEPT_NO"].Value = e.Cell.Value;
- row.Cells["PHONE"].Value = e.Cell.Row.Cells["PHONE"].Value;
- row.Cells["PRDCR_MAN"].Value = e.Cell.Row.Cells["PRDCR_MAN"].Value;
- row.Cells["PRDCR_MAN_PHONE"].Value = e.Cell.Row.Cells["PRDCR_MAN_PHONE"].Value;
- }
- }
- }
- }
- if (e.Cell.Column.Key == "PDEPT_NO2")
- {
- unit = e.Cell.Value.ToString();
- e.Cell.Row.Cells["PDEPT_NAME2"].Value = e.Cell.Text;
- DataTable personDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { unit }, this.ob); //监制人
- ValueList vl = GeneralValuelist(ref personDt, "PHONE", "NAME_");
- e.Cell.Row.Cells["PRDCR_MAN2"].ValueList = vl;
- e.Cell.Row.Cells["PRDCR_MAN2"].Value = "";
- e.Cell.Row.Cells["PRDCR_MAN_PHONE2"].Value = "";
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PDEPT_NO2"].Value = e.Cell.Value;
- row.Cells["PHONE2"].Value = e.Cell.Row.Cells["PHONE2"].Value;
- row.Cells["PRDCR_MAN2"].Value = e.Cell.Row.Cells["PRDCR_MAN2"].Value;
- row.Cells["PRDCR_MAN_PHONE2"].Value = e.Cell.Row.Cells["PRDCR_MAN_PHONE2"].Value;
- }
- }
- }
- }
- if (e.Cell.Column.Key == "PDEPT_NO3")
- {
- unit = e.Cell.Value.ToString();
- e.Cell.Row.Cells["PDEPT_NAME3"].Value = e.Cell.Text;
- DataTable personDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { unit }, this.ob); //监制人
- ValueList vl = GeneralValuelist(ref personDt, "PHONE", "NAME_");
- e.Cell.Row.Cells["PRDCR_MAN3"].ValueList = vl;
- e.Cell.Row.Cells["PRDCR_MAN3"].Value = "";
- e.Cell.Row.Cells["PRDCR_MAN_PHONE3"].Value = "";
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PDEPT_NO3"].Value = e.Cell.Value;
- row.Cells["PHONE3"].Value = e.Cell.Row.Cells["PHONE3"].Value;
- row.Cells["PRDCR_MAN3"].Value = e.Cell.Row.Cells["PRDCR_MAN3"].Value;
- row.Cells["PRDCR_MAN_PHONE3"].Value = e.Cell.Row.Cells["PRDCR_MAN_PHONE3"].Value;
- }
- }
- }
- }
- DataTable dt = Globals.GetData("com.steering.pss.sale.order.CoreOrderProducer.CoreOrderProducerPhoneQuery", new Object[] { unit }, this.ob); //单位电话
- string phone = dt.Rows.Count == 0 ? "" : dt.Rows[0][0].ToString2();
- if (e.Cell.Column.Key == "PDEPT_NO")
- {
- e.Cell.Row.Cells["PHONE"].Value = phone;
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PHONE"].Value = phone;
- }
- }
- }
- }
- else if (e.Cell.Column.Key == "PDEPT_NO2")
- {
- e.Cell.Row.Cells["PHONE2"].Value = phone;
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PHONE2"].Value = phone;
- }
- }
- }
- }
- else if (e.Cell.Column.Key == "PDEPT_NO3")
- {
- e.Cell.Row.Cells["PHONE3"].Value = phone;
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PHONE3"].Value = phone;
- }
- }
- }
- }
- }
- else if (e.Cell.Column.Key.Equals("PRDCR_MAN"))
- {
- e.Cell.Row.Cells["PRDCR_MAN_PHONE"].Value = e.Cell.Value;
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PDEPT_NO"].Value = e.Cell.Row.Cells["PDEPT_NO"].Value;
- row.Cells["PRDCR_MAN"].Value = e.Cell.Text;
- row.Cells["PRDCR_MAN_PHONE"].Value = e.Cell.Row.Cells["PRDCR_MAN_PHONE"].Value;
- }
- }
- }
- }
- else if (e.Cell.Column.Key.Equals("PRDCR_MAN2"))
- {
- e.Cell.Row.Cells["PRDCR_MAN_PHONE2"].Value = e.Cell.Value;
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PDEPT_NO2"].Value = e.Cell.Row.Cells["PDEPT_NO2"].Value;
- row.Cells["PRDCR_MAN2"].Value = e.Cell.Text;
- row.Cells["PRDCR_MAN_PHONE2"].Value = e.Cell.Row.Cells["PRDCR_MAN_PHONE2"].Value;
- }
- }
- }
- }
- else if (e.Cell.Column.Key.Equals("PRDCR_MAN3"))
- {
- e.Cell.Row.Cells["PRDCR_MAN_PHONE3"].Value = e.Cell.Value;
- int num = Convert.ToInt32(e.Cell.Row.Cells["ROWNUM"].Value);
- foreach (UltraGridRow row in e.Cell.Row.ParentRow.ChildBands[0].Rows)
- {
- if (Convert.ToInt32(row.Cells["ROWNUM"].Value) > num)
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["PDEPT_NO3"].Value = e.Cell.Row.Cells["PDEPT_NO3"].Value;
- row.Cells["PRDCR_MAN3"].Value = e.Cell.Text;
- row.Cells["PRDCR_MAN_PHONE3"].Value = e.Cell.Row.Cells["PRDCR_MAN_PHONE3"].Value;
- }
- }
- }
- }
- else if (e.Cell.Column.Key == "XZ")
- {
- if (Convert.ToBoolean(e.Cell.Value))
- {
- e.Cell.Row.Cells["PRDCR_PRC_FL"].Value = true;
- e.Cell.Row.Cells["PRDCR_PRC_FL"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["PRDCR_PRC_DESC"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["PRDCR_ADVC_DAY"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["PDEPT_NO"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["PRDCR_MAN"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["PDEPT_NO2"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["PRDCR_MAN2"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["PDEPT_NO3"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["PRDCR_MAN3"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["MEMO"].Activation = Activation.AllowEdit;
- //自动带出存在的记录的数据
- string prdcr = e.Cell.Row.ParentRow.Cells["PRDCR_NO"].Value.ToString();
- DataRow[] arr = OrderProducer_Tain.Select("PRDCR_NO = '" + prdcr + "' AND XZ='True' AND PRDCR_PRC_DESC <> '' ", "");
- if (arr.Length > 0)
- {
- DataRow dr = arr[arr.Length - 1];
- if (e.Cell.Row.Cells["PRDCR_PRC_DESC"].Text == "" || e.Cell.Row.Cells["PRDCR_ADVC_DAY"].Text == ""
- || e.Cell.Row.Cells["PDEPT_NO"].Text == "")
- {
- e.Cell.Row.Cells["PRDCR_PRC_DESC"].Value = dr["PRDCR_PRC_DESC"].ToString();
- e.Cell.Row.Cells["PRDCR_ADVC_DAY"].Value = dr["PRDCR_ADVC_DAY"].ToString();
- e.Cell.Row.Cells["PDEPT_NO"].Value = dr["PDEPT_NO"].ToString();
- e.Cell.Row.Cells["PDEPT_NAME"].Value = dr["PDEPT_NAME"].ToString();
- e.Cell.Row.Cells["PHONE"].Value = dr["PHONE"].ToString();
- DataTable personDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { dr["PDEPT_NO"].ToString() }, this.ob); //监制人
- ValueList vl = GeneralValuelist(ref personDt, "PHONE", "NAME_");
- e.Cell.Row.Cells["PRDCR_MAN"].ValueList = vl;
- e.Cell.Row.Cells["PRDCR_MAN"].Value = dr["PRDCR_MAN"].ToString();
- e.Cell.Row.Cells["PRDCR_MAN_PHONE"].Value = dr["PRDCR_MAN_PHONE"].ToString();
- e.Cell.Row.Cells["PDEPT_NO2"].Value = dr["PDEPT_NO2"].ToString();
- e.Cell.Row.Cells["PDEPT_NAME2"].Value = dr["PDEPT_NAME2"].ToString();
- e.Cell.Row.Cells["PHONE2"].Value = dr["PHONE2"].ToString();
- DataTable personDt2 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { dr["PDEPT_NO2"].ToString() }, this.ob); //监制人
- ValueList vl2 = GeneralValuelist(ref personDt2, "PHONE", "NAME_");
- e.Cell.Row.Cells["PRDCR_MAN2"].ValueList = vl2;
- e.Cell.Row.Cells["PRDCR_MAN2"].Value = dr["PRDCR_MAN2"].ToString();
- e.Cell.Row.Cells["PRDCR_MAN_PHONE2"].Value = dr["PRDCR_MAN_PHONE2"].ToString();
- e.Cell.Row.Cells["PDEPT_NO3"].Value = dr["PDEPT_NO3"].ToString();
- e.Cell.Row.Cells["PDEPT_NAME3"].Value = dr["PDEPT_NAME3"].ToString();
- DataTable personDt3 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { dr["PDEPT_NO3"].ToString() }, this.ob); //监制人
- ValueList vl3 = GeneralValuelist(ref personDt3, "PHONE", "NAME_");
- e.Cell.Row.Cells["PRDCR_MAN3"].ValueList = vl3;
- e.Cell.Row.Cells["PHONE3"].Value = dr["PHONE3"].ToString();
- e.Cell.Row.Cells["PRDCR_MAN3"].Value = dr["PRDCR_MAN3"].ToString();
- e.Cell.Row.Cells["PRDCR_MAN_PHONE3"].Value = dr["PRDCR_MAN_PHONE3"].ToString();
- }
- }
- }
- else
- {
- e.Cell.Row.Cells["PRDCR_PRC_FL"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["PRDCR_PRC_DESC"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["PRDCR_ADVC_DAY"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["PDEPT_NO"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["PRDCR_MAN_PHONE"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["PDEPT_NO2"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["PRDCR_MAN_PHONE2"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["PDEPT_NO3"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["PRDCR_MAN_PHONE3"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["MEMO"].Activation = Activation.ActivateOnly;
- }
- }
- }
- private void txtPrdcrFile_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- if (e.Button.Key == "DownLoad")//下载
- {
- frmOrderProducerinfo stu = new frmOrderProducerinfo();
- stu.oPbc = this.ob;
- stu.index = ultraGrid1.ActiveRow.Cells["ORDER_NO"].Text;
- stu.ShowDialog();
- }
- else//上传
- {
- string sFileName = "Image/pss/sale/order/ORD_PK/ORD_LN_PK/PRDCR/" + ultraGrid1.ActiveRow.Cells["ORDER_NO"].Text;
- this.txtPrdcrFile.Text = sFileName;
- FlileUploadcomm.FlileUpload(sFileName);
- }
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- ultraGrid2.UpdateData();
- UltraGridRow row = ultraGrid2.ActiveRow;
- if (row == null)
- return;
- if (row.HasParent())
- {
- if (row.Cells["XZ"].Value.ToString().ToUpper() == "TRUE" && this.CustomInfo == "1")
- {
- row.Cells["PRDCR_PRC_FL"].Value = true;
- row.Cells["PRDCR_PRC_FL"].Activation = Activation.AllowEdit;
- row.Cells["PRDCR_PRC_DESC"].Activation = Activation.AllowEdit;
- row.Cells["PRDCR_ADVC_DAY"].Activation = Activation.AllowEdit;
- row.Cells["PDEPT_NO"].Activation = Activation.AllowEdit;
- row.Cells["PHONE"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN"].Activation = Activation.AllowEdit;
- row.Cells["PRDCR_MAN_PHONE"].Activation = Activation.ActivateOnly;
- row.Cells["PDEPT_NO2"].Activation = Activation.AllowEdit;
- row.Cells["PDEPT_NAME2"].Activation = Activation.AllowEdit;
- row.Cells["PHONE2"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN2"].Activation = Activation.AllowEdit;
- row.Cells["PRDCR_MAN_PHONE2"].Activation = Activation.ActivateOnly;
- row.Cells["PDEPT_NO3"].Activation = Activation.AllowEdit;
- row.Cells["PDEPT_NAME3"].Activation = Activation.AllowEdit;
- row.Cells["PHONE3"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN3"].Activation = Activation.AllowEdit;
- row.Cells["PRDCR_MAN_PHONE3"].Activation = Activation.ActivateOnly;
- row.Cells["MEMO"].Activation = Activation.AllowEdit;
- DataTable personDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { row.Cells["PDEPT_NO"].Value.ToString() }, this.ob); //监制人
- ValueList vl = GeneralValuelist(ref personDt, "PHONE", "NAME_");
- row.Cells["PRDCR_MAN"].ValueList = vl;
- DataTable personDt2 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { row.Cells["PDEPT_NO2"].Value.ToString() }, this.ob); //监制人
- ValueList vl2 = GeneralValuelist(ref personDt2, "PHONE", "NAME_");
- row.Cells["PRDCR_MAN2"].ValueList = vl2;
- DataTable personDt3 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getDeptPerson", new object[] { row.Cells["PDEPT_NO3"].Value.ToString() }, this.ob); //监制人
- ValueList vl3 = GeneralValuelist(ref personDt3, "PHONE", "NAME_");
- row.Cells["PRDCR_MAN3"].ValueList = vl3;
- }
- else
- {
- if (this.CustomInfo == "2")
- {
- row.Cells["XZ"].Activation = Activation.ActivateOnly;
- row.ParentRow.Cells["PRDCR_DESC"].Activation = Activation.ActivateOnly;
- }
- row.Cells["PRDCR_PRC_FL"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_PRC_DESC"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_ADVC_DAY"].Activation = Activation.ActivateOnly;
- row.Cells["PDEPT_NO"].Activation = Activation.ActivateOnly;
- row.Cells["PDEPT_NAME"].Activation = Activation.ActivateOnly;
- row.Cells["PHONE"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN_PHONE"].Activation = Activation.ActivateOnly;
- row.Cells["PDEPT_NO2"].Activation = Activation.ActivateOnly;
- row.Cells["PDEPT_NAME2"].Activation = Activation.ActivateOnly;
- row.Cells["PHONE2"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN2"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN_PHONE2"].Activation = Activation.ActivateOnly;
- row.Cells["PDEPT_NO3"].Activation = Activation.ActivateOnly;
- row.Cells["PDEPT_NAME3"].Activation = Activation.ActivateOnly;
- row.Cells["PHONE3"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN3"].Activation = Activation.ActivateOnly;
- row.Cells["PRDCR_MAN_PHONE3"].Activation = Activation.ActivateOnly;
- row.Cells["MEMO"].Activation = Activation.ActivateOnly;
- }
- }
- else
- {
- if (this.CustomInfo == "2")
- {
- row.Cells["PRDCR_DESC"].Activation = Activation.ActivateOnly;
- }
- else
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() != "TRUE")
- {
- row.Cells["PRDCR_DESC"].Activation = Activation.ActivateOnly;
- }
- else
- {
- row.Cells["PRDCR_DESC"].Activation = Activation.AllowEdit;
- }
- }
- }
- }
- /// <summary>
- /// 获取监制状态
- /// </summary>
- /// <param name="orderNo"></param>
- /// <returns></returns>
- public string GetPrdcrStatus(string prdcrNo, string prdcrNoIndex)
- {
- string status = "";
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getPrdcrStatus", new object[] { prdcrNo, prdcrNoIndex }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- status = dt.Rows[0][0].ToString();
- }
- return status;
- }
- /// <summary>
- /// 获取监制编码下的所有状态
- /// </summary>
- /// <param name="prdcrNo"></param>
- /// <returns></returns>
- public List<string> GetPrdcrAllStatus(string prdcrNo)
- {
- List<string> status = new List<string>();
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getPrdcrAllStatus", new object[] { prdcrNo }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- status.Add(dt.Rows[i][0].ToString());
- }
- }
- return status;
- }
- /// <summary>
- /// 获取合同状态
- /// </summary>
- /// <param name="orderNo"></param>
- /// <returns></returns>
- public string GetOrderStatus(string orderNo)
- {
- string status = "";
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getOrderStatus", new object[] { orderNo }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- status = dt.Rows[0][0].ToString();
- }
- return status;
- }
- private void te_order_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- doQuery();
- }
- private void frmOrderProducer_Shown(object sender, EventArgs e)
- {
- if (this.CustomInfo.Equals("1"))
- {
- ultraLabel2.Text = "批量只是用于提报";
- }
- else
- {
- ultraLabel2.Visible = false;
- }
- }
- private DataTable MakeDataTable()
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("ORDER_NO", Type.GetType("System.String"));
- dt.Columns.Add("ORDER_SEQ", Type.GetType("System.String"));
- dt.Columns.Add("MSC_PLINE", Type.GetType("System.String"));
- dt.Columns.Add("MSC_PLINE_DESC", Type.GetType("System.String"));
- dt.Columns.Add("PRDCR_NO", Type.GetType("System.String"));
- dt.Columns.Add("PRDCR_INDEX", Type.GetType("System.String"));
- dt.Columns.Add("PSC_DESC", Type.GetType("System.String"));
- dt.Columns.Add("STD_NAME", Type.GetType("System.String"));
- dt.Columns.Add("STD_STYLE_DESC", Type.GetType("System.String"));
- dt.Columns.Add("PRODUCNAME", Type.GetType("System.String"));
- dt.Columns.Add("MODEL_DESC", Type.GetType("System.String"));
- dt.Columns.Add("FAIL_RSN", Type.GetType("System.String"));
- return dt;
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- try
- {
- if (ultraTabControl1.ActiveTab.Key == "0")
- {
- tabNum = "1";
- }
- else if (ultraTabControl1.ActiveTab.Key == "1")
- {
- tabNum = "2";
- ultraLabel2.Visible = false;
- dept_stuts.Checked = false;
- }
- SetToolMenuVisible(this.CustomInfo);
- }
- catch { }
- }
- /// <summary>
- /// 设置按钮的可见性
- /// </summary>
- /// <param name="p"></param>
- private void SetToolMenuVisible(string p)
- {
- if (toolMenu == null)
- return;
- if (p == "1") //监制维护
- {
- if (tabNum == "1")
- {
- if (toolMenu.Toolbars[0].Tools.Exists("doAdd"))
- toolMenu.Toolbars[0].Tools["doAdd"].InstanceProps.Visible = DefaultableBoolean.True;
- if (toolMenu.Toolbars[0].Tools.Exists("doFect"))
- toolMenu.Toolbars[0].Tools["doFect"].InstanceProps.Visible = DefaultableBoolean.True;
- if (toolMenu.Toolbars[0].Tools.Exists("Copy"))
- toolMenu.Toolbars[0].Tools["Copy"].InstanceProps.Visible = DefaultableBoolean.True;
- if (toolMenu.Toolbars[0].Tools.Exists("Paste"))
- toolMenu.Toolbars[0].Tools["Paste"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- else if (tabNum == "2")
- {
- if (toolMenu.Toolbars[0].Tools.Exists("doAdd"))
- toolMenu.Toolbars[0].Tools["doAdd"].InstanceProps.Visible = DefaultableBoolean.False;
- if (toolMenu.Toolbars[0].Tools.Exists("doFect"))
- toolMenu.Toolbars[0].Tools["doFect"].InstanceProps.Visible = DefaultableBoolean.False;
- if (toolMenu.Toolbars[0].Tools.Exists("Copy"))
- toolMenu.Toolbars[0].Tools["Copy"].InstanceProps.Visible = DefaultableBoolean.False;
- if (toolMenu.Toolbars[0].Tools.Exists("Paste"))
- toolMenu.Toolbars[0].Tools["Paste"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- }
- else if (p == "2") //监制审批
- {
- if (tabNum == "1")
- {
- if (toolMenu.Toolbars[0].Tools.Exists("doFeckBoss"))
- toolMenu.Toolbars[0].Tools["doFeckBoss"].InstanceProps.Visible = DefaultableBoolean.True;
- if (toolMenu.Toolbars[0].Tools.Exists("doFeckBack"))
- toolMenu.Toolbars[0].Tools["doFeckBack"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- else if (tabNum == "2")
- {
- if (toolMenu.Toolbars[0].Tools.Exists("doFeckBoss"))
- toolMenu.Toolbars[0].Tools["doFeckBoss"].InstanceProps.Visible = DefaultableBoolean.False;
- if (toolMenu.Toolbars[0].Tools.Exists("doFeckBack"))
- toolMenu.Toolbars[0].Tools["doFeckBack"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- }
- }
- private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
- {
- doQueryProducerViewer();
- }
- public void doQueryProducerViewer()
- {
- ultraGrid3.UpdateData();
- UltraGridRow ugr = ultraGrid3.ActiveRow;
- if (ugr == null)
- return;
- //查询合同监制从表
- string prdcrNo = ugr.Cells["PRDCR_NO"].Value.ToString();
- DataTable dt1 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getOrderLinePrdcr", new Object[] { prdcrNo }, this.ob);
- DataTable dt2 = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderProducer.getOrderLinePrdcrLst", new Object[] { prdcrNo }, this.ob);
- dataTable3.Clear();
- GridHelper.CopyDataToDatatable(ref dt1, ref this.dataTable2, true);
- GridHelper.CopyDataToDatatable(ref dt2, ref this.dataTable3, true);
- for (int i = 0; i < ultraGrid4.Rows.Count; i++)
- {
- for (int j = 0; j < ultraGrid4.Rows[i].ChildBands[0].Rows.Count; j++)
- {
- ultraGrid4.Rows[i].ChildBands[0].Rows[j].Cells["PDEPT_NO"].ValueList = vlistManageNo;
- ultraGrid4.Rows[i].ChildBands[0].Rows[j].Cells["PDEPT_NO2"].ValueList = vlistManageNo;
- ultraGrid4.Rows[i].ChildBands[0].Rows[j].Cells["PDEPT_NO3"].ValueList = vlistManageNo;
- ultraGrid4.Rows[i].ChildBands[0].Rows[j].Cells["PRDCR_PRC_DESC"].ValueList = vlistManageNo1;
- }
- }
- }
- private void txtPrdcrFile1_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (e.Button.Key == "DownLoad")//下载
- {
- frmOrderProducerinfo stu = new frmOrderProducerinfo();
- stu.oPbc = this.ob;
- stu.index = ultraGrid3.ActiveRow.Cells["ORDER_NO"].Text;
- stu.ShowDialog();
- }
- }
- }
- }
|