| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Lims.Port.封装类.方法;
- using Core.StlMes.Client.Lims.Port.数据管理.实体类;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Lims.Port
- {
- public partial class FrmMilBatchSampleNew : FrmBase
- {
- public FrmMilBatchSampleNew()
- {
- InitializeComponent();
- }
- private string plineCode = "";//产线
- List<CraftSamplingMEntity> dtPlanM = null;//检验计划主信息
- List<CraftSamplingDetailEntity> dtPlanDetial = null;//检验计划从信息
- List<CraftSamplingMEntity> dtPlanM1 = null;//分批详细方案
- int minBatchNum = 0;//最小分批数量
- private string batchNoZ = "";//性能批号产线标识
- private void FrmMilBatchSampleNew_Load(object sender, EventArgs e)
- {
- DateTime now = DateTime.Now;
- DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
- DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
- this.RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- this.RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraGrid2.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PortMilBatchSampleResultEntity>(this.ultraGrid3.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraGrid5.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraGrid6.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PortMilBatchSampleResultEntity>(this.ultraGrid7.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraGrid9.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraGrid10.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraGrid12.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraGrid13.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid15.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid16.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PortMilBatchSampleResultEntity>(this.ultraGrid17.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid18.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid19.DisplayLayout.Bands[0]);
- plineCode = PublicPort.GetPCode(this.ValidDataPurviewIds, ob);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQueryPlan();
- break;
- case"QueryRepeate":
- doQueryRepeate();
- break;
- case "BatchSeting":
- batchSeting();
- break;
- case "CancelBatchSeting":
- cancelBatchSeting();
- break;
- case"OprocessBatch":
- oprocessBatch();
- break;
- case "CancelOprocessBatch":
- cancelBatch();
- break;
- case"GetSample":
- getSample();
- break;
- case"CancelGetSample":
- cancelGetSample();
- break;
- case "Confirm":
- confirm();
- break;
- case "CancelConfirm":
- cancelConfirm();
- break;
- case "ReGetSample":
- reGetSample();
- break;
- case "CancelReGetSample":
- cancelReGetSample();
- break;
- case"RepeateFrim":
- repeateFrim();
- break;
- case "CancelRepeateFrim":
- cancelRepeateFrim();
- break;
- case"Print":
- printTrust();
- break;
- case"PrintLable":
- printLable();
- break;
- case"PrintReLable":
- printReLable();
- break;
- case "PrintRe":
- printReTrust();
- break;
- case "Close":
- close();
- break;
- }
- }
-
-
- /// <summary>
- /// 撤销复取样
- /// </summary>
- private void cancelReGetSample()
- {
- this.ultraGrid15.UpdateData();
- this.ultraGrid17.UpdateData();
- UltraGridRow uRow = this.ultraGrid15.ActiveRow;
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource2.DataSource as List<PortMilBatchSampleResultEntity>;
- if (uRow == null || lists.Count <= 0)
- {
- return;
- }
-
- PipeCheckconsignNoqualifiedEntity milPlans = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
- string milPlanEntity = JSONFormat.Format(milPlans);
- List<string> portMilEntity = lists.Where(p => p.ResamplePipeLenA != "" || p.ResamplePipeLenB != "").Select(JSONFormat.Format).ToList();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "cancelReGetSample";
- ccp.ServerParams = new object[] { milPlanEntity, portMilEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- doQueryRepeate();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 复取样
- /// </summary>
- private void reGetSample()
- {
- this.ultraGrid15.UpdateData();
- this.ultraGrid17.UpdateData();
- UltraGridRow uRow = this.ultraGrid15.ActiveRow;
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource2.DataSource as List<PortMilBatchSampleResultEntity>;
- if (uRow == null || lists.Count <= 0)
- {
- return;
- }
- if (lists.Any(p => p.Chk == true && p.ResamplePipeLenA == "" && p.ResamplePipeLenB == ""))
- {
- MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行复取样完成!");
- return;
- }
- if (lists.Any(p => p.Chk == true && !StringUtil.IsInt32(p.ResamplePipeLenA) && !StringUtil.IsInt32(p.ResamplePipeLenB)))
- {
- MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!");
- return;
- }
- PipeCheckconsignNoqualifiedEntity milPlans = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
- string milPlanEntity = JSONFormat.Format(milPlans);
- List<string> portMilEntity = lists.Where(p=>p.Chk).Select(JSONFormat.Format).ToList();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "reGetSample";
- ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("复取样完成!"))
- {
- doQueryRepeate();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
-
-
-
- /// <summary>
- /// 查询可复取样信息
- /// </summary>
- private void doQueryRepeate()
- {
- string startTime = "";
- string endTim = "";
- string lotNo = "";
- string judgeNo = "";
- if (this.chkRegTime.Checked)
- {
- startTime = this.RegStartTime.Value.ToString();
- endTim = this.RegEndTime.Value.ToString();
- }
- if (chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
- {
- lotNo = this.txtLotNo.Text;
- }
- if (chkJudgeNo.Checked && this.txtJudgeNo.Text.Trim() != "")
- {
- judgeNo = this.txtJudgeNo.Text;
- }
- ArrayList parm = new ArrayList();
- parm.Add(startTime);
- parm.Add(endTim);
- parm.Add(lotNo);
- parm.Add(judgeNo);
- if(ultraTabControl1.SelectedTab.Key == "4")
- {
- parm.Add("0");
- }
- else if (ultraTabControl1.SelectedTab.Key == "5")
- {
- parm.Add("1");
- }
- List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeate", new object[] { parm, plineCode }, this.ob);
- if (ultraTabControl1.SelectedTab.Key == "4")
- {
- pipeCheckconsignNoqualifiedEntityBindingSource.DataSource = listSource;
- }
- else if (ultraTabControl1.SelectedTab.Key == "5")
- {
- pipeCheckconsignNoqualifiedEntityBindingSource3.DataSource = listSource;
- }
-
- }
-
- /// <summary>
- /// 打印标签
- /// </summary>
- private void printLable()
- {
- this.ultraGrid12.UpdateData();
- UltraGridRow uRow = this.ultraGrid12.ActiveRow;
- if (uRow == null) return;
- string checkNo = uRow.Cells["CheckNo"].Text.Trim();
- string strurl = "";
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepEntrustLabel.cpt" + "&CHECK_NO=" + checkNo + "&JUDGE_STOVE_NO=" + uRow.Cells["JudgeStoveNoDesc"].Text.Trim() + "&PROCESS_CODE=D";
- FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Text = "样管号标签";
- fBug.Show();
- }
- /// <summary>
- /// 打印复样标签
- /// </summary>
- private void printReLable()
- {
- this.ultraGrid18.UpdateData();
- UltraGridRow uRow = this.ultraGrid18.ActiveRow;
- if (uRow == null) return;
- string checkNo = "F" + uRow.Cells["CheckNo"].Text.Trim();
- string strurl = "";
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepEntrustLabel.cpt" + "&CHECK_NO=" + checkNo;
- FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Text = "样管号标签";
- fBug.Show();
- }
- /// <summary>
- /// 打印
- /// </summary>
- private void printTrust()
- {
- this.ultraGrid12.UpdateData();
- UltraGridRow uRow = this.ultraGrid12.ActiveRow;
- if (uRow == null) return;
- string checkNo = uRow.Cells["CheckNo"].Text.Trim();
- string orderNo = uRow.Cells["ContractNo"].Text.Trim();
- string strurl = "";
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPortCheckConsignOrder.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo + "&orderNo=" + orderNo;
- FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Text = "检验委托单";
- fBug.Show();
- }
- /// <summary>
- /// 打印复样委托单
- /// </summary>
- private void printReTrust()
- {
- this.ultraGrid18.UpdateData();
- UltraGridRow uRow = this.ultraGrid18.ActiveRow;
- if (uRow == null) return;
- string checkNo = "F" + uRow.Cells["CheckNo"].Text.Trim();
- string orderNo = uRow.Cells["ContractNo"].Text.Trim();
- string strurl = "";
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPortCheckConsignOrder.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo + "&orderNo=" + orderNo;
- FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Text = "检验委托单";
- fBug.Show();
- }
-
- private void close()
- {
- this.Close();
- }
-
-
- /// <summary>
- /// 分批取样完成
- /// </summary>
- private void batchSeting()
- {
- this.ultraGrid1.UpdateData();
- this.ultraGrid3.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
- if (uRow == null || lists.Count <= 0)
- {
- return;
- }
- if (lists.Any(p => p.BatchNo == ""))
- {
- MessageUtil.ShowTips("还有未分配批号管材,不允许进行分批完成!");
- return;
- }
- if (lists.Any(p => p.Chk == true && p.SamplePipeLenA == "" && p.SamplePipeLenB == ""))
- {
- MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行分批完成!");
- return;
- }
- if (lists.Any(p => p.Chk == true && !StringUtil.IsInt32(p.SamplePipeLenA) && !StringUtil.IsInt32(p.SamplePipeLenB)))
- {
- MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!");
- return;
- }
- MilPlanEntity milPlans = (MilPlanEntity)uRow.ListObject;
- string milPlanEntity = JSONFormat.Format(milPlans);
- List<string> portMilEntity = lists.Select(JSONFormat.Format).ToList();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "batchSeting";
- ccp.ServerParams = new object[] { milPlanEntity, portMilEntity,UserInfo.GetUserName(),UserInfo.GetUserGroup(),UserInfo.GetUserOrder() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("分批取样完成!"))
- {
-
- doQueryPlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 分批完成
- /// </summary>
- private void oprocessBatch()
- {
- this.ultraGrid1.UpdateData();
- this.ultraGrid3.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
- if (uRow == null || lists.Count <= 0)
- {
- return;
- }
- if (lists.Any(p => p.BatchNo == ""))
- {
- MessageUtil.ShowTips("还有未分配批号管材,不允许进行分批完成!");
- return;
- }
- MilPlanEntity milPlans = (MilPlanEntity)uRow.ListObject;
- string milPlanEntity = JSONFormat.Format(milPlans);
- List<string> portMilEntity = lists.Select(JSONFormat.Format).ToList();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "oprocessBatch";
- ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("分批完成!"))
- {
- doQueryPlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 撤销分批
- /// </summary>
- private void cancelBatch()
- {
- this.ultraGrid1.UpdateData();
- this.ultraGrid3.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
- MilPlanEntity milPlans = (MilPlanEntity)uRow.ListObject;
- string milPlanEntity = JSONFormat.Format(milPlans);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "cancelBatch";
- ccp.ServerParams = new object[] { milPlanEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- doQueryPlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 撤销分批取样
- /// </summary>
- private void cancelBatchSeting()
- {
- this.ultraGrid5.UpdateData();
- UltraGridRow uRow = this.ultraGrid5.ActiveRow;
- if (uRow == null) return;
- MilPlanEntity milPlans = (MilPlanEntity)uRow.ListObject;
- string milPlanEntity = JSONFormat.Format(milPlans);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "cancelBatchSeting";
- ccp.ServerParams = new object[] { milPlanEntity};
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- doQueryPlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 撤销取样完成
- /// </summary>
- private void cancelGetSample()
- {
- this.ultraGrid5.UpdateData();
- UltraGridRow uRow = this.ultraGrid5.ActiveRow;
- if (uRow == null) return;
- MilPlanEntity milPlans = (MilPlanEntity)uRow.ListObject;
- string milPlanEntity = JSONFormat.Format(milPlans);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "cancelGetSample";
- ccp.ServerParams = new object[] { milPlanEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- doQueryPlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 取样完成
- /// </summary>
- private void getSample()
- {
- this.ultraGrid1.UpdateData();
- this.ultraGrid3.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
- if (uRow == null || lists.Count <= 0)
- {
- return;
- }
- if (lists.Any(p => p.Chk == true && p.SamplePipeLenA == "" && p.SamplePipeLenB == ""))
- {
- MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行取样完成!");
- return;
- }
- if (lists.Any(p => p.Chk == true && !StringUtil.IsInt32(p.SamplePipeLenA) && !StringUtil.IsInt32(p.SamplePipeLenB)))
- {
- MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!");
- return;
- }
- MilPlanEntity milPlans = (MilPlanEntity)uRow.ListObject;
- string milPlanEntity = JSONFormat.Format(milPlans);
- List<string> portMilEntity = lists.Where(p => p.Chk).Select(JSONFormat.Format).ToList();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "getSample";
- ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder(), this.cmbSampleType.Value.ToString() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("取样完成!"))
- {
- doQueryPlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 确认委托
- /// </summary>
- private void confirm()
- {
- this.ultraGrid9.UpdateData();
- this.ultraGrid10.UpdateData();
- this.ultraGrid11.UpdateData();
- this.ultraGrid22.UpdateData();
- string txtRemark = "";
- UltraGrid ug = null;
- DataTable dataTable = null;
- string craftSource = "";
- if (ultraTabControl2.SelectedTab.Key == "0")
- {
- ug = ultraGrid11;
- dataTable = dataTable3;
- craftSource = "0";
-
- }
- else if (ultraTabControl2.SelectedTab.Key == "1")
- {
- ug = ultraGrid22;
- dataTable = dataTable5;
- craftSource = "1";
- }
- UltraGridRow uRow = this.ultraGrid9.ActiveRow;
- if (uRow == null) return;
- if (ug.Rows.Count == 0) return;
- //List<CraftOrdDesignStdCicEntity> chemSource = EntityHelper.GetData<CraftOrdDesignStdCicEntity>(
- //"com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryChem", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, BaseMethod.getJudgeStoveNo(uRow.Cells["JudgeStoveNo"].Text) }, this.ob);//查询成分详细信息
- //List<CraftOrdDesignStdPicEntity> phySource = EntityHelper.GetData<CraftOrdDesignStdPicEntity>(
- //"com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPhy", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, BaseMethod.getJudgeStoveNo(uRow.Cells["JudgeStoveNo"].Text) }, this.ob);//查询理化详细信息
- MilPlanEntity milTity = (MilPlanEntity)uRow.ListObject;
- milTity.CraftSource = craftSource;
- string milEntity = JSONFormat.Format(milTity);
- List<List<string>> parmList = new List<List<string>>();
- foreach (UltraGridRow row in ug.Rows)
- {
- int m = 0;
- List<string> list = new List<string>();
- list.Add(row.Cells["BATCH_NO"].Text);
- list.Add(row.Cells["MAT_NO"].Text);
- list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text);
- list.Add(row.Cells["SAMPLE_POSTION"].Text);
- for (int j = 5; j < dataTable.Columns.Count; j++)
- {
- if (row.Cells[j].Value == "√")
- {
- list.Add(row.Cells[j].Column.Key);
- m = m + 1;
- }
- }
- if (m > 0)
- {
- parmList.Add(list);
- }
-
- }
- List<List<string>> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault()
- ).ToList();
- if (dtPlanM != null)
- {
- if (dtPlanM.Any())
- {
- txtRemark = dtPlanM.Select(p => p.Remark).Distinct().Aggregate((a, b) => a + " " + b);
- }
- }
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "confirm";
- ccp.ServerParams = new object[] { milEntity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment(), txtRemark };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("委托成功!"))
- {
- doQueryPlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 复取样委托
- /// </summary>
- private void repeateFrim()
- {
- this.ultraGrid18.UpdateData();
- this.ultraGrid20.UpdateData();
- UltraGridRow uRow = this.ultraGrid18.ActiveRow;
- if (uRow == null) return;
- PipeCheckconsignNoqualifiedEntity pipeCheckEntity = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
- string pipeTity = JSONFormat.Format(pipeCheckEntity);
-
- List<List<string>> parmList = new List<List<string>>();
- foreach (UltraGridRow row in this.ultraGrid20.Rows)
- {
- List<string> list = new List<string>();
- list.Add(row.Cells["BATCH_NO"].Text);
- list.Add(row.Cells["MAT_NO"].Text);
- list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text);
- list.Add(row.Cells["SAMPLE_POSTION"].Text);
- for (int j = 5; j < dataTable5.Columns.Count; j++)
- {
- if (row.Cells[j].Value == "√")
- {
- list.Add(row.Cells[j].Column.Key);
- }
- }
- parmList.Add(list);
- }
- List<List<string>> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault()
- ).ToList();
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "repeateFrim";
- ccp.ServerParams = new object[] { pipeTity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("复取样委托成功!"))
- {
- doQueryRepeate();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 取消确认
- /// </summary>
- private void cancelConfirm()
- {
- this.ultraGrid12.UpdateData();
- UltraGridRow uRow = this.ultraGrid12.ActiveRow;
- if (uRow == null) return;
- MilPlanEntity milTity = (MilPlanEntity)uRow.ListObject;
- milTity.JudgeStoveNo = milTity.JudgeStoveNoDesc + "-01";
- string milPlanEntity = JSONFormat.Format(milTity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "cancelConfirm";
- ccp.ServerParams = new object[] { milPlanEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销委托成功!"))
- {
- doQueryPlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 撤销复取样委托
- /// </summary>
- private void cancelRepeateFrim()
- {
- this.ultraGrid18.UpdateData();
- UltraGridRow uRow = this.ultraGrid18.ActiveRow;
- if (uRow == null) return;
- PipeCheckconsignNoqualifiedEntity pipeNoTity = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
- string pipeNoEntity = JSONFormat.Format(pipeNoTity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.port.mil.FrmMilBatchSampleNew";
- ccp.MethodName = "cancelRepeateFrim";
- ccp.ServerParams = new object[] { pipeNoEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销复取样委托成功!"))
- {
- doQueryRepeate();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 查询炉计划
- /// </summary>
- private void doQueryPlan()
- {
- string startTime = "";
- string endTim = "";
- string lotNo = "";
- string judgeNo = "";
- List<MilPlanEntity> listSource = null;
- if (this.chkRegTime.Checked)
- {
- startTime = this.RegStartTime.Value.ToString();
- endTim = this.RegEndTime.Value.ToString();
- }
- if (chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
- {
- lotNo = this.txtLotNo.Text;
- }
- if (chkJudgeNo.Checked && this.txtJudgeNo.Text.Trim() != "")
- {
- judgeNo = this.txtJudgeNo.Text;
- }
- ArrayList parm = new ArrayList();
- parm.Add(startTime);
- parm.Add(endTim);
- parm.Add(lotNo);
- parm.Add(judgeNo);
- if (this.ultraTabControl1.SelectedTab.Key == "0")
- {
- parm.Add("0");
- listSource = EntityHelper.GetData<MilPlanEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPlan", new object[] { parm, plineCode }, this.ob);
- }
- else if(this.ultraTabControl1.SelectedTab.Key == "1")
- {
- parm.Add("2");
- listSource = EntityHelper.GetData<MilPlanEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPlan", new object[] { parm, plineCode }, this.ob);
- }
- else if (this.ultraTabControl1.SelectedTab.Key == "2")
- {
- parm.Add("2");
- listSource = EntityHelper.GetData<MilPlanEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPlan2", new object[] { parm, plineCode }, this.ob);
- }
- else if (this.ultraTabControl1.SelectedTab.Key == "3")
- {
- parm.Add("3");
- listSource = EntityHelper.GetData<MilPlanEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPipeBaseInfo", new object[] { parm, plineCode }, this.ob);
- }
-
- if (this.ultraTabControl1.SelectedTab.Key == "0")
- {
- portMilBatchSampleResultEntityBindingSource.Clear();
- MilPlanEntity1bindingSource.Clear();
- dataTable1.Clear();
- MilPlanEntitybindingSource.DataSource = listSource;
- }
- else if (this.ultraTabControl1.SelectedTab.Key == "1")
- {
- portMilBatchSampleResultEntityBindingSource1.Clear();
- milPlanEntityBindingSource2.Clear();
- dataTable2.Clear();
- milPlanEntityBindingSource1.DataSource = listSource;
- }
- else if (this.ultraTabControl1.SelectedTab.Key == "2")
- {
- milPlanEntityBindingSource4.Clear();
- dataTable3.Clear();
- milPlanEntityBindingSource3.DataSource = listSource;
- }
- else if (this.ultraTabControl1.SelectedTab.Key == "3")
- {
- milPlanEntityBindingSource6.Clear();
- dataTable4.Clear();
- milPlanEntityBindingSource5.DataSource = listSource;
- }
-
- }
- private void chkRegTime_CheckedChanged(object sender, EventArgs e)
- {
- this.RegStartTime.Enabled = this.RegEndTime.Enabled = this.chkRegTime.Checked;
- }
- private void chkLotNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txtLotNo.Enabled = this.chkLotNo.Checked;
- }
- private void chkJudgeNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txtJudgeNo.Enabled = this.chkJudgeNo.Checked;
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- this.ultraGrid1.UpdateData();
- if (dtPlanDetial != null)
- {
- dtPlanDetial.Clear();
- }
- if (dtPlanM != null)
- {
- dtPlanM.Clear();
- }
- txt_BatchMax.Text = "0";
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- batchNoZ = doQueryBacthPline(uRow);
- doQueryBasePlan(uRow);
- doQueryRack(uRow);
- dtPlanDetial = doQueryCheckPlanDetila(uRow);
- if (dtPlanDetial != null && dtPlanDetial.Count() > 0)
- {
- var s = dtPlanDetial.Where(p => p.Rate == "408601" || p.Rate == "408608").ToList();
- if (s.Any())
- {
- dtPlanM = doQueryCheckPlan(uRow, "1");
- }
- else
- {
- dtPlanM = doQueryCheckPlan(uRow, "0");
- }
- }
-
-
-
- ultraGrid3.Update();
- ultraGrid3.DataBind();
- ultraGrid3_CellChange(null, null);
- if (dtPlanM == null || dtPlanDetial == null || dtPlanM.Count == 0 || dtPlanDetial.Count == 0)
- {
- txtBATCH_MIN.Text = "";
- txtBATCH_MIN.Text = this.txtPIPE_NUM.Text;//参考批数;
- return;
- }
- //bool isFlag = dtPlanDetial.Any(p => p.Rate == "408607" || p.Rate == "408608" || p.Rate == "408601");
- //if (isFlag)
- //{
-
- //}
- //else
- //{
- //if (int.Parse(uRow.Cells["IsBatch"].Text) >= 1)
- //{
- // txt_BatchMax.Text = this.ultraGrid4.Rows[0].Cells["NUM"].Text;
- // txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / int.Parse(this.txt_BatchMax.Text))).ToString();
- //}
- //else
- //{
- minBatchNum = dtPlanDetial.Min(p => p.BatchCnt == null ? int.Parse(this.txtPIPE_NUM.Text) : (int)(p.BatchCnt));//检验计划最小分批数量
- txt_BatchMax.Text = minBatchNum.ToString();//分批上限
- txtREMARK.Text = dtPlanM.Select(p => p.Remark).Distinct().Aggregate((a, b) => a + " " + b);
- if (minBatchNum == 0)
- {
- txtBATCH_MIN.Text = "0";
- }
- else
- {
- txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / minBatchNum)).ToString();//参考批数
- }
- ultraGrid3.Update();
- ultraGrid3.DataBind();
- ultraGrid3_CellChange(null, null);
- //}
-
- //}
- }
- private string doQueryBacthPline(UltraGridRow uRow)
- {
- string ss = "";
- DataTable ds = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryBacthNo", new object[] { uRow.Cells["PlineCode"].Text }, ob);
- if (ds.Rows.Count > 0)
- {
- ss = ds.Rows[0][0].ToString();
- }
- return ss;
- }
-
- private void initBindTable()
- {
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource1.DataSource as List<PortMilBatchSampleResultEntity>;
- dataTable2.Rows.Clear();
- if (lists == null || lists.Count <= 0) return;
- foreach (var list in lists.Where(p => p.BatchNo != "").GroupBy(p => p.BatchNo))
- {
- DataRow newRow;
- newRow = dataTable2.NewRow();
- newRow["PHY_BATCH_NO"] = list.Key;
- newRow["START_SEQ"] = list.Min(p => p.Seq);
- newRow["END_SEQ"] = list.Max(p => p.Seq);
- newRow["NUM"] = list.Count();
- newRow["SAMPLE_NUM"] = list.Count(p => p.SamplePipeLenA != "" || p.SamplePipeLenB != "");
- dataTable2.Rows.Add(newRow);
- }
- ultraGrid8.Update();
- }
- /// <summary>
- /// 自动分批
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnAuto_Click(object sender, EventArgs e)
- {
- this.ultraGrid4.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
- string target = uRow.Cells["Target"].Text;
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
-
- if (lists==null || lists.Count<=0)
- {
- MessageUtil.ShowTips("不存在有效管号队列,不允许进行分批!");
- return;
- }
- if (dtPlanM == null || dtPlanM.Count <= 0)
- {
- MessageUtil.ShowTips("检验计划未确认,不能自动分批!");
- return;
- }
- int maxBacthNum = int.Parse(this.txt_BatchMax.Text.ToString3());//分批上限
- int maxBacth = dtPlanM.Max(p => p.BatchNo == null ? 1 : (int)(p.BatchNo));//取主表最大方案
- string sampleLen = "";//样管长度
- string sampleCount = "";//样管数量
-
-
- //为批号赋值
- for (int i = 0; i < int.Parse(this.txtBATCH_MIN.Text);i++)
- {
- var list = dtPlanM1.Where(p => p.BatchNo == (i+1 > maxBacth ? maxBacth : i+1)).ToList();
- var listA = list.Where(p => p.Position != "401202").ToList();//非B端
- //var listA = list.Where(p => p.Position != "401201").ToList();
- var listB = list.Where(p => p.Position == "401202").ToList();//B端
- int m = 0;
- for (int k = 0; k < listA.Count; k++)
- {
- var crft = listA[k];
- int a = 1;//非A端的都只取一个样
- /*if (crft.Position.Equals("401201"))
- {
- a = (int)crft.SampleCount;//样管数量
- }*/
- a = (int)crft.SampleCount;//样管数量 8-13 所有的按照工艺取样数量取A端
- for (int j = 0; j < a; j++,m++)
- {
- if (lists.Count > m + i * maxBacthNum)
- {
- lists[m + i * maxBacthNum].SamplePipeLenA = crft.SampleLength.ToString();
- lists[m + i * maxBacthNum].PhyCodeGroup = crft.PhyCodeGroup.ToString();
- lists[m + i * maxBacthNum].Chk = true;
- lists[m + i * maxBacthNum].CraftSource = "0";
- }
- }
- }
- m = 0;
- for (int k = 0; k < listB.Count; k++)
- {
- var crft = listB[k];
- int a = (int)crft.SampleCount;//样管数量
- for (int j = 0; j < a; j++, m++)
- {
- if (lists.Count > m + i * maxBacthNum)
- {
- lists[m + i * maxBacthNum].SamplePipeLenB = crft.SampleLength.ToString();
- lists[m + i * maxBacthNum].PhyCodeGroupb = crft.PhyCodeGroup.ToString();
- lists[m + i * maxBacthNum].Chk = true;
- lists[m + i * maxBacthNum].CraftSource = "0";
- }
- }
- }
- if (target == "C")
- {
- lists.Skip(i * maxBacthNum).Take((i + 1) * maxBacthNum).ToList().ForEach(p => p.BatchNo = batchNoZ + "999");
- }
- else
- {
- lists.Skip(i * maxBacthNum).Take((i + 1) * maxBacthNum).ToList().ForEach(p => p.BatchNo = batchNoZ + (i + 1).ToString("000"));
- }
-
-
- }
-
- ultraGrid3.Update();
- ultraGrid3.DataBind();
- ultraGrid3_CellChange(null, null);
-
- }
- /// <summary>
- /// 人工分批
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnConfirm_Click(object sender, EventArgs e)
- {
- this.ultraGrid4.UpdateData();
- UltraGridRow row = this.ultraGrid1.ActiveRow;
- if (row == null) return;
- string target = row.Cells["Target"].Text; ;
- int sampleNum = 0;
- if (!StringUtil.IsInt32(this.txt_SampleNum.Text.Trim().ToString3()))
- {
- MessageUtil.ShowTips("样管数量需输入正整数!");
- return;
- }
- else
- {
- sampleNum = int.Parse(this.txt_SampleNum.Text.Trim().ToString3());
- }
- if (!StringUtil.IsInt32(txt_BatchMax.Text.ToString3()) || int.Parse(txt_BatchMax.Text.ToString3()) <= 0)
- {
- MessageUtil.ShowTips("人工分批输入的分批上限需为正整数!");
- return;
- }
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
- var m = lists.Where(p => p.BatchNo == "").ToList();//判断是否还未分配性能批号集合数据
- if (m.Count == 0)
- {
- return;
- }
- int Bathno = 1;
- for (int k = 0; k < int.Parse(this.txtBATCH_MIN.Text.ToString3()); k++)
- {
- int startSeq = int.Parse(ultraSTART_PIPE_NO.Text);//开始序号
- int endSeq = int.Parse(ultraEND_PIPE_NO.Text);//结束序号
- var lists1 = lists.Where(p => p.BatchNo != "").ToList();
- if (lists1.Any())
- {
- Bathno = lists1.Max(p => int.Parse(p.BatchNo.Substring(2, 3))) + 1;
- }
- if (target == "C")
- {
- m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.BatchNo = batchNoZ + "999");//赋值批号
- }
- else
- {
- m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.BatchNo = batchNoZ + Bathno.ToString("000"));//赋值批号
- }
-
- m.Take(sampleNum).ToList().ForEach(p => p.Chk = true);
-
- ultraSTART_PIPE_NO.Text = m.First().Seq.ToString();//初始序号 跳过已赋值批号数据
- ultraEND_PIPE_NO.Text = m.Take(int.Parse(txt_BatchMax.Text.ToString3())).Last().Seq.ToString();//结束序号
- ultraGrid3.Update();
- ultraGrid3.DataBind();
- ultraGrid3_CellChange(null, null);
- m = lists.Where(p => p.BatchNo == "").ToList();//判断是否还未分配性能批号集合数据
- if (m.Count == 0)
- {
- return;
- }
- }
- }
- /// <summary>
- /// 仅分批
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void buttonBatchNo_Click(object sender, EventArgs e)
- {
- this.ultraGrid4.UpdateData();
- UltraGridRow row = this.ultraGrid1.ActiveRow;
- if(row == null)return;
- string target = row.Cells["Target"].Text;
- if (!StringUtil.IsInt32(txt_BatchMax.Text.ToString3()) || int.Parse(txt_BatchMax.Text.ToString3()) <= 0)
- {
- MessageUtil.ShowTips("人工分批输入的分批上限需为正整数!");
- return;
- }
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
- var m = lists.Where(p => p.BatchNo == "").ToList();//判断是否还未分配性能批号集合数据
- if (m.Count == 0)
- {
- return;
- }
- int Bathno = 1;
- int sampleNum = 0;
- for (int k = 0; k < int.Parse(this.txtBATCH_MIN.Text.ToString3()); k++)
- {
- int startSeq = int.Parse(ultraSTART_PIPE_NO.Text);//开始序号
- int endSeq = int.Parse(ultraEND_PIPE_NO.Text);//结束序号
- var lists1 = lists.Where(p => p.BatchNo != "").ToList();
- if (lists1.Any())
- {
- Bathno = lists1.Max(p => int.Parse(p.BatchNo.Substring(2, 3))) + 1;
- }
- if (target == "C")
- {
- m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.BatchNo = batchNoZ + "999");//赋值批号
- }
- else
- {
- m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.BatchNo = batchNoZ + Bathno.ToString("000"));//赋值批号
- }
-
- m.Take(sampleNum).ToList().ForEach(p => p.Chk = true);
- ultraSTART_PIPE_NO.Text = m.First().Seq.ToString();//初始序号 跳过已赋值批号数据
- ultraEND_PIPE_NO.Text = m.Take(int.Parse(txt_BatchMax.Text.ToString3())).Last().Seq.ToString();//结束序号
- ultraGrid3.Update();
- ultraGrid3.DataBind();
- ultraGrid3_CellChange(null, null);
- m = lists.Where(p => p.BatchNo == "").ToList();//判断是否还未分配性能批号集合数据
- if (m.Count == 0)
- {
- return;
- }
- }
- }
- /// <summary>
- /// 仅取样
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void buttonGetSample_Click(object sender, EventArgs e)
- {
- this.ultraGrid4.UpdateData();
- int sampleNum = 0;
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
- var m = lists.Where(p => p.BatchNo != "").ToList();//判断是否还未分配性能批号集合数据
- if (m.Count == 0)
- {
- return;
- }
- if (dtPlanM1.Count() == 0)
- {
- if (!StringUtil.IsInt32(this.txt_SampleNum.Text.Trim().ToString3()))
- {
- MessageUtil.ShowTips("样管数量需输入正整数!");
- return;
- }
- if (int.Parse(this.txt_SampleNum.Text.Trim().ToString3()) <= 0)
- {
- MessageUtil.ShowTips("取样时每批样管数应大于0");
- return;
- }
- else
- {
- sampleNum = int.Parse(this.txt_SampleNum.Text.Trim().ToString3());
- }
- foreach (var item in lists.GroupBy(p => p.BatchNo))
- {
- item.Take(sampleNum).ToList().ForEach(p => p.Chk = true);
- }
- }
- else
- {
- int maxBacthNum = int.Parse(this.ultraGrid4.Rows[0].Cells["NUM"].Text);//分批上限
- int maxBacth = dtPlanM.Max(p => p.BatchNo == null ? 1 : (int)(p.BatchNo));//取主表最大方案
- for (int i = 0; i < lists.GroupBy(p => p.BatchNo).Count(); i++)
- {
- var list = dtPlanM1.Where(p => p.BatchNo == (i + 1 > maxBacth ? maxBacth : i + 1)).ToList();
- var listA = list.Where(p => p.Position == "401201").ToList();
- var listB = list.Where(p => p.Position == "401202").ToList();
- int s = 0;
- for (int k = 0; k < listA.Count; k++)
- {
- var crft = list[k];
- int a = (int)crft.SampleCount;//样管数量
- for (int j = 0; j < a; j++, s++)
- {
- if (lists.Count > s + i * maxBacthNum)
- {
- lists[s + i * maxBacthNum].SamplePipeLenA = crft.SampleLength.ToString();
- lists[s + i * maxBacthNum].PhyCodeGroup = crft.PhyCodeGroup.ToString();
- lists[s + i * maxBacthNum].Chk = true;
- }
- }
- }
- s = 0;
- for (int k = 0; k < listB.Count; k++)
- {
- var crft = list[k];
- int a = (int)crft.SampleCount;//样管数量
- for (int j = 0; j < a; j++, s++)
- {
- if (lists.Count > s + i * maxBacthNum)
- {
- lists[s + i * maxBacthNum].SamplePipeLenB = crft.SampleLength.ToString();
- lists[s + i * maxBacthNum].PhyCodeGroupb = crft.PhyCodeGroup.ToString();
- lists[s + i * maxBacthNum].Chk = true;
- }
- }
- }
- }
- }
-
- ultraGrid3.Update();
- ultraGrid3.DataBind();
- ultraGrid3_CellChange(null, null);
- }
- /// <summary>
- /// 查询检验计划子表
- /// </summary>
- /// <param name="uRow"></param>
- /// <returns></returns>
- private List<CraftSamplingDetailEntity> doQueryCheckPlanDetila(UltraGridRow uRow)
- {
- List<CraftSamplingDetailEntity> listSource = EntityHelper.GetData<CraftSamplingDetailEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryCheckPlanDetial", new object[] { uRow.Cells["OrdLnPk"].Text, uRow.Cells["ImpProcess"].Text, uRow.Cells["CraftSeq"].Text }, this.ob);//查询检验计划主表
- return listSource;
- }
- /// <summary>
- /// 查询检验计划主表
- /// </summary>
- /// <param name="uRow"></param>
- private List<CraftSamplingMEntity> doQueryCheckPlan(UltraGridRow uRow,string flag)
- {
- List<CraftSamplingMEntity> listSource = EntityHelper.GetData<CraftSamplingMEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryCheckPlan", new object[] { uRow.Cells["OrdLnPk"].Text, uRow.Cells["ImpProcess"].Text, uRow.Cells["CraftSeq"].Text, flag }, this.ob);//查询检验计划主表
- return listSource;
- }
- /// <summary>
- /// 查询炉计划基础信息
- /// </summary>
- /// <param name="row"></param>
- private void doQueryBasePlan(UltraGridRow row)
- {
- List<MilPlanEntity> listSource = null;
-
- if (this.ultraTabControl1.SelectedTab.Key == "0")
- {
- listSource = EntityHelper.GetData<MilPlanEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryBasePlan", new object[] { row.Cells["Id"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
- MilPlanEntity1bindingSource.DataSource = listSource;
- }
- else if (this.ultraTabControl1.SelectedTab.Key == "1")
- {
- listSource = EntityHelper.GetData<MilPlanEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryBasePlan", new object[] { row.Cells["Id"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
- milPlanEntityBindingSource2.DataSource = listSource;
- }
- else if (this.ultraTabControl1.SelectedTab.Key == "2")
- {
- listSource = EntityHelper.GetData<MilPlanEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryBasePlan", new object[] { row.Cells["Id"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
- milPlanEntityBindingSource4.DataSource = listSource;
- }else if(this.ultraTabControl1.SelectedTab.Key == "3")
- {
- listSource = EntityHelper.GetData<MilPlanEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryBasePlan1", new object[] { row.Cells["LotNo"].Text, row.Cells["JudgeStoveNoDesc"].Text, row.Cells["ContractNo"].Text }, this.ob);
- milPlanEntityBindingSource6.DataSource = listSource;
- }
- }
- /// <summary>
- /// 查询管号队列
- /// </summary>
- /// <param name="row"></param>
- private void doQueryRack(UltraGridRow row)
- {
- List<PortMilBatchSampleResultEntity> listSource = null;
- if (row.Cells["BackSlabFlag"].Text.Equals("2"))
- {
- listSource = EntityHelper.GetData<PortMilBatchSampleResultEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRack1", new object[] { row.Cells["LotNo"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
- }
- else
- {
- listSource = EntityHelper.GetData<PortMilBatchSampleResultEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRack", new object[] { row.Cells["Id"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
- }
-
- if (this.ultraTabControl1.SelectedTab.Key == "0")
- {
- portMilBatchSampleResultEntityBindingSource.DataSource = listSource;
- txtPIPE_NUM.Text = listSource.Count.ToString();
- }
- else if (this.ultraTabControl1.SelectedTab.Key == "1")
- {
- List<PortMilBatchSampleResultEntity> lists = listSource as List<PortMilBatchSampleResultEntity>;
- lists.Where(p => p.IsSamplePipe == "1").ToList().ForEach(p => p.Chk = true);
- portMilBatchSampleResultEntityBindingSource1.DataSource = lists;
- initBindTable();
- }
- }
- private void txt_BatchMax_ValueChanged(object sender, EventArgs e)
- {
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
- if (!StringUtil.IsInt32(this.txt_BatchMax.Text.Trim()))
- {
- return;
- }
- doQueryRack(uRow);
- dataTable1.Clear();
- if (int.Parse(this.txt_BatchMax.Text) == 0)
- {
- txtBATCH_MIN.Text = "0";
- }
- else
- {
- txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / int.Parse(this.txt_BatchMax.Text))).ToString();
- }
- if (dtPlanDetial != null)
- {
- if (dtPlanDetial.Count > 0)
- {
- //bool isBacthFlag = dtPlanDetial.Any(p => p.Rate == "408601" || p.Rate == "408608");//判断是否试样组有生产批
- //if (isBacthFlag)
- //{
- //}
- //else
- //{
- int maxBacth = dtPlanM.Max(p => p.BatchNum == null ? 1 : (int)(p.BatchNum));//取主表最大方案
- int batchNum = int.Parse(txtBATCH_MIN.Text);//实际批数
- dtPlanM1 = dtPlanM.Where(p => p.BatchNum == (batchNum > maxBacth ? maxBacth : batchNum)).OrderBy(p => p.PhyCodeGroup).OrderBy(p => p.SampleLength).ToList();//取具体方案
- //}
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
- if (lists == null || lists.Count() == 0)
- {
- return;
- }
- var lists1 = lists.Where(p => p.BatchNo == "").ToList();
- if (lists1.Any())
- {
- ultraSTART_PIPE_NO.Text = lists1.First().Seq.ToString();
- ultraEND_PIPE_NO.Text =
- lists1.Take(int.Parse(txt_BatchMax.Text)).Last().Seq.ToString();
- }
- else
- {
- ultraSTART_PIPE_NO.Text = "";
- ultraEND_PIPE_NO.Text = "";
- }
- }
- else
- {
- ultraSTART_PIPE_NO.Text = "1";
- ultraEND_PIPE_NO.Text = this.txt_BatchMax.Text;
- }
- }
-
- }
- private void ultraGrid3_CellChange(object sender, CellEventArgs e)
- {
- dataTable1.Rows.Clear();
- ultraGrid3.Update();
- ultraGrid3.UpdateData();
- List<PortMilBatchSampleResultEntity> lists = portMilBatchSampleResultEntityBindingSource.DataSource as List<PortMilBatchSampleResultEntity>;
- if (lists == null || lists.Count() <= 0) return;
- foreach (var list in lists.Where(p =>p.BatchNo != "").GroupBy(p => p.BatchNo))
- {
- DataRow newRow;
- newRow = dataTable1.NewRow();
- newRow["PHY_BATCH_NO"] = list.Key;
- newRow["START_SEQ"] = list.Min(p => p.Seq);
- newRow["END_SEQ"] = list.Max(p => p.Seq);
- newRow["NUM"] = list.Count();
- newRow["SAMPLE_NUM"] = list.Count(p => p.Chk);
- dataTable1.Rows.Add(newRow);
- }
- ultraGrid4.Update();
- //if (e.Cell.Column.Key.Equals("Chk"))
- //{
- // e.Cell.Row.Cells["CraftSource"].Value = "0";
- //}
- //else
- //{
- // e.Cell.Row.Cells["CraftSource"].Value = "";
- //}
-
- }
- private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
- {
- this.ultraGrid5.UpdateData();
- UltraGridRow uRow = this.ultraGrid5.ActiveRow;
- if (uRow == null) return;
- doQueryRack(uRow);
- doQueryBasePlan(uRow);
- }
- DataTable dtChem = new DataTable();
- DataTable dtPhy = new DataTable();
- private void ultraGrid9_AfterRowActivate(object sender, EventArgs e)
- {
- this.ultraGrid9.UpdateData();
- UltraGridRow uRow = this.ultraGrid9.ActiveRow;
- if (uRow == null) return;
- doQuerySampleRack(uRow, "0");//查询正常样样管信息
- doQuerySampleRack(uRow, "1");//查询首日检样管信息
- doQueryBasePlan(uRow);
- doQueryPhyChem(uRow, "0");//查询正常样成分、理化项目明细
- doQueryPhyChem(uRow, "1");//查询首日检成分、理化项目明细
- //if (dtPlanDetial != null && dtPlanDetial.Count() > 0)
- //{
- // var s = dtPlanDetial.Where(p => p.Rate == "408601" || p.Rate == "408608").ToList();
- // if (s.Any())
- // {
- // dtPlanM = doQueryCheckPlan(uRow, "1");
- // }
- // else
- // {
- // dtPlanM = doQueryCheckPlan(uRow, "0");
- // }
- //}
-
- }
- private void ultraGrid12_AfterRowActivate(object sender, EventArgs e)
- {
- this.ultraGrid12.UpdateData();
- UltraGridRow uRow = this.ultraGrid12.ActiveRow;
- if (uRow == null) return;
- doQueryBasePlan(uRow);
- doQuerySampleNo(uRow);//查询试样号信息
- }
- /// <summary>
- /// 查询试样号信息
- /// </summary>
- /// <param name="uRow"></param>
- private void doQuerySampleNo(UltraGridRow uRow)
- {
- while (dataTable4.Columns.Count > 3)
- {
- dataTable4.Columns.RemoveAt(3);
- }
- DataTable dtSample = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryDetialSampleNo",
- new Object[] { uRow.Cells["CheckNo"].Text,"0","D" }, ob);
- dataTable4.Rows.Clear();
- dtSample.AsEnumerable().GroupBy(p => new { BatchNo = p["BATCH_NO"].ToString(), Sample = p["SAMPLE_NO"].ToString(),HeatMatNo = p["HEAD_MAT_NO"].ToString() }).ToList()
- .ForEach(p =>
- {
- foreach (DataRow row in p)
- {
- if (!dataTable4.Columns.Contains(row["PHY_CODE_MAX"].ToString()))
- {
- DataColumn phyCloum = new DataColumn();
- phyCloum.ColumnName = row["PHY_CODE_MAX"].ToString();
- phyCloum.Caption = row["PHY_NAME_MAX"].ToString();
- dataTable4.Columns.Add(phyCloum);
- }
- }
- DataRow dr = dataTable4.NewRow();
- dr["BATCH_NO"] = p.Key.BatchNo;
- dr["HEAD_MAT_NO"] = p.Key.HeatMatNo;
- dr["SAMPLE_LEN"] = p.Max(q => q["SAMPLE_LEN"]);
- foreach (DataRow row in p)
- {
- dr[row["PHY_CODE_MAX"].ToString()] = row["SAMPLE_COUNT"].ToString();
- }
- dataTable4.Rows.Add(dr);
- });
- ultraGrid14.DataBind();
- // GridHelper.CopyDataToDatatable(dtSample, dataTable4, true);
- GridHelper.RefreshAndAutoSize(ultraGrid14);
- }
- /// <summary>
- /// 查询复取样委托信息
- /// </summary>
- /// <param name="uRow"></param>
- private void doQueryResampleNo(UltraGridRow uRow)
- {
- while (dataTable6.Columns.Count > 3)
- {
- dataTable6.Columns.RemoveAt(3);
- }
- DataTable dtSample = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryReDetialSampleNo",
- new Object[] { uRow.Cells["CheckNo"].Text,"2","D" }, ob);
- dataTable6.Rows.Clear();
- dtSample.AsEnumerable().GroupBy(p => new { BatchNo = p["BATCH_NO"].ToString(), Sample = p["SAMPLE_NO"].ToString() }).ToList()
- .ForEach(p =>
- {
- foreach (DataRow row in p)
- {
- if (!dataTable6.Columns.Contains(row["PHY_CODE_MAX"].ToString()))
- {
- DataColumn phyCloum = new DataColumn();
- phyCloum.ColumnName = row["PHY_CODE_MAX"].ToString();
- phyCloum.Caption = row["PHY_NAME_MAX"].ToString();
- dataTable6.Columns.Add(phyCloum);
- }
- }
- DataRow dr = dataTable6.NewRow();
- dr["BATCH_NO"] = p.Key.BatchNo;
- dr["SAMPLE_NO"] = p.Key.Sample;
- dr["SAMPLE_LEN"] = p.Max(q => q["SAMPLE_LEN"]);
- foreach (DataRow row in p)
- {
- dr[row["PHY_CODE_MAX"].ToString()] = row["SAMPLE_COUNT"].ToString();
- }
- dataTable6.Rows.Add(dr);
- });
- ultraGrid21.DataBind();
- GridHelper.RefreshAndAutoSize(ultraGrid21);
- }
- /// <summary>
- /// 查询成分理化项目明细
- /// </summary>
- /// <param name="uRow"></param>
- private void doQueryPhyChem(UltraGridRow uRow, string sampleType)
- {
- DataTable dataTable = null;
- UltraGrid ug = null;
- string craftSource = "";
- if (sampleType == "0")
- {
- dataTable = dataTable3;
- ug = ultraGrid11;
- craftSource = "0";
- }
- else if (sampleType == "1")
- {
- dataTable = dataTable5;
- ug = ultraGrid22;
- craftSource = "1";
- ultraLabel5.Text = "";
- }
- while (dataTable.Columns.Count > 5)
- {
- dataTable.Columns.RemoveAt(5);
- }
- dtChem = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryChem", new Object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, craftSource }, ob);//查询成分明细
- if (dtChem.Rows.Count > 0)
- {
- DataColumn hxCloum = new DataColumn();
- hxCloum.ColumnName = "HX";
- hxCloum.Caption = "化学";
- dataTable.Columns.Add(hxCloum);
- }
- dtPhy = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPhy", new Object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, BaseMethod.getJudgeStoveNo(uRow.Cells["JudgeStoveNo"].Text), craftSource, uRow.Cells["Pic"].Text }, ob);//查询理化明细
- string[] phyMaxCode = null;
- ultraLabel3.Text = "";
- List<string> list = new List<string>();
- if (dtPhy.Rows.Count > 0)
- {
- dtPhy.AsEnumerable().Select(p => new { Code = p["PHY_CODE_MIN"].ToString(), Name = p["PHY_NAME_MIN"].ToString(), rate = p["RATE"].ToString(), rateName = p["DESC_RATE"].ToString() }).Distinct().ToList()
- .ForEach(p =>
- {
- DataColumn phyCloum = new DataColumn();
- phyCloum.ColumnName = p.Code;
- phyCloum.Caption = p.Name;
- dataTable.Columns.Add(phyCloum);
- if (p.rate.Equals("408601") || p.rate.Equals("408608"))
- {
- ultraLabel3.Text = ultraLabel3.Text + p.Name + " 取样频次:" + p.rateName;
- list.Add(p.Code);
- }
- //if (sampleType == "1")
- //{
- // if (p.common.Equals("1"))
- // {
- // ultraLabel17.Text = ultraLabel17.Text + p.Name + " (共样) ";
- // }
- //}
-
- });
- }
- foreach (DataRow dr in dataTable.Rows)
- {
- string[] phyCodeGroup = dr["PHY_CODE_GROUP"].ToString().Split(',');
- for (int i = 5; i < dataTable.Columns.Count; i++)
- {
- if (phyCodeGroup.Contains(dataTable.Columns[i].ColumnName))
- {
- dr[i] = "√";
- }
- }
- }
- phyMaxCode = list.ToArray();
- ug.DataBind();
- GridHelper.RefreshAndAutoSize(ug);
- ultraLabel3.ForeColor = Color.Red;
- //if (phyMaxCode.Length > 0)
- //{
- // doQueryPhyCodeMax(phyMaxCode, uRow.Cells["LotNo"].Text);
- //}
- }
- /// <summary>
- /// 查询哪些炉批已经取样送样
- /// </summary>
- private void doQueryPhyCodeMax(string[] phyCode,string lotNo)
- {
- List<PipeCheckconsignDetailEntity> listSource = EntityHelper.GetData<PipeCheckconsignDetailEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPhyCodeMax", new object[] { lotNo, phyCode }, this.ob);
- pipeCheckconsignDetailEntityBindingSource.DataSource = listSource;
- }
- private void ultraGrid18_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow uRow = this.ultraGrid18.ActiveRow;
- if (uRow == null) return;
- List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeateInformation", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["JudgeStoveNo"].Text }, this.ob);
- pipeCheckconsignNoqualifiedEntityBindingSource4.DataSource = listSource;
- doQueryResampleRck(uRow);
- doQueryChemPhy(uRow);
- doQueryResampleNo(uRow);//复取样委托信息
- }
-
- /// <summary>
- /// 查询复取样试样组
- /// </summary>
- /// <param name="uRow"></param>
- private void doQueryChemPhy(UltraGridRow uRow)
- {
- while (dataTable5.Columns.Count > 5)
- {
- dataTable5.Columns.RemoveAt(5);
- }
- dtPhy = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryReChemPhy", new Object[] { uRow.Cells["LotNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["CheckNo"].Text }, ob);//查询复取样试样组
-
- List<string> list = new List<string>();
- if (dtPhy.Rows.Count > 0)
- {
- dtPhy.AsEnumerable().Select(p => new { Code = p["PHY_CODE_MAX"].ToString(), Name = p["PHY_NAME_MAX"].ToString() }).Distinct().ToList()
- .ForEach(p =>
- {
- DataColumn phyCloum = new DataColumn();
- phyCloum.ColumnName = p.Code;
- phyCloum.Caption = p.Name;
- dataTable5.Columns.Add(phyCloum);
- });
- }
- //foreach (DataRow dr in dataTable5.Rows)
- //{
- // string[] phyCodeGroup = dr["PHY_CODE_GROUP"].ToString().Split(',');
- // for (int i = 5; i < dataTable5.Columns.Count; i++)
- // {
- // if (phyCodeGroup.Contains(dataTable5.Columns[i].ColumnName))
- // {
- // dr[i] = "√";
- // }
- // }
- //}
- ultraGrid20.DataBind();
- GridHelper.RefreshAndAutoSize(ultraGrid20);
- }
- /// <summary>
- /// 查询复取样样管信息
- /// </summary>
- /// <param name="uRow"></param>
- private void doQueryResampleRck(UltraGridRow uRow)
- {
- DataTable dtBatchNo = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryResampleInfo",
- new Object[] { uRow.Cells["JudgeStoveNo"].Text }, ob);
- dataTable5.Rows.Clear();
- foreach (DataRow row in dtBatchNo.Rows)
- {
- if (row["RESAMPLE_PIPE_LEN_A"] != null && row["RESAMPLE_PIPE_LEN_A"].ToString() != "")
- {
- DataRow newRowA = dataTable5.NewRow();
- newRowA["BATCH_NO"] = row["BATCH_NO"].ToString();
- newRowA["MAT_NO"] = row["MAT_NO"].ToString();
- newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_A"].ToString();
- newRowA["SAMPLE_POSTION"] = "A端";
- newRowA["PHY_CODE_GROUP"] = row["REPHY_CODE_GROUP"].ToString();
- dataTable5.Rows.Add(newRowA);
- }
- if (row["RESAMPLE_PIPE_LEN_B"] != null && row["RESAMPLE_PIPE_LEN_B"].ToString() != "")
- {
- DataRow newRowA = dataTable5.NewRow();
- newRowA["BATCH_NO"] = row["BATCH_NO"].ToString();
- newRowA["MAT_NO"] = row["MAT_NO"].ToString();
- newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_B"].ToString();
- newRowA["SAMPLE_POSTION"] = "B端";
- newRowA["PHY_CODE_GROUP"] = row["REPHY_CODE_GROUPB"].ToString();
- dataTable5.Rows.Add(newRowA);
- }
- }
- GridHelper.RefreshAndAutoSize(ultraGrid20);
- }
- /// <summary>
- /// 查询样管信息
- /// </summary>
- private void doQuerySampleRack(UltraGridRow uRow, string sampleType)
- {
- DataTable dtBatchNo = new DataTable();
- if (uRow.Cells["BackSlabFlag"].Text.Equals("2"))
- {
- dtBatchNo = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQuerySampleInfo1",
- new Object[] { uRow.Cells["LotNo"].Text, uRow.Cells["JudgeStoveNo"].Text, sampleType }, ob);
- }
- else
- {
- dtBatchNo = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQuerySampleInfo",
- new Object[] { uRow.Cells["Id"].Text, uRow.Cells["JudgeStoveNo"].Text, sampleType }, ob);
- }
- DataTable dt = new DataTable();
- if (sampleType == "1")
- {
- dt = dataTable5;
- }
- else if (sampleType == "0")
- {
- dt = dataTable3;
- }
- dt.Rows.Clear();
- foreach (DataRow row in dtBatchNo.Rows)
- {
- if (row["SAMPLE_PIPE_LEN_A"] != null && row["SAMPLE_PIPE_LEN_A"].ToString() != "")
- {
- DataRow newRowA = dt.NewRow();
- newRowA["BATCH_NO"] = row["BATCH_NO"].ToString();
- newRowA["MAT_NO"] = row["MAT_NO"].ToString();
- newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_A"].ToString();
- newRowA["SAMPLE_POSTION"] = "A端";
- newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUP"].ToString();
- dt.Rows.Add(newRowA);
- }
- if (row["SAMPLE_PIPE_LEN_B"] != null && row["SAMPLE_PIPE_LEN_B"].ToString() != "")
- {
- DataRow newRowA = dt.NewRow();
- newRowA["BATCH_NO"] = row["BATCH_NO"].ToString();
- newRowA["MAT_NO"] = row["MAT_NO"].ToString();
- newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_B"].ToString();
- newRowA["SAMPLE_POSTION"] = "B端";
- newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPB"].ToString();
- dt.Rows.Add(newRowA);
- }
- }
- GridHelper.RefreshAndAutoSize(ultraGrid11);
- GridHelper.RefreshAndAutoSize(ultraGrid22);
- }
- private void ultraGrid11_ClickCell(object sender, ClickCellEventArgs e)
- {
- if (e.Cell.Column.Key != "BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION")
- {
- if (e.Cell.Text.Trim() == "")
- {
- e.Cell.Value = "√";
- }
- else
- {
- e.Cell.Value = "";
- }
- }
- }
- private void FrmMilBatchSampleNew_Shown(object sender, EventArgs e)
- {
- if (toolMenu == null || toolMenu.Toolbars == null) return;
- if (toolMenu.Toolbars[0].Tools.Exists("CancelBatchSeting"))
- {
- toolMenu.Toolbars[0].Tools["CancelBatchSeting"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Confirm"))
- {
- toolMenu.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelConfirm"))
- {
- toolMenu.Toolbars[0].Tools["CancelConfirm"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Print"))
- {
- toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PrintLable"))
- {
- toolMenu.Toolbars[0].Tools["PrintLable"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("QueryRepeate"))
- {
- toolMenu.Toolbars[0].Tools["QueryRepeate"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelGetSample"))
- {
- toolMenu.Toolbars[0].Tools["CancelGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("ReGetSample"))
- {
- toolMenu.Toolbars[0].Tools["ReGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelReGetSample"))
- {
- toolMenu.Toolbars[0].Tools["CancelReGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("RepeateFrim"))
- {
- toolMenu.Toolbars[0].Tools["RepeateFrim"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelRepeateFrim"))
- {
- toolMenu.Toolbars[0].Tools["CancelRepeateFrim"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PrintRe"))
- {
- toolMenu.Toolbars[0].Tools["PrintRe"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PrintReLable"))
- {
- toolMenu.Toolbars[0].Tools["PrintReLable"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- if (toolMenu == null || toolMenu.Toolbars == null) return;
- if (toolMenu.Toolbars[0].Tools.Exists("Query")) { toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 || this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.False : DefaultableBoolean.True; }
- if (toolMenu.Toolbars[0].Tools.Exists("BatchSeting")) { toolMenu.Toolbars[0].Tools["BatchSeting"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("OprocessBatch")) { toolMenu.Toolbars[0].Tools["OprocessBatch"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelOprocessBatch")) { toolMenu.Toolbars[0].Tools["CancelOprocessBatch"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("GetSample")) { toolMenu.Toolbars[0].Tools["GetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelBatchSeting")) { toolMenu.Toolbars[0].Tools["CancelBatchSeting"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 1 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelGetSample")) { toolMenu.Toolbars[0].Tools["CancelGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 1 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("Confirm")) { toolMenu.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 2 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelConfirm")) { toolMenu.Toolbars[0].Tools["CancelConfirm"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("Print")) { toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("PrintLable")) { toolMenu.Toolbars[0].Tools["PrintLable"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("QueryRepeate")) { toolMenu.Toolbars[0].Tools["QueryRepeate"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 || this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("ReGetSample")) { toolMenu.Toolbars[0].Tools["ReGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelReGetSample")) { toolMenu.Toolbars[0].Tools["CancelReGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("PrintRe")) { toolMenu.Toolbars[0].Tools["PrintRe"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("PrintReLable")) { toolMenu.Toolbars[0].Tools["PrintReLable"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("RepeateFrim")) { toolMenu.Toolbars[0].Tools["RepeateFrim"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
- if (toolMenu.Toolbars[0].Tools.Exists("CancelRepeateFrim")) { toolMenu.Toolbars[0].Tools["CancelRepeateFrim"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
-
-
- }
- private void ultraGrid15_AfterRowActivate(object sender, EventArgs e)
- {
- this.ultraGrid15.UpdateData();
- UltraGridRow uRow = this.ultraGrid15.ActiveRow;
- if (uRow == null) return;
- List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeateInformation", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["JudgeStoveNo"].Text }, this.ob);
- pipeCheckconsignNoqualifiedEntityBindingSource2.DataSource = listSource;
- List<PortMilBatchSampleResultEntity> listSource1 = EntityHelper.GetData<PortMilBatchSampleResultEntity>(
- "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeatRack", new object[] { uRow.Cells["JudgeStoveNo"].Text }, this.ob);
- portMilBatchSampleResultEntityBindingSource2.DataSource = listSource1;
- foreach(UltraGridRow row in this.ultraGrid17.Rows)
- {
- if (row.Cells["IsSamplePipe"].Text == "1")
- {
- row.RowSelectorAppearance.BackColor = Color.Red;
- }
- }
- }
- private void txtBATCH_MIN_ValueChanged(object sender, EventArgs e)
- {
- if (txtBATCH_MIN.Text == "") return;
- if (dtPlanM == null || dtPlanDetial == null || dtPlanM.Count == 0 || dtPlanDetial.Count == 0)
- {
- return;
- }
- //bool isBacthFlag = dtPlanDetial.Any(p => p.Rate == "408601" || p.Rate == "408608");//判断是否试样组有生产批
- //if (isBacthFlag)
- //{
- //}
- //else
- //{
- int maxBacth = dtPlanM.Max(p => p.BatchNum == null ? 1 : (int)(p.BatchNum));//取主表最大方案
- int batchNum = int.Parse(txtBATCH_MIN.Text);//实际批数
- dtPlanM1 = dtPlanM.Where(p => p.BatchNum == (batchNum > maxBacth ? maxBacth : batchNum)).ToList();//取具体方案
- //}
-
- }
- private void ultraGrid20_ClickCell(object sender, ClickCellEventArgs e)
- {
- if (e.Cell.Column.Key != "BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION")
- {
- if (e.Cell.Text.Trim() == "")
- {
- e.Cell.Value = "√";
- }
- else
- {
- e.Cell.Value = "";
- }
- }
- }
- private void ultraGrid22_ClickCell(object sender, ClickCellEventArgs e)
- {
- if (e.Cell.Column.Key != "BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION")
- {
- if (e.Cell.Text.Trim() == "")
- {
- e.Cell.Value = "√";
- }
- else
- {
- e.Cell.Value = "";
- }
- }
- }
-
- //private void ultraGrid17_CellChange(object sender, CellEventArgs e)
- //{
- // this.ultraGrid17.UpdateData();
- // IQueryable<UltraGridRow> checkMagRows = this.ultraGrid17.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- // if(checkMagRows.Count() > 1)
- // {
- // MessageUtil.ShowTips("取样频次是生成批类的,只允许指定一个炉号!");
- // e.Cell.Value = "False";
- // }
- //}
- }
- }
|