| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Qcm.model;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- /// <summary>
- /// 探伤要求
- /// </summary>
- public partial class FrmComMSCStdDetection : FrmBase
- {
- private bool isPasting = false;
- //全局变量 错误信息
- private string errMessage = "";
- //用于判断是否勾选
- //private int isSelect = 0;
- private string _dic = "";
- private bool _isEx = false;
- private string dic = "";
- public string Dic
- {
- get { return dic; }
- set { dic = value; }
- }
- private string msc = "";
- public string Msc
- {
- get { return msc; }
- set { msc = value; }
- }
- private string codeJg = "DefaultValue";
- public string CodeJg
- {
- get { return codeJg; }
- set { codeJg = value; }
- }
- private string stdCode = "";
- public string StdCode
- {
- get { return stdCode; }
- set { stdCode = value; }
- }
- //用于过滤内控适用标准集合
- private string stdCodesNk = "";
- public string StdCodesNk
- {
- get { return stdCodesNk; }
- set { stdCodesNk = value; }
- }
- private string stdStylesNk = "";
- public string StdStylesNk
- {
- get { return stdStylesNk; }
- set { stdStylesNk = value; }
- }
- //是否是内控维护界面
- private string isNkEdite = "0";
- public string IsNkEdite
- {
- get { return isNkEdite; }
- set { isNkEdite = value; }
- }
- private ArrayList steelCodes = new ArrayList();
- public ArrayList SteelCodes
- {
- get { return steelCodes; }
- set { steelCodes = value; }
- }
- private string produccodeNk = "";
- public string ProduccodeNk
- {
- get { return produccodeNk; }
- set { produccodeNk = value; }
- }
- private string steelcodeNk = "";
- public string SteelcodeNk
- {
- get { return steelcodeNk; }
- set { steelcodeNk = value; }
- }
- private string processCode = "";
- public string ProcessCode
- {
- get { return processCode; }
- set { processCode = value; }
- }
- private string modelCode = "";
- public string ModelCode
- {
- get { return modelCode; }
- set { modelCode = value; }
- }
- private string acceptBid = "";
- public string AcceptBid
- {
- get { return acceptBid; }
- set { acceptBid = value; }
- }
- private UltraComboEditor[] ultras = new UltraComboEditor[11];
- public FrmComMSCStdDetection()
- {
- IsLoadUserView = true;
- InitializeComponent();
- ExceptionHelper.RegistException();
- }
- public void PopupLoad(string customInfo, OpeBase ob)
- {
- this.CustomInfo = customInfo;
- this.ob = ob;
- FrmComMSCStdDetection_Load(null, null);
- }
- public void PopupRefresh()
- {
- UltraGridBand ugb = ultraGrid1.DisplayLayout.Bands[0];
- if (CustomInfo == "1")
- { //冶金规范码
- QcmBaseQuery.NitializeMSC(ultras[0], false, this.ob, msc);
- //QcmBaseCommon.InitDrop(ultras[0], "com.steering.pss.qcm.ComBaseQuery.getMsc", "MSC", "MSC", false, this.ob);
- ugb.Columns["MSC"].EditorComponent = ultras[0];
- ugb.Columns["MSC"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- }
- }
- /// <summary>
- /// 初始化下拉框
- /// </summary>
- private void InitDownList()
- {
- for (int i = 0; i < ultras.Length; i++)
- {
- ultras[i] = new UltraComboEditor();
- this.Controls.Add(ultras[i]);
- ultras[i].Visible = false;
- ultras[i].DropDownListWidth = -1;
- }
- //主表
- UltraGridBand ugb = ultraGrid1.DisplayLayout.Bands[0];
- //从表
- UltraGridBand ugbC = ultraGrid1.DisplayLayout.Bands[1];
- if (CustomInfo == "1")
- { //冶金规范码
- QcmBaseQuery.NitializeMSC(ultras[0], false, this.ob, msc);
- //QcmBaseCommon.InitDrop(ultras[0], "com.steering.pss.qcm.ComBaseQuery.getMsc", "MSC", "MSC", false, this.ob);
- ugb.Columns["MSC"].EditorComponent = ultras[0];
- ugb.Columns["MSC"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- }
- if (CustomInfo != "1")
- { //标准名称
- if (CustomInfo == "2")
- {
- QcmBaseCommon.InitDrop(ultras[1], "com.steering.pss.qcm.ComBaseQuery.geComBaseStdN", "STD_NAME", "STD_CODE", false, this.ob);
- InnerChange();
- }
- else if (CustomInfo == "3")
- QcmBaseCommon.InitDrop(ultras[1], "com.steering.pss.qcm.ComBaseQuery.geComBaseStdK", "STD_NAME", "STD_CODE", false, this.ob);
- else
- QcmBaseCommon.InitDrop(ultras[1], "com.steering.pss.qcm.ComBaseQuery.geComBaseStdS", "STD_NAME", "STD_CODE", false, this.ob);
- ugb.Columns["STD_CODE_NK"].EditorComponent = ultras[1];
- ugb.Columns["STD_CODE_NK"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- }
- //探伤位置
- QcmBaseCommon.InitDrop(ultras[2], "com.steering.pss.qcm.ComBaseQuery.geComBaseInfo4020", "BASENAME", "BASECODE", false, this.ob);
- ugbC.Columns["POSITION_CODE"].EditorComponent = ultras[2];
- ugbC.Columns["POSITION_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- //所有工序
- QcmBaseCommon.InitDrop(ultras[5], "com.steering.pss.qcm.ComBaseQuery.geComBaseProcessAll", "PROCESS_DESC", "PROCESS_CODE", true, this.ob);
- ugb.Columns["PROCESS_CODE"].EditorComponent = ultras[5];
- ugb.Columns["PROCESS_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- //检验项
- QcmBaseCommon.InitDrop(ultras[6], "com.steering.pss.qcm.ComBaseQuery.getComBasePhyD", "PHY_NAME", "PHY_CODE", true, this.ob);
- ugbC.Columns["PHY_CODE"].EditorComponent = ultras[6];
- ugbC.Columns["PHY_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- //刻槽位置
- QcmBaseCommon.InitDrop(ultras[7], "com.steering.pss.qcm.ComBaseQuery.geComBaseInfo4023", "BASENAME", "BASENAME", false, this.ob);
- ugbC.Columns["GROOVE_POS"].EditorComponent = ultras[7];
- ugbC.Columns["GROOVE_POS"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- //刻槽方向
- QcmBaseCommon.InitDrop(ultras[8], "com.steering.pss.qcm.ComBaseQuery.geComBaseInfo4024", "BASENAME", "BASENAME", false, this.ob);
- ugbC.Columns["GROOVE_DIR"].EditorComponent = ultras[8];
- ugbC.Columns["GROOVE_DIR"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- //检验频次
- QcmBaseCommon.InitDrop(ultras[9], "com.steering.pss.qcm.ComBaseQuery.geComBaseInfo4011", "BASENAME", "BASECODE", false, this.ob);
- ugbC.Columns["DESC_RATE"].EditorComponent = ultras[9];
- ugbC.Columns["DESC_RATE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- QcmBaseQuery.NitializeProductBigType(ultras[10], false, ob);
- QcmBaseQuery.BindColumn(ultras[10], "PRODUC_HEAD", ugb);
- ClsBaseInfo.SetComboItemHeight(ultras[10]);
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Delete":
- DoUpdateOrResume(true);
- break;
- case "Resume":
- DoUpdateOrResume(false);
- break;
- case "Save":
- DoSave();
- break;
- case "Copy":
- Copy();
- break;
- case "Paste":
- isPasting = true;
- try
- {
- Paste();
- }
- finally
- {
- isPasting = false;
- }
- break;
- case "Refresh":
- InitDownList();
- break;
- case "Group":
- DoGroup();
- break;
- case "Cancel":
- CancelGroup();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 复制
- /// </summary>
- private void Copy()
- {
- if (ultraGrid1.ActiveRow == null)
- {
- MessageUtil.ShowWarning("请选择记录后,再进行操作!");
- return;
- }
- ultraGrid1.UpdateData();
- DataTable copyTab = dataTable2.Copy();
- DataTable copyTab2 = dataTable1.Copy();
- copyTab.Clear();
- copyTab2.Clear();
- if (ultraGrid1.ActiveRow.HasParent())
- {
- foreach (UltraGridRow row in ultraGrid1.ActiveRow.ParentRow.ChildBands[0].Rows)
- {
- if (row.GetValue("CHC") != "True") continue;
- DataRow dr = copyTab.NewRow();
- CopyRowToRow(((DataRowView)row.ListObject).Row, dr);
- copyTab.Rows.Add(dr);
- }
- }
- else
- {
- foreach (UltraGridRow row in ultraGrid1.ActiveRow.ChildBands[0].Rows)
- {
- DataRow dr = copyTab.NewRow();
- CopyRowToRow(((DataRowView)row.ListObject).Row, dr);
- copyTab.Rows.Add(dr);
- }
- DataRow dr2 = copyTab2.NewRow();
- CopyRowToRow(((DataRowView)ultraGrid1.ActiveRow.ListObject).Row, dr2);
- copyTab2.Rows.Add(dr2);
- }
- DataTable[] copyTabs = new DataTable[] { copyTab, copyTab2 };
- Clipboard.SetData("Dic", copyTabs);
- }
- 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 Paste()
- {
- DataTable[] copyTabs = (DataTable[])Clipboard.GetData("Dic");
- if (copyTabs == null)
- {
- MessageUtil.ShowWarning("没有数据,请复制后再进行操作!");
- return;
- }
- DataTable copyTab = copyTabs[0];
- DataTable copyTab2 = copyTabs[1];
- if (copyTab == null || copyTab.Rows.Count == 0)
- {
- MessageUtil.ShowWarning("没有数据,请复制后再进行操作!");
- return;
- }
- dataTable2.BeginInit();
- string dic = "";
- UltraGridRow rowParent;
- if (ultraGrid1.ActiveRow.HasParent())
- {
- //if (ultraGrid1.ActiveRow.ParentRow.ChildBands[0].Rows.Count > 0)
- //{
- // MessageUtil.ShowWarning("该记录下存在子记录,不能进行粘贴操作!");
- // return;
- //}
- dic = ultraGrid1.ActiveRow.ParentRow.GetValue("DIC");
- rowParent = ultraGrid1.ActiveRow.ParentRow;
- }
- else
- {
- //if (ultraGrid1.ActiveRow.ChildBands[0].Rows.Count > 0)
- //{
- // MessageUtil.ShowWarning("该记录下存在子记录,不能进行粘贴操作!");
- // return;
- //}
- dic = ultraGrid1.GetActiveRowValue("DIC");
- rowParent = ultraGrid1.ActiveRow;
- }
- List<string> notCopyColumns = new List<string>();
- notCopyColumns.AddRange("CHC", "CREATE_TIME", "CREATE_NAME", "UPDATE_TIME", "UPDATE_NAME",
- "DELETE_TIME", "DELETE_NAME", "VALIDFLAG", "DIC", "MSC", "PSC_DESC", "PSC", "STD_CODE_NK", "STD_NAME_NK",
- "STDSTYLE", "STD_NAME", "PRODUCNAME", "STEELNAME", "PROCESS_CODE", "STD_STYLE_DESC",
- "PRODUCCODE_NK", "PRODUCNAME_NK", "PROCESS_CODE", "PROCESS_DESC", "STEELCODE_NK", "STEELNAME_NK");
- if (copyTab2.Rows.Count > 0)
- {
- DataRow drParent = ((DataRowView)rowParent.ListObject).Row;
- foreach (DataColumn column in dataTable1.Columns)
- {
- string columnName = column.ColumnName;
- if (notCopyColumns.Contains(columnName) == true) continue;
- drParent[columnName] = copyTab2.Rows[0][columnName];
- }
- }
- foreach (DataRow row in copyTab.Rows)
- {
- DataRow tempRow = dataTable2.NewRow();
- foreach (DataColumn column in dataTable2.Columns)
- {
- string columnName = column.ColumnName;
- if (notCopyColumns.Contains(columnName) == true) continue;
- tempRow[columnName] = row[columnName];
- }
- tempRow["DIC"] = dic;
- dataTable2.Rows.Add(tempRow);
- }
- dataTable2.EndInit();
- if (copyTab.Rows.Count > 0 && ultraGrid1.ActiveRow != null)
- {
- ultraGrid1.ActiveRow.ExpandAll();
- }
- ultraGrid1.UpdateData();
- }
- /// <summary>
- /// 根据交付标准、内控标准和Alpha分别隐藏不同的列
- /// </summary>
- private void HideColumn()
- {
- if (CustomInfo == "1")//交付标准
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE_NK"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["PROCESS_DESC"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["STEELNAME_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["MODEL_DESC_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["PRODUCCODE_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["PRODUCNAME_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_NAME_S_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_STYLE_DESC_S_NK"].Hidden = true;
- }
- if (CustomInfo == "2" || CustomInfo == "4")//内控
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["MSC"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["PSC_DESC"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["STD_NAME"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["STEELNAME"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["STD_STYLE_DESC"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["PRODUCNAME"].Hidden = true;
- if (CustomInfo == "2")
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE_NK"].Header.Caption = "内控管理编号";
- }
- ultraCheckMSC.Visible = false;
- ultraTextMSC.Visible = false;
- }
- if (CustomInfo == "3")//试验标准
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["PROCESS_CODE"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["MSC"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["PSC_DESC"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["STD_NAME"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["STEELNAME"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["STD_STYLE_DESC"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["PRODUCNAME"].Hidden = true;
- ultraCheckMSC.Visible = false;
- ultraTextMSC.Visible = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["PROCESS_DESC"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["STEELNAME_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["MODEL_DESC_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["PRODUCCODE_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["PRODUCNAME_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_NAME_S_NK"].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_STYLE_DESC_S_NK"].Hidden = true;
- }
- }
- /// <summary>
- /// 查询条件
- /// </summary>
- /// <returns></returns>
- private ArrayList QueryCondition()
- {
- ArrayList conditionList = new ArrayList();
- //标准名称
- string stdName = "";
- if (ultraCheckStd.Checked)
- stdName = ultraTextStd.Text.Trim();
- conditionList.Add(stdName);
- //产品规范描述
- string pscDesc = "";
- if (CustomInfo == "1")
- {
- if (ultraCheckMSC.Checked)
- pscDesc = ultraTextMSC.Text.Trim();
- }
- conditionList.Add(pscDesc);
- //包含无效
- string valid = "1";
- if (ultraCheckValid.Checked)
- valid = "0";
- conditionList.Add(valid);
- conditionList.Add(stdCode);
- return conditionList;
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void DoQuery()
- {
- ArrayList condition = QueryCondition();
- //主表查询
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getCoreDetection",
- new Object[] { condition, CustomInfo, dic, msc, codeJg, produccodeNk,
- steelcodeNk, stdCodesNk, stdStylesNk, isNkEdite, processCode, modelCode}, this.ob);
- dataTable2.Clear();
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- //从表查询
- //包含无效
- string valid = "1";
- if (ultraCheckValid.Checked)
- valid = "0";
- DataTable dt1 = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getCoreDetectionC",
- new Object[] { CustomInfo, valid, stdCode, msc, codeJg, produccodeNk, steelcodeNk, processCode, modelCode }, this.ob);
- dt1 = QcmBaseCommon.FilterTable(dt, dt1, "DIC");
- GridHelper.CopyDataToDatatable(ref dt1, ref this.dataTable2, true);
- UltraGridColumn[] col = new UltraGridColumn[] { this.ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"], this.ultraGrid1.DisplayLayout.Bands[0].Columns["MSC"],
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["PSC_DESC"],this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE_NK"],
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["MODEL_DESC"]};
- //GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1, col);
- QcmBaseCommon.SetGridColor(ultraGrid1, "VALIDFLAG", "无效");
- QcmBaseCommon.SetUltraGridNoEdit(ultraGrid1);
- //isSelect = 0;
- //展开或者定位
- UltraGridRow[] rows1 = GridHelper.GetRowsWithKey(ultraGrid1, new string[] { "DIC" }, new string[] { _dic });
- if (rows1.Length > 0)
- {
- rows1[0].Activate();
- if (_isEx)
- rows1[0].ExpandAll();
- }
- _isEx = false;
- _dic = "";
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- ugr.Cells["CHKNK"].Value = "选择";
- }
- dataTable1.AcceptChanges();
- dataTable2.AcceptChanges();
- //清空复制数据
- //_copyedRows.Clear();
- }
- public void QueryPurchaseAgreement(string stdCodeNk)
- {
- dataTable2.Clear();
- dataTable1.Clear();
- DataTable dtP = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getPurchaseAgreementDic",
- new object[] { stdCodeNk }, ob);
- GridHelper.CopyDataToDatatable(ref dtP, ref this.dataTable1, true);
- DataTable dtC = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getPurchaseAgreementDetec",
- new object[] { stdCodeNk }, ob);
- GridHelper.CopyDataToDatatable(ref dtC, ref this.dataTable2, true);
- QcmBaseCommon.SetGridColor(ultraGrid1, "VALIDFLAG", "无效");
- QcmBaseCommon.SetUltraGridNoEdit(ultraGrid1);
- }
- private int GetGridSelectCount()
- {
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.Cells["CHC"].Value.ToString() == "True")
- {
- return 1;
- }
- UltraGridRow[] rows = GridHelper.GetRowsWithKey(row.ChildBands[0],
- new string[] { "CHC" }, new string[] { "True" });
- if (rows.Length > 0)
- {
- return 1;
- }
- }
- return 0;
- }
- private DataRow GetComBaseStdRowByPk(string stdCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComStandard.getComBaseStdByPk",
- new object[] { stdCode }, ob);
- return dt.Rows[0];
- }
- /// <summary>
- /// 保存
- /// </summary>
- private void DoSave()
- {
- ultraGrid1.UpdateData();
- DataRow comBaseStdRow = null;
- string style = "G";
- if (CustomInfo == "2") //内控的编码特殊处理
- {
- comBaseStdRow = GetComBaseStdRowByPk(stdCode);
- if (comBaseStdRow["ACCEPT_BID"].ToString() == "1")
- {
- style = "N";
- }
- else
- {
- style = "L";
- }
- }
- if (CustomInfo == "3")
- style = "K";
- if (CustomInfo == "4")
- style = "S";
- if (GetGridSelectCount() == 0)
- {
- MessageBox.Show("请选择记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (CustomInfo == "2")
- {
- if (comBaseStdRow["ACCEPT_BID"].ToString() == "1" && comBaseStdRow["UNIT_CODE"].ToString() != UserInfo.GetDeptid()
- && UserInfo.GetUserID() != "admin" && UserInfo.GetUserID() != "longjinhua")
- {
- MessageUtil.ShowWarning("该记录只有[" + comBaseStdRow["UNIT_DESC"].ToString() + "]的成员才能操作!");
- return;
- }
- }
- ArrayList baseList = new ArrayList();
- ArrayList childList = new ArrayList();
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- UltraGridRow ugr = ultraGrid1.Rows[i];
- DataRow rowDic = null;
- //主表行
- if (Convert.ToBoolean(ugr.Cells["CHC"].Value))
- {
- if (ugr.GetValue("VALIDFLAG") != "")
- {
- rowDic = GetMscDicByDic(ugr.GetValue("DIC"));
- }
- if (comBaseStdRow != null && comBaseStdRow["ACCEPT_BID"].ToString() == "0" && rowDic != null)
- {
- string[] units = ClsBaseInfo.GetUnitByUserName(rowDic["CREATE_NAME"].ToString(), ob, "002001007", "002001001", "002023005");
- if (units[0] != UserInfo.GetDeptid() && UserInfo.GetUserID() != "admin")
- {
- MessageUtil.ShowWarning("该记录只有[" + units[1] + "]才能操作!");
- ugr.Activate();
- return;
- }
- }
- DectionObject comM = GetBaseData(ugr, rowDic);
- if (comM == null)
- {
- MessageBox.Show(errMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- baseList.Add(JSONFormat.Format(comM));
- _dic = comM.Dic;
- }
- //从表行
- if (ugr.HasChild())
- {
- if (ugr.Cells["VALIDFLAG"].Value.ToString().Equals("") && !Convert.ToBoolean(ugr.Cells["CHC"].Value))
- {
- MessageBox.Show("请选择主记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- for (int j = 0; j < ugr.ChildBands[0].Rows.Count; j++)
- {
- UltraGridRow ugrChild = ugr.ChildBands[0].Rows[j];
- if (Convert.ToBoolean(ugrChild.Cells["CHC"].Value))
- {
- if (ugr.GetValue("VALIDFLAG") != "")
- {
- rowDic = GetMscDicByDic(ugr.GetValue("DIC"));
- }
- if (comBaseStdRow != null && comBaseStdRow["ACCEPT_BID"].ToString() == "0" && rowDic != null)
- {
- string[] units = ClsBaseInfo.GetUnitByUserName(rowDic["CREATE_NAME"].ToString(), ob, "002001007", "002001001", "002023005");
- if (units[0] != UserInfo.GetDeptid() && UserInfo.GetUserID() != "admin")
- {
- MessageUtil.ShowWarning("该记录只有[" + units[1] + "]才能操作!");
- ugrChild.Activate();
- return;
- }
- }
- DectionCObject comMC = GetChildData(ugrChild, rowDic);
- if (comMC == null)
- {
- MessageBox.Show(errMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- childList.Add(JSONFormat.Format(comMC));
- _dic = comMC.Dic;
- _isEx = true;
- }
- }
- }
- }
- if (MessageBox.Show("是否保存选择记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- if (baseList.Count > 0 || childList.Count > 0)
- {
- int count = ServerHelper.SetData("com.steering.pss.qcm.CoreDetection.saveCoreDetection",
- new Object[] { baseList, childList, style }, this.ob);
- if (count > 0)
- {
- MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- DoQuery();
- }
- }
- }
- private DataTable GetMscTabByMsc(string msc)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.getComMscByMsc",
- new object[] { msc }, ob);
- return dt;
- }
- private string GetMscByDic(string dic)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getComDicByDic",
- new object[] { dic }, ob);
- if (dt.Rows.Count > 0)
- {
- return dt.Rows[0]["MSC"].ToString();
- }
- return "";
- }
- /// <summary>
- /// 通过主键查询探伤主表
- /// </summary>
- /// <returns></returns>
- private DataRow GetMscDicByDic(string dic)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getComDicByDic",
- new object[] { dic }, ob);
- if (dt.Rows.Count == 0)
- {
- return null;
- }
- else
- {
- return dt.Rows[0];
- }
- }
- private bool CheckAuthority(UltraGridRow row)
- {
- if (CustomInfo == "1")
- {
- string mscOld;
- if (row.GetValue("VALIDFLAG") != "")
- {
- mscOld = GetMscByDic(row.GetValue("DIC"));
- }
- else
- {
- mscOld = row.HasParent() ? row.ParentRow.GetValue("MSC") : row.GetValue("MSC");
- }
- DataTable dtMsc = GetMscTabByMsc(mscOld);
- //if (dtMsc.Rows[0]["UNIT_CODE"].ToString() != UserInfo.GetDeptid() && UserInfo.GetUserID() != "admin")
- //{
- // errMessage = "该条记录对应的冶金规范是[" + dtMsc.Rows[0]["UNIT_DESC"].ToString() + "]科室维护的,您没有权限!";
- // row.Activate();
- // return false;
- //}
- }
- return true;
- }
- /// <summary>
- /// 主表操作项
- /// </summary>
- /// <returns></returns>
- private DectionObject GetBaseData(UltraGridRow ugr, DataRow rowDic)
- {
- DectionObject comM = new DectionObject();
- string dic = ugr.Cells["DIC"].Value.ToString().Trim();
- string psc = ugr.Cells["PSC"].Value.ToString().Trim();
- string msc = ugr.Cells["MSC"].Value.ToString().Trim();
- if (psc.Equals("") && CustomInfo == "1")
- {
- errMessage = "请选择冶金规范码";
- return null;
- }
- if (CheckAuthority(ugr) == false) return null;
- string stdStyle = ugr.Cells["STDSTYLE"].Value.ToString().Trim();
- if (stdStyle.Equals("内控"))
- stdStyle = "N";
- else if (stdStyle.Equals("订货标准"))
- stdStyle = "G";
- else if (stdStyle.Equals("协议标准"))
- stdStyle = "X";
- else if (stdStyle.Equals("Alpha"))
- stdStyle = "K";
- else if (stdStyle.Equals("试验标准"))
- stdStyle = "S";
- else if (stdStyle.Equals("成分偏差标准"))
- stdStyle = "P";
- else
- stdStyle = "";
- string process_code = ugr.Cells["PROCESS_CODE"].Value.ToString().Trim();
- string process_desc = ugr.Cells["PROCESS_DESC"].Value.ToString().Trim();
- string std_code_nk = ugr.Cells["STD_CODE_NK"].Value.ToString().Trim();
- string std_name_nk = ugr.Cells["STD_NAME_NK"].Value.ToString().Trim();
- if (CustomInfo != "1" && std_name_nk.Equals(""))
- {
- errMessage = "请选择内控标准";
- return null;
- }
- string model_code = ugr.Cells["MODEL_CODE"].Value.ToString().Trim();
- string model_desc = ugr.Cells["MODEL_DESC"].Value.ToString().Trim();
- string create_name = UserInfo.GetUserName();
- string create_time = ugr.Cells["CREATE_TIME"].Value.ToString().Trim();
- string update_name = UserInfo.GetUserName();
- string update_time = ugr.Cells["UPDATE_TIME"].Value.ToString().Trim();
- string delete_name = UserInfo.GetUserName();
- string delete_time = ugr.Cells["DELETE_TIME"].Value.ToString().Trim();
- string validflag = ugr.Cells["VALIDFLAG"].Value.ToString().Trim();
- if (rowDic != null && (rowDic["VALIDFLAG"].ToString() == "2" || rowDic["VALIDFLAG"].ToString() == "3"))
- {
- errMessage = "提交审核或已审核记录不能保存";
- return null;
- }
- //if (CustomInfo == "2" && ugr.GetValue("PRODUCCODE_NK") == "")
- //{
- // errMessage = "请选择品名!";
- // return null;
- //}
- string memo = ugr.Cells["MEMO"].Value.ToString().Trim();
- comM.Dic = dic;
- comM.Psc = psc;
- comM.Msc = msc;
- comM.StdStyle = stdStyle;
- comM.ProcessCode = process_code;
- comM.ProcessDesc = process_desc;
- comM.StdCodeNk = std_code_nk;
- comM.StdNameNk = std_name_nk;
- comM.ModelCode = model_code;
- comM.ModelDesc = model_desc;
- comM.CreateName = create_name;
- comM.CreateTime = create_time;
- comM.UpdateName = update_name;
- comM.UpdateTime = update_time;
- comM.DeleteName = delete_name;
- comM.DeleteTime = delete_time;
- comM.Memo = memo;
- comM.ProducHead = ugr.GetValue("PRODUC_HEAD");
- comM.CodeJg = codeJg == "DefaultValue" ? "" : codeJg;
- comM.Validflag = validflag;
- comM.SteelcodeNk = ugr.GetValue("STEELCODE_NK");
- comM.SteelnameNk = ugr.GetValue("STEELNAME_NK");
- comM.ModelCodeNk = ugr.GetValue("MODEL_CODE_NK");
- comM.ModelDescNk = ugr.GetValue("MODEL_DESC_NK");
- comM.ProduccodeNk = ugr.GetValue("PRODUCCODE_NK");
- comM.ProducnameNk = ugr.GetValue("PRODUCNAME_NK");
- comM.StdCodeSNk = ugr.GetValue("STD_CODE_S_NK");
- comM.StdNameSNk = ugr.GetValue("STD_NAME_S_NK");
- comM.StdStyleSNk = ugr.GetValue("STD_STYLE_S_NK");
- comM.StdStyleDescSNk = ugr.GetValue("STD_STYLE_DESC_S_NK");
- return comM;
- }
- /// <summary>
- /// 从表操作项
- /// </summary>
- /// <param name="ugr"></param>
- /// <returns></returns>
- private DectionCObject GetChildData(UltraGridRow ugr, DataRow rowDic)
- {
- if (CheckAuthority(ugr) == false) return null;
- if (rowDic != null && (rowDic["VALIDFLAG"].ToString() == "2" || rowDic["VALIDFLAG"].ToString() == "2"))
- {
- errMessage = "主记录为提交审核或已审核状态时,无法修改";
- return null;
- }
- string dic = ugr.Cells["DIC"].Value.ToString().Trim();
- string xh = ugr.Cells["XH"].Value.ToString().Trim();
- string phy_code = ugr.Cells["PHY_CODE"].Value.ToString().Trim();
- string phy_name = ugr.Cells["PHY_CODE"].Text;
- string rate = ugr.Cells["RATE"].Value.ToString().Trim();
- string rate_desc = ugr.Cells["DESC_RATE"].Text.Trim();
- string rateval = ugr.Cells["DESC_VAL"].Value.ToString().Trim();
- string position_code = ugr.Cells["POSITION_CODE"].Value.ToString().Trim();
- string position_desc = ugr.Cells["POSITION_CODE"].Text;
- string std_desc = ugr.Cells["STD_CODE"].Value.ToString().Trim();
- string lv_code = ugr.Cells["LV_CODE"].Value.ToString().Trim();
- string lv_desc = ugr.Cells["LV_DESC"].Value.ToString().Trim();
- string coverage = ugr.Cells["COVERAGE"].Value.ToString();
- string groove_pos = ugr.Cells["GROOVE_POS"].Value.ToString().Trim();
- string groove_dir = ugr.Cells["GROOVE_DIR"].Value.ToString().Trim();
- string create_name = UserInfo.GetUserName();
- string create_time = ugr.Cells["CREATE_TIME"].Value.ToString().Trim();
- string update_name = UserInfo.GetUserName();
- string update_time = ugr.Cells["UPDATE_TIME"].Value.ToString().Trim();
- string delete_name = UserInfo.GetUserName();
- string delete_time = ugr.Cells["DELETE_TIME"].Value.ToString().Trim();
- string validflag = ugr.Cells["VALIDFLAG"].Value.ToString().Trim();
- string minD = ugr.GetValue("MIN_D").Trim();
- string maxD = ugr.GetValue("MAX_D").Trim();
- string minH = ugr.GetValue("MIN_H").Trim();
- string maxH = ugr.GetValue("MAX_H").Trim();
- string memo = ugr.Cells["MEMO"].Text.Trim();
- if (phy_name.Equals(""))
- {
- errMessage = "请选择材质检验项";
- return null;
- }
- if (rate_desc == "")
- {
- errMessage = "请选择检验频次!";
- return null;
- }
- else
- {
- if (rate_desc == "按比例")
- {
- if (rateval == "")
- {
- errMessage = "请输入频率值!";
- return null;
- }
- if (!StringUtil.IsNumber(rateval))
- {
- errMessage = "频率值:请输入数字!";
- return null;
- }
- if (Convert.ToDouble(rateval) <= 0 || Convert.ToDouble(rateval) > 100)
- {
- errMessage = "频率值:请输入大于0小于等于100的数字";
- return null;
- }
- }
- }
- if (position_desc.Equals(""))
- {
- errMessage = "请选择探伤位置";
- return null;
- }
- if (std_desc.Equals(""))
- {
- errMessage = "请选择探伤参考标准";
- return null;
- }
- if (lv_desc.Equals(""))
- {
- errMessage = "请选择探伤级别";
- return null;
- }
- if (coverage != "" && (!StringUtil.IsNumber(coverage) || Convert.ToDouble(coverage) > 150 || Convert.ToDouble(coverage) < 0))
- {
- errMessage = "请输入探伤覆盖率:0~150";
- return null;
- }
- if (!coverage.Equals("") && coverage.StartsWith("."))
- coverage = "0" + coverage;
- if (groove_pos.Equals(""))
- {
- errMessage = "请选择刻槽位置";
- return null;
- }
- if (minD != "" || maxD != "")
- {
- if (minD == "")
- {
- errMessage = "请输入适用规格-外径下限!";
- ugr.SetCellActive("MIN_D");
- return null;
- }
- else if (minD.TryParseDouble() == false)
- {
- errMessage = "适用规格-外径下限:请输入数字";
- ugr.SetCellActive("MIN_D");
- return null;
- }
- if (maxD == "")
- {
- errMessage = "请输入适用规格-外径上限!";
- ugr.SetCellActive("MAX_D");
- return null;
- }
- else if (maxD.TryParseDouble() == false)
- {
- errMessage = "适用规格-外径上限:请输入数字";
- ugr.SetCellActive("MAX_D");
- return null;
- }
- }
- if (minH != "" || maxH != "")
- {
- if (minH == "")
- {
- errMessage = "请输入适用规格-壁厚下限!";
- ugr.SetCellActive("MIN_H");
- return null;
- }
- else if (minH.TryParseDouble() == false)
- {
- errMessage = "适用规格-壁厚下限:请输入数字";
- ugr.SetCellActive("MIN_H");
- return null;
- }
- if (maxH == "")
- {
- errMessage = "请输入适用规格-壁厚上限!";
- ugr.SetCellActive("MAX_H");
- return null;
- }
- else if (maxH.TryParseDouble() == false)
- {
- errMessage = "适用规格-壁厚上限:请输入数字";
- ugr.SetCellActive("MAX_H");
- return null;
- }
- }
- DectionCObject comMC = new DectionCObject();
- comMC.Dic = dic;
- comMC.Xh = xh;
- comMC.PhyCode = phy_code;
- comMC.PhyName = phy_name;
- comMC.PositionCode = position_code;
- comMC.PositionDesc = position_desc;
- comMC.StdDesc = std_desc;
- comMC.LvCode = lv_code;
- comMC.LvDesc = lv_desc;
- comMC.Coverage = coverage;
- comMC.GroovePos = groove_pos;
- comMC.GrooveDir = groove_dir;
- comMC.CreateName = create_name;
- comMC.CreateTime = create_time;
- comMC.UpdateName = update_name;
- comMC.DeleteName = delete_name;
- comMC.UpdateTime = update_time;
- comMC.DeleteTime = delete_time;
- comMC.Validflag = validflag;
- comMC.Memo = memo;
- comMC.Rate = rate;
- comMC.Ratedesc = rate_desc;
- comMC.Rateval = rateval;
- comMC.MinD = minD;
- comMC.MaxD = maxD;
- comMC.MinH = minH;
- comMC.MaxH = maxH;
- comMC.GroupSeq = ugr.GetValue("GROUP_SEQ");
- return comMC;
- }
- /// <summary>
- /// 删除或者恢复
- /// </summary>
- private void DoUpdateOrResume(Boolean flag)
- {
- ultraGrid1.UpdateData();
- if (GetGridSelectCount() == 0)
- {
- MessageBox.Show("请选择记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- DataRow comBaseStdRow = null;
- if (CustomInfo == "2")
- {
- comBaseStdRow = GetComBaseStdRowByPk(stdCode);
- if (comBaseStdRow["ACCEPT_BID"].ToString() == "1" && comBaseStdRow["UNIT_CODE"].ToString() != UserInfo.GetDeptid()
- && UserInfo.GetUserID() != "admin")
- {
- MessageUtil.ShowWarning("该记录只有[" + comBaseStdRow["UNIT_DESC"].ToString() + "]的成员才能" + (flag ? "作废" : "恢复") + "!");
- return;
- }
- }
- ultraGrid1.UpdateData();
- ArrayList baseList = new ArrayList();
- ArrayList childList = new ArrayList();
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- UltraGridRow ugr = ultraGrid1.Rows[i];
- if (Convert.ToBoolean(ugr.Cells["CHC"].Value))
- {
- DataRow rowDic = null;
- if (ugr.GetValue("VALIDFLAG") != "")
- {
- rowDic = GetMscDicByDic(ugr.GetValue("DIC"));
- }
- if (comBaseStdRow != null && comBaseStdRow["ACCEPT_BID"].ToString() == "0" && rowDic != null)
- {
- string[] units = ClsBaseInfo.GetUnitByUserName(rowDic["CREATE_NAME"].ToString(), ob, "002001007", "002001001", "002023005");
- if (units[0] != UserInfo.GetDeptid() && UserInfo.GetUserID() != "admin")
- {
- MessageUtil.ShowWarning("该记录只有[" + units[1] + "]才能操作!");
- ugr.Activate();
- return;
- }
- }
- if (CheckAuthority(ugr) == false)
- {
- MessageUtil.ShowWarning(errMessage);
- return;
- }
- DectionObject comM = new DectionObject();
- comM.DeleteName = UserInfo.GetUserName();
- comM.Dic = ugr.Cells["DIC"].Value.ToString();
- if (ugr.Cells["VALIDFLAG"].Value.Equals("无效") && flag)
- {
- MessageBox.Show("无效记录不能作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (flag && (ugr.Cells["VALIDFLAG"].Value.Equals("提交审核") || ugr.Cells["VALIDFLAG"].Value.Equals("已审核")))
- {
- MessageBox.Show("提交审核或已审核记录不能作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (ugr.Cells["VALIDFLAG"].Value.Equals("有效") && (!flag))
- {
- MessageBox.Show("有效记录不能恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (ugr.HasChild())
- {
- if (MessageBox.Show("对应子记录将全部作废!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- foreach (UltraGridRow ugrc in ugr.ChildBands[0].Rows)
- {
- //子记录全部删除
- DectionCObject comMC = new DectionCObject();
- comMC.DeleteName = UserInfo.GetUserName();
- comMC.Dic = ugrc.Cells["DIC"].Value.ToString();
- comMC.Xh = ugrc.Cells["XH"].Value.ToString();
- childList.Add(JSONFormat.Format(comMC));
- }
- }
- baseList.Add(JSONFormat.Format(comM));
- }
- if (ugr.HasChild())
- {
- for (int j = 0; j < ugr.ChildBands[0].Rows.Count; j++)
- {
- UltraGridRow ugrc = ugr.ChildBands[0].Rows[j];
- if (Convert.ToBoolean(ugrc.Cells["CHC"].Value))
- {
- DataRow rowDic = null;
- if (ugr.GetValue("VALIDFLAG") != "")
- {
- rowDic = GetMscDicByDic(ugr.GetValue("DIC"));
- }
- if (comBaseStdRow != null && comBaseStdRow["ACCEPT_BID"].ToString() == "0" && rowDic != null)
- {
- string[] units = ClsBaseInfo.GetUnitByUserName(rowDic["CREATE_NAME"].ToString(), ob, "002001007", "002001001", "002023005");
- if (units[0] != UserInfo.GetDeptid() && UserInfo.GetUserID() != "admin")
- {
- MessageUtil.ShowWarning("该记录只有[" + units[1] + "]才能操作!");
- ugrc.Activate();
- return;
- }
- }
- if (CheckAuthority(ugrc) == false)
- {
- MessageUtil.ShowWarning(errMessage);
- return;
- }
- if (!flag && ugrc.ParentRow.Cells["VALIDFLAG"].Value.Equals("无效") && !Convert.ToBoolean(ugrc.ParentRow.Cells["CHC"].Value))
- {
- MessageBox.Show("请选择主记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (ugrc.ParentRow.Cells["VALIDFLAG"].Value.ToString() != "录入状态"
- && ugrc.ParentRow.Cells["VALIDFLAG"].Value.ToString() != "无效"
- && ugr.Cells["VALIDFLAG"].Value.ToString() != "")
- {
- MessageUtil.ShowWarning("主记录为提交审核或已审核状态时,无法修改");
- return;
- }
- DectionCObject comMC = new DectionCObject();
- comMC.DeleteName = UserInfo.GetUserName();
- comMC.Dic = ugrc.Cells["DIC"].Value.ToString();
- comMC.Xh = ugrc.Cells["XH"].Value.ToString();
- if (ugrc.Cells["VALIDFLAG"].Value.Equals("无效") && flag)
- {
- MessageBox.Show("无效记录不能作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (ugrc.Cells["VALIDFLAG"].Value.Equals("有效") && !flag)
- {
- MessageBox.Show("有效记录不能恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- childList.Add(JSONFormat.Format(comMC));
- }
- }
- }
- }
- if (flag)
- {
- if (MessageBox.Show("作废选中记录,您是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- }
- else
- {
- if (MessageBox.Show("恢复选中记录,您是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- }
- if (baseList.Count > 0 || childList.Count > 0)
- {
- int count = ServerHelper.SetData("com.steering.pss.qcm.CoreDetection.deleteOrResume", new Object[] { baseList, childList, flag }, this.ob);
- if (count > 0)
- {
- DoQuery();
- if (flag)
- MessageBox.Show("作废成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- else
- MessageBox.Show("恢复成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- }
- private void FrmComMSCStdDetection_Load(object sender, EventArgs e)
- {
- HideColumn();
- InitDownList();
- ultraTextStd.Enabled = false;
- ultraTextMSC.Enabled = false;
- }
- /// <summary>
- /// 新增一行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowInsert(object sender, RowEventArgs e)
- {
- UltraGridRow ugr = ultraGrid1.DisplayLayout.ActiveRow;
- string style = "G";
- if (CustomInfo == "2")
- style = "N";
- if (CustomInfo == "3")
- style = "K";
- if (CustomInfo == "4")
- style = "S";
- if (!ugr.HasParent()) //主表自动填充主键(成分索引号)
- {
- string dic = "";
- int temp = 0;
- for (int i = 0; i < ultraGrid1.Rows.Count - 1; i++)
- {
- string str = ultraGrid1.Rows[i].Cells["DIC"].Value.ToString().Substring(4, 6);
- if (Convert.ToInt32(str) > temp)
- temp = Convert.ToInt32(str);
- }
- dic = "DIC" + style + string.Format("{0:000000}", temp + 1);
- ugr.Cells["DIC"].Value = dic;
- }
- //从表自动填充序号
- if (ugr.HasParent())
- {
- int index = 0;
- string cic = ugr.Cells["DIC"].Value.ToString();
- foreach (UltraGridRow ug in ultraGrid1.Rows)
- {
- if (ug.Cells["DIC"].Value.ToString().Equals(cic))
- {
- for (int i = 0; i < ug.ChildBands[0].Rows.Count - 1; i++)
- {
- int indexSeq = Convert.ToInt32(ug.ChildBands[0].Rows[i].Cells["XH"].Value.ToString());
- if (indexSeq > index)
- index = indexSeq;
- }
- }
- }
- ugr.Cells["XH"].Value = index + 1;
- ugr.Cells["DESC_VAL"].Activation = Activation.NoEdit;
- }
- //增加行如果没有勾选则不可编辑
- if (!Convert.ToBoolean(ugr.Cells["CHC"].Value))
- {
- for (int i = 0; i < ugr.Cells.Count; i++)
- {
- if (!ugr.Cells[i].Column.Key.Equals("CHC"))
- ugr.Cells[i].Activation = Activation.ActivateOnly;
- if (ugr.Cells[i].Column.Key.Equals("CHKNK"))
- ugr.Cells["CHKNK"].Value = "选择";
- }
- }
- e.Row.Update();
- }
- FrmComMSCStdDetection _frmComMSCStdDetection = null;
- /// <summary>
- /// 扣型选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key.Equals("MODEL_DESC") && Convert.ToBoolean(ultraGrid1.DisplayLayout.ActiveRow.Cells["CHC"].Value))
- {
- UltraGridRow row = this.ultraGrid1.DisplayLayout.ActiveRow;
- FrmModel frms = new FrmModel();
- frms.FrmOb = this.ob;
- frms.Desc = row.Cells["MODEL_DESC"].Value.ToString();
- frms.ShowDialog();
- row.Cells["MODEL_CODE"].Value = frms.Code;
- row.Cells["MODEL_DESC"].Value = frms.Desc;
- }
- if (e.Cell.Column.Key.Equals("CHKNK"))
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- _frmComMSCStdDetection = new FrmComMSCStdDetection();
- _frmComMSCStdDetection.PopupLoad("3", ob);
- //_frmComMSCStdDetection.UltraPanel1.Visible = false;
- _frmComMSCStdDetection.ultraToolbarsManager1.Visible = true;
- _frmComMSCStdDetection.Msc = msc;
- _frmComMSCStdDetection.CodeJg = "";
- _frmComMSCStdDetection.DoQuery1();
- if (_frmComMSCStdDetection.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- DataRow CurRow, NewRow;
- for (int i = 0; i < _frmComMSCStdDetection.dataTable2.Rows.Count; i++)
- {
- CurRow = _frmComMSCStdDetection.dataTable2.Rows[i];
- NewRow = dataTable2.NewRow();
- if (!_frmComMSCStdDetection.Ids.Contains(CurRow["DIC"].ToString2()))
- {
- continue;
- }
- for (int j = 0; j < _frmComMSCStdDetection.dataTable2.Columns.Count; j++)
- {
- try
- {
- if (dataTable2.Columns.Contains(_frmComMSCStdDetection.dataTable2.Columns[j].ColumnName))
- {
- if (_frmComMSCStdDetection.dataTable2.Columns[j].ColumnName == "DIC")
- {
- NewRow[_frmComMSCStdDetection.dataTable2.Columns[j].ColumnName] = ultraGrid1.ActiveRow.GetValue("DIC");
- }
- else
- {
- NewRow[_frmComMSCStdDetection.dataTable2.Columns[j].ColumnName] = CurRow[j];
- }
- }
- }
- catch { }
- }
- dataTable2.Rows.Add(NewRow);
- }
- ultraGrid1.UpdateData();
- ultraGrid1.ActiveRow.ExpandAll();
- }
- }
- }
- /// <summary>
- /// 单元格值变化事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid1.UpdateData();
- UltraGridRow ugr = ultraGrid1.DisplayLayout.ActiveRow;
- if (e.Cell.Column.Key.Equals("MSC"))//
- {
- string msc = ugr.Cells["MSC"].Value.ToString();
- DataRow[] dr = ((DataTable)ultras[0].DataSource).Select("MSC='" + msc + "'");
- if (dr.Length > 0)
- {
- ugr.Cells["PSC"].Value = dr[0][2];
- ugr.Cells["PSC_DESC"].Value = dr[0][3];
- ugr.Cells["PRODUCNAME"].Value = dr[0][4];
- ugr.Cells["STD_NAME"].Value = dr[0][5];
- ugr.Cells["STEELNAME"].Value = dr[0][6];
- ugr.Cells["STD_STYLE_DESC"].Value = dr[0][7];
- ugr.Cells["STDSTYLE"].Value = dr[0][8];
- }
- }
- //工序
- if (e.Cell.Column.Key.Equals("PROCESS_CODE"))
- {
- ugr.Cells["PROCESS_DESC"].Value = ugr.Cells["PROCESS_CODE"].Text.ToString();
- }
- //标准内控
- if (e.Cell.Column.Key.Equals("STD_CODE_NK"))
- {
- string stdCode = ugr.Cells["STD_CODE_NK"].Value.ToString();
- ugr.Cells["STD_NAME_NK"].Value = ugr.Cells["STD_CODE_NK"].Text.Trim();
- DataRow[] dr = ((DataTable)ultras[1].DataSource).Select("STD_CODE='" + stdCode + "'");
- if (dr.Length > 0)
- {
- ugr.Cells["STDSTYLE"].Value = dr[0][2];
- }
- }
- //检验项
- if (e.Cell.Column.Key.Equals("PHY_CODE"))
- {
- ugr.Cells["PHY_NAME"].Value = ugr.Cells["PHY_CODE"].Text.ToString();
- ugr.Cells["STD_DESC"].Value = "";
- ugr.Cells["STD_CODE"].Value = "";
- ugr.Cells["LV_DESC"].Value = "";
- ugr.Cells["LV_CODE"].Value = "";
- }
- //探伤位置
- if (e.Cell.Column.Key.Equals("POSITION_CODE"))
- {
- ugr.Cells["POSITION_DESC"].Value = ugr.Cells["POSITION_CODE"].Text.ToString();
- }
- //检验频次
- if (e.Cell.Column.Key.Equals("DESC_RATE"))
- {
- ugr.Cells["RATE"].Value = ugr.Cells["DESC_RATE"].Value.ToString();
- if (ugr.Cells["DESC_RATE"].Text.Trim() != "按比例")
- {
- ugr.Cells["DESC_VAL"].Activation = Activation.NoEdit;
- }
- else
- {
- ugr.Cells["DESC_VAL"].Activation = Activation.AllowEdit;
- }
- }
- //选择
- if (e.Cell.Column.Key.Equals("CHC"))
- {
- Activation activation = Activation.ActivateOnly;
- if (Convert.ToBoolean(e.Cell.Value))
- {
- activation = Activation.AllowEdit;
- //isSelect += 1;
- if (e.Cell.Row.HasParent())
- {
- if (e.Cell.Row.Cells["DESC_RATE"].Value.ToString() == "按比例")
- e.Cell.Row.Cells["DESC_VAL"].Activation = Activation.AllowEdit;
- else
- e.Cell.Row.Cells["DESC_VAL"].Activation = Activation.NoEdit;
- }
- }
- else
- {
- if (e.Cell.Row.HasParent())
- e.Cell.Row.Cells["DESC_VAL"].Activation = Activation.NoEdit;
- }
- //else
- // isSelect -= 1;
- CellsCollection cells = e.Cell.Row.Cells;
- for (int i = 0; i < cells.Count; i++)
- {
- if (!cells[i].Column.Key.Equals("CHC"))
- {
- if (!cells[i].Column.Key.Equals("DESC_VAL"))
- e.Cell.Row.Cells[i].Activation = activation;
- }
- }
- }
- }
- /// <summary>
- /// 标准名称
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraCheckStd_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckStd.Checked)
- ultraTextStd.Enabled = true;
- else
- ultraTextStd.Enabled = false;
- }
- private void ultraCheckMSC_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckMSC.Checked)
- ultraTextMSC.Enabled = true;
- else
- ultraTextMSC.Enabled = false;
- }
- private void DoGroup()
- {
- ArrayList list = new ArrayList();
- int ischeck = 0; //是否勾选
- int isselect = 0; //勾选项是否已写入数据库
- int isvalid = 0; //是否有效
- //是否有数据修改
- foreach (DataRow dr in dataTable2.Rows)
- {
- IQueryable<UltraGridRow> rows = ultraGrid1.Rows.AsQueryable().Where(a => ((DataRowView)a.ListObject).Row == dr
- && a.GetValue("CHK") == "True");
- if ((dr.RowState == DataRowState.Added || dr.RowState == DataRowState.Modified)
- && rows.Count() > 0)
- {
- MessageUtil.ShowWarning("理化标准有数据修改,请保存后再进行分组操作!");
- return;
- }
- }
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.HasChild() && row.Cells["CHC"].Value.ToString().ToUpper() == "TRUE")
- {
- MessageBox.Show("主表不能进行分组操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- ArrayList plist = new ArrayList(); //分为几组。
- Dictionary<int, DataTable> dicStation = new Dictionary<int, DataTable>();
- int i = 0;
- foreach (UltraGridRow crow in row.ChildBands[0].Rows)
- {
- ArrayList clist = new ArrayList(); //哪些分为一组。
- if (crow.Cells["CHC"].Value.ToString().ToUpper() == "TRUE")
- {
- if (crow.Cells["VALIDFLAG"].Value.ToString().Equals(""))
- {
- isselect += 1;
- }
- if (crow.Cells["VALIDFLAG"].Value.ToString().Equals("无效"))
- {
- isvalid += 1;
- }
- ischeck += 1;
- clist.Add(crow.Cells["DIC"].Value.ToString());
- clist.Add(crow.Cells["XH"].Value.ToString());
- plist.Add(clist);
- _dic = crow.Cells["DIC"].Value.ToString();
- _isEx = true;
- //验证是否同一工序点
- DataTable dtStation = GetStationByPhyCode(crow.GetValue("PHY_CODE"));
- dicStation.Add(i, dtStation);
- if (i != 0)
- {
- bool isSame = false;
- foreach (DataRow dr in dicStation[i].Rows)
- {
- for (int j = i - 1; j >= 0; j--)
- {
- if (dicStation[j].Rows.Count == 0 || dicStation[i].Rows.Count == 0)
- {
- isSame = true;
- }
- int cnt = dicStation[j].Select("PROCESS_CODE = '" + dr["PROCESS_CODE"] + "'").Length;
- if (cnt > 0)
- {
- isSame = true;
- }
- else
- {
- isSame = false;
- break;
- }
- }
- if (isSame)
- {
- break;
- }
- }
- if (isSame == false)
- {
- MessageUtil.ShowWarning("不能将工序不一样的检验项分组到一组中!");
- return;
- }
- }
- i++;
- }
- }
- list.Add(plist);
- }
- if (ischeck == 0)
- {
- MessageBox.Show("请选择你要分组的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (isselect > 0)
- {
- MessageBox.Show("您选择的分组记录中存在未保存的项,请先保存后再分组", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (isvalid > 0)
- {
- MessageBox.Show("您选择的分组记录中存在无效数据,无法分组", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("是否确认对所选项进行分组?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam(); //CoreClientParam是平台用来向服务端传递存放所有相关参数信息的。
- ccp.ServerName = "com.steering.pss.qcm.CoreDetection"; //服务名指的是服务端的包名+类名
- ccp.MethodName = "doGroup"; //方法名指的是服务名指定类里的方法
- ccp.ServerParams = new object[] { list };//服务端方法的参数
- //ExecuteNonQuery主要用来执行添加、修改、删除、存储过程的操作。
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- return;
- MessageBox.Show("分组成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- DoQuery();
- }
- private DataTable GetStationByPhyCode(string phyCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getStationByPhyCode",
- new object[] { phyCode }, ob);
- return dt;
- }
- private void CancelGroup()
- {
- int ischeck = 0; //是否勾选
- int isselect = 0; //勾选项是否已写入数据库
- int isvalid = 0; //是否有效
- int hasindex = 0;
- ArrayList plist = new ArrayList();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.HasChild() && row.Cells["CHC"].Value.ToString().ToUpper() == "TRUE")
- {
- MessageBox.Show("主表不能进行取消分组操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- foreach (UltraGridRow crow in row.ChildBands[0].Rows)
- {
- ArrayList clist = new ArrayList(); //需要取消的GIC和XH
- if (crow.Cells["CHC"].Value.ToString().ToUpper() == "TRUE")
- {
- if (crow.Cells["VALIDFLAG"].Value.ToString().Equals(""))
- {
- isselect += 1;
- }
- if (crow.Cells["VALIDFLAG"].Value.ToString().Equals("无效"))
- {
- isvalid += 1;
- }
- if (crow.Cells["GROUP_SEQ"].Value.ToString().Equals(""))
- {
- hasindex += 1;
- }
- ischeck += 1;
- clist.Add(crow.Cells["DIC"].Value.ToString());
- clist.Add(crow.Cells["XH"].Value.ToString());
- plist.Add(clist);
- _dic = crow.Cells["DIC"].Value.ToString();
- _isEx = true;
- }
- }
- }
- if (ischeck == 0)
- {
- MessageBox.Show("请选择你要取消分组的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (isselect > 0)
- {
- MessageBox.Show("您选择的记录中存在未保存的项,不能对其进行取消分组操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (isvalid > 0)
- {
- MessageBox.Show("您选择的记录中存在无效数据,无法取消分组", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (hasindex > 0)
- {
- MessageBox.Show("您选择的记录中存在未分组的数据,无法取消分组", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("是否确认对所选项进行取消分组?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- int count = ServerHelper.SetData("com.steering.pss.qcm.CoreDetection.cancleGroup", new Object[] { plist }, this.ob);
- if (count > 0)
- {
- MessageBox.Show("取消分组成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- DoQuery();
- }
- }
- private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- if (isPasting)
- {
- e.Row.SetValue("CHC", "True");
- }
- }
- /// <summary>
- /// 2015-07-15 PDY
- /// </summary>
- private void InnerChange()
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["PROCESS_CODE"].CellActivation = Activation.ActivateOnly;
- ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE_NK"].CellActivation = Activation.ActivateOnly;
- ultraGrid1.DisplayLayout.Bands[0].Columns["MODEL_DESC"].Hidden = true;
- }
- private void ultraTextEditor3_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (ultraGrid1.ActiveCell.Column.Key == "PROCESS_DESC")
- {
- string processCodes = ultraGrid1.ActiveRow.GetValue("PROCESS_CODE");
- ChoiceProcessPopup choiceProcessPopup = new ChoiceProcessPopup(processCodes, this.ob);
- if (choiceProcessPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComStandard.getProcessByStdCode",
- new object[] { this.stdCode }, ob);
- string stdProcessCodes = dt.Rows[0]["PROCESS_CODE"].ToString();
- string[] processCodesAry = choiceProcessPopup.ProcessCodes.Split(',');
- for (int i = 0; i < processCodesAry.Length; i++)
- {
- if (!stdProcessCodes.Contains(processCodesAry[i].Trim()))
- {
- DataTable dtBaseProcess = ServerHelper.GetData("com.steering.pss.qcm.ComStandard.getProcessDescByCode",
- new object[] { processCodesAry[i].Trim() }, ob);
- string processDesc = dtBaseProcess.Rows[0]["PROCESS_DESC"].ToString();
- MessageUtil.ShowWarning("该标准下不包含工序" + processDesc + ", 不能选择!");
- return;
- }
- }
- ultraGrid1.ActiveRow.SetValue("PROCESS_CODE", choiceProcessPopup.ProcessCodes);
- ultraGrid1.ActiveRow.SetValue("PROCESS_DESC", choiceProcessPopup.ProcessDescs);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "STEELNAME_NK")
- {
- FrmRepSteel frmSteel = new FrmRepSteel();
- frmSteel.Ob1 = this.ob;
- frmSteel.Code = ultraGrid1.ActiveRow.GetValue("STEELCODE_NK");
- if (frmSteel.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraGrid1.ActiveRow.SetValue("STEELCODE_NK", frmSteel.Code);
- ultraGrid1.ActiveRow.SetValue("STEELNAME_NK", frmSteel.Desc);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "MODEL_DESC_NK")
- {
- FrmModel frmModel = new FrmModel();
- frmModel.FrmOb = this.ob;
- frmModel.Code = ultraGrid1.ActiveRow.GetValue("MODEL_CODE_NK");
- frmModel.Desc = ultraGrid1.ActiveCell.Value.ToString();
- if (frmModel.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraGrid1.ActiveRow.SetValue("MODEL_CODE_NK", frmModel.Code);
- ultraGrid1.ActiveRow.SetValue("MODEL_DESC_NK", frmModel.Desc);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "PRODUCNAME_NK")
- {
- PopupProductName popupProductName = new PopupProductName(
- ultraGrid1.ActiveRow.GetValue("PRODUCCODE_NK"), ob);
- if (popupProductName.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraGrid1.ActiveRow.SetValue("PRODUCCODE_NK", popupProductName.ProductCodes);
- ultraGrid1.ActiveRow.SetValue("PRODUCNAME_NK", popupProductName.ProductNames);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "STD_NAME_S_NK")
- {
- string stdCodes = ultraGrid1.ActiveRow.GetValue("STD_CODE_S_NK");
- FrmStandardChoice standardChoice = new FrmStandardChoice(stdCodes, ob);
- if (standardChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraGrid1.ActiveRow.SetValue("STD_CODE_S_NK", standardChoice.StdCodes);
- ultraGrid1.ActiveRow.SetValue("STD_NAME_S_NK", standardChoice.StdNames);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "STD_STYLE_DESC_S_NK")
- {
- string stdStyles = ultraGrid1.ActiveRow.GetValue("STD_STYLE_S_NK");
- FrmStandardStyleChoice standardStyleChoice = new FrmStandardStyleChoice(stdStyles, ob);
- if (standardStyleChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraGrid1.ActiveRow.SetValue("STD_STYLE_S_NK", standardStyleChoice.StdStyles);
- ultraGrid1.ActiveRow.SetValue("STD_STYLE_DESC_S_NK", standardStyleChoice.StdStyleDescs);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "STD_DESC")
- {
- var row = ultraGrid1.ActiveRow;
- if (row.GetValue("PHY_CODE") == "")
- {
- MessageUtil.ShowWarning("请选择探伤项!");
- row.Cells["PHY_CODE"].Activate();
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.DAL.ComBaseDetectionRltDAL.QueryStdBaseInfo", new object[] { row.GetValue("PHY_CODE") }, ob);
- dt.Columns["STD_DESC"].Caption = "参考标准";
- BaseInfoPopup baseInfoPopup = new BaseInfoPopup(dt, "STD_DESC", "PHY_CODE", "PHY_NAME", "STD_CODE", "LV_CODE", "LV_DESC", "ID");
- baseInfoPopup.Text = "参考标准";
- baseInfoPopup.LabelTextBox1.Caption = "参考标准";
- baseInfoPopup.Shown += new EventHandler((c, d) =>
- {
- IQueryable<UltraGridRow> rows = baseInfoPopup.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("STD_CODE") == ultraGrid1.ActiveRow.GetValue("STD_CODE"));
- if (rows.Count() > 0)
- {
- rows.First().Activate();
- }
- });
- if (baseInfoPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraGrid1.ActiveRow.SetValue("STD_DESC", baseInfoPopup.ChoicedRow.GetValue("STD_DESC"));
- ultraGrid1.ActiveRow.SetValue("STD_CODE", baseInfoPopup.ChoicedRow.GetValue("STD_CODE"));
- ultraGrid1.ActiveRow.Cells["LV_DESC"].Value = "";
- ultraGrid1.ActiveRow.Cells["LV_CODE"].Value = "";
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "LV_DESC")
- {
- var row = ultraGrid1.ActiveRow;
- if (row.GetValue("STD_CODE") == "")
- {
- MessageUtil.ShowWarning("请选择参考标准!");
- row.Cells["STD_CODE"].Activate();
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.DAL.ComBaseDetectionRltDAL.QueryLvBaseInfo", new object[] { row.GetValue("STD_CODE") }, ob);
- dt.Columns["LV_DESC"].Caption = "探伤级别";
- BaseInfoPopup baseInfoPopup = new BaseInfoPopup(dt, "LV_DESC", "PHY_CODE", "PHY_NAME", "STD_DESC", "STD_CODE", "LV_CODE", "ID");
- baseInfoPopup.Text = "探伤级别";
- baseInfoPopup.LabelTextBox1.Caption = "探伤级别";
- baseInfoPopup.Shown += new EventHandler((c, d) =>
- {
- IQueryable<UltraGridRow> rows = baseInfoPopup.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("LV_CODE") == ultraGrid1.ActiveRow.GetValue("LV_CODE"));
- if (rows.Count() > 0)
- {
- rows.First().Activate();
- }
- });
- if (baseInfoPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraGrid1.ActiveRow.SetValue("LV_DESC", baseInfoPopup.ChoicedRow.GetValue("LV_DESC"));
- ultraGrid1.ActiveRow.SetValue("LV_CODE", baseInfoPopup.ChoicedRow.GetValue("LV_CODE"));
- }
- }
- ultraGrid1.UpdateData();
- }
- private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
- {
- ugr.Cells["CHC"].Value = true;
- Activation activation = Activation.ActivateOnly;
- if (Convert.ToBoolean(ugr.Cells["CHC"].Value))
- {
- activation = Activation.AllowEdit;
- //isSelect += 1;
- }
- //else
- //isSelect -= 1;
- CellsCollection cells = ugr.Cells;
- for (int i = 0; i < cells.Count; i++)
- {
- if (!cells[i].Column.Key.Equals("CHC"))
- {
- ugr.Cells[i].Activation = activation;
- }
- }
- }
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "查询":
- DoQuery1();
- break;
- case "确认选择":
- Choice();
- break;
- }
- }
- private DataRow[] rows;
- public DataRow[] Rows
- {
- get { return rows; }
- set { rows = value; }
- }
- List<string> ids;
- public List<string> Ids
- {
- get { return ids; }
- set { ids = value; }
- }
- private void DoQuery1()
- {
- //主表查询
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getComDetectionNK",
- new Object[] { msc }, this.ob);
- dataTable2.Clear();
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- //从表查询
- DataTable dt1 = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getComDetectionNKC",
- new Object[] { msc }, this.ob);
- dt1 = QcmBaseCommon.FilterTable(dt, dt1, "DIC");
- GridHelper.CopyDataToDatatable(ref dt1, ref this.dataTable2, true);
- UltraGridColumn[] col = new UltraGridColumn[] { this.ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"], this.ultraGrid1.DisplayLayout.Bands[0].Columns["MSC"],
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["PSC_DESC"],this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE_NK"],
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["MODEL_DESC"]};
- //GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1, col);
- QcmBaseCommon.SetGridColor(ultraGrid1, "VALIDFLAG", "无效");
- QcmBaseCommon.SetUltraGridNoEdit(ultraGrid1);
- //isSelect = 0;
- //展开或者定位
- UltraGridRow[] rows1 = GridHelper.GetRowsWithKey(ultraGrid1, new string[] { "DIC" }, new string[] { _dic });
- if (rows1.Length > 0)
- {
- rows1[0].Activate();
- if (_isEx)
- rows1[0].ExpandAll();
- }
- _isEx = false;
- _dic = "";
- dataTable1.AcceptChanges();
- dataTable2.AcceptChanges();
- //清空复制数据
- //_copyedRows.Clear();
- }
- private void Choice()
- {
- ultraGrid1.UpdateData();
- int count = ultraGrid1.Rows.Where(a => Convert.ToBoolean(a.GetValue("CHC"))).Count();
- if (count > 1)
- {
- MessageUtil.ShowTips("请选择一条数据!");
- return;
- }
- foreach (UltraGridRow ugr in ultraGrid1.Rows.Where(a => Convert.ToBoolean(a.GetValue("CHC"))))
- {
- //从表操作
- if (ugr.HasChild())
- {
- Ids = ugr.ChildBands[0].Rows.Select(p => p.GetValue("DIC")).ToList();
- Rows = dataTable2.Select("DIC IN ('" + string.Join("','", Ids) + "')");
- }
- }
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- }
|