| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.StlMes.Client.SaleOrder.BLL;
- using CoreFS.CA06;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Qcm;
- using Infragistics.Win.UltraWinGrid;
- using Infragistics.Win.UltraWinEditors;
- using Core.Mes.Client.Comm.Server;
- using CoreFS.SA06;
- using Infragistics.Win;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.StlMes.Client.SaleOrder.Dialog;
- using System.Reflection;
- namespace Core.StlMes.Client.SaleOrder.Control
- {
- public partial class CraftOrdFdPicCtrl : UserControl
- {
- private OpeBase _ob;
- private UltraComboEditor Pics = new UltraComboEditor();
- public CraftOrdFdPicCtrl(System.Windows.Forms.Control container, string designKey, string ordLnPk, OpeBase ob)
- {
- InitializeComponent();
- _ob = ob;
- this.designKey = designKey;
- this.ordLnPk = ordLnPk;
- container.Controls.Add(this);
- this.Dock = DockStyle.Fill;
- LoadBaseData();
- }
- private void LoadBaseData()
- {
- QcmBaseCommon.InitSignMin(ultraComSignMin);
- QcmBaseCommon.InitSignMax(ultraComSignMax);
- //初始化理化检验项大类
- ultraComPhyMax.DropDownListWidth = -1;
- QcmBaseQuery.NitializeDropDownBox(ultraComPhyMax, "com.steering.pss.qcm.ComBaseQuery.geComBasePhyRStd", "PHY_TYPE", "PHY_CODE", false, _ob);
- //初始化结箍名称
- QcmBaseQuery.NitializeJG(ultraComJG, true, _ob);
- //初始化限制规格
- QcmBaseCommon.InitDropUltraComEditor(ultraComSize, "com.steering.pss.qcm.ComBaseQuery.geComBaseInfo4003", "BASENAME", _ob, true);
- //交货标准
- QcmBaseCommon.InitDropUltraComEditor(ultraComboDelivery, "com.steering.pss.qcm.ComBaseQuery.geComBaseInfo4060", "BASENAME", _ob, true);
- //内控标准
- UltraGridBand ugc = entityGrid1.DisplayLayout.Bands[0];
- //附加标准
- UltraComboEditor uceAddStdCon = new UltraComboEditor();
- this.Controls.Add(uceAddStdCon);
- uceAddStdCon.Visible = false;
- QcmBaseCommon.InitDropUltraComEditor(uceAddStdCon, "com.steering.pss.qcm.ComMaterial.getAddCondition", "BASENAME", _ob, false);
- entityGrid1.DisplayLayout.Bands[0].Columns["AddstdconCode"].EditorComponent = uceAddStdCon;
- entityGrid1.DisplayLayout.Bands[0].Columns["AddstdconCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- ClsBaseInfo.SetComboItemHeight(uceAddStdCon);
- this.Controls.Add(Pics);
- Pics.Visible = false;
- //多标准选择分类
- UltraComboEditor uceMultStd = new UltraComboEditor();
- this.Controls.Add(uceMultStd);
- uceMultStd.Visible = false;
- QcmBaseCommon.InitDropUltraComEditor(uceMultStd, "com.steering.pss.qcm.ComMaterial.getMultStd", "BASENAME", _ob, true);
- entityGrid1.DisplayLayout.Bands[0].Columns["StdChoose"].EditorComponent = uceMultStd;
- entityGrid1.DisplayLayout.Bands[0].Columns["StdChoose"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- ClsBaseInfo.SetComboItemHeight(uceMultStd);
- }
- private string designKey = "";
- private string ordLnPk = "";
- /// <summary>
- /// 查询质量设计理化
- /// </summary>
- /// <param name="designStdPicEntity"></param>
- public void Query()
- {
- CraftOrdDesignStdPicEntityBindingSource.Clear();
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CraftOrdFdPic.queryM", new object[] { ordLnPk }, _ob);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- foreach (var row in ultraGrid1.Rows)
- {
- row.Cells["SAMPLE"].Value = "维护";
- row.Cells["SAMPLE"].ButtonAppearance.TextHAlign = HAlign.Center;
- }
- }
- private string[] _parms;
- public void Clear()
- {
- this.CraftOrdDesignStdPicEntityBindingSource.Clear();
- }
- public void Save()
- {
- List<CrafOrdFdPicEntity> parms = new List<CrafOrdFdPicEntity>();
- var mRow = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True").FirstOrDefault();
- var rows = entityGrid1.Rows.Where(a=>a.GetValue("Chk") == "True");
- if (mRow == null && rows.Count() == 0)
- {
- MessageUtil.ShowWarning("请选择一行记录!");
- return;
- }
- string mscPline = ultraGrid1.ActiveRow.GetValue("MSC_PLINE");
- string processCode = ultraGrid1.ActiveRow.GetValue("PROCESS_CODE");
- string pic = ultraGrid1.ActiveRow.GetValue("PIC");
- foreach (var row in rows)
- {
- var parm = EntityHelper.CopyEntity<CrafOrdFdPicEntity>(row.ListObject);
- if (parm.PhyNameMax == "")
- {
- MessageUtil.ShowWarning("请选择检验项!");
- row.SetCellActive("PhyNameMax");
- return;
- }
- if (parm.PhyNameMin == "")
- {
- MessageUtil.ShowWarning("请选择试样组!");
- row.SetCellActive("PhyNameMin");
- return;
- }
- if (parm.PhyName == "")
- {
- MessageUtil.ShowWarning("请选择检验项目!");
- row.SetCellActive("PhyName");
- return;
- }
- if (parm.StdminSign == "=" && (parm.StdmaxSign != "" || parm.Stdmax != ""))
- {
- MessageUtil.ShowWarning("标准范围下限符号为'=',不能存在上限!");
- row.SetCellActive("Stdmax");
- return;
- }
- if (parm.Isjudge == true)
- {
- if (parm.StdminSign.Equals("") && parm.StdmaxSign.Equals(""))
- {
- MessageUtil.ShowWarning("请选择标准范围(默认)下限符号或者上限符号!");
- row.SetCellActive("StdminSign");
- return;
- }
- }
- if (!parm.StdminSign.Equals("") && parm.Stdmin.Equals(""))
- {
- MessageUtil.ShowWarning("请输入标准范围(默认)下限值!");
- row.SetCellActive("Stdmin");
- return;
- }
- if (parm.StdminSign.Equals("") && !parm.Stdmin.Equals(""))
- {
- MessageUtil.ShowWarning("请选择标准范围(默认)下限符号!");
- row.SetCellActive("StdminSign");
- return;
- }
- if (!parm.StdmaxSign.Equals("") && parm.Stdmax.Equals(""))
- {
- MessageUtil.ShowWarning("请输入标准范围(默认)上限值!");
- row.SetCellActive("Stdmax");
- return;
- }
- if (parm.StdmaxSign.Equals("") && !parm.Stdmax.Equals(""))
- {
- MessageUtil.ShowWarning("已有标准范围(默认)上限值,请选择标准范围(默认)上限符号!");
- row.SetCellActive("StdmaxSign");
- return;
- }
- if (parm.PhyType == false)
- {
- if (!parm.Stdmin.Equals("") && !StringUtil.IsNumber(parm.Stdmin) && !parm.StdminSign.Equals("="))
- {
- MessageUtil.ShowWarning("标准范围(默认)下限值由数字组成!");
- row.SetCellActive("Stdmin");
- return;
- }
- if (!parm.Stdmax.Equals("") && !StringUtil.IsNumber(parm.Stdmax))
- {
- MessageUtil.ShowWarning("标准范围(默认)上限值由数字组成!");
- row.SetCellActive("Stdmax");
- return;
- }
- }
- else
- {
- if (!parm.Stdmin.Equals("") && !parm.StdminSign.Equals("=") && !QcmBaseCommon.CheckCompositeFormula(parm.Stdmin))
- {
- MessageUtil.ShowWarning("标准范围(默认)下限值,输入公式不合法,请重新输入!");
- row.SetCellActive("Stdmin");
- return;
- }
- if (!parm.Stdmax.Equals("") && !QcmBaseCommon.CheckCompositeFormula(parm.Stdmax))
- {
- MessageUtil.ShowWarning("标准范围(默认)上限值,输入公式不合法,请重新输入!");
- row.SetCellActive("Stdmax");
- return;
- }
- }
- if (!parm.Stdmin.Equals(""))
- {
- if (parm.Stdmin.StartsWith("."))
- parm.Stdmin = "0" + parm.Stdmin;
- }
- if (!parm.Stdmax.Equals(""))
- {
- if (parm.Stdmax.StartsWith("."))
- parm.Stdmax = "0" + parm.Stdmax;
- }
- if (!parm.Stdmin.Equals("") && !parm.Stdmax.Equals("")) //&& Convert.ToDouble(stdmin) > Convert.ToDouble(stdmax)
- {
- int i = QcmBaseInfo.CheckStdData(parm.StdminSign, parm.StdmaxSign, parm.Stdmin, parm.Stdmax);
- if (i == 0)
- {
- MessageUtil.ShowWarning("输入的数据不完整!");
- return;
- }
- if (i == 1)
- {
- MessageUtil.ShowWarning("标准范围(默认)下限值与上限值相等,上下限符号请选择<=和>=!");
- row.SetCellActive("StdminSign");
- return;
- }
- if (i == 2)
- {
- MessageUtil.ShowWarning("标准范围(默认)下限值不能大于上限值!");
- row.SetCellActive("Stdmin");
- return;
- }
- }
- if (parm.JudgeBasis.Equals(""))
- {
- MessageUtil.ShowWarning("判断依据不能为空!");
- row.SetCellActive("JudgeBasis");
- return;
- }
- if (parm.StdminSign2 == "=" && (parm.StdmaxSign2 != "" || parm.Stdmax2 != ""))
- {
- MessageUtil.ShowWarning("标准范围(二)下限符号为'=',不能存在上限!");
- row.SetCellActive("Stdmax2");
- return;
- }
- if (parm.StdChoose != "") //取大/小值
- {
- if (parm.StdminSign2.Equals("") && parm.StdmaxSign2.Equals(""))
- {
- MessageUtil.ShowWarning("请选择标准范围(二)下限符号或者上限符号!");
- row.SetCellActive("StdminSign2");
- return;
- }
- if (!parm.StdminSign2.Equals("") && parm.Stdmin2.Equals(""))
- {
- MessageUtil.ShowWarning("请输入标准范围(二)下限值!");
- row.SetCellActive("Stdmin2");
- return;
- }
- if (parm.StdminSign2.Equals("") && !parm.Stdmin2.Equals(""))
- {
- MessageUtil.ShowWarning("标准范围(默认)不存在下限符号,则标准范围(二)下限不能存在值!");
- row.SetCellActive("Stdmin2");
- return;
- }
- if (!parm.StdmaxSign2.Equals("") && parm.Stdmax2.Equals(""))
- {
- MessageUtil.ShowWarning("请输入标准范围(二)上限值!");
- row.SetCellActive("Stdmax2");
- return;
- }
- if (parm.StdmaxSign2.Equals("") && !parm.Stdmax2.Equals(""))
- {
- MessageUtil.ShowWarning("标准范围(默认)不存在上限符号,则标准范围(二)上限不能存在值!");
- row.SetCellActive("Stdmax2");
- return;
- }
- if (parm.PhyType == false)
- {
- if (!parm.Stdmin2.Equals("") && !StringUtil.IsNumber(parm.Stdmin2) && !parm.StdminSign2.Equals("="))
- {
- MessageUtil.ShowWarning("标准范围(二)下限值由数字组成!");
- row.SetCellActive("Stdmin2");
- return;
- }
- if (!parm.Stdmax2.Equals("") && !StringUtil.IsNumber(parm.Stdmax2))
- {
- MessageUtil.ShowWarning("标准范围(二)上限值由数字组成!");
- row.SetCellActive("Stdmax2");
- return;
- }
- }
- else
- {
- if (!parm.Stdmin2.Equals("") && !parm.StdminSign2.Equals("=") && !StringUtil.IsNumber(parm.Stdmin2)
- && !QcmBaseCommon.CheckCompositeFormula(parm.Stdmin2))
- {
- MessageUtil.ShowWarning("标准范围(二)下限值输入公式不合法,请重新输入!");
- row.SetCellActive("Stdmin2");
- return;
- }
- if (!parm.Stdmax2.Equals("") && !StringUtil.IsNumber(parm.Stdmax2) && !QcmBaseCommon.CheckCompositeFormula(parm.Stdmax2))
- {
- MessageUtil.ShowWarning("标准范围(二)上限值输入公式不合法,请重新输入!");
- row.SetCellActive("Stdmax2");
- return;
- }
- }
- if (!parm.Stdmin2.Equals(""))
- {
- if (parm.Stdmin2.StartsWith("."))
- parm.Stdmin2 = "0" + parm.Stdmin2;
- }
- if (!parm.Stdmax2.Equals(""))
- {
- if (parm.Stdmax2.StartsWith("."))
- parm.Stdmax2 = "0" + parm.Stdmax2;
- }
- if (!parm.Stdmin2.Equals("") && !parm.Stdmax2.Equals("")) //&& Convert.ToDouble(stdmin2) > Convert.ToDouble(stdmax2)
- {
- int i = QcmBaseInfo.CheckStdData(parm.StdminSign2, parm.StdmaxSign2, parm.Stdmin2, parm.Stdmax2);
- if (i == 0)
- {
- MessageUtil.ShowWarning("输入的数据不完整!");
- return;
- }
- if (i == 1)
- {
- MessageUtil.ShowWarning("标准范围(二)下限值与上限值相等,上下限符号请选择<=和>=!");
- row.SetCellActive("StdminSign2");
- return;
- }
- if (i == 2)
- {
- MessageUtil.ShowWarning("标准范围(二)下限值不能大于上限值!");
- row.SetCellActive("Stdmin2");
- return;
- }
- }
- }
- if (parm.SizeMinSign2 == "=" && (parm.SizeMaxSign2 != "" || parm.SizeMax2 != ""))
- {
- MessageUtil.ShowWarning("限制规格(一)下限符号为'=',不能存在上限!");
- row.SetCellActive("SizeMax2");
- return;
- }
- if (parm.SizeMinSign == "=" && (parm.SizeMaxSign != "" || parm.SizeMax != ""))
- {
- MessageUtil.ShowWarning("限制规格(二)下限符号为'=',不能存在上限!");
- row.SetCellActive("SizeMax");
- return;
- }
- if (!parm.SpecJg.Equals("") && !parm.SpecJgDesc.Equals("-1"))
- {
- if (!parm.SizeName2.Equals("") || !parm.SizeName.Equals(""))
- {
- MessageUtil.ShowWarning("接箍描述与限制规格不能同时存在!");
- row.SetCellActive("SpecJg");
- return;
- }
- }
- if (!parm.SizeName2.Equals(""))
- {
- if (parm.SizeMinSign2.Equals("") && parm.SizeMaxSign2.Equals(""))
- {
- MessageUtil.ShowWarning("请选择限制规格(一)下限符号或者上限符号!");
- row.SetCellActive("SizeMinSign2");
- return;
- }
- if (!parm.SizeMinSign2.Equals("") && parm.SizeMin2.Equals(""))
- {
- MessageUtil.ShowWarning("存在限制规格(一)下限符号,下限值不能为空!");
- row.SetCellActive("SizeMin2");
- return;
- }
- if (parm.SizeMinSign2.Equals("") && !parm.SizeMin2.Equals(""))
- {
- MessageUtil.ShowWarning("存在限制规格(一)下限值,下限符号不能为空!");
- row.SetCellActive("SizeMinSign2");
- return;
- }
- if (!parm.SizeMaxSign2.Equals("") && parm.SizeMax2.Equals(""))
- {
- MessageUtil.ShowWarning("存在限制规格(一)上限符号,上限值不能为空!");
- row.SetCellActive("SizeMax2");
- return;
- }
- if (parm.SizeMaxSign2.Equals("") && !parm.SizeMax2.Equals(""))
- {
- MessageUtil.ShowWarning("存在限制规格(一)上限值,上限符号不能为空!");
- row.SetCellActive("SizeMaxSign2");
- return;
- }
- if (!parm.SizeMin2.Equals("") && !StringUtil.IsNumber(parm.SizeMin2) && !parm.SizeMinSign2.Equals("="))
- {
- MessageUtil.ShowWarning("限制规格(一)下限值由数字组成!");
- row.SetCellActive("SizeMin2");
- return;
- }
- if (!parm.SizeMax2.Equals("") && !StringUtil.IsNumber(parm.SizeMax2))
- {
- MessageUtil.ShowWarning("限制规格(一)上限值由数字组成!");
- row.SetCellActive("SizeMax2");
- return;
- }
- if (!parm.SizeMin2.Equals("") && !parm.SizeMax2.Equals("")) //&& Convert.ToDouble(size_max2) < Convert.ToDouble(size_min2)
- {
- int i = QcmBaseInfo.CheckStdData(parm.SizeMinSign2, parm.SizeMaxSign2, parm.SizeMin2, parm.SizeMax2);
- if (i == 0)
- {
- MessageUtil.ShowWarning("输入的数据不完整!");
- return;
- }
- if (i == 1)
- {
- MessageUtil.ShowWarning("限制规格(一)下限值与上限值相等,上下限符号请选择<=和>=!");
- row.SetCellActive("SizeMinSign2");
- return;
- }
- if (i == 2)
- {
- MessageUtil.ShowWarning("限制规格(一)下限值不能大于上限值!");
- row.SetCellActive("SizeMin2");
- return;
- }
- }
- }
- else
- {
- if (parm.SizeMaxSign2 != "" || parm.SizeMinSign2 != "" || parm.SizeMin2 != "" || parm.SizeMax2 != "")
- {
- MessageUtil.ShowWarning("限制规格(一)描述不存在!");
- row.SetCellActive("SizeCode2");
- return;
- }
- }
- if (!parm.SizeMin2.Equals(""))
- {
- if (parm.SizeMin2.StartsWith("."))
- parm.SizeMin2 = "0" + parm.SizeMin2;
- }
- if (!parm.SizeMax2.Equals(""))
- {
- if (parm.SizeMax2.StartsWith("."))
- parm.SizeMax2 = "0" + parm.SizeMax2;
- }
- if (!parm.SizeName.Equals(""))
- {
- if (parm.SizeMinSign.Equals("") && parm.SizeMaxSign.Equals(""))
- {
- MessageUtil.ShowWarning("限制规格(二)下限符号与上限符号必须存在一项!");
- row.SetCellActive("SizeMinSign");
- return;
- }
- if (!parm.SizeMinSign.Equals("") && parm.SizeMin.Equals(""))
- {
- MessageUtil.ShowWarning("存在限制规格(二)下限符号,下限值不能为空!");
- row.SetCellActive("SizeMin");
- return;
- }
- if (parm.SizeMinSign.Equals("") && !parm.SizeMin.Equals(""))
- {
- MessageUtil.ShowWarning("存在限制规格(二)下限值,下限符号不能为空!");
- row.SetCellActive("SizeMinSign");
- return;
- }
- if (!parm.SizeMaxSign.Equals("") && parm.SizeMax.Equals(""))
- {
- MessageUtil.ShowWarning("存在限制规格(二)上限符号,上限值不能为空!");
- row.SetCellActive("SizeMax");
- return;
- }
- if (parm.SizeMaxSign.Equals("") && !parm.SizeMax.Equals(""))
- {
- MessageUtil.ShowWarning("存在限制规格(二)上限值,上限符号不能为空!");
- row.SetCellActive("SizeMaxSign");
- return;
- }
- if (!parm.SizeMax.Equals("") && !StringUtil.IsNumber(parm.SizeMax))
- {
- MessageUtil.ShowWarning("限制规格(二)上限值由数字组成!");
- row.SetCellActive("SizeMax");
- return;
- }
- if (!parm.SizeMin.Equals("") && !StringUtil.IsNumber(parm.SizeMin) && !parm.SizeMinSign.Equals("="))
- {
- MessageUtil.ShowWarning("限制规格(二)下限值由数字组成!");
- row.SetCellActive("SizeMin");
- return;
- }
- if (!parm.SizeMin.Equals("") && !parm.SizeMax.Equals("")) //&& Convert.ToDouble(size_max) < Convert.ToDouble(size_min)
- {
- int i = QcmBaseInfo.CheckStdData(parm.SizeMinSign, parm.SizeMaxSign, parm.SizeMin, parm.SizeMax);
- if (i == 0)
- {
- MessageUtil.ShowWarning("输入的数据不完整!");
- return;
- }
- if (i == 1)
- {
- MessageUtil.ShowWarning("限制规格(二)下限值与上限值相等,上下限符号请选择<=和>=!");
- row.SetCellActive("SizeMinSign");
- return;
- }
- if (i == 2)
- {
- MessageUtil.ShowWarning("限制规格(二)下限值不能大于上限值!");
- row.SetCellActive("SizeMin");
- return;
- }
- }
- }
- else
- {
- if (parm.SizeMaxSign != "" || parm.SizeMinSign != "" || parm.SizeMin != "" || parm.SizeMax != "")
- {
- MessageUtil.ShowWarning("限制规格(二)描述不存在!");
- row.SetCellActive("SizeCode");
- return;
- }
- }
- if (!parm.SizeName2.Equals("") && !parm.SizeName.Equals("") && parm.SizeName.Equals(parm.SizeName2))
- {
- MessageUtil.ShowWarning("限制规格(一)与限制规格(二)描述不能相同!");
- row.SetCellActive("SizeCode");
- return;
- }
- if (!parm.SizeMax.Equals(""))
- {
- if (parm.SizeMax.StartsWith("."))
- parm.SizeMax = "0" + parm.SizeMax;
- }
- if (!parm.SizeMin.Equals(""))
- {
- if (parm.SizeMin.StartsWith("."))
- parm.SizeMin = "0" + parm.SizeMin;
- }
- if (parm.Addcondition != "") //存在附加标准约束
- {
- if (parm.AddstdconCode == "")
- {
- MessageUtil.ShowWarning("请选择附加标准项!");
- row.SetCellActive("AddstdconCode");
- return;
- }
- if (parm.AddstdMinSign == "=" && (parm.AddstdMaxSign != "" || parm.AddstdMax != ""))
- {
- MessageUtil.ShowWarning("附加标准范围下限符号为'=',不能存在上限!");
- row.SetCellActive("AddstdMax");
- return;
- }
- if (parm.AddstdMinSign.Equals("") && parm.AddstdMaxSign.Equals(""))
- {
- MessageUtil.ShowWarning("请选择附加标准范围下限符号或者上限符号!");
- row.SetCellActive("AddstdMinSign");
- return;
- }
- if (!parm.AddstdMinSign.Equals("") && parm.AddstdMin.Equals(""))
- {
- MessageUtil.ShowWarning("请输入附加标准范围下限值!");
- row.SetCellActive("AddstdMin");
- return;
- }
- if (parm.AddstdMinSign.Equals("") && !parm.AddstdMin.Equals(""))
- {
- MessageUtil.ShowWarning("请选择附加标准范围下限符号!");
- row.SetCellActive("AddstdMinSign");
- return;
- }
- if (!parm.AddstdMinSign.Equals("") && parm.AddstdMin.Replace("Value", "1").CompileFormula() == null)
- {
- MessageUtil.ShowWarning("附加标准范围下限值,只能包含附加标准符号'Value'!");
- row.SetCellActive("AddstdMin");
- return;
- }
- if (!parm.AddstdMaxSign.Equals("") && parm.AddstdMax.Equals(""))
- {
- MessageUtil.ShowWarning("请输入附加标准范围上限值!");
- row.SetCellActive("AddstdMax");
- return;
- }
- if (!parm.AddstdMaxSign.Equals("") && parm.AddstdMax.Replace("Value", "1").CompileFormula() == null)
- {
- MessageUtil.ShowWarning("附加标准范围上限值,只能包含附加标准符号'Value'!");
- row.SetCellActive("AddstdMax");
- return;
- }
- if (parm.AddstdMaxSign.Equals("") && !parm.AddstdMax.Equals(""))
- {
- MessageUtil.ShowWarning("已有附加标准范围上限值,请选择附加标准范围上限符号!");
- row.SetCellActive("AddstdMaxSign");
- return;
- }
- if (!parm.AddstdMin.Equals(""))
- {
- if (parm.AddstdMin.StartsWith("."))
- parm.AddstdMin = "0" + parm.AddstdMin;
- }
- if (!parm.AddstdMax.Equals(""))
- {
- if (parm.AddstdMax.StartsWith("."))
- parm.AddstdMax = "0" + parm.AddstdMax;
- }
- if (!parm.AddstdMin.Equals("") && !parm.AddstdMax.Equals(""))//&& Convert.ToDouble(addstd_min) > Convert.ToDouble(addstd_max)
- {
- int i = QcmBaseInfo.CheckStdData(parm.AddstdMinSign, parm.AddstdMaxSign, parm.AddstdMin, parm.AddstdMax);
- if (i == 0)
- {
- MessageUtil.ShowWarning("输入的数据不完整!");
- return;
- }
- if (i == 1)
- {
- MessageUtil.ShowWarning("附加标准范围下限值与上限值相等,上下限符号请选择<=和>=!");
- row.SetCellActive("AddstdMinSign");
- return;
- }
- if (i == 2)
- {
- MessageUtil.ShowWarning("附加标准范围下限值不能大于上限值!");
- row.SetCellActive("AddstdMin");
- return;
- }
- }
- }
- string[] strJudgeBiasis = new string[] { "A", "B", "C", "D" };
- if (!strJudgeBiasis.Contains(parm.JudgeBasis)) //中文就是从交付或内控复制过来的,特殊处理。
- {
- if (parm.JudgeBasis.Equals("最小值"))
- parm.JudgeBasis = "A";
- else if (parm.JudgeBasis.Equals("最大值"))
- parm.JudgeBasis = "B";
- else if (parm.JudgeBasis.Equals("平均值"))
- parm.JudgeBasis = "C";
- else
- parm.JudgeBasis = "D";
- }
- parm.CreateName = CoreUserInfo.UserInfo.GetUserName();
- parm.UpdateName = CoreUserInfo.UserInfo.GetUserName();
- parm.DeleteName = CoreUserInfo.UserInfo.GetUserName();
- parm.SpeclFl = "2";
- parm.DesginKey = designKey;
- parm.OrdLnPk = ordLnPk;
- parm.PicMemo = ultraGrid1.ActiveRow.GetValue("PIC_MEMO");
- parm.MscPline = ultraGrid1.ActiveRow.GetValue("MSC_PLINE");
- parm.ProcessCode = ultraGrid1.ActiveRow.GetValue("PROCESS_CODE");
- parm.Pic = ultraGrid1.ActiveRow.GetValue("PIC");
- parms.Add(parm);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认保存?") == DialogResult.No)
- {
- return;
- }
- List<string> jsons = new List<string>();
- foreach (var craftOrdDesignStdPicEntity in parms)
- {
- jsons.Add(JSONFormat.Format(craftOrdDesignStdPicEntity));
- }
- string chkMscPline = mRow == null ? "" : mRow.GetValue("MSC_PLINE");
- string chkProcessCode = mRow == null ? "" : mRow.GetValue("PROCESS_CODE");
- string chkMemo = mRow == null ? "" : mRow.GetValue("PIC_MEMO");
- ServerHelper.SetData("com.steering.pss.sale.order.CraftOrdFdPic.save", new object[] { jsons, ordLnPk, mscPline, processCode, pic,
- chkMscPline, chkProcessCode, chkMemo }, _ob);
- MessageUtil.ShowTips("保存成功!");
- Relocate(mscPline, processCode, pic);
- }
- public void CopyNkStd()
- {
- var mRow = ultraGrid1.Rows.Where(a=>a.GetValue("CHK") == "True").FirstOrDefault();
- if (mRow == null)
- {
- MessageUtil.ShowWarning("请选择一条理化标准索引码!");
- return;
- }
- if (mRow.GetValue("PIC") == "")
- {
- MessageUtil.ShowWarning("请选择一条理化标准索引码!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认复制内控索引码" + mRow.GetValue("PIC") + "?") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.sale.order.CraftOrdFdPic.copyNkStd", new object[] { designKey, ordLnPk, mRow.GetValue("MSC_PLINE"),
- mRow.GetValue("PROCESS_CODE"), mRow.GetValue("PIC") }, _ob);
- MessageUtil.ShowTips("复制成功!");
- Query();
- }
- public void Delete()
- {
- List<CrafOrdFdPicEntity> parms = new List<CrafOrdFdPicEntity>();
- var pRow = ultraGrid1.Rows.Where(a=>a.GetValue("CHK") == "True").FirstOrDefault();
- var rows = entityGrid1.Rows.Where(a => a.GetValue("Chk") == "True");
- if (pRow == null && rows.Count() == 0)
- {
- MessageUtil.ShowWarning("请选择一条记录!");
- return;
- }
- string mscPline = ultraGrid1.ActiveRow.GetValue("MSC_PLINE");
- string processCode = ultraGrid1.ActiveRow.GetValue("PROCESS_CODE");
- string pic = ultraGrid1.ActiveRow.GetValue("PIC");
- foreach (var row in rows)
- {
- var parm = EntityHelper.CopyEntity<CrafOrdFdPicEntity>(row.ListObject);
- parm.CreateName = CoreUserInfo.UserInfo.GetUserName();
- parm.UpdateName = CoreUserInfo.UserInfo.GetUserName();
- parm.DeleteName = CoreUserInfo.UserInfo.GetUserName();
- parm.SpeclFl = "2";
- parm.DesginKey = designKey;
- parms.Add(parm);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认删除?") == DialogResult.No)
- {
- return;
- }
- List<string> jsons = new List<string>();
- foreach (var craftOrdDesignStdPicEntity in parms)
- {
- jsons.Add(JSONFormat.Format(craftOrdDesignStdPicEntity));
- }
- string parmMscPline = pRow == null ? "" : pRow.GetValue("MSC_PLINE");
- string parmProcessCode = pRow == null ? "" : pRow.GetValue("PROCESS_CODE");
- ServerHelper.SetData("com.steering.pss.sale.order.CraftOrdFdPic.Delete", new object[] { ordLnPk, parmMscPline, parmProcessCode,
- jsons }, _ob);
- MessageUtil.ShowTips("删除成功!");
- Relocate(mscPline, processCode, pic);
- }
- private void Relocate(string mscPline, string processCode, string pic)
- {
- Query();
- var mRow = ultraGrid1.Rows.Where(a=>a.GetValue("MSC_PLINE") == mscPline && a.GetValue("PROCESS_CODE") == processCode &&
- a.GetValue("PIC") == pic).FirstOrDefault();
- if (mRow != null)
- {
- mRow.Activate();
- }
- }
- private void entityGrid1_CellChange(object sender, CellEventArgs e)
- {
- e.Cell.Row.Update();
- var ugr = e.Cell.Row;
- string deliverystate = ugr.Cells["DELIVERYSTATE"].Value.ToString();
- ugr.Cells["SizeName2"].Value = ugr.Cells["SizeCode2"].Text;
- ugr.Cells["SizeName"].Value = ugr.Cells["SizeCode"].Text;
- ugr.Cells["SpecJgDesc"].Value = ugr.Cells["SpecJg"].Text;
- GridEdite(e.Cell.Row);
- }
- private void GridEdite(UltraGridRow row)
- {
- if (row.GetValue("Chk") == "True")
- {
- foreach (UltraGridCell cell in row.Cells)
- {
- if (cell.Column.CellActivation == Activation.AllowEdit)
- {
- cell.Activation = Activation.AllowEdit;
- }
- }
- }
- else
- {
- foreach (UltraGridCell cell in row.Cells)
- {
- if (cell.Column.Key == "Chk") continue;
- if (cell.Column.CellActivation == Activation.AllowEdit)
- {
- cell.Activation = Activation.ActivateOnly;
- }
- }
- }
- }
- private void entityGrid1_AfterRowInsert(object sender, RowEventArgs e)
- {
- var mRow = ultraGrid1.ActiveRow;
- e.Row.SetValue("mscPline", mRow.GetValue("MSC_PLINE"));
- e.Row.SetValue("processCode", mRow.GetValue("PROCESS_CODE"));
- e.Row.SetValue("processDesc", mRow.GetValue("PROCESS_DESC"));
- e.Row.SetValue("pic", mRow.GetValue("PIC"));
- //将增加行的是否必选项置为默认选择 和 复合元素选择项置为默认不选
- e.Row.Cells["PhyType"].Value = false;
- e.Row.Cells["BilletSample"].Value = false;
- e.Row.Cells["JudgeBasis"].Value = "D";
- e.Row.Cells["IsJudge"].Value = true;
- e.Row.Cells["IsQuote"].Value = true;
- e.Row.Cells["Ischeck"].Value = true;
- e.Row.Cells["CraftSource"].Value = "1";
- e.Row.Cells["SpeclFl"].Value = "2";
- e.Row.Cells["OrdLnPk"].Value = ordLnPk;
- }
- private void ultraTextEditor3_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- UltraGridRow row = entityGrid1.ActiveRow;
- string key = entityGrid1.ActiveCell.Column.Key;
- //if (key == "MscPline")
- //{
- // DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CraftOrdFdPic.getMscPlineProcess",
- // new object[]{ designKey }, _ob);
- // dt.Columns["MSC_PLINE"].Caption = "制程号";
- // dt.Columns["WHOLE_BACKLOG"].Caption = "全程途径码";
- // dt.Columns["WHOLE_BACKLOG_DESC"].Caption = "全程途径描述";
- // dt.Columns["PROCESS_DESC"].Caption = "工序";
- // BaseInfoPopup popup = new BaseInfoPopup(dt, "MSC_PLINE", "PROCESS_CODE");
- // GridHelper.RefreshAndAutoSize(popup.UltraGrid1);
- // popup.LabelTextBox1.Caption = "制程号";
- // if (popup.ShowDialog() == DialogResult.OK)
- // {
- // row.SetValue("MscPline", popup.ChoicedRow.GetValue("MSC_PLINE"));
- // row.SetValue("ProcessDesc", popup.ChoicedRow.GetValue("PROCESS_DESC"));
- // row.SetValue("ProcessCode", popup.ChoicedRow.GetValue("PROCESS_CODE"));
- // }
- //}
- //else if (key == "ProcessDescC")
- //{
- // string mscPline = entityGrid1.ActiveRow.GetValue("MscPline");
- // DataTable dt = _designMscPlPrcBLL.queryProcess(designKey, mscPline);
- // dt.Columns["PROCESS_DESC"].Caption = "工序";
- // dt.Columns["PROCESS_DESC_C"].Caption = "二级工序";
- // BaseInfoPopup popup = new BaseInfoPopup(dt, "PROCESS_DESC_C", "PROCESS_CODE", "PROCESS_CODE_C");
- // popup.LabelTextBox1.Caption = "二级工序";
- // if (popup.ShowDialog() == DialogResult.OK)
- // {
- // row.SetValue("ProcessDescC", popup.ChoicedRow.GetValue("PROCESS_DESC_C"));
- // row.SetValue("ProcessCodeC", popup.ChoicedRow.GetValue("PROCESS_CODE_C"));
- // row.SetValue("ProcessDesc", popup.ChoicedRow.GetValue("PROCESS_DESC"));
- // row.SetValue("ProcessCode", popup.ChoicedRow.GetValue("PROCESS_CODE"));
- // }
- //}
- //else if (key == "Pic")
- //{
- // string mscPline = entityGrid1.ActiveRow.GetValue("MscPline");
- // string processCode = entityGrid1.ActiveRow.GetValue("ProcessCode");
- // DataTable dt = _designMscPlPrcBLL.queryProcessNkIndex(designKey, mscPline, processCode);
- // dt.Columns["PIC"].Caption = "理化内控索引码";
- // BaseInfoPopup popup = new BaseInfoPopup(dt, "PIC", "CIC", "SIC", "DIC", "WIC", "GIC");
- // popup.LabelTextBox1.Caption = "理化内控索引码";
- // if (popup.ShowDialog() == DialogResult.OK)
- // {
- // row.SetValue("Pic", popup.ChoicedRow.GetValue("PIC"));
- // }
- //}
- if (entityGrid1.ActiveCell.Column.Key == "PhyNameMax")
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComBaseQuery.geComBasePhyRStd", null, _ob);
- dt.Columns["PHY_TYPE"].Caption = "检验大项";
- BaseInfoPopup baseInfoPopup = new BaseInfoPopup(dt, "PHY_TYPE", "PHY_CODE");
- baseInfoPopup.Text = "检验大项";
- baseInfoPopup.LabelTextBox1.Caption = "检验大项";
- baseInfoPopup.Shown += new EventHandler((c, d) =>
- {
- IQueryable<UltraGridRow> rows = baseInfoPopup.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("PHY_CODE") == entityGrid1.ActiveRow.GetValue("PhyCodeMax"));
- if (rows.Count() > 0)
- {
- rows.First().Activate();
- }
- });
- if (baseInfoPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- entityGrid1.ActiveRow.SetValue("PhyNameMax", baseInfoPopup.ChoicedRow.GetValue("PHY_TYPE"));
- entityGrid1.ActiveRow.SetValue("PhyCodeMax", baseInfoPopup.ChoicedRow.GetValue("PHY_CODE"));
- entityGrid1.ActiveRow.SetValue("PhyNameMin", "");
- entityGrid1.ActiveRow.SetValue("PhyCodeMin", "");
- entityGrid1.ActiveRow.SetValue("PhyName", "");
- entityGrid1.ActiveRow.SetValue("PhyCode", "");
- entityGrid1.ActiveRow.SetValue("ItemNameF", "");
- entityGrid1.ActiveRow.SetValue("ItemCodeF", "");
- entityGrid1.ActiveRow.SetValue("ItemNameS", "");
- entityGrid1.ActiveRow.SetValue("ItemCodeS", "");
- entityGrid1.ActiveRow.SetValue("ItemNameW", "");
- entityGrid1.ActiveRow.SetValue("ItemCodeW", "");
- }
- }
- else if (entityGrid1.ActiveCell.Column.Key == "PhyNameMin")
- {
- string phyCodeMax = entityGrid1.ActiveRow.GetValue("PhyCodeMax");
- if (phyCodeMax == "")
- {
- MessageUtil.ShowWarning("请选检验大项!");
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComBaseQuery.geComBasePhyC", new object[] { phyCodeMax }, _ob);
- dt.Columns["PHY_TYPE"].Caption = "试样组";
- BaseInfoPopup baseInfoPopup = new BaseInfoPopup(dt, "PHY_TYPE", "PHY_CODE");
- baseInfoPopup.Text = "试样组";
- baseInfoPopup.LabelTextBox1.Caption = "试样组";
- baseInfoPopup.Shown += new EventHandler((c, d) =>
- {
- IQueryable<UltraGridRow> rows = baseInfoPopup.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("PHY_CODE") == entityGrid1.ActiveRow.GetValue("PhyCodeMin"));
- if (rows.Count() > 0)
- {
- rows.First().Activate();
- }
- });
- if (baseInfoPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- entityGrid1.ActiveRow.SetValue("PhyNameMin", baseInfoPopup.ChoicedRow.GetValue("PHY_TYPE"));
- entityGrid1.ActiveRow.SetValue("PhyCodeMin", baseInfoPopup.ChoicedRow.GetValue("PHY_CODE"));
- entityGrid1.ActiveRow.SetValue("PhyName", "");
- entityGrid1.ActiveRow.SetValue("PhyCode", "");
- entityGrid1.ActiveRow.SetValue("ItemNameF", "");
- entityGrid1.ActiveRow.SetValue("ItemCodeF", "");
- entityGrid1.ActiveRow.SetValue("ItemNameS", "");
- entityGrid1.ActiveRow.SetValue("ItemCodeS", "");
- entityGrid1.ActiveRow.SetValue("ItemNameW", "");
- entityGrid1.ActiveRow.SetValue("ItemCodeW", "");
- }
- }
- else if (entityGrid1.ActiveCell.Column.Key == "PhyName")
- {
- string phyCodeMax = entityGrid1.ActiveRow.GetValue("PhyCodeMax");
- string phyCodeMin = entityGrid1.ActiveRow.GetValue("PhyCodeMin");
- if (phyCodeMax == "")
- {
- MessageUtil.ShowWarning("请选择检验大项");
- entityGrid1.ActiveRow.Cells["PhyNameMax"].Activate();
- return;
- }
- else if (phyCodeMin == "")
- {
- MessageUtil.ShowWarning("请选择试样组");
- entityGrid1.ActiveRow.Cells["PhyNameMin"].Activate();
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComBaseQuery.geComBasePhy", new object[] { phyCodeMax, phyCodeMin }, _ob);
- dt.Columns["PHY_NAME"].Caption = "检验项";
- BaseInfoPopup baseInfoPopup = new BaseInfoPopup(dt, "PHY_NAME", "PHY_CODE");
- baseInfoPopup.Text = "检验项";
- baseInfoPopup.LabelTextBox1.Caption = "检验项";
- baseInfoPopup.Shown += new EventHandler((c, d) =>
- {
- IQueryable<UltraGridRow> rows = baseInfoPopup.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("PHY_CODE") == entityGrid1.ActiveRow.GetValue("PhyCode"));
- if (rows.Count() > 0)
- {
- rows.First().Activate();
- }
- });
- if (baseInfoPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- entityGrid1.ActiveRow.SetValue("PhyName", baseInfoPopup.ChoicedRow.GetValue("PHY_NAME"));
- entityGrid1.ActiveRow.SetValue("PhyCode", baseInfoPopup.ChoicedRow.GetValue("PHY_CODE"));
- entityGrid1.ActiveRow.SetValue("ItemNameW", "");
- entityGrid1.ActiveRow.SetValue("ItemCodeW", "");
- }
- }
- else if (entityGrid1.ActiveCell.Column.Key == "ItemNameF")
- {
- string phyTypeC = entityGrid1.ActiveRow.GetValue("PhyCodeMin");
- if (phyTypeC == "")
- {
- MessageUtil.ShowWarning("请选择试样组");
- entityGrid1.ActiveRow.Cells["PhyNameMin"].Activate();
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComBaseQuery.geComBasePhyRItem",
- new object[] { phyTypeC }, _ob);
- dt.Columns["ITEM_NAME_F"].Caption = "试验方向";
- dt.Columns["ITEM_NAME_C"].Caption = "试验尺寸";
- BaseInfoPopup baseInfoPopup = new BaseInfoPopup(dt, "ITEM_NAME_F", "ITEM_CODE_F", "ITEM_CODE_C");
- baseInfoPopup.Text = "试验选择";
- baseInfoPopup.LabelTextBox1.Caption = "试验方向";
- baseInfoPopup.Shown += new EventHandler((c, d) =>
- {
- IQueryable<UltraGridRow> rows = baseInfoPopup.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("ITEM_CODE_F") == entityGrid1.ActiveRow.GetValue("ItemCodeF")
- && a.GetValue("ITEM_CODE_C") == entityGrid1.ActiveRow.GetValue("ItemCodeS"));
- if (rows.Count() > 0)
- {
- rows.First().Activate();
- }
- });
- if (baseInfoPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- entityGrid1.ActiveRow.SetValue("ItemNameF", baseInfoPopup.ChoicedRow.GetValue("ITEM_NAME_F"));
- entityGrid1.ActiveRow.SetValue("ItemCodeF", baseInfoPopup.ChoicedRow.GetValue("ITEM_CODE_F"));
- entityGrid1.ActiveRow.SetValue("ItemNameS", baseInfoPopup.ChoicedRow.GetValue("ITEM_NAME_C"));
- entityGrid1.ActiveRow.SetValue("ItemCodeS", baseInfoPopup.ChoicedRow.GetValue("ITEM_CODE_C"));
- }
- }
- else if (entityGrid1.ActiveCell.Column.Key == "ItemNameW")
- {
- string phyCode = entityGrid1.ActiveRow.GetValue("PhyCode");
- if (phyCode == "")
- {
- MessageUtil.ShowWarning("请选择检验项");
- entityGrid1.ActiveRow.Cells["PhyName"].Activate();
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComBaseQuery.geComBasePhyRPos",
- new object[] { phyCode }, _ob);
- dt.Columns["ITEM_NAME_W"].Caption = "试验温度";
- BaseInfoPopup baseInfoPopup = new BaseInfoPopup(dt, "ITEM_NAME_W", "ITEM_CODE_W");
- baseInfoPopup.Text = "试验选择";
- baseInfoPopup.LabelTextBox1.Caption = "试验温度";
- baseInfoPopup.Shown += new EventHandler((c, d) =>
- {
- IQueryable<UltraGridRow> rows = baseInfoPopup.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("ITEM_CODE_W") == entityGrid1.ActiveRow.GetValue("ItemCodeW"));
- if (rows.Count() > 0)
- {
- rows.First().Activate();
- }
- });
- if (baseInfoPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- entityGrid1.ActiveRow.SetValue("ItemNameW", baseInfoPopup.ChoicedRow.GetValue("ITEM_NAME_W"));
- entityGrid1.ActiveRow.SetValue("ItemCodeW", baseInfoPopup.ChoicedRow.GetValue("ITEM_CODE_W"));
- }
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- var row = ultraGrid1.ActiveRow;
- string pic = row.GetValue("PIC");
- string mscPline = row.GetValue("MSC_PLINE");
- string processCode = row.GetValue("PROCESS_CODE");
- this.CraftOrdDesignStdPicEntityBindingSource.DataSource = EntityHelper.GetData<CrafOrdFdPicEntity>(
- "com.steering.pss.sale.order.CraftOrdFdPic.query", new object[] { ordLnPk, mscPline, processCode, pic }, _ob);
- foreach (var row2 in entityGrid1.Rows)
- {
- GridEdite(row2);
- }
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (ultraGrid1.ActiveCell.Column.Key == "MSC_PLINE")
- {
- if (entityGrid1.Rows.Count != 0)
- {
- MessageUtil.ShowWarning("已维护首日检数据,不能修改!");
- }
- else
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- string key = ultraGrid1.ActiveCell.Column.Key;
- if (key == "MSC_PLINE")
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CraftOrdFdPic.getMscPlineProcess",
- new object[] { designKey }, _ob);
- dt.Columns["MSC_PLINE"].Caption = "制程号";
- dt.Columns["WHOLE_BACKLOG"].Caption = "全程途径码";
- dt.Columns["WHOLE_BACKLOG_DESC"].Caption = "全程途径描述";
- dt.Columns["PROCESS_DESC"].Caption = "工序";
- dt.Columns["PIC"].Caption = "理化索引码";
- BaseInfoPopup popup = new BaseInfoPopup(dt, "MSC_PLINE", "PROCESS_CODE");
- GridHelper.RefreshAndAutoSize(popup.UltraGrid1);
- popup.LabelTextBox1.Caption = "制程号";
- if (popup.ShowDialog() == DialogResult.OK)
- {
- var mRow = ultraGrid1.Rows.Where(a => a.GetValue("MSC_PLINE") == popup.ChoicedRow.GetValue("MSC_PLINE")
- && a.GetValue("PROCESS_CODE") == popup.ChoicedRow.GetValue("PROCESS_CODE")).FirstOrDefault();
- if (mRow != null)
- {
- MessageUtil.ShowWarning("同制程、同工序下只能维护一套首日检数据,请先删除制程" + popup.ChoicedRow.GetValue("MSC_PLINE") +
- " - 工序" + popup.ChoicedRow.GetValue("PROCESS_DESC") + "下的索引码" + mRow.GetValue("PIC") + "!");
- return;
- }
- row.SetValue("MSC_PLINE", popup.ChoicedRow.GetValue("MSC_PLINE"));
- row.SetValue("PROCESS_DESC", popup.ChoicedRow.GetValue("PROCESS_DESC"));
- row.SetValue("PROCESS_CODE", popup.ChoicedRow.GetValue("PROCESS_CODE"));
- row.SetValue("PIC", popup.ChoicedRow.GetValue("PIC"));
- }
- }
- }
- }
- }
- private void entityGrid1_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- if (ultraGrid1.ActiveRow == null) e.Cancel = true;
- if (ultraGrid1.ActiveRow.GetValue("PIC") == "") e.Cancel = true;
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- e.Cell.Row.Update();
- if (e.Cell.Column.Key == "CHK")
- {
- UltraGridRow chkRow = e.Cell.Row;
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.Cells["CHK"].Value.ToString() == "True" && row != chkRow)
- {
- row.Cells["CHK"].Value = "False";
- row.Update();
- }
- }
- }
- }
- private void ultraGrid1_AfterRowInsert(object sender, RowEventArgs e)
- {
- }
- private void ultraGrid1_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- if (ultraGrid1.Rows.Count > 0)
- {
- e.Cancel = true;
- }
- }
- private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
- {
- if (entityGrid1.Rows.Count == 0)
- {
- MessageUtil.ShowWarning("请先维护首日检数据!");
- return;
- }
- string mscPline = ultraGrid1.ActiveRow.GetValue("MSC_PLINE");
- string processCode = ultraGrid1.ActiveRow.GetValue("PROCESS_CODE");
- CraftOrdFdPicSmpFrm picSmp = new CraftOrdFdPicSmpFrm(ordLnPk, mscPline, processCode, _ob);
- picSmp.ShowDialog();
- }
- /// <summary>
- /// 复制
- /// </summary>
- public void Copy()
- {
- var chkRows = entityGrid1.Rows.Where(a => a.GetValue("chk") == "True");
- if (chkRows.Count() == 0)
- {
- MessageUtil.ShowWarning("请选择记录后,再进行操作!");
- return;
- }
- ultraGrid1.UpdateData();
- DataTable copyTable = CreateTableByEntity((CrafOrdFdPicEntity)chkRows.FirstOrDefault().ListObject);
- foreach (UltraGridRow row in entityGrid1.Rows)
- {
- if (row.GetValue("Chk") != "True") continue;
- DataRow dr = copyTable.NewRow();
- CopyEntityToRow((CrafOrdFdPicEntity)row.ListObject, dr);
- dr["ORD_SEQ"] = "";
- copyTable.Rows.Add(dr);
- }
- DataTable[] copyTabs = new DataTable[] { copyTable, new DataTable() };
- Clipboard.SetData("Pic", copyTabs);
- }
- /// <summary>
- /// 粘贴
- /// </summary>
- public void Paste()
- {
- if (ultraGrid1.ActiveRow == null || ultraGrid1.ActiveRow.GetValue("PIC") == "")
- {
- MessageUtil.ShowWarning("请选择一条成分标准索引码!");
- return;
- }
- DataTable[] copyTabs = (DataTable[])Clipboard.GetData("Pic");
- if (copyTabs == null)
- {
- MessageUtil.ShowWarning("没有数据,请复制后再进行操作!");
- return;
- }
- DataTable copyTab = copyTabs[0];
- DataTable copyTab2 = copyTabs[1];
- if (copyTab == null || copyTab.Rows.Count == 0)
- {
- MessageUtil.ShowWarning("没有数据,请复制后再进行操作!");
- return;
- }
- dataTable1.BeginInit();
- List<CrafOrdFdPicEntity> data = (List<CrafOrdFdPicEntity>)CraftOrdDesignStdPicEntityBindingSource.DataSource;
- CrafOrdFdPicEntity activeFd = null;
- foreach (DataRow row in copyTab.Rows)
- {
- CrafOrdFdPicEntity fd = new CrafOrdFdPicEntity();
- fd.Chk = true;
- CopyRowToEntity(row, fd);
- data.Add(fd);
- activeFd = fd;
- }
- CraftOrdDesignStdPicEntityBindingSource.ResetBindings(false);
- //CraftOrdDesignStdCicEntityBindingSource.DataSource = data;
- dataTable1.EndInit();
- entityGrid1.UpdateData();
- if (entityGrid1.Rows.Count > 0)
- {
- entityGrid1.Rows[entityGrid1.Rows.Count - 1].Activate();
- }
- }
- private string GetLineName(string name)
- {
- string lineName = "";
- for (int i = 0; i < name.Length; i++)
- {
- if (i == 0)
- {
- lineName += name[i];
- }
- else
- {
- if (name[i] >= 'A' && name[i] <= 'Z')
- {
- lineName += '_';
- lineName += name[i];
- }
- else
- {
- lineName += name[i];
- }
- }
- }
- return lineName.ToUpper();
- }
- private string GetName(string lineName)
- {
- string[] strs = lineName.Split('_');
- string name = "";
- for (int i = 0; i < strs.Length; i++)
- {
- name += strs[i].Substring(0, 1).ToUpper() + strs[i].Substring(1).ToLower();
- }
- return name;
- }
- private DataTable CreateTableByEntity(CrafOrdFdPicEntity fdEntity)
- {
- DataTable dt = new DataTable();
- PropertyInfo[] srcPropertyInfos = fdEntity.GetType().GetProperties();
- foreach (PropertyInfo srcPropertyInfo in srcPropertyInfos)
- {
- dt.Columns.Add(GetLineName(srcPropertyInfo.Name));
- }
- return dt;
- }
- private void CopyEntityToRow(CrafOrdFdPicEntity fdEntity, DataRow desRow)
- {
- PropertyInfo[] pros = fdEntity.GetType().GetProperties();
- foreach (PropertyInfo pro in pros)
- {
- desRow[GetLineName(pro.Name)] = pro.GetValue(fdEntity, null);
- }
- }
- private void CopyRowToEntity(DataRow row, CrafOrdFdPicEntity fdEntity)
- {
- PropertyInfo[] pros = fdEntity.GetType().GetProperties();
- foreach (DataColumn dc in row.Table.Columns)
- {
- if (dc.ColumnName == "CREATE_TIME") continue;
- PropertyInfo pro = fdEntity.GetType().GetProperty(GetName(dc.ColumnName));
- if (pro != null)
- {
- pro.SetValue(fdEntity, ConvertDataType(pro.PropertyType, row[dc.ColumnName].ToString()), null);
- }
- }
- }
- private object ConvertDataType(Type type, object objValue)
- {
- if (type == typeof(bool))
- {
- bool result;
- if (bool.TryParse(objValue.ToString(), out result))
- {
- return result;
- }
- else
- {
- return false;
- }
- }
- else if (type == typeof(bool?))
- {
- bool result;
- if (bool.TryParse(objValue.ToString(), out result))
- {
- return result;
- }
- else
- {
- return null;
- }
- }
- else if (type == typeof(int?))
- {
- if (objValue.ToString2() == "")
- {
- return null;
- }
- else
- {
- return int.Parse(objValue.ToString());
- }
- }
- else if (type == typeof(long?))
- {
- if (objValue.ToString2() == "")
- {
- return null;
- }
- else
- {
- return long.Parse(objValue.ToString());
- }
- }
- else if (type == typeof(short?))
- {
- if (objValue.ToString2() == "")
- {
- return null;
- }
- else
- {
- return short.Parse(objValue.ToString());
- }
- }
- else if (type == typeof(float?))
- {
- if (objValue.ToString2() == "")
- {
- return null;
- }
- else
- {
- return float.Parse(objValue.ToString());
- }
- }
- else if (type == typeof(double?))
- {
- if (objValue.ToString2() == "")
- {
- return null;
- }
- else
- {
- return double.Parse(objValue.ToString());
- }
- }
- else if (type == typeof(decimal?))
- {
- if (objValue.ToString2() == "")
- {
- return null;
- }
- else
- {
- return decimal.Parse(objValue.ToString());
- }
- }
- else if (type == typeof(DateTime?))
- {
- if (objValue.ToString2() == "")
- {
- return null;
- }
- else
- {
- return DateTime.Parse(objValue.ToString());
- }
- }
- else
- {
- return objValue == null ? "" : objValue.ToString();
- }
- }
- }
- }
|