| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Qcm;
- using Core.StlMes.Client.SaleOrder.BLL;
- using Core.StlMes.Client.SaleOrder.Control;
- using Core.StlMes.Client.SaleOrder.Dialog;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle;
- namespace Core.StlMes.Client.SaleOrder.ReviewForm
- {
- public partial class FrmChoiceCraftFileLv2New : FrmBase
- {
- private CraftOrdDesignBLL _craftOrdDesignBLL;
- private CraftOrdDesignStdCicCtrl _cicCtrl;
- private CraftOrdDesignStdPicCtrl _picCtrl;
- private CraftOrdDesignStdSicCtrl _sicCtrl;
- private CraftOrdDesignStdDicCtrl _dicCtrl;
- private CraftOrdDesignStdWicCtrl _wicCtrl;
- private CraftOrdDesignStdGicCtrl _gicCtrl;
- private CraftOrdDesignStdCicBLL _cicBLL;
- private CraftOrdDesignStdPicBLL _picBLL;
- private CraftOrdDesignStdSicBLL _sicBLL;
- private CraftOrdDesignStdDicBLL _dicBLL;
- private CraftOrdDesignStdWicBLL _wicBLL;
- private CraftOrdDesignStdGicBLL _gicBLL;
- UltraComboEditor uceA = new UltraComboEditor();
- private int maxBatch = 0;
- private List<string> AllPline = new DataSourceList<string>();
- private Dictionary<string,List<string>> CanNotMergePhyCode = new Dictionary<string, List<string>>();
- public FrmChoiceCraftFileLv2New()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<ChoiceCraftFileLv2Entity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<CraftOrdDesignStdPicSmpDetailEntity>(ultraGrid10.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<CraftOrdDesignStdPicSmpTotalEntity>(ultraGrid9.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<CraftOrdDesignStdPicEntity>(ultraGrid11.DisplayLayout.Bands[0]);
- foreach (UltraGridColumn ugc in ultraGrid9.DisplayLayout.Bands[0].Columns)
- {
- ugc.SortIndicator = SortIndicator.Disabled;
- }
- ultraGrid9.DisplayLayout.Bands[0].Columns["DescPosition"].MergedCellEvaluator = new CustomMergedCellEvaluator(new string[] { "BatchNum", "StoveNum" });
- ultraGrid9.DisplayLayout.Bands[0].Columns["BatchNoStr"].MergedCellEvaluator = new CustomMergedCellEvaluator(new string[] { "BatchNum", "StoveNum" });
- ValueList vlist = new ValueList();
- vlist.ValueListItems.Add("1", "首检增项");
- vlist.ValueListItems.Add("0", "正常");
- ultraGrid10.DisplayLayout.Bands[0].Columns["Type"].ValueList = vlist;
- ultraGrid10.DisplayLayout.Bands[0].Columns["Type"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- ValueList vlist1 = new ValueList();
- vlist1.ValueListItems.Add("1", "生产批");
- vlist1.ValueListItems.Add("0", "非生产批");
- ultraGrid9.DisplayLayout.Bands[0].Columns["StoveNum"].ValueList = vlist1;
- // 写死限制压扁和扩口不在同一个管头上
- CanNotMergePhyCode.Add("C0009", new List<string>() { "C0026" });
- CanNotMergePhyCode.Add("C0026", new List<string>() { "C0009" });
- /* ultraGrid9.DisplayLayout.Bands[0].Columns["Remark"].CellActivation = Activation.AllowEdit;*/
- this.IsLoadUserView = true;
- }
- private void FrmChoiceCraftFileLv2_Load(object sender, EventArgs e)
- {
- _craftOrdDesignBLL = new CraftOrdDesignBLL(ob);
- lblCmbPlanStatus.ComboBox.SelectedIndex = 0;
- //ultraGrid1.DisplayLayout.Bands[0].Columns["CraftFileLv2" + CustomInfo + "Desc"].Hidden = false;
- string process = CustomInfo.Substring(0, 1);
- if (process != "D")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "PlanTimeBZg", "CraftFileLv2DDesc", "CraftFileLv2FDown");
- }
- if (process != "E")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "PlanTimeBDbk", "CraftFileLv2EDesc");
- }
- if (process != "F")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "PlanTimeBRcl", "CraftFileLv2FDesc");
- }
- if (process != "G")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "PlanTimeBJgx", "CraftFileLv2GDesc");
- }
- if (process != "H")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "PlanTimeBProp", "CraftFileLv2HDesc");
- }
- if (!CustomInfo.Contains("PLAN"))
- {
- splitContainer1.Panel2Collapsed = true;
- }
- if (CustomInfo != "D_PLAN")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "FlagDStr");
- }
- if (CustomInfo != "E_PLAN")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "FlagEStr");
- }
- if (CustomInfo != "F_PLAN")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "FlagFStr");
- }
- if (CustomInfo != "G_PLAN")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "FlagGStr");
- }
- if (CustomInfo != "H_PLAN")
- {
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "FlagHStr");
- }
- AllPline= InitDropPlinePower(process, lcPline.ComboBox, this.ValidDataPurviewIds, ob);
- //QcmBaseQuery.NitializePlineByProcess("D", labelComboBox1.ComboBox, true, ob);
- //_plnOrderZgSCtrl = new PlnOrderZgSCtrl(splitContainer1.Panel1, ob);
- //_plnOrderZgSCtrl.EntityGrid1.AfterRowActivate += plnOrderZgSCtrl_AfterRowActivate;
- _cicCtrl = new CraftOrdDesignStdCicCtrl(panel3, ob);
- _cicCtrl.EntityGrid1.AfterRowInsert += cicCtrl_AfterRowInsert;
- _cicCtrl.EntityGrid1.BeforeRowInsert += cicCtrl_BeforeRowInsert;
- _picCtrl = new CraftOrdDesignStdPicCtrl(panel4, ob);
- _picCtrl.EntityGrid1.AfterRowInsert += picCtrl_AfterRowInsert;
- _picCtrl.EntityGrid1.BeforeRowInsert += picCtrl_BeforeRowInsert;
- _picCtrl.EntityGrid1.DisplayLayout.Bands[0].Columns["PhyNameMin"].ButtonDisplayStyle = ButtonDisplayStyle.OnMouseEnter;
- _picCtrl.EntityGrid1.DisplayLayout.Bands[0].Columns["PhyNameMax"].ButtonDisplayStyle = ButtonDisplayStyle.OnMouseEnter;
- _sicCtrl = new CraftOrdDesignStdSicCtrl(panel5, ob);
- _sicCtrl.EntityGrid1.AfterRowInsert += sicCtrl_AfterRowInsert;
- _sicCtrl.EntityGrid1.BeforeRowInsert += sicCtrl_BeforeRowInsert;
- _dicCtrl = new CraftOrdDesignStdDicCtrl(panel6, ob);
- _dicCtrl.EntityGrid1.AfterRowInsert += dicCtrl_AfterRowInsert;
- _dicCtrl.EntityGrid1.BeforeRowInsert += dicCtrl_BeforeRowInsert;
- _wicCtrl = new CraftOrdDesignStdWicCtrl(panel7, ob);
- _wicCtrl.EntityGrid1.AfterRowInsert += wicCtrl_AfterRowInsert;
- _wicCtrl.EntityGrid1.BeforeRowInsert += wicCtrl_BeforeRowInsert;
- _gicCtrl = new CraftOrdDesignStdGicCtrl(panel8, ob);
- _gicCtrl.EntityGrid1.AfterRowInsert += gicCtrl_AfterRowInsert;
- _gicCtrl.EntityGrid1.BeforeRowInsert += gicCtrl_BeforeRowInsert;
- _cicBLL = new CraftOrdDesignStdCicBLL(ob);
- _picBLL = new CraftOrdDesignStdPicBLL(ob);
- _sicBLL = new CraftOrdDesignStdSicBLL(ob);
- _dicBLL = new CraftOrdDesignStdDicBLL(ob);
- _wicBLL = new CraftOrdDesignStdWicBLL(ob);
- _gicBLL = new CraftOrdDesignStdGicBLL(ob);
- }
- void gicCtrl_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- /* if (ultraGrid7.Rows.Count == 0)*/
- if (ultraGrid1.ActiveRow == null)
- {
- e.Cancel = true;
- }
- }
- void wicCtrl_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- /* if (ultraGrid6.Rows.Count == 0)*/
- if (ultraGrid1.ActiveRow == null)
- {
- e.Cancel = true;
- }
- }
- void dicCtrl_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- /* if (ultraGrid5.Rows.Count == 0)*/
- if (ultraGrid1.ActiveRow == null)
- {
- e.Cancel = true;
- }
- }
- void sicCtrl_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- /* if (ultraGrid4.Rows.Count == 0)*/
- if (ultraGrid1.ActiveRow == null)
- {
- e.Cancel = true;
- }
- }
- void picCtrl_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- /* if (ultraGrid8.Rows.Count == 0)*/
- if (ultraGrid1.ActiveRow == null)
- {
- e.Cancel = true;
- }
- }
- void cicCtrl_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- /* if (ultraGrid2.Rows.Count == 0)*/
- if (ultraGrid1.ActiveRow==null)
- {
- e.Cancel = true;
- }
- }
- void gicCtrl_AfterRowInsert(object sender, RowEventArgs e)
- {
- /* var row = ultraGrid7.ActiveRow;
- string mscPline = row.GetValue("MscPline");
- string processCode = row.GetValue("ProcessCode");
- string gic = row.GetValue("Gic");
- e.Row.Cells["MscPline"].Value = mscPline;
- e.Row.Cells["ProcessCode"].Value = processCode;
- e.Row.Cells["Gic"].Value = gic;*/
- var craftOrdDesign = ultraGrid1.ActiveRow.ListObject as ChoiceCraftFileLv2Entity;
- e.Row.Cells["Gic"].Value = craftOrdDesign.Gic;
- e.Row.Cells["MscPline"].Value = craftOrdDesign.MscPline;
- e.Row.Cells["ProcessCode"].Value = CustomInfo.Substring(0, 1);;
- }
- void wicCtrl_AfterRowInsert(object sender, RowEventArgs e)
- {
- /* var row = ultraGrid6.ActiveRow;
- string mscPline = row.GetValue("MscPline");
- string processCode = row.GetValue("ProcessCode");
- string wic = row.GetValue("Wic");
- e.Row.Cells["MscPline"].Value = mscPline;
- e.Row.Cells["ProcessCode"].Value = processCode;
- e.Row.Cells["Wic"].Value = wic;*/
- var craftOrdDesign = ultraGrid1.ActiveRow.ListObject as ChoiceCraftFileLv2Entity;
- e.Row.Cells["Wic"].Value = craftOrdDesign.Wic;
- e.Row.Cells["MscPline"].Value = craftOrdDesign.MscPline;
- e.Row.Cells["ProcessCode"].Value = CustomInfo.Substring(0, 1); ;
- }
- void dicCtrl_AfterRowInsert(object sender, RowEventArgs e)
- {
- /* var row = ultraGrid5.ActiveRow;
- string mscPline = row.GetValue("MscPline");
- string processCode = row.GetValue("ProcessCode");
- string dic = row.GetValue("Dic");
- e.Row.Cells["MscPline"].Value = mscPline;
- e.Row.Cells["ProcessCode"].Value = processCode;
- e.Row.Cells["Dic"].Value = dic;*/
- var craftOrdDesign = ultraGrid1.ActiveRow.ListObject as ChoiceCraftFileLv2Entity;
- e.Row.Cells["Dic"].Value = craftOrdDesign.Dic;
- e.Row.Cells["MscPline"].Value = craftOrdDesign.MscPline;
- e.Row.Cells["ProcessCode"].Value = CustomInfo.Substring(0, 1); ;
- }
- void sicCtrl_AfterRowInsert(object sender, RowEventArgs e)
- {
- /* var row = ultraGrid4.ActiveRow;
- string mscPline = row.GetValue("MscPline");
- string processCode = row.GetValue("ProcessCode");
- string sic = row.GetValue("Sic");
- e.Row.Cells["MscPline"].Value = mscPline;
- e.Row.Cells["ProcessCode"].Value = processCode;
- e.Row.Cells["Sic"].Value = sic;*/
- var craftOrdDesign = ultraGrid1.ActiveRow.ListObject as ChoiceCraftFileLv2Entity;
- e.Row.Cells["Sic"].Value = craftOrdDesign.Sic;
- e.Row.Cells["MscPline"].Value = craftOrdDesign.MscPline;
- e.Row.Cells["ProcessCode"].Value = CustomInfo.Substring(0, 1); ;
- }
- void picCtrl_AfterRowInsert(object sender, RowEventArgs e)
- {
- /* var row = ultraGrid3.ActiveRow;
- string mscPline = row.GetValue("MscPline");
- string processCode = row.GetValue("ProcessCode");
- string pic = row.GetValue("Pic");
- e.Row.Cells["MscPline"].Value = mscPline;
- e.Row.Cells["ProcessCode"].Value = processCode;
- e.Row.Cells["Pic"].Value = pic;*/
- var craftOrdDesign = ultraGrid1.ActiveRow.ListObject as ChoiceCraftFileLv2Entity;
- e.Row.Cells["Pic"].Value = craftOrdDesign.Pic;
- e.Row.Cells["MscPline"].Value = craftOrdDesign.MscPline;
- e.Row.Cells["ProcessCode"].Value = CustomInfo.Substring(0, 1); ;
- }
- void cicCtrl_AfterRowInsert(object sender, RowEventArgs e)
- {
- /* var row = ultraGrid2.ActiveRow;
- string mscPline = row.GetValue("MscPline");
- string processCode = row.GetValue("ProcessCode");
- string cic = row.GetValue("Cic");
- e.Row.Cells["MscPline"].Value = mscPline;
- e.Row.Cells["ProcessCode"].Value = processCode;
- e.Row.Cells["Cic"].Value = cic;*/
-
- var craftOrdDesign = ultraGrid1.ActiveRow.ListObject as ChoiceCraftFileLv2Entity;
- e.Row.Cells["Cic"].Value = craftOrdDesign.Cic;
- e.Row.Cells["MscPline"].Value = craftOrdDesign.MscPline;
- e.Row.Cells["ProcessCode"].Value = CustomInfo.Substring(0, 1); ;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query":
- Query();
- break;
- case "Save":
- Save();
- break;
- case "Submit":
- Submit();
- break;
- case "Cancel":
- Cancel2();
- break;
- case "Consign":
- Consign();
- break;
- case "CancelConsign":
- CancelConsign();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void Query()
- {
- WaitingForm2 wf = new WaitingForm2("正在查询,请稍候....");
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string craftNo = labelTextBox1.Checked ? labelTextBox1.Text.Trim() : "";
- string orderNo = labelTextBox2.Checked ? labelTextBox2.Text.Trim() : "";
- string planStatus = lblCmbPlanStatus.Checked ? lblCmbPlanStatus.SelecteValue.ToString2() : "";
- string maintenanceStatus = labelCheckBox1.Checked ? "1" : "";
- string[] exeStatus = contorlPlanStatus1.statusArr;
- List<string> _allPline = lcPline.Checked && lcPline.ComboBox.SelectedIndex > -1
- ? new List<string>() {lcPline.ComboBox.SelectedItem.DataValue.ToString()}
- : AllPline;
- ultraGrid1.BeginUpdate();
- craftOrdDesignEntityBindingSource.DataSource = _craftOrdDesignBLL.QueryCraftLv2New(
- craftNo, orderNo, planStatus, maintenanceStatus, CustomInfo.Substring(0, 1), exeStatus, _allPline);
- CopyUnfinishTimeZg();
- foreach (var row in ultraGrid1.Rows)
- {
- Color color = row.Cells["CraftNo"].Appearance.BackColor;
- if (!row.GetValue("ProcessCodes").Contains("D"))
- {
- row.Cells["CraftFileLv2DDesc"].Appearance.BackColor = color;
- row.Cells["CraftFileLv2DDesc"].Value = "无";
- }
- if (!row.GetValue("ProcessCodes").Contains("E"))
- {
- row.Cells["CraftFileLv2EDesc"].Appearance.BackColor = color;
- row.Cells["CraftFileLv2EDesc"].Value = "无";
- }
- if (!row.GetValue("ProcessCodes").Contains("F"))
- {
- row.Cells["CraftFileLv2FDesc"].Appearance.BackColor = color;
- row.Cells["CraftFileLv2FDesc"].Value = "无";
- }
- if (!row.GetValue("ProcessCodes").Contains("G"))
- {
- row.Cells["CraftFileLv2GDesc"].Appearance.BackColor = color;
- row.Cells["CraftFileLv2GDesc"].Value = "无";
- }
- if (!row.GetValue("ProcessCodes").Contains("H"))
- {
- row.Cells["CraftFileLv2HDesc"].Appearance.BackColor = color;
- row.Cells["CraftFileLv2HDesc"].Value = "无";
- }
- }
- ultraGrid1.EndUpdate();
- ultraGrid1.UpdateData();
- ClearCraftDesignDown();
- }
- finally
- {
- wf.Close();
- this.Cursor = Cursors.Default;
- }
- }
- private void ClearCraftDesignDown()
- {
- dataTable1.Clear();
- craftOrdDesignStdPicSmpDetailEntityBindingSource.Clear();
- craftOrdDesignStdPicSmpTotalEntityBindingSource.Clear();
- if (_cicCtrl != null)
- {
- _cicCtrl.Clear();
- _picCtrl.Clear();
- _sicCtrl.Clear();
- _dicCtrl.Clear();
- _wicCtrl.Clear();
- _gicCtrl.Clear();
- }
- maxBatch = 0;
- }
- private void CopyUnfinishTimeZg()
- {
- //DataTable dtUnfinishTime = _craftOrdDesignBLL.QueryUnfinishTimeZg();
- //foreach (var row in ultraGrid1.Rows)
- //{
- // string pk = row.GetValue("OrdLnDlyPk") + "-" + row.GetValue("PlnDivideId");
- // DataRow[] drs = dtUnfinishTime.Select("PK = '"+ pk +"'");
- // if (drs.Length > 0)
- // {
- // row.SetValue("UnfinishTime", drs[0]["UNFINISH_TIME"].ToString());
- // }
- //}
- }
- private void Relocat(string ordLnPk, string craftSeq)
- {
- Query();
- var row = ultraGrid1.Rows.Where(a => a.GetValue("OrdLnPk") == ordLnPk
- && a.GetValue("CraftSeq") == craftSeq).FirstOrDefault();
- if (row != null)
- {
- row.Activate();
- }
- }
- private void Save()
- {
- ultraGrid10.UpdateData();
- ultraGrid1.UpdateData();
- if (CustomInfo.Contains("PLAN"))
- {
- //保存6个标准
- SaveCraftOrdDesignDown();
- return;
- }
- var rows = ultraGrid1.Rows.Where(a=>a.GetValue("Chk") == "True");
- if (rows.Count() == 0)
- {
- MessageUtil.ShowWarning("请选择记录!");
- return;
- }
- List<CraftOrdDesignEntity> craftOrdDesignList = new List<CraftOrdDesignEntity>();
- string ordLnPk = "";
- string craftSeq = "";
- foreach (var row in rows)
- {
- CraftOrdDesignEntity craftOrdDesign = EntityHelper.CopyEntity<CraftOrdDesignEntity>(row.ListObject);
- craftOrdDesign.UpdateName = UserInfo.GetUserName();
- craftOrdDesignList.Add(craftOrdDesign);
- ordLnPk = craftOrdDesign.OrdLnPk;
- craftSeq = craftOrdDesign.CraftSeq.ToString();
- }
-
- if (MessageUtil.ShowYesNoAndQuestion("是否确认保存?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- _craftOrdDesignBLL.SaveCraftLv2(craftOrdDesignList);
- MessageUtil.ShowTips("保存成功!");
- Query();
- }
- private void SaveCraftOrdDesignDown()
- {
- if (ultraGrid1.ActiveRow == null) return;
- var craftOrdDesign = (ChoiceCraftFileLv2Entity)ultraGrid1.ActiveRow.ListObject;
- string processCode = CustomInfo.Substring(0, 1);
- switch (ultraTabControl1.ActiveTab.Key)
- {
- case "cic":
- _cicCtrl.Save();
- break;
- case "pic":
- _picCtrl.Save();
- break;
- case "sic":
- _sicCtrl.Save();
- break;
- case "dic":
- _dicCtrl.Save();
- break;
- case "wic":
- _wicCtrl.Save();
- break;
- case "gic":
- _gicCtrl.Save();
- break;
- case "smp":
- if (MessageUtil.ShowYesNoAndQuestion("是否确认保存?") == DialogResult.No)
- {
- return;
- }
- // _designStdGicBLL.Save(parms);
-
- List<CraftOrdDesignStdPicSmpTotalEntity> CraftOrdDesignStdPicSmpTotalEntitys =
- craftOrdDesignStdPicSmpTotalEntityBindingSource.DataSource as List<CraftOrdDesignStdPicSmpTotalEntity>;
- List<CraftOrdDesignStdPicSmpDetailEntity> CraftOrdDesignStdPicSmpDetailEntity =
- craftOrdDesignStdPicSmpDetailEntityBindingSource.DataSource as List<CraftOrdDesignStdPicSmpDetailEntity>;
- if (!CraftOrdDesignStdPicSmpTotalEntitys.Any() || !CraftOrdDesignStdPicSmpDetailEntity.Any())
- {
- MessageUtil.ShowTips("无试样取样数据!");
- return;
- }
- var checkList =
- CraftOrdDesignStdPicSmpDetailEntity.Where(p => p.Rate == "408602" || p.Rate == "401101" || p.Rate == "408608").ToList();
- if (checkList.Any() && checkList.Any(p=>!p.BatchCnt.TryParseInt()))
- {
- MessageBox.Show("分批取样数量必须是数字");
- return;
- }
- ultraGrid9.UpdateData();
- _craftOrdDesignBLL.SaveCraftSampling(CraftOrdDesignStdPicSmpTotalEntitys, CraftOrdDesignStdPicSmpDetailEntity);
- BindSmpDataGroup(craftOrdDesign.OrdLnPk,craftOrdDesign.CraftSeq.ToString(), craftOrdDesign.CraftNo, craftOrdDesign.DesginKey, craftOrdDesign.MscPline, processCode, craftOrdDesign.Cic,
- craftOrdDesign.CutNum == null ? 1 : (int)craftOrdDesign.CutNum);
- MessageUtil.ShowTips("保存成功!");
- break;
- }
- }
- /// <summary>
- /// 计划科委托
- /// </summary>
- private void Consign()
- {
-
- ultraGrid10.UpdateData();
- var rows = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True");
- if (!rows.Any())
- {
- MessageUtil.ShowWarning("请勾选一条记录!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- List<object> paras = new List<object>();
- foreach (var ultraGridRow in rows)
- {
- List<object> para = new List<object>();
- var craftOrdDesign = (ChoiceCraftFileLv2Entity)ultraGridRow.ListObject;
- string Process = CustomInfo.Substring(0, 1);
- List<CraftOrdDesignStdPicSmpDetailEntity> list = null;
- List<CraftOrdDesignStdPicSmpTotalEntity> listToltal = null;
- if (ultraGridRow.Activated)
- {
- listToltal =
- craftOrdDesignStdPicSmpTotalEntityBindingSource.DataSource as
- List<CraftOrdDesignStdPicSmpTotalEntity>;
- list =
- craftOrdDesignStdPicSmpDetailEntityBindingSource.DataSource as
- List<CraftOrdDesignStdPicSmpDetailEntity>;
- var checkList =
- list.Where(p => p.Rate == "408602" || p.Rate == "401101" || p.Rate == "408608").ToList();
- if (checkList.Any())
- {
- var HxCheckList = checkList.Where(p => p.PhyCodeMin == "HX").ToList();
- var OtherCheckList = checkList.Where(p => p.PhyCodeMin != "HX").ToList();
- if (OtherCheckList.Any() && OtherCheckList.Any(p => !p.BatchCnt.TryParseInt()))
- {
- MessageBox.Show("分批取样数量必须是数字");
- return;
- }
- if (HxCheckList.Any() && !OtherCheckList.Any())
- {
- MessageBox.Show("化学频率是检验批,无检验批理化检验项, 无法识别分批数量!");
- return;
- }
- }
- }
- else
- {
- list = _craftOrdDesignBLL.GetCraftPicSmpGroup(craftOrdDesign.OrdLnPk,
- craftOrdDesign.CraftSeq.ToString(), craftOrdDesign.CraftNo, craftOrdDesign.DesginKey,
- craftOrdDesign.MscPline, Process, craftOrdDesign.Cic,
- craftOrdDesign.CutNum == null ? 1 : (int)craftOrdDesign.CutNum);
- listToltal = GetCraftSamplingTotal(craftOrdDesign.OrdLnPk, craftOrdDesign.CraftSeq.ToString(),
- craftOrdDesign.CraftNo, craftOrdDesign.ProcessCodes, list);
- var checkList =
- list.Where(p => p.Rate == "408602" || p.Rate == "401101" || p.Rate == "408608").ToList();
- if (checkList.Any())
- {
- var HxCheckList = checkList.Where(p => p.PhyCodeMin == "HX").ToList();
- var OtherCheckList = checkList.Where(p => p.PhyCodeMin != "HX").ToList();
- if (OtherCheckList.Any() && OtherCheckList.Any(p => !p.BatchCnt.TryParseInt()))
- {
- MessageBox.Show("分批取样数量必须是数字");
- return;
- }
- if (HxCheckList.Any() && !OtherCheckList.Any())
- {
- MessageBox.Show("化学频率是检验批,无检验批理化检验项, 无法识别分批数量!");
- return;
- }
- }
- if (checkList.Any() && checkList.Any(p => !p.BatchCnt.TryParseInt()))
- {
- MessageBox.Show("分批取样数量必须是数字");
- return;
- }
- }
- if (list.Where(p => p.PhyCodeMin != "HX").Select(p => p.Pic).Distinct().Count() > 1)
- {
- MessageBox.Show("合同(" + craftOrdDesign.OrderManageNo + ") PIC存在多个,请通知工艺人员变更工艺");
- return;
- }
- if (craftOrdDesign.FlagDStr.Equals("是") && Process.Equals("D"))
- {
- MessageUtil.ShowWarning("已确认的计划不能委托!");
- return;
- }
- para.Add(Process);
- para.Add(craftOrdDesign.OrdLnPk);
- para.Add(craftOrdDesign.CraftSeq.ToString());
- para.Add(listToltal.Select(JSONFormat.Format).ToList());
- para.Add(list.Select(JSONFormat.Format).ToList());
- paras.Add(para);
- }
- _craftOrdDesignBLL.SetProcessJhFlag(paras, "1");
- MessageUtil.ShowTips("委托成功!");
- Query();
- }
- private void Submit()
- {
- /* var row = ultraGrid1.Rows.Where(a=>a.GetValue("Chk") == "True").FirstOrDefault();
- if (row == null)
- {
- MessageUtil.ShowWarning("请勾选一条记录!");
- return;
- }
- string process = CustomInfo.Substring(0, 1);
- string ordLnPk = row.GetValue("OrdLnPk");
- string craftSeq = row.GetValue("CraftSeq");
- string craftNo = row.GetValue("CraftNo");
- if (MessageUtil.ShowYesNoAndQuestion("是否确认?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- List<CraftOrdDesignStdPicSmpTotalEntity> CraftOrdDesignStdPicSmpTotalEntitys =
- craftOrdDesignStdPicSmpTotalEntityBindingSource.DataSource as List<CraftOrdDesignStdPicSmpTotalEntity>;
- List<CraftOrdDesignStdPicSmpDetailEntity> CraftOrdDesignStdPicSmpDetailEntity =
- craftOrdDesignStdPicSmpDetailEntityBindingSource.DataSource as List<CraftOrdDesignStdPicSmpDetailEntity>;
- if (CraftOrdDesignStdPicSmpTotalEntitys.Any() && CraftOrdDesignStdPicSmpDetailEntity.Any())
- {
- ultraGrid9.UpdateData();
- _craftOrdDesignBLL.SaveCraftSampling(CraftOrdDesignStdPicSmpTotalEntitys, CraftOrdDesignStdPicSmpDetailEntity);
- }
- _craftOrdDesignBLL.SetProcessFlag(process, "1", ordLnPk, craftSeq);
- MessageUtil.ShowTips("确认成功!");
- Relocat(ordLnPk, craftSeq);*/
- ultraGrid10.UpdateData();
- var rows = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True");
- if (!rows.Any())
- {
- MessageUtil.ShowWarning("请勾选一条记录!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- List<object> paras = new List<object>();
- foreach (var ultraGridRow in rows)
- {
-
- List<object> para = new List<object>();
- var craftOrdDesign = (ChoiceCraftFileLv2Entity)ultraGridRow.ListObject;
- string Process = CustomInfo.Substring(0, 1);
- List<CraftOrdDesignStdPicSmpDetailEntity> list = null;
- List<CraftOrdDesignStdPicSmpTotalEntity> listToltal = null;
- if (ultraGridRow.Activated)
- {
- listToltal =
- craftOrdDesignStdPicSmpTotalEntityBindingSource.DataSource as
- List<CraftOrdDesignStdPicSmpTotalEntity>;
- list =
- craftOrdDesignStdPicSmpDetailEntityBindingSource.DataSource as
- List<CraftOrdDesignStdPicSmpDetailEntity>;
-
- var checkList =
- list.Where(p => p.Rate == "408602" || p.Rate == "401101" || p.Rate == "408608").ToList();
- if (checkList.Any())
- {
- var HxCheckList =checkList.Where(p=>p.PhyCodeMin=="HX").ToList();
- var OtherCheckList = checkList.Where(p => p.PhyCodeMin != "HX").ToList();
- if (OtherCheckList.Any() && OtherCheckList.Any(p => !p.BatchCnt.TryParseInt()))
- {
- MessageBox.Show("分批取样数量必须是数字");
- return;
- }
- if (HxCheckList.Any() && !OtherCheckList.Any())
- {
- MessageBox.Show("化学频率是检验批,无检验批理化检验项, 无法识别分批数量!");
- return;
- }
- }
-
- }
- else
- {
- list = _craftOrdDesignBLL.GetCraftPicSmpGroup(craftOrdDesign.OrdLnPk,
- craftOrdDesign.CraftSeq.ToString(), craftOrdDesign.CraftNo, craftOrdDesign.DesginKey,
- craftOrdDesign.MscPline, Process, craftOrdDesign.Cic,
- craftOrdDesign.CutNum == null ? 1 : (int) craftOrdDesign.CutNum);
- listToltal = GetCraftSamplingTotal(craftOrdDesign.OrdLnPk, craftOrdDesign.CraftSeq.ToString(),
- craftOrdDesign.CraftNo, craftOrdDesign.ProcessCodes, list);
- var checkList =
- list.Where(p => p.Rate == "408602" || p.Rate == "401101" || p.Rate == "408608").ToList();
- if (checkList.Any())
- {
- var HxCheckList =checkList.Where(p=>p.PhyCodeMin=="HX").ToList();
- var OtherCheckList = checkList.Where(p => p.PhyCodeMin != "HX").ToList();
- if (OtherCheckList.Any() && OtherCheckList.Any(p => !p.BatchCnt.TryParseInt()))
- {
- MessageBox.Show("分批取样数量必须是数字");
- return;
- }
- if (HxCheckList.Any() && !OtherCheckList.Any())
- {
- MessageBox.Show("化学频率是检验批,无检验批理化检验项, 无法识别分批数量!");
- return;
- }
- }
- if (checkList.Any() && checkList.Any(p => !p.BatchCnt.TryParseInt()))
- {
- MessageBox.Show("分批取样数量必须是数字");
- return;
- }
- }
- if (list.Where(p => p.PhyCodeMin != "HX").Select(p => p.Pic).Distinct().Count() > 1)
- {
- MessageBox.Show("合同(" + craftOrdDesign.OrderManageNo + ") PIC存在多个,请通知工艺人员变更工艺");
- return;
- }
- para.Add(Process);
- para.Add(craftOrdDesign.OrdLnPk);
- para.Add(craftOrdDesign.CraftSeq.ToString());
- para.Add(listToltal.Select(JSONFormat.Format).ToList());
- para.Add(list.Select(JSONFormat.Format).ToList());
- paras.Add(para);
- }
- _craftOrdDesignBLL.SetProcessFlag(paras, "1");
- MessageUtil.ShowTips("确认成功!");
- Query();
- }
- private void Cancel2()
- {
- /* var row = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True").FirstOrDefault();
- if (row == null)
- {
- MessageUtil.ShowWarning("请勾选一条记录!");
- return;
- }
- string process = CustomInfo.Substring(0, 1);
- string ordLnPk = row.GetValue("OrdLnPk");
- string craftSeq = row.GetValue("CraftSeq");
- string craftNo = row.GetValue("CraftNo");
- if (MessageUtil.ShowYesNoAndQuestion("是否取消确认?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- List<CraftOrdDesignStdPicSmpTotalEntity> CraftOrdDesignStdPicSmpTotalEntitys =
- craftOrdDesignStdPicSmpTotalEntityBindingSource.DataSource as List<CraftOrdDesignStdPicSmpTotalEntity>;
- if (CraftOrdDesignStdPicSmpTotalEntitys!=null && CraftOrdDesignStdPicSmpTotalEntitys.Any() )
- {
- ultraGrid9.UpdateData();
- _craftOrdDesignBLL.CancelCraftSampling(CraftOrdDesignStdPicSmpTotalEntitys.FirstOrDefault());
- }
- _craftOrdDesignBLL.SetProcessFlag(process, "0", ordLnPk, craftSeq);
- MessageUtil.ShowTips("取消成功!");
- Relocat(ordLnPk, craftSeq);*/
- var rows = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True");
- if (!rows.Any())
- {
- MessageUtil.ShowWarning("请勾选一条记录!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否取消确认?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- List<object> paras = new List<object>();
- foreach (var ultraGridRow in rows)
- {
- List<object> para = new List<object>();
- var craftOrdDesign = (ChoiceCraftFileLv2Entity)ultraGridRow.ListObject;
- string Process = CustomInfo.Substring(0, 1);
- var list = _craftOrdDesignBLL.GetCraftPicSmpGroup(craftOrdDesign.OrdLnPk, craftOrdDesign.CraftSeq.ToString(), craftOrdDesign.CraftNo, craftOrdDesign.DesginKey,
- craftOrdDesign.Msc, Process, craftOrdDesign.Cic, craftOrdDesign.CutNum == null ? 1 : (int)craftOrdDesign.CutNum);
- var listToltal = GetCraftSamplingTotal(craftOrdDesign.OrdLnPk, craftOrdDesign.CraftSeq.ToString(), craftOrdDesign.CraftNo, craftOrdDesign.ProcessCodes, list);
- if (craftOrdDesign.FlagD.Equals("是") && Process.Equals("D"))
- {
- MessageUtil.ShowWarning("已确认的计划不能取消委托!");
- return;
- }
- para.Add(Process);
- para.Add(craftOrdDesign.OrdLnPk);
- para.Add(craftOrdDesign.CraftSeq.ToString());
- para.Add(JSONFormat.Format(listToltal.Any()? listToltal.FirstOrDefault():new CraftOrdDesignStdPicSmpTotalEntity() ));
- paras.Add(para);
- }
- _craftOrdDesignBLL.SetProcessFlag(paras, "0");
- MessageUtil.ShowTips("取消成功!");
- Query();
- }
- /// <summary>
- /// 取消计划科委托
- /// </summary>
- private void CancelConsign()
- {
-
- var rows = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True");
- if (!rows.Any())
- {
- MessageUtil.ShowWarning("请勾选一条记录!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否取消确认?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- List<object> paras = new List<object>();
- foreach (var ultraGridRow in rows)
- {
- List<object> para = new List<object>();
- var craftOrdDesign = (ChoiceCraftFileLv2Entity)ultraGridRow.ListObject;
- string Process = CustomInfo.Substring(0, 1);
- var list = _craftOrdDesignBLL.GetCraftPicSmpGroup(craftOrdDesign.OrdLnPk, craftOrdDesign.CraftSeq.ToString(), craftOrdDesign.CraftNo, craftOrdDesign.DesginKey,
- craftOrdDesign.Msc, Process, craftOrdDesign.Cic, craftOrdDesign.CutNum == null ? 1 : (int)craftOrdDesign.CutNum);
- var listToltal = GetCraftSamplingTotal(craftOrdDesign.OrdLnPk, craftOrdDesign.CraftSeq.ToString(), craftOrdDesign.CraftNo, craftOrdDesign.ProcessCodes, list);
- para.Add(Process);
- para.Add(craftOrdDesign.OrdLnPk);
- para.Add(craftOrdDesign.CraftSeq.ToString());
- para.Add(JSONFormat.Format(listToltal.Any() ? listToltal.FirstOrDefault() : new CraftOrdDesignStdPicSmpTotalEntity()));
- paras.Add(para);
- }
- _craftOrdDesignBLL.SetProcessJhFlag(paras, "0");
- MessageUtil.ShowTips("取消成功!");
- Query();
- }
- private void Cancel()
- {
-
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- CraftOrdDesignEntity craftOrdDesign = _craftOrdDesignBLL.QueryByPk(new CraftOrdDesignEntity()
- {
- OrdLnPk = ultraGrid1.ActiveRow.GetValue("OrdLnPk"),
- CraftSeq = decimal.Parse(ultraGrid1.ActiveRow.GetValue("CraftSeq"))
- });
- //if (craftOrdDesign.Validflag != "1")
- //{
- // MessageUtil.ShowWarning("只有生效状态才能选择二级工艺文件!");
- // return;
- //}
- string msc = ultraGrid1.ActiveRow.GetValue("Msc");
- switch (ultraGrid1.ActiveCell.Column.Key)
- {
- case "CraftFileLv2DDesc":
- ChoiceCraftFileLv2(craftOrdDesign.DesginKey, "D", "轧制", craftOrdDesign.CraftNo, msc);
- break;
- case "CraftFileLv2EDesc":
- ChoiceCraftFileLv2(craftOrdDesign.DesginKey, "E", "镦拔扩", craftOrdDesign.CraftNo, msc);
- break;
- case "CraftFileLv2FDesc":
- ChoiceCraftFileLv2(craftOrdDesign.DesginKey, "F", "热处理", craftOrdDesign.CraftNo, msc);
- break;
- case "CraftFileLv2GDesc":
- ChoiceCraftFileLv2(craftOrdDesign.DesginKey, "G", "加工", craftOrdDesign.CraftNo, msc);
- break;
- case "CraftFileLv2HDesc":
- ChoiceCraftFileLv2(craftOrdDesign.DesginKey, "H", "接箍加工", craftOrdDesign.CraftNo, msc);
- break;
- }
- }
- private void ChoiceCraftFileLv2(string designKey, string processCode, string processDesc, string craftNo, string msc)
- {
- var rows = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True");
- //if (rows.Count() == 0)
- //{
- // MessageUtil.ShowWarning("请至少勾选一条记录!");
- // return;
- //}
- int cnt = _craftOrdDesignBLL.GetCntByDesignKeyProcess(designKey, processCode);
- if (cnt == 0)
- {
- MessageUtil.ShowWarning("一级工艺文件不包含" + processDesc + "工序!");
- return;
- }
- string craftFileLv2Pks = ultraGrid1.GetActiveRowValue("CraftFileLv2" + processCode);
- bool isAddAsk = ultraGrid1.GetActiveRowValue("DescriptionDiff") == "" ? false : true;
- string modelCode = ultraGrid1.GetActiveRowValue("ModelCode");
- string modelDesc = ultraGrid1.GetActiveRowValue("ModelDesc");
- string dimater = ultraGrid1.GetActiveRowValue("Dimater");
- string height = ultraGrid1.GetActiveRowValue("Height");
- FrmCraftFileLv2 frmCraftFileLv2 = new FrmCraftFileLv2(designKey, processCode, craftFileLv2Pks,
- craftNo, "0", ob, msc, isAddAsk, modelCode, modelDesc, dimater, height);
- if (frmCraftFileLv2.ShowDialog() == DialogResult.OK)
- {
- foreach (var row in rows)
- {
- row.SetValue("CraftFileLv2" + processCode, frmCraftFileLv2.CraftFileLv2Pks);
- row.SetValue("CraftFileLv2" + processCode + "Desc", frmCraftFileLv2.CraftFileLv2Nos);
- }
- }
- }
- private PopupTextBox popupTextBox;
- private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- switch (ultraGrid1.ActiveCell.Column.Key)
- {
- case "CraftPath":
- var row = ultraGrid1.ActiveRow;
- CraftOrdDesignEntity craftOrdDesign = (CraftOrdDesignEntity)row.ListObject;
- string filePathOld = row.GetValue("CraftPathOld");
- string filePathNew = "Qcm/Craft/" + craftOrdDesign.OrdLnPk + "/" + craftOrdDesign.CraftSeq + "/";
- if (e.Button.Key.ToLower().Equals("select"))
- {
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePathOld);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- break;
- case "OrderSpecialDesc":
- case "DescriptionDiff":
- case "DescriptionAll":
- case "ChgeVal":
- case "Memo":
- case "CraftChangeMemo":
- popupTextBox = new PopupTextBox(ultraGrid1.ActiveCell.Value.ToString());
- popupTextBox.TxtInfo.ReadOnly = true;
- popupTextBox.UltraPanel1.Visible = false;
- popupTextBox.Show();
- break;
- }
- }
- private void lblCmbPlanStatus_CheckBox_CheckedChanged(object sender, EventArgs e)
- {
- }
- private void ultraGrid1_MouseUp(object sender, MouseEventArgs e)
- {
- //foreach (var row in ultraGrid1.Rows)
- //{
- // if (row.Selected)
- // {
- // row.Cells["CHK"].Value = true;
- // }
- //}
- ultraGrid1.UpdateData();
- }
- private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- /* 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();
- }
- }
- }
- ultraGrid1.UpdateData();*/
- }
- private void QueryCraftOrdDesignDown()
- {
- if (ultraGrid1.ActiveRow == null) return;
- var craftOrdDesign = (ChoiceCraftFileLv2Entity)ultraGrid1.ActiveRow.ListObject;
- string processCode = CustomInfo.Substring(0, 1);
- DataTable dt;
- switch (ultraTabControl1.ActiveTab.Key)
- {
- case "cic":
- /* dt = _cicBLL.getCraftMscPline(craftOrdDesign.DesginKey, processCode);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);*/
- _cicCtrl.QueryByDesignKeyCic(new string[] { craftOrdDesign.DesginKey, craftOrdDesign.MscPline, processCode, craftOrdDesign.Cic });
- break;
- case "pic":
- /* dt = _picBLL.getCraftMscPline(craftOrdDesign.DesginKey, processCode);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);*/
- dt = _picBLL.getGroupPhyMin(craftOrdDesign.DesginKey, "", craftOrdDesign.MscPline, processCode);
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- break;
- case "sic":
- /*dt = _sicBLL.getCraftMscPline(craftOrdDesign.DesginKey, processCode);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);*/
- _sicCtrl.QueryByDesignKeySic(new string[] { craftOrdDesign.DesginKey, craftOrdDesign.MscPline, processCode, "" });
- break;
- case "dic":
- /* dt = _dicBLL.getCraftMscPline(craftOrdDesign.DesginKey, processCode);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);*/
- _dicCtrl.QueryByDesignKeyDic(new string[] { craftOrdDesign.DesginKey, craftOrdDesign.MscPline, processCode, "" });
- break;
- case "wic":
- /* dt = _wicBLL.getCraftMscPline(craftOrdDesign.DesginKey, processCode);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);*/
- _wicCtrl.QueryByDesignKeyWic(new string[] { craftOrdDesign.DesginKey, craftOrdDesign.MscPline, processCode, "" });
- break;
- case "gic":
- /* dt = _gicBLL.getCraftMscPline(craftOrdDesign.DesginKey, processCode);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);*/
- _gicCtrl.QueryByDesignKeyGic(new string[] { craftOrdDesign.DesginKey, craftOrdDesign.MscPline, processCode, "" });
- break;
- case "smp":
- // BindSmpDataGroup(craftOrdDesign.DesginKey, processCode);
- // BindSmpData(craftOrdDesign.DesginKey, processCode);
- BindSmpDataGroup(craftOrdDesign.OrdLnPk, craftOrdDesign.CraftSeq.ToString(), craftOrdDesign.CraftNo, craftOrdDesign.DesginKey, craftOrdDesign.MscPline, processCode, craftOrdDesign.Cic,craftOrdDesign.CutNum == null ? 1 : (int)craftOrdDesign.CutNum);
-
- break;
- }
- }
- private void BindSmpDataGroup(string designKey, string processCode)
- {
- DataTable dt = _craftOrdDesignBLL.GetCraftPicSmpGroup(designKey, processCode);
- ultraGrid10.BeginUpdate();
- GridHelper.CopyDataToDatatable(dt, dataTable4, true);
- GridHelper.RefreshAndAutoSize(ultraGrid10);
- ultraGrid10.EndUpdate();
- }
- private void BindSmpDataGroup(string LnPk,string CraftSeq, string CraftNo, string designKey, string Msc, string processCode,string Cic,int Cut)
- {
- var list = _craftOrdDesignBLL.GetCraftPicSmpGroup(LnPk, CraftSeq, CraftNo, designKey, Msc, processCode, Cic,Cut);
- craftOrdDesignStdPicSmpDetailEntityBindingSource.DataSource = list;
- GridHelper.RefreshAndAutoSize(ultraGrid10);
- var listToltal = GetCraftSamplingTotal(LnPk, CraftSeq, CraftNo, processCode, list);
- craftOrdDesignStdPicSmpTotalEntityBindingSource.DataSource = listToltal;
- ultraGrid9.DisplayLayout.Bands[0].Columns["TypeStr"].Hidden =
- listToltal.Where(p => p.BatchNum != 0).Select(p => p.BatchNum).Distinct().Count() <=
- 1;
- ultraGrid9.DisplayLayout.Bands[0].Columns["StoveNum"].Hidden =
- listToltal.Select(p => p.StoveNum).Distinct().Count() <=
- 1;
- GridHelper.RefreshAndAutoSize(ultraGrid9);
- var list2 = _craftOrdDesignBLL.getSampleDetail(designKey, processCode);
- craftOrdDesignStdPicEntityBindingSource.DataSource = list2;
- GridHelper.RefreshAndAutoSize(ultraGrid11);
- }
- private List<CraftOrdDesignStdPicSmpTotalEntity> GetCraftSamplingTotal(string LnPk, string CraftSeq, string CraftNo, string processCode, List<CraftOrdDesignStdPicSmpDetailEntity> list)
- {
- var listToltal = _craftOrdDesignBLL.GetCraftSamplingTotal(LnPk, CraftSeq, CraftNo, processCode);
- if (!listToltal.Any())
- {
- list =CutAB(list);
- //找出生产批的检验项
- var ProBatch = list.Where(p => p.Rate == "408601" || p.Rate == "408608").ToList();
- if (ProBatch.Any())
- {
- listToltal.AddRange(GetAllToltalData(list, "1"));
- }
- listToltal.AddRange(GetAllToltalData(list.Where(p => p.Rate != "408601" && p.Rate != "408608").ToList(),
- ProBatch.Any() ? "0" : ""));
- }
- else
- {
- maxBatch = listToltal.Max(p => (int) (p.BatchNum ?? 0));
- }
- return listToltal;
- }
- public List<CraftOrdDesignStdPicSmpDetailEntity> CutAB(List<CraftOrdDesignStdPicSmpDetailEntity> lists)
- {
- lists = lists.Select(p => p.Clone() as CraftOrdDesignStdPicSmpDetailEntity).ToList();
- var listAB = lists.Where(p => p.Position == "401204").ToList();
- return listAB.SelectMany(p =>
- {
- List<CraftOrdDesignStdPicSmpDetailEntity> list = new List<CraftOrdDesignStdPicSmpDetailEntity>();
- if (p.DescCount == "1")
- {
- int Samplen;
- if (!int.TryParse(p.SampleCount, out Samplen))
- {
- Samplen = 2;
- }
- CraftOrdDesignStdPicSmpDetailEntity A = p.Clone() as CraftOrdDesignStdPicSmpDetailEntity;
- A.Position = "401201";
- A.DescPosition = "A端";
- A.SampleCount = (Samplen / 2).ToString();
- list.Add(A);
- CraftOrdDesignStdPicSmpDetailEntity B = p.Clone() as CraftOrdDesignStdPicSmpDetailEntity;
- B.Position = "401202";
- B.DescPosition = "B端";
- B.SampleCount = (Samplen / 2).ToString();
- lists.Add(B);
- }
- else
- {
- int Samplen;
- if (!int.TryParse(p.DescCount, out Samplen))
- {
- Samplen = 2;
- }
- CraftOrdDesignStdPicSmpDetailEntity A = p.Clone() as CraftOrdDesignStdPicSmpDetailEntity;
- A.Position = "401201";
- A.DescPosition = "A端";
- A.DescCount = (Samplen/2).ToString();
- list.Add(A);
- CraftOrdDesignStdPicSmpDetailEntity B = p.Clone() as CraftOrdDesignStdPicSmpDetailEntity;
- B.Position = "401202";
- B.DescPosition = "B端";
- B.DescCount = (Samplen/2).ToString();
- lists.Add(B);
- }
- return list;
- }
- ).ToList().Concat(lists.Where(p => p.Position != "401204")).ToList();
- }
- public List<CraftOrdDesignStdPicSmpTotalEntity> GetOnlyBatchList(List<CraftOrdDesignStdPicSmpDetailEntity> lists, int Type, int BatchNo)
- {
- List<CraftOrdDesignStdPicSmpTotalEntity> listTotalAll = new List<CraftOrdDesignStdPicSmpTotalEntity>();
- /* //先将检验批A端排列好
- GetNewList(listTotalAll,
- lists.Where(p => p.Rate == "408602" && p.Position == "401201").ToList(), "401201", "A端", Type, BatchNo);
- //再将检验批B端排列好
- GetNewList(listTotalAll,
- lists.Where(p => p.Rate == "408602" && p.Position == "401202").ToList(), "401202", "B端", Type, BatchNo);
- //再将检验批A或B端整合进A端或B端 若A或B端管头数大于A端和B端和 先暂时保留A端或B端 给后续插入整炉 留选择. 最后再把A端或B端改成A端
- GetNewList(listTotalAll,
- lists.Where(p => p.Rate == "408602" && p.Position == "401203").ToList(), "401203", "A端或B端", Type, BatchNo);*/
- // A和B端 A端和B端 都取
-
- foreach (var data in lists.Where(p => p.Rate == "408602" || p.Rate == "401101" || p.Rate == "408608").OrderBy(p => p.Position).GroupBy(p => new { p.Position, p.DescPosition }))
- {
- GetNewList(listTotalAll,
- data.ToList(), data.Key.Position, data.Key.DescPosition, Type, BatchNo);
- }
- if (!listTotalAll.Any() && lists.Any()) listTotalAll.Add(new CraftOrdDesignStdPicSmpTotalEntity()
- {
- OrdLnPk = lists[0].OrdLnPk,
- CraftSeq = lists[0].CraftSeq,
- CraftNo = lists[0].CraftNo,
- ProcessCode = lists[0].ProcessCode,
- Position = "",
- DescPosition = "",
- SampleCount = "0",
- SampleLength = "0",
- BatchNo = BatchNo,
- BatchNum = Type,
- });
- return listTotalAll;
- }
- private List<CraftOrdDesignStdPicSmpDetailEntity> AddStoveToBatchList(List<CraftOrdDesignStdPicSmpTotalEntity> listTotalAll, List<CraftOrdDesignStdPicSmpDetailEntity> lists, int Type, int BatchNo)
- {
- //先将炉批A端 加入检验批中,返回剩下不能加入的炉批
- var list1 = AddStoveToBatch(listTotalAll,
- lists.Where(p => (p.Rate == "408603" || p.Rate == "408601") && p.Position == "401201").ToList(), "401201", "A端", Type, BatchNo);
- //再将检验批B端排列好
- var list2 = AddStoveToBatch(listTotalAll,
- lists.Where(p => (p.Rate == "408603" || p.Rate == "408601") && p.Position == "401202").ToList(), "401202", "B端", Type, BatchNo);
- //再将检验批A或B端整合进A端或B端 若A或B端管头数A端和B端和 先暂时保留A端或B端 给后续插入整炉 留选择. 最后再把A端或B端改成A端
- var list3 = AddStoveToBatch(listTotalAll,
- lists.Where(p => (p.Rate == "408603" || p.Rate == "408601") && p.Position == "401203").ToList(), "401203", "A端或B端", Type, BatchNo);
-
- /*var list4 = AddStoveToBatch(listTotalAll,
- lists.Where(p => (p.Rate == "408603" || p.Rate == "408601") && p.Position == "401204").ToList(), "401204", "A端和B端", Type, BatchNo);*/
- List<CraftOrdDesignStdPicSmpDetailEntity> returnData = new List<CraftOrdDesignStdPicSmpDetailEntity>();
- if (list1 != null && list1.Count > 0) returnData = returnData.Concat(list1).ToList();
- if (list2 != null && list2.Count > 0) returnData = returnData.Concat(list2).ToList();
- if (list3 != null && list3.Count > 0) returnData = returnData.Concat(list3).ToList();
- foreach (var data in lists.Where(p => (p.Rate == "408603" || p.Rate == "408601") && p.Position != "401201" && p.Position != "401202" && p.Position != "401203").GroupBy(p => new { p.Position, p.DescPosition }))
- {
- var listother = AddStoveToBatch(listTotalAll, data.ToList(), data.Key.DescPosition,
- data.Key.DescPosition, Type, BatchNo);
- if (listother != null && listother.Count > 0) returnData = returnData.Concat(listother).ToList();
- }
-
- return returnData;
- }
- public void GetNewList(List<CraftOrdDesignStdPicSmpTotalEntity> listTotalAll,
- List<CraftOrdDesignStdPicSmpDetailEntity> listA, string position, string positionName, int Type, int BatchNo)
- {
- if (listTotalAll==null) listTotalAll = new List<CraftOrdDesignStdPicSmpTotalEntity>();
- var data = position == "401203" ?
- listTotalAll.Where(p => p.Position == "401201" || p.Position == "401202" || p.Position == "").ToList()
- : listTotalAll.Where(p => p.Position == position || p.Position == "").ToList();
- foreach (var As in listA)
- {
- var data1 = GetCanNotMergeData(data, As);
- int count = As.DescCount.TryParseInt() ? int.Parse(As.DescCount) : 1;
- for (int i = 0; i < count; i++)
- {
- if (data1.Count <= i)
- {
- CraftOrdDesignStdPicSmpTotalEntity CraftOrdDesignStdPicSmpTotalEntityA =
- new CraftOrdDesignStdPicSmpTotalEntity();
- CraftOrdDesignStdPicSmpTotalEntityA.OrdLnPk = As.OrdLnPk;
- CraftOrdDesignStdPicSmpTotalEntityA.CraftSeq = As.CraftSeq;
- CraftOrdDesignStdPicSmpTotalEntityA.CraftNo = As.CraftNo;
- CraftOrdDesignStdPicSmpTotalEntityA.ProcessCode = As.ProcessCode;
- CraftOrdDesignStdPicSmpTotalEntityA.Position = position;
- CraftOrdDesignStdPicSmpTotalEntityA.DescPosition = positionName;
- CraftOrdDesignStdPicSmpTotalEntityA.SampleCount = "1";
- CraftOrdDesignStdPicSmpTotalEntityA.SampleLength = "0";
- CraftOrdDesignStdPicSmpTotalEntityA.BatchNo = BatchNo;
- CraftOrdDesignStdPicSmpTotalEntityA.BatchNum = Type;
- data1.Add(CraftOrdDesignStdPicSmpTotalEntityA);
- listTotalAll.Add(CraftOrdDesignStdPicSmpTotalEntityA);
- }
- if (!data1[i].PhyCodeGroup.Contains(As.PhyCodeMin))
- {
- data1[i].PhyCodeGroup = string.IsNullOrWhiteSpace(data1[i].PhyCodeGroup)
- ? As.PhyCodeMin
- : (data1[i].PhyCodeGroup + "," + As.PhyCodeMin);
- data1[i].PhyNameGroup = string.IsNullOrWhiteSpace(data1[i].PhyNameGroup)
- ? As.PhyNameMin
- : (data1[i].PhyNameGroup + "," + As.PhyNameMin);
- }
-
- //环状
- if (As.SampleStyle == "408102")
- {
- data1[i].SampleLength = ((data1[i].SampleLength.TryParseInt()
- ? int.Parse(data1[i].SampleLength)
- : 0) + (
- As.Length.TryParseInt() ? int.Parse(As.Length) : 0)) *
- (As.SampleCount.TryParseInt() ? int.Parse(As.SampleCount) : 1) +
- "";
- }
- else
- {
- Rectangle rectangle = new Rectangle();
- double.TryParse(As.Length, out rectangle.Height);
- double.TryParse(As.Width, out rectangle.Width);
- /* rectangle.Height = double.Parse(As.Length);
- rectangle.Width = double.Parse(As.Width);*/
- var tag = data1[i].Tag as List<Rectangle> ?? new List<Rectangle>();
- tag.Add(rectangle);
- data1[i].Tag = tag;
- }
- }
- }
- }
- private List<CraftOrdDesignStdPicSmpTotalEntity> GetCanNotMergeData(List<CraftOrdDesignStdPicSmpTotalEntity> datas,
- CraftOrdDesignStdPicSmpDetailEntity As)
- {
- try
- {
- if (CanNotMergePhyCode.ContainsKey(As.PhyCodeMin))
- {
- List<string> list = CanNotMergePhyCode[As.PhyCodeMin];
- return datas.Where(p =>
- {
- string[] phyCodeGroups = p.PhyCodeGroup.Split(',');
- for (int i = 0; i < phyCodeGroups.Length; i++)
- {
- if (list.Contains(phyCodeGroups[i])) return false;
- }
- return true;
- }).ToList();
- }
- return datas;
- }
- catch (Exception)
- {
- return datas;
- }
- }
- public List<CraftOrdDesignStdPicSmpTotalEntity> AddRemainStoveToBatch(
- List<CraftOrdDesignStdPicSmpDetailEntity> lists, int Type, int BatchNo)
- {
- List<CraftOrdDesignStdPicSmpTotalEntity> listTotalAll = new List<CraftOrdDesignStdPicSmpTotalEntity>();
- /* //先将检验批A端排列好
- GetNewList(listTotalAll,
- lists.Where(p => p.Position == "401201").ToList(), "401201", "A端", Type, BatchNo);
- //再将检验批B端排列好
- GetNewList(listTotalAll,
- lists.Where(p => p.Position == "401202").ToList(), "401202", "B端", Type, BatchNo);
- //再将检验批A或B端整合进A端或B端 若A或B端管头数大于A端和B端和 先暂时保留A端或B端 给后续插入整炉 留选择. 最后再把A端或B端改成A端
- GetNewList(listTotalAll,
- lists.Where(p => p.Position == "401203").ToList(), "401203", "A端或B端", Type, BatchNo);*/
- foreach (var data in lists.GroupBy(p=>new {p.Position,p.DescPosition}))
- {
- GetNewList(listTotalAll,
- data.ToList(), data.Key.Position, data.Key.DescPosition, Type, BatchNo);
- }
- return listTotalAll;
- }
- public List<CraftOrdDesignStdPicSmpDetailEntity> AddStoveToBatch(List<CraftOrdDesignStdPicSmpTotalEntity> listTotalAll,
- List<CraftOrdDesignStdPicSmpDetailEntity> listA, string position, string positionName, int Type, int BatchNo)
- {
- List<CraftOrdDesignStdPicSmpDetailEntity> remainStove = new List<CraftOrdDesignStdPicSmpDetailEntity>();
- if (listTotalAll == null) listTotalAll = new List<CraftOrdDesignStdPicSmpTotalEntity>();
- var data =
- position == "401203" ?
- listTotalAll.Where(p => p.Position == "401201" || p.Position == "401202" || p.Position == "401203" || p.Position=="").ToList() :
- (position == "401201" || position == "401202") ? listTotalAll.Where(p => p.Position == position || p.Position == "401203" || p.Position == "").ToList()
- : listTotalAll.Where(p => p.Position == position || p.Position == "").ToList();
- bool CanRemain = data.Count <= 0;
-
-
- foreach (var As in listA)
- {
- int count = As.DescCount.TryParseInt() ? int.Parse(As.DescCount) : 1;
- for (int i = 0; i < count; i++)
- {
- if (data.Count <= i)
- {
- if (!CanRemain)
- {
- CraftOrdDesignStdPicSmpDetailEntity remain =
- As.Clone() as CraftOrdDesignStdPicSmpDetailEntity;
- if (remain != null)
- {
- remain.DescCount = (count - i) + "";
- remainStove.Add(remain);
- }
- break;
- }
- else
- {
- CraftOrdDesignStdPicSmpTotalEntity CraftOrdDesignStdPicSmpTotalEntityA =
- new CraftOrdDesignStdPicSmpTotalEntity
- {
- OrdLnPk = As.OrdLnPk,
- CraftSeq = As.CraftSeq,
- CraftNo = As.CraftNo,
- ProcessCode = As.ProcessCode,
- Position = position,
- DescPosition = positionName,
- SampleCount = "1",
- SampleLength = "0",
- BatchNo = BatchNo,
- BatchNum = Type
- };
- data.Add(CraftOrdDesignStdPicSmpTotalEntityA);
- listTotalAll.Add(CraftOrdDesignStdPicSmpTotalEntityA);
- }
- }
- if (data[i].Position == "" )
- {
- //data[i] = new CraftOrdDesignStdPicSmpTotalEntity
- //{
- // OrdLnPk = As.OrdLnPk,
- // CraftSeq = As.CraftSeq,
- // CraftNo = As.CraftNo,
- // ProcessCode = As.ProcessCode,
- // Position = position,
- // DescPosition = positionName,
- // SampleCount = "1",
- // SampleLength = "0",
- // BatchNo = BatchNo,
- // BatchNum = Type
- //};
- data[i].OrdLnPk = As.OrdLnPk;
- data[i].CraftSeq = As.CraftSeq;
- data[i].CraftNo = As.CraftNo;
- data[i].ProcessCode = As.ProcessCode;
- data[i].Position = As.Position;
- data[i].DescPosition = As.DescPosition;
- data[i].SampleCount = "1";
- data[i].SampleLength = "0";
- data[i].BatchNo = BatchNo;
- data[i].BatchNum = Type;
-
- }
- if (!data[i].PhyCodeGroup.Contains(As.PhyCodeMin))
- {
- data[i].PhyCodeGroup = string.IsNullOrWhiteSpace(data[i].PhyCodeGroup)
- ? As.PhyCodeMin
- : (data[i].PhyCodeGroup + "," + As.PhyCodeMin);
- data[i].PhyNameGroup = string.IsNullOrWhiteSpace(data[i].PhyNameGroup)
- ? As.PhyNameMin
- : (data[i].PhyNameGroup + "," + As.PhyNameMin);
- }
- // A或B的检验批的管头 比如加上了A端检验项, 则这个管头标记成A端,后续不能挂B端检验项
- if (data[i].Position == "401203")
- {
- data[i].Position = As.Position;
- data[i].DescPosition = As.DescPosition;
- }
- //环状
- if (As.SampleStyle == "408102")
- {
- data[i].SampleLength = ((data[i].SampleLength.TryParseInt()
- ? int.Parse(data[i].SampleLength)
- : 0) + (
- As.Length.TryParseInt() ? int.Parse(As.Length) : 0)) *
- (As.SampleCount.TryParseInt() ? int.Parse(As.SampleCount) : 1) +
- "";
- }
- else
- {
- Rectangle rectangle = new Rectangle();
- double.TryParse(As.Length, out rectangle.Height);
- double.TryParse(As.Width, out rectangle.Width);
- /* rectangle.Height = double.Parse(As.Length);
- rectangle.Width = double.Parse(As.Width);*/
- var tag = data[i].Tag as List<Rectangle> ?? new List<Rectangle>();
- tag.Add(rectangle);
- data[i].Tag = tag;
- }
- }
- }
- return remainStove;
- }
- public List<CraftOrdDesignStdPicSmpTotalEntity> GetAllToltalData(List<CraftOrdDesignStdPicSmpDetailEntity> lists,string StoveNum)
- {
- List<CraftOrdDesignStdPicSmpTotalEntity> toltalData = new DataSourceList<CraftOrdDesignStdPicSmpTotalEntity>();
- List<CraftOrdDesignStdPicSmpTotalEntity> toltalData1 = new DataSourceList<CraftOrdDesignStdPicSmpTotalEntity>();
- List<List<CraftOrdDesignStdPicSmpDetailEntity>> Remains = new List<List<CraftOrdDesignStdPicSmpDetailEntity>>();
- int i = 0;
- //是否有按炉分配
- if (lists.Any(p => p.Rate == "408603" || p.Rate== "408601"))
- {
- var BatchData = GetOnlyBatchList(lists,1, ++i );
- var RemainStove = AddStoveToBatchList(BatchData, lists, 0, i );
- toltalData1.AddRange(BatchData);
- Remains.Add(RemainStove);
- if (RemainStove != null && RemainStove.Count > 0)
- {
- while (true)
- {
- var BatchData1 = GetOnlyBatchList(lists,0, ++i );
- RemainStove = AddStoveToBatchList(BatchData1, RemainStove, 0, i );
- toltalData1.AddRange(BatchData1);
- Remains.Add(RemainStove);
- if (RemainStove == null || RemainStove.Count <= 0) break;
- }
-
- }
-
- }
- toltalData1.AddRange(GetOnlyBatchList(lists,0, ++i ));
- maxBatch = i;
- foreach (var data in toltalData1)
- {
- data.BatchNum = i ;
- }
- for (int j = i-1; j >=1; j--)
- {
- List<CraftOrdDesignStdPicSmpTotalEntity> tempData = toltalData1.Where(p => p.BatchNo < j).
- Select(p =>
- {
- CraftOrdDesignStdPicSmpTotalEntity CraftOrdDesignStdPicSmpTotalEntity =
- p.Clone() as CraftOrdDesignStdPicSmpTotalEntity;
- CraftOrdDesignStdPicSmpTotalEntity.BatchNum = j ;
- return CraftOrdDesignStdPicSmpTotalEntity;
- }).ToList();
- List<CraftOrdDesignStdPicSmpTotalEntity> LastBatch = toltalData1.Where(p => p.BatchNo == j).
- Select(p =>
- {
- CraftOrdDesignStdPicSmpTotalEntity CraftOrdDesignStdPicSmpTotalEntity =
- p.Clone() as CraftOrdDesignStdPicSmpTotalEntity;
- CraftOrdDesignStdPicSmpTotalEntity.BatchNum = j;
- return CraftOrdDesignStdPicSmpTotalEntity;
- }).ToList();
- LastBatch.AddRange(AddRemainStoveToBatch(Remains[j - 1], j, j));
- toltalData.AddRange(tempData);
- toltalData.AddRange(LastBatch);
-
- }
- toltalData.AddRange(toltalData1);
- toltalData.AddRange(AddRemainStoveToBatch(lists.Where(p => p.Rate != "408602" && p.Rate != "401101" && p.Rate != "408603" && p.Rate != "408601" && p.Rate != "408608").ToList(), 0, -1));
- foreach (var data in toltalData)
- {
- data.SampleLength = (data.SampleLength.TryParseInt()
- ? double.Parse(data.SampleLength)
- : 0) + (CalculateLength(1000, data.Tag as List<Rectangle>)) +
- "";
- // 若最后仍有A或B的检验批的管头 全默认A管头
- if (data.Position == "401203")
- {
- data.Position = "401201";
- data.DescPosition ="A端";
- }
- data.StoveNum = StoveNum;
- }
- toltalData = toltalData.GroupBy(p => new { Type = p.BatchNum, p.BatchNo, p.SampleCount,p.Position, p.PhyCodeGroup }).Select(
- p =>
- {
- CraftOrdDesignStdPicSmpTotalEntity CraftOrdDesignStdPicSmpTotalEntity = p.FirstOrDefault();
- CraftOrdDesignStdPicSmpTotalEntity.SampleCount = p.Sum(q => int.Parse(q.SampleCount)) + "";
- return CraftOrdDesignStdPicSmpTotalEntity;
- }).OrderBy(p => p.BatchNum).ThenBy(p=>p.BatchNo).ThenBy(p=>p.Position).ToList();
- return toltalData;
- }
- private DataTable _dt = null;
- private void BindSmpData(string designKey, string processCode)
- {
- dataTable3.Clear();
- for (int i = dataTable3.Columns.Count - 1; i >= 0; i--)
- {
- if (dataTable3.Columns[i].ColumnName.ToString().StartsWith("C"))
- {
- dataTable3.Columns.Remove(dataTable3.Columns[i]);
- }
- }
- dataTable4.Clear();
- _dt = _craftOrdDesignBLL.GetCraftPicSmp(designKey, processCode);
- var drs = _dt.Rows.Cast<DataRow>();
- if (_dt.Rows.Count == 0)
- {
- return;
- }
- int pipeCnt = drs.Max(a => int.Parse(a["DESC_COUNT"].ToString()));
- //处理主表
- //新增列
- ultraGrid9.BeginUpdate();
- foreach (var dr in drs)
- {
- string phyCodeMin = dr["PHY_CODE_MIN"].ToString();
- string phyNameMin = dr["PHY_NAME_MIN"].ToString();
- if (dataTable3.Columns.Contains(phyCodeMin)) continue;
- dataTable3.Columns.Add(phyCodeMin);
- dataTable3.Columns[phyCodeMin].Caption = phyNameMin;
- }
- for (int i = 0; i < pipeCnt; i++)
- {
- var dt3Dr = dataTable3.NewRow();
- dt3Dr["PIPE_INDEX"] = i + 1;
- dataTable3.Rows.Add(dt3Dr);
- }
- var aryDrs = drs.ToArray();
- for (int i = 0; i < aryDrs.Length; i++)
- {
- var dr = aryDrs[i];
- int descCount = int.Parse(dr["DESC_COUNT"].ToString());
- string phyCodeMin = dr["PHY_CODE_MIN"].ToString();
- string phyNameMin = dr["PHY_NAME_MIN"].ToString();
- string sampleCount = dr["SAMPLE_COUNT"].ToString();
- for (int j = 0; j < descCount; j++)
- {
- int drSmpCnt = sampleCount == "" ? 0 : int.Parse(sampleCount.ToString());
- int dt3SmpCnt = dataTable3.Rows[j][phyCodeMin].ToString() == "" ? 0 : int.Parse(dataTable3.Rows[j][phyCodeMin].ToString());
- dataTable3.Rows[j][phyCodeMin] = drSmpCnt + dt3SmpCnt;
- }
- }
- string strD = ultraGrid1.ActiveRow.GetValue("DIMATER");
- string strH = ultraGrid1.ActiveRow.GetValue("HEIGHT");
- double dimater = strD.TryParseDouble() ? double.Parse(strD) : 0;
- double height = strH.TryParseDouble() ? double.Parse(strH) : 0;
- double perimeter = 2 * Math.PI * (dimater - height); //周长
- //计算长度
- foreach (DataRow pDr in dataTable3.Rows)
- {
- List<Rectangle> noArrayData = new List<Rectangle>();
- double length = 0;
- foreach (DataRow dr in _dt.Rows)
- {
- if (int.Parse(dr["DESC_COUNT"].ToString()) < int.Parse(pDr["PIPE_INDEX"].ToString())) continue;
- if (dr["SAMPLE_STYLE"].ToString() == "408102")
- {
- length += double.Parse(dr["LENGTH"].ToString());
- continue;
- }
- Rectangle rectangle = new Rectangle();
- rectangle.Height = double.Parse(dr["LENGTH"].ToString());
- rectangle.Width = double.Parse(dr["WIDTH"].ToString());
- noArrayData.Add(rectangle);
- }
- length += CalculateLength(perimeter, noArrayData);
- pDr["PIPE_LENGTH"] = length;
- }
-
- GridHelper.RefreshAndAutoSize(ultraGrid9);
- ultraGrid9.EndUpdate();
- }
- /// <summary>
- /// 计算试样所需的样管高度
- /// </summary>
- /// <param name="perimeter">宽(周长)</param>
- /// <param name="listData">取样集合</param>
- /// <returns></returns>
- private double CalculateLength(double perimeter, List<Rectangle> noArrayData)
- {
- if (noArrayData == null) return 0d;
- double length = 0;
- //已排列好的取样
- List<Rectangle> arrayData = new List<Rectangle>();
- noArrayData = noArrayData.OrderByDescending(a=>a.Height).ToList();
- Test test = new Test(perimeter);
- for (int i = 0; i < noArrayData.Count; i++)
- {
- Rectangle rectangle = noArrayData[i];
- test.Add(rectangle);
- }
- foreach (var area in test.Data)
- {
- length += area.Height;
- }
- return length;
- }
- private class Test
- {
- private List<Area> data = new List<Area>();
- public List<Area> Data
- {
- get { return data; }
- set { data = value; }
- }
- private Area area;
- private double perimeter = 0;
- public Test(double perimeter)
- {
- this.perimeter = perimeter;
- data.Add(new Area());
- }
- public void Add(Rectangle rectangle)
- {
- if (!CheckAdd(rectangle))
- {
- data.Add(new Area());
- }
- Area area = data[data.Count - 1];
- var maxRectangele = area.Rectangles.Where(a => a.Point.X == area.Rectangles.Max(b => b.Point.X)).FirstOrDefault();
- if (maxRectangele.Height != 0)
- {
- rectangle.Point.Y = maxRectangele.Point.Y;
- rectangle.Point.X = maxRectangele.Point.X + rectangle.Width;
- }
- area.Rectangles.Add(rectangle);
- area.Height = area.Rectangles.Max(a => a.Height);
- }
- private bool CheckAdd(Rectangle rectangle)
- {
- Area area = data[data.Count - 1];
- var maxRectangele = area.Rectangles.Where(a => a.Point.X == area.Rectangles.Max(b => b.Point.X)).FirstOrDefault();
- if (maxRectangele.Point.X + rectangle.Width <= perimeter)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- //public bool IsStartRight()
- //{
- // if (data.Count == 0)
- // {
- // return true;
- // }
- // else
- // {
-
- // }
- //}
- }
- private class Area
- {
- public List<Rectangle> Rectangles = new List<Rectangle>();
- public double Height;
- }
- [Serializable]
- /// <summary>
- /// 样条属性
- /// </summary>
- private struct Rectangle
- {
- public Point Point;
- public double Width;
- public double Height;
- }
- [Serializable]
- private struct Point
- {
- public double X;
- public double Y;
- public Point(double x, double y)
- {
- X = x;
- Y = y;
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- if (!CustomInfo.Contains("PLAN")) return;
- try
- {
- this.Cursor = Cursors.WaitCursor;
- ClearCraftDesignDown();
- if (ultraGrid1.ActiveRow == null) return;
- var craftOrdDesign = (CraftOrdDesignEntity)ultraGrid1.ActiveRow.ListObject;
- string processCode = CustomInfo.Substring(0, 1);
- DataTable dt = _craftOrdDesignBLL.GetCraftStationType(craftOrdDesign.DesginKey, processCode);
- bool existCic = false;
- bool existPic = false;
- bool existSic = false;
- bool existDic = false;
- bool existWic = false;
- bool existGic = false;
- foreach (DataRow dr in dt.Rows)
- {
- if (dr["STATION_TYPE"].ToString() == "403201")
- {
- existCic = true;
- }
- else if (dr["STATION_TYPE"].ToString() == "403202")
- {
- existPic = true;
- }
- else if (dr["STATION_TYPE"].ToString() == "403203")
- {
- existSic = true;
- }
- else if (dr["STATION_TYPE"].ToString() == "403204")
- {
- existDic = true;
- }
- else if (dr["STATION_TYPE"].ToString() == "403205")
- {
- existWic = true;
- }
- else if (dr["STATION_TYPE"].ToString() == "403208")
- {
- existGic = true;
- }
- }
-
- ultraTabControl1.Tabs["cic"].Visible = existCic;
- ultraTabControl1.Tabs["pic"].Visible = existPic;
- ultraTabControl1.Tabs["sic"].Visible = existSic;
- ultraTabControl1.Tabs["dic"].Visible = existDic;
- ultraTabControl1.Tabs["wic"].Visible = existWic;
- ultraTabControl1.Tabs["gic"].Visible = existGic;
- QueryCraftOrdDesignDown();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string designKey = ultraGrid2.ActiveRow.GetValue("DesignKey");
- string mscPline = ultraGrid2.ActiveRow.GetValue("MscPline");
- string processCode = ultraGrid2.ActiveRow.GetValue("ProcessCode");
- string cic = ultraGrid2.ActiveRow.GetValue("Cic");
- _cicCtrl.QueryByDesignKeyCic(new string[] { designKey, mscPline, processCode, cic });
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string designKey = ultraGrid3.ActiveRow.GetValue("DesignKey");
- string mscPline = ultraGrid3.ActiveRow.GetValue("MscPline");
- string processCode = ultraGrid3.ActiveRow.GetValue("ProcessCode");
- string pic = ultraGrid3.ActiveRow.GetValue("Pic");
- DataTable dt = _picBLL.getGroupPhyMin(designKey, pic, mscPline, processCode);
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string designKey = ultraGrid4.ActiveRow.GetValue("DesignKey");
- string mscPline = ultraGrid4.ActiveRow.GetValue("MscPline");
- string processCode = ultraGrid4.ActiveRow.GetValue("ProcessCode");
- string sic = ultraGrid4.ActiveRow.GetValue("Sic");
- _sicCtrl.QueryByDesignKeySic(new string[] { designKey, mscPline, processCode, sic });
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string designKey = ultraGrid5.ActiveRow.GetValue("DesignKey");
- string mscPline = ultraGrid5.ActiveRow.GetValue("MscPline");
- string processCode = ultraGrid5.ActiveRow.GetValue("ProcessCode");
- string dic = ultraGrid5.ActiveRow.GetValue("Dic");
- _dicCtrl.QueryByDesignKeyDic(new string[] { designKey, mscPline, processCode, dic });
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraGrid6_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string designKey = ultraGrid6.ActiveRow.GetValue("DesignKey");
- string mscPline = ultraGrid6.ActiveRow.GetValue("MscPline");
- string processCode = ultraGrid6.ActiveRow.GetValue("ProcessCode");
- string wic = ultraGrid6.ActiveRow.GetValue("Wic");
- _wicCtrl.QueryByDesignKeyWic(new string[] { designKey, mscPline, processCode, wic });
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraGrid7_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string designKey = ultraGrid7.ActiveRow.GetValue("DesignKey");
- string mscPline = ultraGrid7.ActiveRow.GetValue("MscPline");
- string processCode = ultraGrid7.ActiveRow.GetValue("ProcessCode");
- string gic = ultraGrid7.ActiveRow.GetValue("Gic");
- _gicCtrl.QueryByDesignKeyGic(new string[] { designKey, mscPline, processCode, gic });
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- ClearCraftDesignDown();
- QueryCraftOrdDesignDown();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraGrid8_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- /* string designKey = ultraGrid3.ActiveRow.GetValue("DesignKey");
- string mscPline = ultraGrid3.ActiveRow.GetValue("MscPline");
- string processCode = ultraGrid3.ActiveRow.GetValue("ProcessCode");
- string pic = ultraGrid3.ActiveRow.GetValue("Pic");*/
- string phyCodeMin = ultraGrid8.ActiveRow.GetValue("PHY_CODE_MIN");
- if (ultraGrid1.ActiveRow == null) return;
- var craftOrdDesign = (ChoiceCraftFileLv2Entity)ultraGrid1.ActiveRow.ListObject;
- string processCode = CustomInfo.Substring(0, 1);
- _picCtrl.QueryByDesignKeyPic(new string[] { craftOrdDesign.DesginKey, craftOrdDesign.MscPline, processCode, "", phyCodeMin });
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- /// <summary>
- /// 通过权限初始化产线
- /// </summary>
- /// <param name="processCode"></param>
- /// <param name="ugc"></param>
- /// <param name="validDataPurviewIds"></param>
- /// <param name="ob"></param>
- public List<String> InitDropPlinePower(string processCode, UltraComboEditor ugc, string[] validDataPurviewIds, OpeBase ob)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.initPlinePower", new object[] { processCode, validDataPurviewIds }, ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- ugc.DataSource = dt;
- ugc.ValueMember = "PLINE_CODE";
- ugc.DisplayMember = "PLINE_NAME";
- List<String> plineArr = new List<string>();
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- plineArr.Add(dt.Rows[i]["PLINE_CODE"].ToString());
- }
- return plineArr;
- }
- else
- {
- return null;
- }
- }
- public class CustomMergedCellEvaluator : IMergedCellEvaluator
- {
- private string[] keys;
- public CustomMergedCellEvaluator(string[] GroupKey)
- {
- keys = GroupKey;
- }
- public bool ShouldCellsBeMerged(UltraGridRow row1, UltraGridRow row2, UltraGridColumn column) //控件自带的方法,会自动进行调用,column为初始化中设置的行
- {
- foreach (string key in keys)
- {
- if (row1.Cells[key].Value.ToString() != row2.Cells[key].Value.ToString()) return false;
- }
- return row1.Cells[column].Value.ToString() == row2.Cells[column].Value.ToString();
- }
- }
- private void ultraGrid9_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- if(e.Row.HasParent()) return;
- CraftOrdDesignStdPicSmpTotalEntity CraftOrdDesignStdPicSmpTotalEntity =
- e.Row.ListObject as CraftOrdDesignStdPicSmpTotalEntity;
- e.Row.Cells["TypeStr"].Value =int.Parse(e.Row.Cells["BatchNum"].Value.ToString()) == 0 ? "" : (e.Row.Cells["BatchNum"].Value +
- (int.Parse(e.Row.Cells["BatchNum"].Value.ToString()) == maxBatch ? "-N" : ""));
- e.Row.Cells["BatchNoStr"].Value = (decimal)e.Row.Cells["BatchNo"].Value == 1
- ? "首批"
- : ("第" + e.Row.Cells["BatchNo"].Value +
- ((decimal)e.Row.Cells["BatchNo"].Value == maxBatch ? "-N批" : "批"));
-
- }
- private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- /* foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows.AsParallel())
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["Chk"].Value = true;
- }
- }*/
- foreach (var ultraGridRow in ultraGrid1.Rows.AsParallel())
- {
- if (ultraGridRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- ultraGridRow.Cells["Chk"].Value = ultraGridRow.Selected;
- }
- }
- }
- private void ultraGrid10_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- CraftOrdDesignStdPicSmpDetailEntity row = e.Row.ListObject as CraftOrdDesignStdPicSmpDetailEntity;
- if (row ==null) return;
- if (row.Rate == "408602" || row.Rate == "401101" || row.Rate == "408608")
- {
- ultraGrid10.Rows[e.Row.Index].Cells["BatchCnt"].IgnoreRowColActivation = true;
- ultraGrid10.Rows[e.Row.Index].Cells["BatchCnt"].Activation = Activation.AllowEdit;
- ultraGrid10.Rows[e.Row.Index].Cells["BatchCnt"].Appearance.BackColor = Color.FromArgb(255, 255, 192);
- }
- }
- private void ultraGrid10_CellChange(object sender, CellEventArgs e)
- {
- CraftOrdDesignStdPicSmpDetailEntity row = e.Cell. Row.ListObject as CraftOrdDesignStdPicSmpDetailEntity;
- List<CraftOrdDesignStdPicSmpDetailEntity> lists =
- craftOrdDesignStdPicSmpDetailEntityBindingSource.DataSource as List<CraftOrdDesignStdPicSmpDetailEntity>;
- if (row == null|| lists==null) return;
- if (row.Rate == "408602" || row.Rate == "401101" || row.Rate == "408608")
- {
- lists.Where(p => p.Rate == "408602" || p.Rate == "401101" || p.Rate == "408608" ).ToList().ForEach(p=>p.BatchCnt = e.Cell.Text);
- }
- ultraGrid10.Refresh();
- }
- private void craftView_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- var entity = ultraGrid1.ActiveRow.ListObject as ChoiceCraftFileLv2Entity;
- if (entity == null) return;
- /* UltraGridRow row = ultraGrid1.ActiveRow;
- string filePathOld = row.GetValue("CRAFT_PATH_OLD");
- string filePathNew = "";*/
- if (e.Button.Key.ToLower().Equals("select"))
- {
- var strurl = "";
- /*strurl =
- "http://localhost:8075/WebReport/ReportServer?reportlet=HttRotaCrackDetetionPipeHeatReport.cpt&resultNo=" +
- resultNo;*/
- strurl =
- "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepHttCasingProcess.cpt&desginKey={0}&mscPline={1}";
- strurl = String.Format(strurl, entity.DesginKey, entity.MscPline);
- var fre = new FrmRepExcel(ob, strurl);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width,
- Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- /* dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePathOld);
- down.DeleteButton.Visible = false;
- down.ShowDialog();*/
- }
- else if (e.Button.Key.ToLower().Equals("view"))
- {
- string path = "Qcm/CraftLv2/" + entity.OrderManageNo + "/" + entity.CraftFileLv2F;
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, path);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- else if (e.Button.Key.ToLower().Equals("insert"))
- {
- /* string guid = Guid.NewGuid().ToString("N").ToUpper();
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePathOld);
- down.CtrlFileDown1.FilePath = filePathOld;
- if (down.CtrlFileDown1.List.Count > 0)
- {
- MessageUtil.ShowWarning("只能上传一份文件!");
- return;*/
- List<FileBean> list = new List<FileBean>();
- FileBean bean = new FileBean();
- OpenFileDialog file = new OpenFileDialog();
- file.Multiselect = false;
- DialogResult drStat;
- drStat = file.ShowDialog();
- if (drStat == DialogResult.OK)
- {
- string fileName = file.FileName;
- string filena = System.IO.Path.GetFileName(fileName);
- string filePathNew = "Qcm/CraftLv2/" + entity.OrderManageNo + "/";
- entity.CraftFileLv2F = filena;
- entity.CraftFileLv2FDesc = filena;
- bean = new FileBean();
- bean.setFileName(filena);
- bean.setPathName(filePathNew);
- bean.setFile(FileHelper.FileToArray(fileName));
- list.Add(bean);
- _craftOrdDesignBLL.SaveCraftLv2(new List<CraftOrdDesignEntity>() {entity});
- bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- if (isSuccess)
- {
- MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- ultraGrid1.Refresh();
- }
- else
- {
- MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- }
- }
- }
- }
- private void ultraTextEditor2_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- var strurl = "";
- var entity = ultraGrid1.ActiveRow.ListObject as ChoiceCraftFileLv2Entity;
- strurl =
- "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepHttZhaZhiProcess.cpt&orderManageNo={0}&desginKey={1}&mscPline={2}&sic={3}";
- strurl = String.Format(strurl, entity.OrderManageNo,entity.DesginKey,entity.MscPline,entity.Sic);
- var fre = new FrmRepExcel(ob, strurl);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width,
- Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- }
- }
- }
|