| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221 |
- 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 CoreFS.CA06;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using com.steering.mes.zgmil.entity;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.NodeResultQuery;
- using Core.StlMes.Client.ZGMil.Entity;
- using Core.StlMes.Client.ZGMil.ResultConrtrol;
- using System.Collections;
- using System.Timers;
- using Core.StlMes.Client.ZGMil.Signature;
- using Core.StlMes.Client.ZGMil.Common;
- using Core.StlMes.Client.ZGMil.Popup;
- using Microsoft.Win32;
- using CoreFS.SA06;
- using System.Text.RegularExpressions;
- namespace Core.StlMes.Client.ZGMil.Result
- {
- public partial class FrmFeedSawingResult : FrmBase
- {
- #region 初始化
- private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
- RollingInfomation rf = new RollingInfomation();
- FeedRowPlan QuertFeedplan = new FeedRowPlan();
- MilPlan QueryMainPlan = new MilPlan();
- FeedRowPlan Feedplan = new FeedRowPlan();
- MilPlan MainPlan = new MilPlan();
- FeedSawResultEntity FeedSawResult = new FeedSawResultEntity();
- string GirdSizeFlag = "";
- string PlanStatusQuery = "09"; //查询结炉实绩状态
- string PlanStartStatusQuery = "00"; //查询结炉实绩起始状态
- string Shift = "";
- string Group = "";
- string _User = "";
- private string ResultNo = "";
- private string proPlanId = null;//轧管订单编号
- private string gxPlanNo = null;//工序排产序号
- private string lotNo = null;//生产批号
- private string Departm = "";//部门
- private string PlineCode = "";//产线
- private int ChangeSeq = 0; //交班Seq
- private string ChangeUserID = ""; //接班用户名
- private string ChangePassWord = ""; //接班密码
- int ShowMessageFlag = 0;
- private string _UserName = ""; //签名 姓名
- private string _Url = ""; //签名 Url
- private string _UserID = ""; //签名 签名ID
- private int _MouseLocX = 0; //鼠标横坐标
- private int _MouseLocY = 0; //鼠标纵坐标
- private int ChangeFlag = 0; //交班标识
- public Infragistics.Win.UltraWinGrid.UltraGrid Grid
- {
- get { return _grid; }
- }
- public FrmFeedSawingResult()
- {
- Shift = UserInfo.GetUserOrder();
- Group = UserInfo.GetUserGroup();
- InitializeComponent();
- GirdSizeFlag = "1";
- //this.feedSaw1.UltraGrid4.ClickCellButton += new CellEventHandler(UltraGrid4_ClickCellButton);
- if (GirdSizeFlag == "1")
- {
- splitContainer2.SplitterDistance = 180;
- GirdSizeFlag = "0";
- }
- //管号队列Grid未拉伸
- else
- {
- splitContainer2.SplitterDistance = 90;
- GirdSizeFlag = "1";
- }
- //获取鼠标坐标
- Point formPoint = this.PointToClient(Control.MousePosition);
- _MouseLocX = Convert.ToInt32(formPoint.X);
- _MouseLocY = Convert.ToInt32(formPoint.Y);
- }
- /// <summary>
- /// 交班取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void UltraGrid4_ClickCellButton(object sender, CellEventArgs e)
- {
- string JudgeStoveNo = "";
- string Status = "";
- string ResultNo = "";
- string FeedRowNo = "";
- UltraGridRow ugr = this.chkNodeQuery.ActiveRow;
- if (ugr != null)
- {
- if (!ugr.HasParent())
- {
- JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- Status = ugr.Cells["IS_START"].Value.ToString();
- ResultNo = ugr.Cells["ID"].Value.ToString();
- proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- MessageBox.Show("请选择需要交班取消的上料行。");
- return;
- }
- else
- {
- UltraGridRow ugrp = ugr.ParentRow;
- JudgeStoveNo = ugrp.Cells["JUDGE_STOVE_NO"].Value.ToString();
- Status = ugrp.Cells["IS_START"].Value.ToString();
- ResultNo = ugrp.Cells["ID"].Value.ToString();
- FeedRowNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
- proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- }
- if (Status == "未上料")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未上料,不能交班取消", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (Status == "已完成锯切")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】锯切完成,不能交班取消", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (e.Cell.Column.Key == "CHANGENUMCANCEL")
- {
- ArrayList FeedRowNoList = new ArrayList(); //上料行ID
- ArrayList BeforeSeqList = new ArrayList(); //上料行前道班交班SEQ
- ArrayList FeedStartSeq = new ArrayList(); //上料行起始SEQ
- ArrayList BeforeCountList = new ArrayList(); //上料行前道班交班支数
- int ChangeCancelCount = 0; //所有上料行交班取消总支数之和 上料行取消交班支数 = 上料行交班支数-(前道班交班SEQ-上料行起始SEQ+1)
- //查询上个班上料行交班Seq
- DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
- {
- for (int i = 0; i < dtChangeNum.Rows.Count; i++)
- {
- FeedRowNoList.Add(dtChangeNum.Rows[i]["FEED_ROW_NO"].ToString());
- BeforeSeqList.Add(dtChangeNum.Rows[i]["SEQ"].ToString());
- }
- }
- //查询当前炉次上料行起始Seq
- DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
- {
- for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
- {
- FeedStartSeq.Add(dtFeedSeq.Rows[i]["SEQ"].ToString());
- }
- };
- //查询上个班上料行交班支数
- DataTable dtChangeCount = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getFeedChangeNum", new object[] { JudgeStoveNo }, this.ob);
- {
- for (int i = 0; i < dtChangeCount.Rows.Count; i++)
- {
- BeforeCountList.Add(dtChangeCount.Rows[i]["CHANGE_NUM"].ToString());
- }
- }
- for (int i = 0; i < FeedRowNoList.Count; i++)
- {
- ChangeCancelCount += int.Parse(BeforeCountList[i].ToString()) - (int.Parse(BeforeSeqList[i].ToString()) - int.Parse(FeedStartSeq[i].ToString()) + 1);
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeCancel", new object[] { JudgeStoveNo, ResultNo, FeedRowNoList, BeforeSeqList, FeedStartSeq, ChangeCancelCount }, this.ob);
- //NativeMethodNew nass = new NativeMethodNew(this.ob);
- //nass.ChangeShiftBack(JudgeStoveNo, ResultNo, PlineCode, Shift, Group, 0);
- GetFeedRack();
- GetGridButtonName();
- ChangeGridColor();
- DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { JudgeStoveNo, FeedRowNo, proPlanId, gxPlanNo }, this.ob);
- if (dtFP.Rows.Count > 0)
- {
- FeedRowEditGridForRack(dtFP);//上料计 划信息
- }
- }
- }
- }
- /// <summary>
- /// 交班取消
- /// </summary>
- private void ChangeCancel()
- {
- string JudgeStoveNo = "";
- string Status = "";
- string ResultNo = "";
- string FeedRowNo = "";
- UltraGridRow ugr = this.chkNodeQuery.ActiveRow;
- if (ugr != null)
- {
- if (!ugr.HasParent())
- {
- JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- Status = ugr.Cells["IS_START"].Value.ToString();
- ResultNo = ugr.Cells["ID"].Value.ToString();
- proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- //MessageBox.Show("请选择需要交班取消的上料行。");
- return;
- }
- else
- {
- UltraGridRow ugrp = ugr.ParentRow;
- JudgeStoveNo = ugrp.Cells["JUDGE_STOVE_NO"].Value.ToString();
- Status = ugrp.Cells["IS_START"].Value.ToString();
- ResultNo = ugrp.Cells["ID"].Value.ToString();
- FeedRowNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
- proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- }
- if (Status == "未上料")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未上料,不能交班取消", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (Status == "已完成锯切")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】锯切完成,不能交班取消", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- ArrayList FeedRowNoList = new ArrayList(); //上料行ID
- ArrayList BeforeSeqList = new ArrayList(); //上料行前道班交班SEQ
- ArrayList FeedStartSeq = new ArrayList(); //上料行起始SEQ
- ArrayList BeforeCountList = new ArrayList(); //上料行前道班交班支数
- ArrayList FeedChangeNum = new ArrayList(); //上料行交班支数
- int ChangeCancelCount = 0; //所有上料行交班取消总支数之和 上料行取消交班支数 = 上料行交班支数-(前道班交班SEQ-上料行起始SEQ+1)
- //查询当前炉次上料行起始Seq
- DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
- {
- for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
- {
- FeedRowNoList.Add(dtFeedSeq.Rows[i]["FEED_ROW_NO"].ToString());
- FeedStartSeq.Add(dtFeedSeq.Rows[i]["SEQ"].ToString());
- }
- };
- ////查询当班上料行交班支数
- DataTable dtChangeCount = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getFeedChangeNum", new object[] { JudgeStoveNo }, this.ob);
- {
- if (dtChangeCount.Rows.Count != 0)
- {
- for (int i = 0; i < dtChangeCount.Rows.Count; i++)
- {
- FeedChangeNum.Add(dtChangeCount.Rows[i]["CHANGE_NUM"].ToString());
- }
- }
- else
- {
- for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
- {
- FeedChangeNum.Add(0);
- }
- }
- }
- //查询上个班上料行交班Seq 上个班
- DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
- {
- if (dtChangeNum.Rows.Count != 0)
- {
- for (int i = 0; i < dtChangeNum.Rows.Count; i++)
- {
- BeforeSeqList.Add(dtChangeNum.Rows[i]["SEQ"].ToString());
- if (dtChangeNum.Rows[i]["SEQ"].ToString() == "0")
- {
- BeforeCountList.Add(0);
- }
- else
- {
- BeforeCountList.Add(int.Parse(dtChangeNum.Rows[i]["SEQ"].ToString()) - int.Parse(FeedStartSeq[i].ToString()));
- }
- }
- }
- else
- {
- for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
- {
- BeforeCountList.Add(0);
- BeforeSeqList.Add(0);
- }
- }
- }
- int Flag = 0;
- //前道班有交班
- if (dtChangeNum.Rows.Count > 0)
- {
- for (int i = 0; i < FeedRowNoList.Count; i++)
- {
- ChangeCancelCount += int.Parse(FeedChangeNum[i].ToString()) - (int.Parse(BeforeSeqList[i].ToString()) - int.Parse(FeedStartSeq[i].ToString()) + 1);
- }
- Flag = 1;
- }
- //前道班没交班
- else
- {
- for (int i = 0; i < FeedRowNoList.Count; i++)
- {
- ChangeCancelCount += int.Parse(FeedChangeNum[i].ToString());
- }
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeCancel", new object[] { JudgeStoveNo, ResultNo, FeedRowNoList, BeforeSeqList, FeedStartSeq, ChangeCancelCount, Flag }, this.ob);
- //NativeMethodNew nass = new NativeMethodNew(this.ob);
- //nass.ChangeShiftBack(JudgeStoveNo, ResultNo, PlineCode, Shift, Group, 0);
- GetFeedRack();
- GetGridButtonName();
- DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { JudgeStoveNo, FeedRowNo, proPlanId, gxPlanNo }, this.ob);
- if (dtFP.Rows.Count > 0)
- {
- FeedRowEditGridForRack(dtFP);//上料计 划信息
- }
- }
- PlanQuery();
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- //屏蔽Grid筛选条件
- rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- feedSaw1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- chkNodeQuery.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- ultraGridMatSeq.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- ChangeGridColor();
- InitControl();
- GirdSizeFlag = "0";
- ShowShift();
- splitContainer2.SplitterDistance = 180;
- timer1.Tick += new EventHandler(timer1_Tick);
- }
- /// <summary>
- /// 定时器事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void timer1_Tick(object sender, EventArgs e)
- {
- int MouseLocX = 0;
- int MouseLocY = 0;
- //获取当前鼠标坐标
- //获取鼠标坐标
- Point formPoint = this.PointToClient(Control.MousePosition);
- MouseLocX = Convert.ToInt32(formPoint.X);
- MouseLocY = Convert.ToInt32(formPoint.Y);
- if (MouseLocX == _MouseLocX && MouseLocY == _MouseLocY)
- {
- ShowMessageFlag = 1;
- PlanQuery();
- ShowMessageFlag = 0;
- }
- else
- {
- _MouseLocX = MouseLocX;
- _MouseLocY = MouseLocY;
- }
- }
- protected override void OnShown(EventArgs e)
- {
- base.OnShown(e);
- NativeMethodNew na = new NativeMethodNew(this.ob);
- Departm = UserInfo.GetDepartment();
- PlineCode = na.GetPCode(Departm);//获取 用户 对应的产线
- if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017") || PlineCode.Equals("C072"))
- {
- this.rollingCard1.ChangCard();
- }
- foreach (UltraGridRow ugr in chkNodeQuery.Rows)
- {
- if (ugr.HasChild())
- {
- ugr.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString());
- }
- }
- //选择操作人
- Sign();
- PlanQuery();
- }
- /// <summary>
- /// 签名
- /// </summary>
- private void Sign()
- {
- ColUserName col = new ColUserName();
- col.StationId = "0";
- col.PlineCode = PlineCode;
- col.ColGroup = Group;
- col.Ob = this.ob;
- col.ShowDialog();
- _UserID = col.getUserId();
- _UserName = col.getUserName();
- }
- private void ShowShift()
- {
- colShowShiftGroup1.Ob = this.ob;
- colShowShiftGroup1.Group = this.UserInfo.GetUserGroup();
- colShowShiftGroup1.Shift = this.UserInfo.GetUserOrder();
- colShowShiftGroup1.ShowShift();
- colShowShiftGroup1.Timer1.Enabled = true;
- }
- /// <summary>
- /// 初始化控件
- /// </summary>
- public void InitControl()
- {
- //if (chkDate.Checked)
- //{
- // dtStartDate.Enabled = true;
- // dtEndDate.Enabled = true;
- //}
- //else
- //{
- // dtStartDate.Enabled = false;
- // dtEndDate.Enabled = false;
- //}
- if (chkLotNo.Checked)
- {
- txtLOT_NO.Enabled = true;
- }
- else
- {
- txtLOT_NO.Enabled = false;
- }
- if (chkHeatNo.Checked)
- {
- txtJudgeStoveNo.Enabled = true;
- }
- else
- {
- txtJudgeStoveNo.Enabled = false;
- }
- if (ultraGridMatSeq.Rows.Count > 0)
- {
- foreach (UltraGridRow ugr in ultraGridMatSeq.Rows)
- {
- ugr.Cells["FEED_BACK"].Value = "上料回退";
- }
- }
- GetGridButtonName();
- }
- #endregion
- #region 查询 控件赋值 方法
- /// <summary>
- /// 刷新
- /// </summary>
- public override void Refresh()
- {
- ChangeGridColor();
- GetRollingCard();
- GetFeedRack();
- GetGridButtonName();
- PlanQuery();
- }
- /// <summary>
- /// 判断是否能开始当前炉次
- /// </summary>
- /// <returns></returns>
- private bool IsStart()
- {
- bool Start = true;
- foreach (UltraGridRow ugr in chkNodeQuery.Rows)
- {
- if (ugr.Cells["IS_START"].Value.ToString() == "已开始锯切")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString()) + "】正在锯切,不能两炉同时开始锯切。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- Start = false;
- }
- }
- return Start;
- }
- /// <summary>
- /// GridButton赋名字
- /// </summary>
- public void GetGridButtonName()
- {
- if (ultraGridMatSeq.Rows.Count > 0)
- {
- foreach (UltraGridRow ugr in ultraGridMatSeq.Rows)
- {
- ugr.Cells["btnScrapFeedSlab"].Value = "切前剔除";
- ugr.Cells["btnScrapDBSlab"].Value = "切后剔除";
- ugr.Cells["DELBACK"].Value = "剔料回退";
- }
- }
- if (chkNodeQuery.Rows.Count > 0)
- {
- foreach (UltraGridRow ugr in chkNodeQuery.Rows)
- {
- if (ugr.Cells["IS_START"].Value.ToString() != "未开始锯切" && ugr.Cells["IS_START"].Value.ToString() != "已开始锯切" && ugr.Cells["IS_START"].Value.ToString() != "已完成锯切")
- {
- switch (Convert.ToInt32(ugr.Cells["IS_START"].Value))
- {
- case 3:
- ugr.Cells["IS_START"].Value = "未开始锯切";
- break;
- case 0:
- ugr.Cells["IS_START"].Value = "已开始锯切";
- break;
- case 1:
- ugr.Cells["IS_START"].Value = "已完成锯切";
- break;
- }
- }
- }
- }
- }
- /// <summary>
- /// 得到上料锯切开始结束时间
- /// </summary>
- /// <param name="Flag">0 - 开始时间 1 - 结束时间</param>
- /// <returns></returns>
- public string GetTime(string Flag, string JudgeStoveNo)
- {
- string StartTime = "";
- string EndTime = "";
- // UltraGridRow ugr = chkNodeQuery.ActiveRow;
- //string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetSingleFeedResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
- if (dt.Rows.Count > 0)
- {
- StartTime = dt.Rows[0]["START_TIME"].ToString();
- EndTime = dt.Rows[0]["END_TIME"].ToString();
- }
- if (Flag == "0")
- {
- return StartTime;
- }
- else
- {
- return EndTime;
- }
- }
- /// <summary>
- /// 更改girdRow颜色
- /// </summary>
- public void ChangeGridColor()
- {
- if (chkNodeQuery.Rows.Count > 0)
- {
- foreach (UltraGridRow ugr in chkNodeQuery.Rows)
- {
- if (ugr.Cells["IS_START"].Value.ToString() == "已完成锯切")
- {
- ugr.Appearance.BackColor = Color.YellowGreen;
- }
- if (ugr.HasChild())
- {
- foreach (UltraGridRow ugr1 in ugr.ChildBands[0].Rows)
- {
- if (ugr1.Cells["SAW_FALG"].Value.ToString() == "已上料")
- {
- ugr1.Appearance.BackColor = Color.YellowGreen;
- }
- else if (ugr1.Cells["SAW_FALG"].Value.ToString() == "锯切完成")
- {
- ugr1.Appearance.BackColor = Color.YellowGreen;
- }
- }
- }
- }
- }
- if (ultraGridMatSeq.Rows.Count > 0)
- {
- foreach (UltraGridRow ugr in ultraGridMatSeq.Rows)
- {
- if (ugr != null)
- {
- switch (ugr.Cells["STATUS"].Value.ToString())
- {
- case "切前剔除":
- ugr.Appearance.BackColor = Color.Yellow;
- break;
- case "切后剔除":
- ugr.Appearance.BackColor = Color.YellowGreen;
- break;
- }
- switch (ugr.Cells["CHANGE_FLAG"].Value.ToString())
- {
- case "待接班确认":
- ugr.Appearance.BackColor = Color.LightGreen;
- break;
- }
- }
- }
- }
- }
- /// <summary>
- /// 查询上料管号队列
- /// </summary>
- public void GetFeedRack()
- {
- Infragistics.Win.ValueList valueList = new Infragistics.Win.ValueList();
- UltraGridRow ugr = chkNodeQuery.ActiveRow;
- if (ugr != null)
- {
- string JudgeStoveNo = "";
- string FeedRowNo = "";
- dtMatSeq.Clear();
- JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- if (ugr.HasParent())
- {
- FeedRowNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getFeedRackSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
- if (dt.Rows.Count > 0)
- {
- GridHelper.CopyDataToDatatable(ref dt, ref dtMatSeq, true);
- ultraGridMatSeq.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
- if (dt.Rows[0]["DB_NUM"] != null)
- {
- int ScrapDBNum = int.Parse(dt.Rows[0]["DB_NUM"].ToString());
- valueList.ValueListItems.Add("", "");
- for (int i = 0; i < ScrapDBNum; i++)
- {
- valueList.ValueListItems.Add((i + 1).ToString(), (i + 1).ToString());
- }
- }
- else
- {
- valueList.ValueListItems.Add("0", "0");
- }
- ultraGridMatSeq.DisplayLayout.Bands[0].Columns["SCRAP_DBNUM"].ValueList = valueList;
- }
- GridHelper.CopyDataToDatatable(ref dt, ref dtMatSeq, true);
- }
- }
- /// <summary>
- /// 查询流通卡信息
- /// </summary>
- public void GetRollingCard()
- {
- UltraGridRow ugr = chkNodeQuery.ActiveRow;
- if (ugr != null)
- {
- string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- DataTable dt = new DataTable();
- if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017"))
- {
- dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
- }
- else
- {
- dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
- }
- RollingCardEditGrid(dt, JudgeStoveNo);
- //string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
- //if (dt.Rows.Count > 0)
- //{
- // RollingCardEditGrid(dt, JudgeStoveNo);
- //}
- //else
- //{
- // rollingCard1.Value.Clear();
- // GridHelper.InitCardGrid(rollingCard1.RollCardDataSource1, rollingCard1.UltraGrid4);
- //}
- }
- }
- /// <summary>
- /// 查询结炉实绩
- /// </summary>
- public void NodeQuery()
- {
- string Group = UserInfo.GetUserGroup();
- DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
- string StartTime = SeverTime.ToString("yyyy-MM-dd");
- string EndTime = SeverTime.AddDays(1).ToString("yyyy-MM-dd");
- string Date = StartTime;
- string Time = SeverTime.ToLongTimeString();
- //晚班
- if (Shift == "3")
- {
- Time = Time.Replace(":", "");
- if (int.Parse(Time) > 205900)
- {
- StartTime += " " + "21:00:00";
- EndTime += " " + "10:00:00";
- }
- else
- {
- StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00";
- EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "10:00:00";
- }
- }
- else
- {
- StartTime = StartTime + " 00:00:00";
- EndTime = EndTime + " 00:00:00";
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetSingleFeedNodeResult", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
- FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 1, Date, Shift, Group, this.ob);
- frm.ShowDialog();
- }
- #endregion
- #region 事件
- /// <summary>
- /// ToolBar按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- PlanQuery();
- break;
- case "DoSave":
- FeedRowSave();
- break;
- case "SaveRemark":
- DoSave();
- break;
- case "DoNode":
- FeedSawResultNode();
- break;
- case "DoNodeBack":
- NodeBack();
- break;
- case "DoNodeQuery":
- NodeQuery();
- break;
- //case "DoUpdateDate":
- // UpdateDatePlan();
- // break;
- case "DoSign":
- Sign();
- break;
- case "DoPrint":
- PrintResult();
- break;
- case "DoQueryBefore":
- QueryBefore();
- break;
- case "DoStart":
- DoStart();
- break;
- case "DoChangeCancel":
- ChangeCancel();
- break;
- case "DoFeedBack":
- DoFeedBack();
- break;
- case "DoBackFurSlab":
- BackFurSlab();
- break;
- case "UpdateTube":
- updateTubeType();
- break;
- case "Close":
- this.Dispose();
- this.Close();
- break;
- }
- }
- private void updateTubeType()
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult";
- ccp.MethodName = "updateTubeType";
- ccp.ServerParams = new object[] { };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("同步成功!"))
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// checkbox点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- //if (chkDate.Checked)
- //{
- // dtStartDate.Enabled = true;
- // dtEndDate.Enabled = true;
- //}
- //else
- //{
- // dtStartDate.Enabled = false;
- // dtEndDate.Enabled = false;
- //}
- if (chkLotNo.Checked)
- {
- txtLOT_NO.Enabled = true;
- }
- else
- {
- txtLOT_NO.Enabled = false;
- }
- if (chkHeatNo.Checked)
- {
- txtJudgeStoveNo.Enabled = true;
- }
- else
- {
- txtJudgeStoveNo.Enabled = false;
- }
- if (chkStatusQuery.Checked)
- {
- PlanStatusQuery = "99";
- PlanStartStatusQuery = "10";
- }
- else
- {
- PlanStatusQuery = "09";
- PlanStartStatusQuery = "00";
- }
- if (chkAutoRefresh.Checked)
- {
- timer1.Enabled = true;
- }
- else
- {
- timer1.Enabled = false;
- }
- }
- /// <summary>
- /// 数据同步
- /// </summary>
- //public void UpdateDatePlan()
- //{
- // SyncPro frm = new SyncPro(this.ob, PlineCode);
- // frm.ShowDialog();
- // //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.GetSQLDate.getPlanQuery", new object[] { }, this.ob);
- // //MessageBox.Show("计划同步完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // PlanQuery();
- //}
- /// <summary>
- /// 查询按钮
- /// </summary>
- public void PlanQuery()
- {
- if (chkHeatNo.Checked)
- {
- if (string.IsNullOrEmpty(txtJudgeStoveNo.Text))
- {
- MessageBox.Show("请输入需查询的炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- if (this.chkLotNo.Checked)
- {
- if (string.IsNullOrEmpty(this.txtLOT_NO.Text))
- {
- MessageBox.Show("请输入需查询的轧批号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- //if (dtStartDate.DateTime > dtEndDate.DateTime)
- //{
- // MessageBox.Show("开始时间不能大于结束时间。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- //}
- //if (chkDate.Checked == true)
- //{
- // QueryMainPlan.StartTime = this.dtStartDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
- // QueryMainPlan.EndTime = this.dtEndDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
- //}
- //else
- //{
- // QueryMainPlan.StartTime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
- // QueryMainPlan.EndTime = DateTime.Now.AddDays(+1).ToString("yyyy-MM-dd HH:mm:ss");
- //}
- if (chkHeatNo.Checked == true)
- {
- QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
- QuertFeedplan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
- }
- else
- {
- QueryMainPlan.JudgeStoveNo = "";
- QuertFeedplan.JudgeStoveNo = "";
- }
- if (chkLotNo.Checked == true)
- {
- QueryMainPlan.LotNo = this.txtLOT_NO.Text;
- QuertFeedplan.LotNo = this.txtLOT_NO.Text;
- }
- else
- {
- QueryMainPlan.LotNo = "";
- QuertFeedplan.LotNo = "";
- }
- string PrimaKey = "";
- string SencodKey = "";
- UltraGridRow ugr = this.chkNodeQuery.ActiveRow;
- if (ugr != null)
- {
- PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- if (ugr.HasParent())
- {
- SencodKey = ugr.Cells["FEED_ROW_NO"].Value.ToString();
- }
-
- string NodeFlag = "";
- if (ugr.HasParent())
- {
- UltraGridRow ugrp = ugr.ParentRow;
- ResultNo = ugrp.Cells["ID"].Value.ToString();
- NodeFlag = ugrp.Cells["IS_START"].Value.ToString();
- }
- else
- {
- ResultNo = ugr.Cells["ID"].Value.ToString();
- NodeFlag = ugr.Cells["IS_START"].Value.ToString();
- }
- }
- //ugr.Cells["ID"].Value.ToString();
- dtMatSeq.Clear();
- dtFeedPlan.Clear();
- dtPlan.Clear();
- QueryMainPlan.PlineCode = PlineCode;
- QuertFeedplan.PlineCode = PlineCode;
- QueryMainPlan.Status = PlanStatusQuery;
- QueryMainPlan.StartStatus = PlanStartStatusQuery;
- //查询主表记录
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
- //chkNodeQuery.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
- foreach (UltraGridColumn ugc in chkNodeQuery.DisplayLayout.Bands[0].Columns)
- {
- ugc.SortIndicator = SortIndicator.Disabled;
- }
- if (dt.Rows.Count > 0)
- {
- //查询从表记录
- QuertFeedplan.SawFalg = PlanStatusQuery;
- QuertFeedplan.StartStatus = PlanStartStatusQuery;
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlan", new object[] { QuertFeedplan }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt1, ref dtFeedPlan, true);
- chkNodeQuery.DisplayLayout.Bands[1].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
- ChangeGridColor();
- }
- else
- {
- if (ShowMessageFlag == 0)
- {
- MessageBox.Show("未查询到数据!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- return;
- }
- if (ugr != null)
- {
- foreach (UltraGridRow ugr1 in chkNodeQuery.Rows)
- {
- //子行
- if (ugr.HasParent())
- {
- foreach (UltraGridRow ugr2 in ugr1.ChildBands[0].Rows)
- {
- if (ugr2.Cells["FEED_ROW_NO"].Value.ToString() == SencodKey && ugr2.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
- {
- UltraGridRow ugrParents = ugr2.ParentRow;
- ugrParents.ExpandAll();
- ugr2.Activated = true;
- }
- }
- }
- else
- {
- if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
- {
- ugr1.Activated = true;
- ugr1.ExpandAll();
- }
- }
- }
- //
- }
-
- }
-
- /// <summary>
- /// 保存备注
- /// </summary>
- private void DoSave()
- {
- if (this.chkNodeQuery.Rows.Count > 0)
- {
- try
- {
- feedSaw1.UltraGrid4.UpdateData();
- }
- catch (Exception e)
- {
- MessageBox.Show("请输入正确的时间。");
- return;
- }
- UltraGridRow ugr = chkNodeQuery.ActiveRow;
- if (ugr.HasParent())
- {
- feedSaw1.UltraGrid4.UpdateData();
- string Remark = this.feedSaw1.UltraGrid4.Rows[0].Cells["Remark"].Value.ToString();
- string StartTime = this.feedSaw1.UltraGrid4.Rows[0].Cells["StartTime"].Value.ToString();
- string EndTime = this.feedSaw1.UltraGrid4.Rows[0].Cells["EndTime"].Value.ToString();
- string JudgeStoveNo = ugr.ParentRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string ResultNo = ugr.ParentRow.Cells["ID"].Value.ToString();
- string proPlanId = ugr.ParentRow.Cells["PRO_PLAN_ID"].Value.ToString();
- string gxPlanNo = ugr.ParentRow.Cells["GX_PLAN_NO"].Value.ToString();
- if (string.IsNullOrEmpty(StartTime))
- {
- MessageBox.Show("开始时间不能为空,请输入正确的开始时间");
- return;
- }
-
- //查询结炉状态,已结炉的计划 结炉时间不能为空
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
- if (int.Parse(dt.Rows[0][0].ToString()) > 9)
- {
- if (string.IsNullOrEmpty(EndTime))
- {
- MessageBox.Show("结束时间不能为空,请输入正确的结束时间");
- return;
- }
- //开始时间必须小于结束时间
- if (DateTime.Parse(StartTime) > DateTime.Parse(EndTime))
- {
- MessageBox.Show("结束时间不能小于开始时间。");
- return;
- }
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.SaveRemark", new object[] { JudgeStoveNo, ResultNo, Remark, StartTime, EndTime, proPlanId, gxPlanNo }, this.ob);
- MessageBox.Show("保存成功。");
- }
- else
- {
- MessageBox.Show("请选择需要保存的上料行。");
- }
- }
- }
- /// <summary>
- /// 单击计划行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
- {
- dtMatSeq.Clear();
- if (this.dtPlan.Rows.Count > 0)
- {
- UltraGridRow ugr = chkNodeQuery.ActiveRow;
- //UltraGridRow ugr = e.Row;
- if (ugr != null)
- {
- this.feedSaw1.DataClear();
- //查询主计划信息
- string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- lotNo = ugr.Cells["LOT_NO"].Value.ToString();
- MainPlan.JudgeStoveNo = HeatNo;
- MainPlan.ProPlanId = proPlanId;
- MainPlan.GxPlanNo = gxPlanNo;
- DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
- // string Status = dtMP.Rows[0]["IS_START"].ToString();
- if (dtMP.Rows.Count > 0)
- {
- GridEdit(dtMP); //轧制计划信息
- if (ugr.HasParent()) //子行
- {
- string FeedNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
- Feedplan.JudgeStoveNo = HeatNo;
- Feedplan.FeedRowNo = FeedNo;
- Feedplan.PlineCode = PlineCode;
- Feedplan.SawFalg = PlanStatusQuery;
- Feedplan.ProPlanId = proPlanId;
- Feedplan.GxPlanNo = gxPlanNo;
- MainPlan.Status = PlanStatusQuery;
- FeedSawResult.JudgeStoveNo = HeatNo;
- //查询上料行信息
- DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { Feedplan.JudgeStoveNo, Feedplan.FeedRowNo, proPlanId, gxPlanNo }, this.ob);
- //查询上料锯切实绩信息
- //DataTable dtFSResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedResult.SingleFeedSawResult", new object[] { FeedSawRuslt }, this.ob);
- if (dtFP.Rows.Count > 0)
- {
- FeedRowEditGrid(dtFP);//上料计 划信息
- }
- else
- {
- feedSaw1.DataClear();
- }
- GetFeedRack();
- }
- }
- GetGridButtonName();
- ChangeGridColor();
- GetRollingCard();
- }
- }
- }
- /// <summary>
- /// 双击开始上料
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void DoStart()
- // private void ultraGridPlan_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
- {
- if (chkNodeQuery.Rows.Count > 0)
- {
- //if (!IsStart())
- //{
- // return;
- //}
- UltraGridRow ugr = chkNodeQuery.ActiveRow;
- if (ugr != null)
- {
- string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string ResultNo = "";
- //string ProPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- //string GxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- MainPlan.JudgeStoveNo = HeatNo;
- MainPlan.ProPlanId = proPlanId;
- MainPlan.GxPlanNo = gxPlanNo;
- if (ugr.HasParent())
- {
- ResultNo = ugr.ParentRow.Cells["ID"].Value.ToString();
- string strtus = ugr.ParentRow.Cells["IS_START"].Value.ToString();
- if (strtus == "已完成锯切")
- {
- MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成锯切操作,不允许进行上料操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- else
- {
- ResultNo = ugr.Cells["ID"].Value.ToString();
- }
- DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
- GridEdit(dtMP); //轧制计划信息
- if ("0".Equals(dtMP.Rows[0]["IS_LOAD"].ToString()))
- {
- MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已撤销出库,不允许进行上料操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- Refresh();
- return;
- }
- if (ugr.HasParent()) //子行
- {
- string FeedNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
- Feedplan.JudgeStoveNo = HeatNo;
- Feedplan.PlineCode = PlineCode;
- Feedplan.FeedRowNo = FeedNo;
- Feedplan.LotNo = "";
- Feedplan.SawFalg = PlanStatusQuery;
- DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { Feedplan.JudgeStoveNo, Feedplan.FeedRowNo, proPlanId, gxPlanNo }, this.ob);
- FeedRowEditGrid(dtFP);//上料计划信息
- string SawFlag = dtFP.Rows[0]["SAW_FALG"].ToString();
- string PLineCode = dtFP.Rows[0]["PLINE_CODE"].ToString();
- //string PLineCode = "460机组";
- string LotNo = dtFP.Rows[0]["LOT_NO"].ToString();
- string StoveNo = dtFP.Rows[0]["STOVE_NO"].ToString();
- Feedplan.ResultNo = ResultNo;
- Feedplan.LotNo = LotNo;
- Feedplan.StoveNo = StoveNo;
- Feedplan.PlineCode = PLineCode;
- Feedplan.ColMode = "0";
- Feedplan.ReMark = PlanStatusQuery;
- Feedplan.ColGroup = UserInfo.GetUserGroup();
- Feedplan.ColShift = UserInfo.GetUserOrder();
- Feedplan.ColUser = UserInfo.GetUserName();
- Feedplan.CutTarget = dtFP.Rows[0]["CUT_TARGET"].ToString();
- Feedplan.ProPlanId = proPlanId;
- Feedplan.GxPlanNo = gxPlanNo;
- //查询当前生产批最大流水号
- DataTable dtLotSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getLotSeq", new object[] { LotNo }, this.ob);
- string LotSeq = "";
- if (!string.IsNullOrEmpty(dtLotSeq.Rows[0][0].ToString()))
- {
- LotSeq = dtLotSeq.Rows[0][0].ToString();
- LotSeq = LotSeq.Substring(0, LotSeq.Length - 3) + (int.Parse(LotSeq.Substring(LotSeq.Length - 3, 3)) + 1).ToString().PadLeft(3, '0');
- }
- else
- {
- LotSeq = LotNo + "001";
- }
- Feedplan.LotSeq = LotSeq;
- switch (SawFlag)
- {
- case "未上料":
- SawFlag = "0";
- break;
- case "已上料":
- SawFlag = "1";
- break;
- default:
- SawFlag = "2";
- break;
- }
- Feedplan.SawFalg = "1";
- //
- if (SawFlag == "1" || SawFlag == "2")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(Feedplan.JudgeStoveNo) + "】已上料或锯切完成,不能再次上料!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (SawFlag == "0")
- {
- //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + Feedplan.JudgeStoveNo + "】开始锯切?") == DialogResult.No)
- //{
- // return;
- //}
- //修改MSSQL中入炉计划状态为:20
- ArrayList FeedRowIDList = new ArrayList();
- if (ugr.HasChild())
- {
- foreach (UltraGridRow ugrs in ugr.ChildBands[0].Rows)
- {
- if (ugrs.Cells["JUDGE_STOVE_NO"].Value.ToString() == HeatNo)
- {
- FeedRowIDList.Add(ugrs.Cells["FEED_ROW_NO"].Value.ToString());
- }
- }
- }
- else
- {
- UltraGridRow ugrP = ugr.ParentRow;
- foreach (UltraGridRow ugrs in ugrP.ChildBands[0].Rows)
- {
- if (ugrs.Cells["JUDGE_STOVE_NO"].Value.ToString() == HeatNo)
- {
- FeedRowIDList.Add(ugrs.Cells["FEED_ROW_NO"].Value.ToString());
- }
- }
- }
- DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
- string Time = SeverTime.ToShortDateString().Replace("/", "");
- string Temp = Time + PlineCode;
- int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.InsertFeedSeq", new object[] { HeatNo, ResultNo, Temp }, this.ob);//上料插入上料顺序
- // int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.updateMSQLStartStatus", new object[] { FeedRowIDList }, this.ob); ;
- //修改上料行上料标识,新增上料锯切实绩
- //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateFeedRowStatue1", new object[] { Feedplan }, this.ob);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult";
- ccp.MethodName = "UpdateFeedRowStatue1";
- ccp.ServerParams = new object[] { Feedplan };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("生成成功!"))
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.AddRack", new object[] { Feedplan, PlanStatusQuery }, this.ob);
- FeedRowEditGrid(dtFP);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- //if (count > 0)
- //{
- // //DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
- // //string Time = SeverTime.ToShortDateString().Trim("/");
- // //string FeedNo = Time + PlineCode;
- // //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.InsertFeedSeq", new object[] { HeatNo, ResultNo, FeedNo }, this.ob);
- // count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.AddRack", new object[] { Feedplan, PlanStatusQuery }, this.ob);
- // FeedRowEditGrid(dtFP);
- //}
- }
- }
- //父行
- else
- {
- }
- }
- }
- Refresh();
- }
- /// <summary>
- /// 上料回退
- /// </summary>
- private void DoFeedBack()
- {
- ArrayList FeedRow = new ArrayList();
- ArrayList FeedNum = new ArrayList();
- if (chkNodeQuery.Rows.Count > 0)
- {
- if (chkNodeQuery.ActiveRow != null)
- {
- UltraGridRow ugr = chkNodeQuery.ActiveRow;
- string NodeStatus = "";
- string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- //string ProPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- //string GxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- string ResultNo = "";
- if (ugr.HasParent())
- {
- UltraGridRow ugrp = ugr.ParentRow;
- NodeStatus = ugrp.Cells["IS_START"].Value.ToString();
- ResultNo = ugrp.Cells["ID"].Value.ToString();
- foreach (UltraGridRow ugrch in ugrp.ChildBands[0].Rows)
- {
- FeedRow.Add(ugrch.Cells["FEED_ROW_NO"].Value.ToString());
- FeedNum.Add(ugrch.Cells["FEED_NUM_PLAN"].Value.ToString());
- }
- }
- else
- {
- NodeStatus = ugr.Cells["IS_START"].Value.ToString();
- ResultNo = ugr.Cells["ID"].Value.ToString();
- foreach (UltraGridRow ugrch in ugr.ChildBands[0].Rows)
- {
- FeedRow.Add(ugrch.Cells["FEED_ROW_NO"].Value.ToString());
- FeedNum.Add(ugrch.Cells["FEED_NUM_PLAN"].Value.ToString());
- }
- }
- if (NodeStatus == "已完成锯切")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已锯切完成,不能上料回退!!!");
- return;
- }
- NativeMethodNew nvw = new NativeMethodNew(this.ob);
- if (nvw.isBegineNode(JudgeStoveNo, 1))
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始入炉,不能上料回退!!!!");
- return;
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.feedBack", new object[] { JudgeStoveNo, ResultNo, FeedRow, FeedNum, proPlanId, gxPlanNo }, this.ob);
- //int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.deleteMilProcesses", new object[] { BaseMethod.getJudgeStoveNo(JudgeStoveNo), ResultNo }, this.ob);
- Refresh();
- }
- else
- {
- MessageBox.Show("请选择需要回退的炉号");
- }
- }
- }
- /// <summary>
- /// 上料行 锯切完成
- /// </summary>
- /// <param name="dt"></param>
- public void FeedRowSave()
- {
- List<UltraGridRow> UgrList = new List<UltraGridRow>();
- FeedRowPlan Feedplan = new FeedRowPlan();
- ArrayList FeedRowNo = new ArrayList();
- string ResultNo = "";
- if (chkNodeQuery.Rows.Count > 0)
- {
- if (chkNodeQuery.ActiveRow != null)
- {
- string JudgeStoveNo = chkNodeQuery.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
- UltraGridRow ugr = null;
- if (chkNodeQuery.ActiveRow.HasParent())
- {
- ResultNo = chkNodeQuery.ActiveRow.ParentRow.Cells["ID"].Value.ToString();
- proPlanId = chkNodeQuery.ActiveRow.ParentRow.Cells["PRO_PLAN_ID"].Value.ToString();
- gxPlanNo = chkNodeQuery.ActiveRow.ParentRow.Cells["GX_PLAN_NO"].Value.ToString();
- foreach (UltraGridRow ugrCh in chkNodeQuery.ActiveRow.ParentRow.ChildBands[0].Rows)
- {
- if (ugrCh.Cells[1].Value.ToString() == "未上料")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 未开始上料,不能锯切!!!");
- return;
- }
- if (ugrCh.Cells[1].Value.ToString() == "锯切完成")
- {
- // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 锯切完成,不能再次锯切!!!");
- return;
- }
- if (ugrCh.Cells[1].Value.ToString() == "已上料")
- {
- FeedRowNo.Add(ugrCh.Cells["FEED_ROW_NO"].Value.ToString());
- }
- }
- }
- else
- {
- ResultNo = chkNodeQuery.ActiveRow.Cells["ID"].Value.ToString();
- foreach (UltraGridRow ugrCh in chkNodeQuery.ActiveRow.ChildBands[0].Rows)
- {
- if (ugrCh.Cells[1].Value.ToString() == "未上料")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 未开始上料,不能锯切!!!");
- return;
- }
- if (ugrCh.Cells[1].Value.ToString() == "锯切完成")
- {
- // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 锯切完成,不能再次锯切!!!");
- return;
- }
- if (ugrCh.Cells[1].Value.ToString() == "已上料")
- {
- FeedRowNo.Add(ugrCh.Cells["FEED_ROW_NO"].Value.ToString());
- }
- }
- }
- for (int i = 0; i < FeedRowNo.Count; i++)
- {
- chkNodeQuery.ActiveRow = ugr;
- string feedNo = FeedRowNo[i].ToString();
- //查询上料行信息
- DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { JudgeStoveNo, feedNo, proPlanId, gxPlanNo }, this.ob);
- if (dtFP.Rows.Count > 0)
- {
- FeedRowEditGrid(dtFP);//上料计 划信息
- }
- DoSaw(JudgeStoveNo, feedNo, Feedplan, ResultNo, proPlanId, gxPlanNo);
- }
- #region 所有上料行锯切完成后自动结炉代码(勿动)
- Refresh();
- UltraGridRow ugrp = null;
- if (chkNodeQuery.Rows.Count > 0)
- {
- foreach (UltraGridRow prow in chkNodeQuery.DisplayLayout.Bands[0].Layout.Rows)
- {
- if (prow.Cells["JUDGE_STOVE_NO"].Value.ToString() == JudgeStoveNo.ToString())
- {
- ugrp = prow;
- if (prow.HasChild())
- {
- foreach (UltraGridRow crow in prow.ChildBands["Relation1"].Rows)
- {
- if (crow.Cells["SAW_FALG"].Value.ToString().Contains("上料"))
- {//
- Refresh();
- return;
- }
- if (crow.Cells["FEED_ROW_NO"].Value.ToString() == Feedplan.FeedRowNo)
- {
- chkNodeQuery.ActiveRow = crow;
- }
- }
- if (MessageBox.Show("所有上料行均已锯切完成,是否结炉。", "提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
- {
- FeedSawResultNode();
- Refresh();
- return;
- }
- else
- {
- Refresh();
- return;
- }
- }
- }
- if (chkNodeQuery.Rows.Count < 1)
- {
- break;
- }
- // Refresh();
- }
- }
- #endregion
- }
- }
- Refresh();
- }
- /// <summary>
- /// 锯切上料行
- /// </summary>
- /// <param name="ugr"> 需要锯切的子行</param>
- private void DoSaw(string JudgeNo, string FeedRowNo, FeedRowPlan Feedplan1, string ResultNo, string ProPlanId, string GxPlanNo)
- {
- try
- {
- feedSaw1.UltraGrid4.UpdateData();
- }
- catch (Exception e)
- {
- MessageBox.Show("请输入正确的时间。");
- return;
- }
- //UltraGridRow ugr = null;
- //if (chkNodeQuery.DisplayLayout.Bands[0].Layout.ActiveRow != null)
- //{
- // ugr = chkNodeQuery.DisplayLayout.Bands[0].Layout.ActiveRow;
- //}
- //else
- //{
- // ugr = chkNodeQuery.DisplayLayout.Bands[1].Layout.ActiveRow;
- //}
- UltraGridRow ugr1 = this.feedSaw1.UltraGrid4.Rows[0];
- //if (ugr != null)
- //{
- this.feedSaw1.UltraGrid4.UpdateData();
- Feedplan1.JudgeStoveNo = JudgeNo;
- Feedplan1.FeedRowNo = FeedRowNo;
- Feedplan1.ProPlanId = ProPlanId;
- Feedplan1.GxPlanNo = GxPlanNo;
- //string FeedRowFlag = ugr.Cells[1].Value.ToString();
- //if (FeedRowFlag == "未上料")
- //{
- // MessageBox.Show("炉号【" + Feedplan1.BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】上料行【" + Feedplan1.FeedRowNo + "】未上料 不能锯切完成。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // return;
- //}
- //if (FeedRowFlag == "锯切完成")
- //{
- // MessageBox.Show("炉号【" + Feedplan1.BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】上料行【" + Feedplan1.FeedRowNo + "】已锯切 不能再次锯切。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // return;
- //}
- //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + Feedplan1.JudgeStoveNo + "】上料行【" + Feedplan1.FeedRowNo + "】完成锯切?") == DialogResult.No)
- //{
- // return;
- //}
- //查询上料行 上料状态 (0- 不允许锯切完成 1-允许锯切完成)
- //DataTable dtFeedRow = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateFeedResult", new object[] { Feedplan1 }, this.ob);
- //剔除上料支数
- if (string.IsNullOrEmpty(ugr1.Cells["ScrapFeedNum"].Value.ToString()))
- {
- Feedplan1.ScrapFeednum = "0";
- }
- else
- {
- Feedplan1.ScrapFeednum = ugr1.Cells["ScrapFeedNum"].Value.ToString();
- }
- //剔除单倍坯支数
- if (string.IsNullOrEmpty(ugr1.Cells["ScrapDBNum"].Value.ToString()))
- {
- Feedplan1.ScrapDbnum = "0";
- }
- else
- {
- Feedplan1.ScrapDbnum = ugr1.Cells["ScrapDBNum"].Value.ToString();
- }
- //单倍坯合格支数
- Feedplan1.QualifiedNum = ugr1.Cells["QualityDBNum"].Value.ToString();
- //切损总长度
- Feedplan1.CutLength = ugr1.Cells["WasterLength"].Value.ToString();
- //切损总重量
- Feedplan1.CutWeight = ugr1.Cells["WasterHeight"].Value.ToString();
- //备注
- Feedplan1.ReMark = ugr1.Cells["Remark"].Value.ToString();
- //标识
- Feedplan1.SawFalg = "2";
- //上料时间
- Feedplan1.StartTime = ugr1.Cells["StartTime"].Value.ToString();
- //交接班支数
- if (!string.IsNullOrEmpty(ugr1.Cells["ChangeGroupNum"].Value.ToString()))
- {
- Feedplan1.ChangeNum = ugr1.Cells["ChangeGroupNum"].Value.ToString();
- }
- else
- {
- Feedplan1.ChangeNum = "0";
- }
- string StartTime = this.feedSaw1.UltraGrid4.Rows[0].Cells["StartTime"].Value.ToString();
- string EndTime = this.feedSaw1.UltraGrid4.Rows[0].Cells["EndTime"].Value.ToString();
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateFeedResult", new object[] { Feedplan1 }, this.ob);
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.SaveRemark", new object[] { JudgeNo, ResultNo, Feedplan1.ReMark, StartTime, EndTime, ProPlanId, GxPlanNo }, this.ob);
- //MessageBox.Show("炉号【" + Feedplan1.JudgeStoveNo + "】上料行【" + Feedplan1.FeedRowNo + "】锯切完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- //#region 所有上料行锯切完成后自动结炉代码(勿动)
- ////Refresh();
- //UltraGridRow ugrp = null;
- //if (chkNodeQuery.Rows.Count > 0)
- //{
- // foreach (UltraGridRow prow in chkNodeQuery.DisplayLayout.Bands[0].Layout.Rows)
- // {
- // if (prow.Cells["JUDGE_STOVE_NO"].Value.ToString() == Feedplan1.JudgeStoveNo.ToString())
- // {
- // ugrp = prow;
- // if (prow.HasChild())
- // {
- // foreach (UltraGridRow crow in prow.ChildBands["Relation1"].Rows)
- // {
- // if (crow.Cells["SAW_FALG"].Value.ToString().Contains("上料"))
- // {//
- // Refresh();
- // return;
- // }
- // if (crow.Cells["FEED_ROW_NO"].Value.ToString() == FeedRowNo)
- // {
- // chkNodeQuery.ActiveRow = crow;
- // }
- // }
- // //if (MessageBox.Show("所有上料行均已锯切完成,是否结炉。", "提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
- // //{
- // // FeedSawResultNode();
- // // Refresh();
- // // //return;
- // //}
- // //else
- // //{
- // // Refresh();
- // // return;
- // //}
- // }
- // }
- // if (chkNodeQuery.Rows.Count < 1)
- // {
- // break;
- // }
- // // Refresh();
- // }
- //}
- // #endregion
- }
- /// <summary>
- /// 管号队列剔除事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid2_ClickCellButton(object sender, CellEventArgs e)
- {
- MilSlabScrapSeqEntity ScrapSlab = new MilSlabScrapSeqEntity();
- UltraGridRow ugr = ultraGridMatSeq.ActiveRow;
- HOTMethod hm = new HOTMethod(this.ob);
- string Statuss = "";
- string ResultNo = "";
- UltraGridRow ugr1 = this.chkNodeQuery.ActiveRow;
- string JudgeStoveNo1 = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
- if (ugr1.HasParent())
- {
- Statuss = ugr1.ParentRow.Cells["IS_START"].Value.ToString();
- ResultNo = ugr1.ParentRow.Cells["ID"].Value.ToString();
- }
- else
- {
- Statuss = ugr1.Cells["IS_START"].Value.ToString();
- ResultNo = ugr1.Cells["ID"].Value.ToString();
- }
- if (Statuss == "已完成锯切")
- {
- if (e.Cell.Column.Key == "CHANGE_NUM")
- {
- MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo1) + "】已完成锯切操作,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else if (e.Cell.Column.Key == "BTNCHANGECOM")
- {
- MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo1) + "】已完成锯切操作,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else
- {
- MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo1) + "】已完成锯切操作,不允许进行剔除操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- return;
- }
- int ScrapFeedNumcount = 0;
- int ScrapDBNumcount = 0;
- if (ugr != null)
- {
- string MatNo = ugr.Cells["MAT_NO"].Value.ToString();
- string Seq = ugr.Cells["SEQ"].Value.ToString();
- string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string FeedRowNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
- int DBNum = int.Parse(ugr.Cells["DB_NUM"].Value.ToString());
- string Status = ugr.Cells["STATUS"].Value.ToString();
- string proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- string gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- ScrapSlab.ProPlanId = proPlanId;
- ScrapSlab.GxPlanNo = gxPlanNo;
- string shif = ugr.Cells["COL_SHIFT"].Value.ToString();
- string group = ugr.Cells["COL_GROUP"].Value.ToString();
- NativeMethodNew nasssss = new NativeMethodNew(this.ob);
- if (nasssss.IsRackOperate(shif, group))
- {
- MessageBox.Show("序号:【" + Seq + "】管已由" + shif + "," + group + "交班操作,不允许再进行操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- //切前剔除
- if (e.Cell.Column.Key == "btnScrapFeedSlab")
- {
- if (Status == "未上料" || Status == "切前剔除" || Status == "切后剔除" || Status == "锯切完成")
- {
- MessageBox.Show("序号:【" + Seq + "】管坯状态为【" + Status + "】,不能剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (int.Parse(Seq) < 3)
- {
- if (MessageUtil.ShowYesNoAndQuestion("该坯料可能是样管,是否继续剔除?") == DialogResult.No)
- {
- return;
- }
- }
-
- ScrapSlab.FeedRowNo = FeedRowNo;
- ScrapSlab.JudgeStoveNo = JudgeStoveNo;
- ScrapSlab.Seq = Seq;
- ScrapSlab.ProcessNo = "0";
- //ScrapSlab.MatNo = MatNo;
- ScrapSlab.Flag = "0";
- ScrapSlab.ColMode = "1";
- ScrapSlab.ColUser = UserInfo.GetUserName();
- ScrapSlab.ColGroup = UserInfo.GetUserGroup();
- ScrapSlab.ColShift = UserInfo.GetUserOrder();
- ScrapSlab.MatNo = MatNo;
- ScrapSlab.Status = "3";
- ScrapFeedNumcount = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapFeedMat", new object[] { ScrapSlab, "0" }, this.ob);
- }
- //切后剔除
- else if (e.Cell.Column.Key == "btnScrapDBSlab")
- {
- if (Status == "未上料" || Status == "切前剔除" || Status == "切后剔除") //|| Status == "锯切完成")
- {
- MessageBox.Show("序号:【" + Seq + "】管坯状态为【" + Status + "】,不能剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (int.Parse(Seq) < 3)
- {
- if (MessageUtil.ShowYesNoAndQuestion("该坯料可能是样管,是否继续剔除?") == DialogResult.No)
- {
- return;
- }
- }
- if (string.IsNullOrEmpty(ugr.Cells["SCRAP_DBNUM"].Value.ToString()))
- {
- MessageBox.Show("请选择需要剔除的单倍坯支数!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int ScrapDBNum = int.Parse(ugr.Cells["SCRAP_DBNUM"].Value.ToString());
- for (int i = 0; i < ScrapDBNum; i++)
- {
- ScrapSlab.FeedRowNo = FeedRowNo;
- ScrapSlab.JudgeStoveNo = JudgeStoveNo;
- ScrapSlab.Seq = ((int.Parse(Seq) - 1) * DBNum + i + 1).ToString();
- ScrapSlab.SeqForUpdate = Seq;
- ScrapSlab.ProcessNo = "1";
- // ScrapSlab.MatNo = MatNo;
- ScrapSlab.Flag = "0";
- ScrapSlab.ColMode = "1";
- ScrapSlab.ColUser = UserInfo.GetUserName();
- ScrapSlab.ColGroup = UserInfo.GetUserGroup();
- ScrapSlab.ColShift = UserInfo.GetUserOrder();
- ScrapSlab.ScrapDbnum = ScrapDBNum;
- ScrapSlab.Status = "4";
- ScrapSlab.ProPlanId = proPlanId;
- ScrapSlab.GxPlanNo = gxPlanNo;
- try
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapFeedMat", new object[] { ScrapSlab, "1" }, this.ob);
- ScrapDBNumcount += count;
- }
- catch (Exception ex)
- {
- GetFeedRack();
- ChangeGridColor();
- GetGridButtonName();
- }
- }
- }
- else if (e.Cell.Column.Key == "DELBACK")
- {
- //if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No)
- //{
- // return;
- //}
- if (!ultraGridMatSeq.ActiveRow.Cells["STATUS"].Value.ToString().Contains("剔除"))
- {
- MessageBox.Show("该上料行未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- NativeMethodNew na = new NativeMethodNew(this.ob);
- if (ultraGridMatSeq.ActiveRow.Cells["STATUS"].Value.ToString().Equals("切前剔除"))//切前剔除回退
- {
- //锯切完成不能回退切前剔除的坯料
- string FeedRowNoForRack = ultraGridMatSeq.ActiveRow.Cells["FEED_ROW_NO"].Value.ToString();
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSawFlag", new object[] { FeedRowNoForRack }, this.ob);
- if (dt.Rows.Count > 0)
- {
- if (dt.Rows[0][0].ToString() == "2")
- {
- MessageBox.Show("上料行【" + FeedRowNoForRack + "】已经锯切完成,不能回退切前剔除的坯料");
- return;
- }
- }
- int count = na.DeleteFeedSlabSeq(JudgeStoveNo, FeedRowNo, Seq, 0, 1, DBNum, proPlanId, gxPlanNo);
-
- }
- else if (ultraGridMatSeq.ActiveRow.Cells["STATUS"].Value.ToString().Equals("切后剔除"))
- {
- int num = 0;
- if (!string.IsNullOrEmpty(ultraGridMatSeq.ActiveRow.Cells["SCRAP_DBNUM"].Value.ToString()))
- {
- num = int.Parse(ultraGridMatSeq.ActiveRow.Cells["SCRAP_DBNUM"].Value.ToString());
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetRackScrpNum", new object[] { JudgeStoveNo, Seq }, this.ob);
- if (dt.Rows.Count > 0)
- {
- num = int.Parse(dt.Rows[0]["SCRAP_DBNUM"].ToString());
- }
- int count = na.DeleteFeedSlabSeq(JudgeStoveNo, FeedRowNo, Seq, 1, num, DBNum, proPlanId, gxPlanNo);
- if (count > 0)
- {
- // MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else
- {
- // MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- }
- //交班
- else if (e.Cell.Column.Key == "CHANGE_NUM")
- {
- string Shift = UserInfo.GetUserOrder();
- string Group = UserInfo.GetUserGroup();
- string User = UserInfo.GetUserName();
- int BeforeChangeNum = 0; //前道工序交接班支数
- int FeedStartSeq = 1; //上料行起始Seq
- //string FeedRowNo = ultraGridMatSeq.ActiveRow.Cells["FEED_ROW_NO"].Value.ToString();
- //查询上个班上料行交班Seq
- DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
- if (dtChangeNum.Rows.Count > 0)
- {
- for (int i = 0; i < dtChangeNum.Rows.Count; i++)
- {
- if (FeedRowNo == dtChangeNum.Rows[i]["FEED_ROW_NO"].ToString())
- {
- BeforeChangeNum = int.Parse(dtChangeNum.Rows[i]["SEQ"].ToString());
- }
- }
- }
- //查询当前坯料上料行起始Seq
- DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
- if (dtFeedSeq.Rows.Count > 0)
- {
- for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
- {
- if (FeedRowNo == dtFeedSeq.Rows[i]["FEED_ROW_NO"].ToString())
- {
- FeedStartSeq = int.Parse(dtFeedSeq.Rows[i]["SEQ"].ToString());
- }
- }
- }
- ChangeSeq = int.Parse(Seq);
- int Seq1 = int.Parse(Seq);
- if (Seq1 <= BeforeChangeNum)
- {
- MessageBox.Show("前道班次已交班,该支不能再次交班。");
- return;
- }
- // int Seq = int.Parse(e.Cell.Row.Cells["SEQ"].Value.ToString());
- // int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, Seq1, BeforeChangeNum, FeedStartSeq, PlineCode, Shift, Group, _UserName, 1, 0 }, this.ob);
- //ChangeFlag = 1;
- hm.UpdateChangeFlag(JudgeStoveNo, ResultNo, FeedRowNo, 0, Seq1, 0);
- }
- //交班确认
- else if (e.Cell.Column.Key == "BTNCHANGECOM")
- {
- int WaitChangeSeq = hm.GetWaitChangeSeq(JudgeStoveNo, ResultNo, FeedRowNo, 0, 0, proPlanId, gxPlanNo);
- if (WaitChangeSeq == 0)
- {
- MessageBox.Show("没有待交班确认的管号。");
- return;
- }
- if (WaitChangeSeq != int.Parse(Seq))
- {
- MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确认上料行号:【" + FeedRowNo + "】序号:【" + Seq + "】交班?") == DialogResult.No)
- {
- return;
- }
- //查询是否有该班接班记录
- DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
- string Time = SeverTime.ToLongTimeString();
- //string Time = DateTime.Now.ToLongTimeString();
- string StartTime = SeverTime.ToShortDateString() + " 00:00:00";
- string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
- Time = Time.Replace(":", "");
- switch (Shift)
- {
- case "1":
- if (int.Parse(Time) > 60000 && int.Parse(Time) < 80000)
- {
- StartTime = SeverTime.ToShortDateString() + " 06:00:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 08:00:00";
- }
- if (int.Parse(Time) > 130000 && int.Parse(Time) < 150000)
- {
- StartTime = SeverTime.ToShortDateString() + " 13:00:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 15:00:00";
- }
- break;
- case "2":
- if (int.Parse(Time) > 130000 && int.Parse(Time) < 150000)
- {
- StartTime = SeverTime.ToShortDateString() + " 13:00:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 15:00:00";
- }
- if (int.Parse(Time) > 200000 && int.Parse(Time) < 220000)
- {
- StartTime = SeverTime.ToShortDateString() + " 20:00:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 22:00:00";
- }
- break;
- case "3":
- if (int.Parse(Time) > 200000 && int.Parse(Time) < 220000)
- {
- StartTime = SeverTime.ToShortDateString() + " 20:00:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 22:00:00";
- }
- if (int.Parse(Time) > 60000 && int.Parse(Time) < 80000)
- {
- StartTime = SeverTime.ToShortDateString() + " 06:00:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 08:00:00";
- }
- break;
- }
- //未登录
- //if (!hm.IsChanged(StartTime, EndTime, Shift, Group, "0", PlineCode))
- //{
- if (this.DoRelogin(DoCheck))
- {
- //FrmChangeGroup frmCg = new FrmChangeGroup(this.ob);
- //frmCg.ShowDialog();
- //if (frmCg.DialogResult == DialogResult.OK)
- //{
- //string Shift = UserInfo.GetUserOrder();
- //string Group = UserInfo.GetUserGroup();
- string User = UserInfo.GetUserName();
- //插入接班确认履历表
- hm.InsertChangeRemuse(Shift, Group, _UserName, "0", PlineCode);
- int BeforeChangeNum = 0; //前道工序交接班支数
- int FeedStartSeq = 1; //上料行起始Seq
- //string FeedRowNo = ultraGridMatSeq.ActiveRow.Cells["FEED_ROW_NO"].Value.ToString();
- //查询上个班上料行交班Seq
- DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
- if (dtChangeNum.Rows.Count > 0)
- {
- for (int i = 0; i < dtChangeNum.Rows.Count; i++)
- {
- if (FeedRowNo == dtChangeNum.Rows[i]["FEED_ROW_NO"].ToString())
- {
- BeforeChangeNum = int.Parse(dtChangeNum.Rows[i]["SEQ"].ToString());
- }
- }
- }
- //查询当前坯料上料行起始Seq
- DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
- if (dtFeedSeq.Rows.Count > 0)
- {
- for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
- {
- if (FeedRowNo == dtFeedSeq.Rows[i]["FEED_ROW_NO"].ToString())
- {
- FeedStartSeq = int.Parse(dtFeedSeq.Rows[i]["SEQ"].ToString());
- }
- }
- }
- ChangeSeq = int.Parse(Seq);
- int Seq1 = int.Parse(Seq);
- if (Seq1 <= BeforeChangeNum)
- {
- MessageBox.Show("前道班次已交班,该支不能再次交班。");
- return;
- }
- // int Seq = int.Parse(e.Cell.Row.Cells["SEQ"].Value.ToString());
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, Seq1, BeforeChangeNum, FeedStartSeq, PlineCode, Shift, Group, _UserName, 1, 0, proPlanId, gxPlanNo }, this.ob);
- // int FeedRowEndSeq = ultraGridMatSeq.Rows.Count + FeedStartSeq -1; //上料行结束Seq
- //修改上料行管号队列开始时间
- DataTable dtFeedRow = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQuery", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, proPlanId, gxPlanNo }, this.ob);
- if (dtFeedRow.Rows.Count > 0)
- {
- string ChangeFeedRowNo = dtFeedRow.Rows[0][0].ToString();
- MessageBox.Show("上料行【" + ChangeFeedRowNo + "】需要交班确认。");
- //foreach (UltraGridRow ugrf in chkNodeQuery.DisplayLayout.Bands[1].Layout.Rows)
- //{
- // if (ugrf.Cells["FEED_ROW_NO"].Value.ToString() == ChangeFeedRowNo)
- // {
- // chkNodeQuery.ActiveRow = ugrf;
- // }
- //}
- }
- else
- {
- ChangeFlag = 1;
- }
- // frmCg.Close();
- //}
- }
- // }
- // else
- // {
- // // string Shift = UserInfo.GetUserOrder();
- // // string Group = UserInfo.GetUserGroup();
- // string User = UserInfo.GetUserName();
- // int BeforeChangeNum = 0; //前道工序交接班支数
- // int FeedStartSeq = 1; //上料行起始Seq
- // //string FeedRowNo = ultraGridMatSeq.ActiveRow.Cells["FEED_ROW_NO"].Value.ToString();
- // //查询上个班上料行交班Seq
- // DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group }, this.ob);
- // if (dtChangeNum.Rows.Count > 0)
- // {
- // for (int i = 0; i < dtChangeNum.Rows.Count; i++)
- // {
- // if (FeedRowNo == dtChangeNum.Rows[i]["FEED_ROW_NO"].ToString())
- // {
- // BeforeChangeNum = int.Parse(dtChangeNum.Rows[i]["SEQ"].ToString());
- // }
- // }
- // }
- // //查询当前坯料上料行起始Seq
- // DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
- // if (dtFeedSeq.Rows.Count > 0)
- // {
- // for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
- // {
- // if (FeedRowNo == dtFeedSeq.Rows[i]["FEED_ROW_NO"].ToString())
- // {
- // FeedStartSeq = int.Parse(dtFeedSeq.Rows[i]["SEQ"].ToString());
- // }
- // }
- // }
- // ChangeSeq = int.Parse(Seq);
- // int Seq1 = int.Parse(Seq);
- // if (Seq1 <= BeforeChangeNum)
- // {
- // MessageBox.Show("前道班次已交班,该支不能再次交班。");
- // return;
- // }
- // // int Seq = int.Parse(e.Cell.Row.Cells["SEQ"].Value.ToString());
- // int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, Seq1, BeforeChangeNum, FeedStartSeq, PlineCode, Shift, Group, _UserName, 1, 0 }, this.ob);
- // DataTable dtFeedRow = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQuery", new object[] { JudgeStoveNo, ResultNo, FeedRowNo }, this.ob);
- // if (dtFeedRow.Rows.Count > 0)
- // {
- // string ChangeFeedRowNo = dtFeedRow.Rows[0][0].ToString();
- // MessageBox.Show("上料行【" + ChangeFeedRowNo + "】需要交班确认。");
- // //foreach (UltraGridRow ugrf in chkNodeQuery.DisplayLayout.Bands[1].Layout.Rows)
- // //{
- // // if (ugrf.Cells["FEED_ROW_NO"].Value.ToString() == ChangeFeedRowNo)
- // // {
- // // chkNodeQuery.ActiveRow = ugrf;
- // // }
- // //}
- // }
- // else
- // {
- // ChangeFlag = 1;
- // }
- // }
- }
- //过渡方法,接班后重登陆初始化导致Grid.Row为null
- if (chkNodeQuery.Rows == null)
- {
- return;
- }
- //查询上料行信息
- DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { JudgeStoveNo, FeedRowNo, proPlanId, gxPlanNo }, this.ob);
- if (dtFP.Rows.Count > 0)
- {
- FeedRowEditGridForRack(dtFP);//上料计 划信息
- }
- GetFeedRack();
- ChangeGridColor();
- GetGridButtonName();
- PlanQuery();
- }
- }
- public string DoCheck(CoreUserInfo User)
- {
- return "";
- }
- /// <summary>
- /// 结炉按钮
- /// </summary>
- public void FeedSawResultNode()
- {
- DoSave();
- HOTMethod hm = new HOTMethod(this.ob);
- this.feedSaw1.UltraGrid4.UpdateData();
- if (chkNodeQuery.Rows.Count > 0)
- {
- UltraGridRow ugr = chkNodeQuery.ActiveRow;
- if (ugr != null)
- {
- string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- string gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- if (!ugr.HasParent())
- {
- ResultNo = ugr.Cells["ID"].Value.ToString();
- }
- else
- {
- UltraGridRow ugrp = ugr.ParentRow;
- ResultNo = ugrp.Cells["ID"].Value.ToString();
- }
- //if (!string.IsNullOrEmpty(ugr.Cells["IS_START"].Value.ToString()))
- //{
- // string s = ugr.Cells["IS_START"].Value.ToString();
- // if (s == "已完成锯切")
- // {
- // MessageBox.Show("炉号:【" + JudgeStoveNo + "】已完成锯切操作,不允许进行结炉操作!!!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // return;
- // }
- //}
- string Status = "";
- if (ugr.HasParent())
- {
- UltraGridRow ugr1 = ugr.ParentRow;
- Status = ugr1.Cells["IS_START"].Value.ToString();
- //ResultNo = ugr1.Cells["ID"].Value.ToString();
- if (Status == "已完成锯切")
- {
- MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成锯切操作,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- else if (ugr.HasChild())
- {
- // ResultNo = ugr.Cells["ID"].Value.ToString();
- }
- else if (!string.IsNullOrEmpty(ugr.Cells["IS_START"].Value.ToString()))
- {
- string s = ugr.Cells["IS_START"].Value.ToString();
- if (s == "已完成锯切")
- {
- MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成锯切操作,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- DataRow[] drArr = dtFeedPlan.Select("JUDGE_STOVE_NO = '" + JudgeStoveNo + "'");
- foreach (DataRow dr in drArr)
- {
- if (dr["SAW_FALG"].ToString() == "未上料" || dr["SAW_FALG"].ToString() == "已上料")
- {
- string FeedRowNo = dr["FEED_ROW_NO"].ToString();
- MessageBox.Show("上料行【" + FeedRowNo + "】还未锯切完成,请锯切后结炉。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉?") == DialogResult.No)
- //{
- // return;
- //}
- if (hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 0) > 0)
- {
- MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 0) + "】未接班确认,不能结炉");
- return;
- }
- //判断
- //DataTable dtPROCESS = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getInputWeigtht", new object[] { JudgeStoveNo }, this.ob);
- //if (dtPROCESS.Rows.Count > 0)
- //{
- // if (double.Parse(dtPROCESS.Rows[0]["INPUT_WEIGHT"].ToString3()) <= 0)
- // {
- // MessageBox.Show("该炉的锯切有问题,请【上料退回】后,重新操作!");
- // return;
- // }
- //}
- DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getToltalFeedPlan", new object[] { JudgeStoveNo }, this.ob);
- //剔除上料支数
- if (!string.IsNullOrEmpty(dtFP.Rows[0]["BEFORE_SCRAP_NUM"].ToString()))
- {
- FeedSawResult.BeforeScrapNum = dtFP.Rows[0]["BEFORE_SCRAP_NUM"].ToString();
- }
- else
- {
- FeedSawResult.BeforeScrapNum = "0";
- }
- //剔除单倍坯支数
- if (!string.IsNullOrEmpty(dtFP.Rows[0]["AFTER_SCRAP_NUM"].ToString()))
- {
- FeedSawResult.AfterScrapNum = dtFP.Rows[0]["AFTER_SCRAP_NUM"].ToString();
- }
- else
- {
- FeedSawResult.AfterScrapNum = "0";
- }
- //合格支数
- FeedSawResult.CutNum = dtFP.Rows[0]["CUT_NUM"].ToString();
- //切损长度
- FeedSawResult.CutLength = dtFP.Rows[0]["CUT_LENGTH"].ToString();
- //切损重量
- FeedSawResult.CutWeight = dtFP.Rows[0]["CUT_WEIGHT"].ToString();
- //结炉标识
- FeedSawResult.NodeFurFlag = "1";
- //备注
- UltraGridRow ugr2 = this.feedSaw1.UltraGrid4.Rows[0];
- FeedSawResult.Remark = ugr2.Cells["Remark"].Value.ToString();
- //上料支数 = 计划上料支数 - 实际剔除上料支数
- int PlanFeedNum = int.Parse(dtFP.Rows[0]["FEED_NUM"].ToString());
- //int ScrapFeedNum = 0;
- //if (!string.IsNullOrEmpty(FeedSawResult.BeforeScrapNum))
- //{
- // ScrapFeedNum = int.Parse(FeedSawResult.BeforeScrapNum);
- //}
- //单倍重
- double DBNum = 1;
- double DBHeight = 0;
- DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getDbHeight", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
- if (dtDBH.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_HEIGHT"].ToString()))
- {
- DBHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString());
- }
- if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_NUM"].ToString()))
- {
- DBNum = double.Parse(dtDBH.Rows[0]["DB_NUM"].ToString());
- }
- }
- if (DBHeight <= 0.0)
- {
- MessageBox.Show("该炉的计划有问题,没有单倍重,请撤销计划重新下发!");
- return;
- }
- //if (!ugr.Cells["LOT_NO"].Value.ToString().Equals("无"))
- //{
- // if (int.Parse(FeedSawResult.CutNum) <= 0)
- // {
- // MessageBox.Show("该炉的锯切有问题,请【上料退回】后,重新操作!");
- // return;
- // }
- //}
- FeedSawResult.QaTon = (DBHeight * double.Parse(FeedSawResult.CutNum)).ToString();
- FeedSawResult.FeedNum = (PlanFeedNum).ToString();
- FeedSawResult.Statue = "10";
- FeedSawResult.ColUser = _UserName;
- FeedSawResult.ColGroup = UserInfo.GetUserGroup();
- FeedSawResult.ColShift = UserInfo.GetUserOrder();
- FeedSawResult.JudgeStoveNo = JudgeStoveNo;
- FeedSawResult.UserId = _UserID;
- FeedSawResult.ProPlanId = proPlanId;
- FeedSawResult.GxPlanNo = gxPlanNo;
- FeedSawResult.LotNo = lotNo;
- FeedSawResult.PlineCode = PlineCode;
- FeedSawResult.SesultNo = ResultNo;
-
- //写进程表
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult";
- ccp.MethodName = "updateProcess";
- ccp.ServerParams = new object[] { JudgeStoveNo, "0", "0", proPlanId, gxPlanNo };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.FeedSawResultNode", new object[] { FeedSawResult }, this.ob);
- if (count > 0)
- {
- int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { JudgeStoveNo, 1, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
- //int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.insertHeatNo", new object[] { JudgeStoveNo, ResultNo }, this.ob);
- try
- {
- //GeneratePlanStoveD(ResultNo, JudgeStoveNo, UserInfo.GetUserName(), ob);
- }catch(Exception e)
- {
- }
-
- }
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- dtMatSeq.Clear();
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- Refresh();
- }
- }
- /// <summary>
- /// 生成轧管炉计划(以及镦拔扩虚拟炉计划)
- /// </summary>
- /// <param name="resultNo">实绩编号</param>
- /// <param name="judgeStoveNo">判定炉号</param>
- /// <param name="userName">操作人</param>
- /// <param name="ob">OpeBase</param>
- public static void GeneratePlanStoveD(string resultNo, string judgeStoveNo, string userName, OpeBase ob)
- {
- OpeBase ob1 = new OpeBase();
- //string url1 = CoreUserInfo.UrlList["PSSServer"].Url; //"服务名" = PSSServer
- ob1.MainUrl = "http://172.16.2.130:8081/PSSServer/remoting/HessianRemoting";
- ServerHelper.SetData("com.steering.pss.plnsaleord.planStove.StoveCommon.generatePlanStove", new string[] { resultNo, judgeStoveNo, userName }, ob1);
- }
- /// <summary>
- /// 撤销轧管炉计划(以及镦拔扩虚拟炉计划)
- /// </summary>
- /// <param name="resultNo">实绩编号</param>
- /// <param name="judgeStoveNo">判定炉号</param>
- /// <param name="userName">操作人</param>
- /// <param name="ob">OpeBase</param>
- public static void deletePlanStove(string judgeStoveNo,OpeBase ob)
- {
- OpeBase ob1 = new OpeBase();
- //string url1 = CoreUserInfo.UrlList["PSSServer"].Url; //"服务名" = PSSServer
- ob1.MainUrl = "http://172.16.2.130:8081/PSSServer/remoting/HessianRemoting";
- ServerHelper.SetData("com.steering.pss.plnsaleord.planStove.StoveCommon.deletePlanStove", new string[] {judgeStoveNo}, ob1);
- }
- /// <summary>
- /// 结炉回退
- /// </summary>
- private void NodeBack()
- {
- if (this.chkNodeQuery.ActiveRow == null)
- {
- MessageBox.Show("请选择需要回退的炉号!!!");
- return;
- }
- UltraGridRow ugr = chkNodeQuery.ActiveRow;
- string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string ResultNo = "";
- string NodeFlag = "";
- if (ugr.HasParent())
- {
- UltraGridRow ugrp = ugr.ParentRow;
- ResultNo = ugrp.Cells["ID"].Value.ToString();
- NodeFlag = ugrp.Cells["IS_START"].Value.ToString();
- }
- else
- {
- ResultNo = ugr.Cells["ID"].Value.ToString();
- NodeFlag = ugr.Cells["IS_START"].Value.ToString();
- }
- if (NodeFlag != "已完成锯切")
- {
- MessageBox.Show("炉号【" + JudgeStoveNo + "】未结炉,不能结炉回退!!!!");
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
- if (dt.Rows.Count > 0)
- {
- string NodeProcess = ""; //当前炉次结炉工序
- string NodeStatus = dt.Rows[0][0].ToString();
- switch (NodeStatus)
- {
- case "20":
- NodeProcess = "环形加热炉";
- break;
- case "30":
- NodeProcess = "穿孔";
- break;
- case "40":
- NodeProcess = "连轧";
- break;
- case "50":
- NodeProcess = "再加热炉";
- break;
- case "60":
- NodeProcess = "定径";
- break;
- case "70":
- NodeProcess = "分切";
- break;
- case "80":
- NodeProcess = "矫直";
- break;
- case "90":
- NodeProcess = "探伤";
- break;
- case "96":
- NodeProcess = "质检";
- break;
- }
- if (NodeStatus != "10")
- {
- MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 " + NodeProcess + "工序已结炉,当前工序不能结炉回退");
- return;
- }
- //判断当前炉次下道工序是否结炉 下道工序结炉 - 不允许回退
- //查询当前炉次是否有交班点
- int Seq = 0;
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.changeFlagQuery", new object[] { JudgeStoveNo, ResultNo, 0, proPlanId, gxPlanNo }, this.ob);
- if (dt1.Rows.Count > 0)
- {
- Seq = int.Parse(dt1.Rows[0][0].ToString());
- }
- try
- {
- deletePlanStove(JudgeStoveNo, ob);
- }
- catch
- {
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 0, PlineCode, Seq, 0, 0, proPlanId, gxPlanNo, lotNo }, this.ob);
- GetFeedRack();
- ChangeGridColor();
- GetGridButtonName();
- PlanQuery();
- }
- }
- /// <summary>
- /// 回炉坯组炉
- /// </summary>
- private void BackFurSlab()
- {
- string Shift = UserInfo.GetUserOrder();
- string Group = UserInfo.GetUserGroup();
- FrmBackSlab FrmBS = new FrmBackSlab(Shift, Shift, _UserName,this.ob,PlineCode);
- FrmBS.ShowDialog();
- PlanQuery();
- }
- /// <summary>
- /// 双击管号队列grid变更大小
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGridMatSeq_DoubleClickHeader(object sender, DoubleClickHeaderEventArgs e)
- {
- //管号队列Grid已拉伸
- if (GirdSizeFlag == "1")
- {
- splitContainer2.SplitterDistance = 180;
- GirdSizeFlag = "0";
- }
- //管号队列Grid未拉伸
- else
- {
- splitContainer2.SplitterDistance = 90;
- GirdSizeFlag = "1";
- }
- }
-
- /// <summary>
- /// 打印报表
- /// </summary>
- private void PrintResult()
- {
- DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
- string Time = SeverTime.ToLongTimeString();
- string StartTime = "";
- string EndTime = "";
- string strurl = "";
- Time = Time.Replace(":", "");
- //晚班
- if (Shift == "3")
- {
- //查询晚班前一天20点40后到当天07点20前所有记录
- if (int.Parse(Time) < 072000)
- {
- StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
- EndTime = SeverTime.ToShortDateString() + " 07:20:00";
- //string Date2 = SeverTime.ToString("yyyy-MM-dd");
- //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
- }
- //查询当天晚班的所有数据
- else if (int.Parse(Time) > 204000)
- {
- StartTime = SeverTime.ToShortDateString() + " 20:40:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
- //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
- }
- }
- //白班 中班
- else
- {
- StartTime = SeverTime.ToShortDateString() + " 00:00:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
- //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
- }
- switch (PlineCode)
- {
- case "C008": //250
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
- break;
- case "C009": //258
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult258.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
- break;
- case "C010": //168
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
- break;
- case "C012": //Arssel
- break;
- case "C017": //460
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult460.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
- break;
- case "C072": //508
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult508.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
- break;
- }
- //项目内窗口方式打开
- FrmRepExcel 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();
- }
- /// <summary>
- /// 查询上个班原始记录
- /// </summary>
- private void QueryBefore()
- {
- HOTMethod hm = new HOTMethod(this.ob);
- DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
- string Time = SeverTime.ToLongTimeString();
- string Date = "";
- if (Shift == "3")
- {
- Time = Time.Replace(":", "");
- if (int.Parse(Time) < 122000)
- {
- Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
- }
- else
- {
- Date = SeverTime.ToString("yyyyMMdd");
- }
- }
- if (Shift == "1" || Shift == "0")
- {
- Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
- }
- else
- {
- Date = SeverTime.ToString("yyyyMMdd");
- }
- string StartTime = ""; // 开始时间 用于报表查询
- string EndTime = ""; // 结束时间 用于报表查询
- string StartTimeU = ""; // 开始时间 用于得到上班UserID
- string EndTimeU = ""; // 结束时间 用于得到上班UserID
- string strurl = "";
- string ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date, PlineCode);
- //if (PlineCode.Equals("C072"))
- //{
- // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date);
- //}
- //else
- //{
- // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group);
- //}
- string UserIDBefore = "";
- //晚班
- Time = Time.Replace(":", "");
- if (Shift == "3")
- {
- //查询晚班前一天中班所有记录
- if (int.Parse(Time) < 122000)
- {
- StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
- EndTime = SeverTime.ToShortDateString() + " 00:00:00";
- //string Date2 = SeverTime.ToString("yyyy-MM-dd");
- StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
- EndTimeU = SeverTime.ToShortDateString() + " 00:00:00";
- UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
- //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
- }
- //查询当天中班的所有数据
- else if (int.Parse(Time) > 204000)
- {
- StartTime = SeverTime.ToShortDateString() + " 13:40:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
- StartTimeU = SeverTime.ToShortDateString() + " 13:40:00";
- EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
- UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
- //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
- }
- }
- //白班
- else if (Shift == "1")
- {
- StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
- EndTime = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
- StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
- EndTimeU = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
- UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
- }
- //中班
- else
- {
- StartTime = SeverTime.ToShortDateString() + " 00:00:00";
- EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
- StartTimeU = SeverTime.ToShortDateString() + " 00:00:00";
- EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
- UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
- //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
- }
-
- switch (PlineCode)
- {
- case "C008": //250
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult250.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
- break;
- case "C009": //258
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult258.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
- break;
- case "C010": //168
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult168.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
- break;
- case "C012": //Arssel
- break;
- case "C017": //460
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult460.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
- break;
- case "C072": //508
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult508.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
- break;
- }
- FrmRepExcel 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();
- }
- #endregion
- #region 卡片赋值
- /// <summary>
- /// 轧制信息Grid赋值
- /// </summary>
- /// <param name="dt">轧制计划信息datatable</param>
- public void GridEdit(DataTable dt)
- {
- if (dt.Rows.Count > 0)
- {
- DataRow row1 = dt.Rows[0];
- //熔炼炉号
- this.rollingInfomation1.Value.StoveNo = row1["stove_no"].ToString();
- //炉号
- this.rollingInfomation1.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
- //生产批号
- this.rollingInfomation1.Value.LotNo = row1["lot_no"].ToString();
- //工序合同号
- this.rollingInfomation1.Value.ContractNo = row1["contract_no"].ToString();
- //执行工艺号
- this.rollingInfomation1.Value.ImpProcess = row1["imp_process"].ToString();
- //执行工艺号路径
- this.rollingInfomation1.Value.ImpProcessPath = row1["imp_process_path"].ToString();
- //产线代码
- this.rollingInfomation1.Value.PlineCode = row1["pline_code"].ToString();
- //状态
- this.rollingInfomation1.Value.Status = row1["STATUS"].ToString();
- //监制
- this.rollingInfomation1.Value.Producer = row1["producer"].ToString();
- //工艺状态
- this.rollingInfomation1.Value.ProcessStatus = row1["process_status"].ToString();
- //单倍长
- this.rollingInfomation1.Value.DbLength = row1["db_length"].ToString();
- //单倍重
- this.rollingInfomation1.Value.DbHeight = row1["db_height"].ToString();
- //轧制长度
- this.rollingInfomation1.Value.RollLength = row1["roll_length"].ToString();
- //分切数
- this.rollingInfomation1.Value.SawNum = row1["saw_num"].ToString();
- //目标长度
- this.rollingInfomation1.Value.TargetLength = row1["target_length"].ToString();
- //最终用户
- this.rollingInfomation1.Value.FinishUser = row1["finish_user"].ToString();
- //目标库
- this.rollingInfomation1.Value.TargetLiabrary = row1["target_liabrary"].ToString();
- //品种
- this.rollingInfomation1.Value.Varieties = row1["varieties"].ToString();
- //成品规格
- this.rollingInfomation1.Value.PipeSize = row1["pipe_size"].ToString();
- //扣型
- this.rollingInfomation1.Value.BuckleType = row1["buckle_type"].ToString();
- //长度范围
- this.rollingInfomation1.Value.LengthRange = row1["length_range"].ToString();
- //轧管判定标准
- this.rollingInfomation1.Value.RollStandrad = row1["roll_standrad"].ToString();
- //断面
- this.rollingInfomation1.Value.PipeSection = row1["pipe_section"].ToString();
- //钢种代码
- this.rollingInfomation1.Value.SteelCode = row1["steelcode"].ToString();
- //钢种名称
- this.rollingInfomation1.Value.SteelName = row1["steelname"].ToString();
- //钢级代码
- this.rollingInfomation1.Value.GradeCode = row1["gradecode"].ToString();
- //钢级名称
- this.rollingInfomation1.Value.GradeName = row1["gradename"].ToString();
- //炼钢判定标准
- this.rollingInfomation1.Value.SteelStandrad = row1["steel_standrad"].ToString();
- //去向
- this.rollingInfomation1.Value.Target = row1["target"].ToString();
- //支
- this.rollingInfomation1.Value.PlanNum = row1["BRANCH"].ToString();
- //吨
- this.rollingInfomation1.Value.PlanTon = row1["TON"].ToString();
- //切损去向
- this.rollingInfomation1.Value.CutTarget = row1["cut_target"].ToString();
- //切损长度
- this.rollingInfomation1.Value.CutLength = row1["cut_length"].ToString();
- //切损重量
- this.rollingInfomation1.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
- //倍尺数
- this.rollingInfomation1.Value.DbNum = row1["DB_NUM"].ToString();
- //标准类别代码
- this.rollingInfomation1.Value.StdStyle = row1["STD_STYLE"].ToString();
- //标准类别描述
- this.rollingInfomation1.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
- //成品备注
- this.rollingInfomation1.Value.ReMark = row1["ReMark"].ToString();
- this.rollingInfomation1.UpdateData();
- }
- }
- /// <summary>
- /// 上料行信息Grid赋值
- /// </summary>
- /// <param name="dt">上料行计划信息datatable</param>
- public void FeedRowEditGrid(DataTable dtFP)
- {
- if (dtFP.Rows.Count > 0)
- {
- DataRow dr = dtFP.Rows[0];
- //计划上料支数
- this.feedSaw1.Value.FeedNumPlan = dr["FEED_NUM_PLAN"].ToString();
- //上料支数
- this.feedSaw1.Value.FeedNum = dr["FEED_NUM"].ToString();
- //上料长度
- this.feedSaw1.Value.FeedLength = dr["FEED_LENGTH"].ToString();
- //使用长度
- this.feedSaw1.Value.UseLength = dr["USE_LENGTH"].ToString();
- //未使用长度
- this.feedSaw1.Value.NonUseLength = dr["NON_USE_LENGTH"].ToString();
- //切损去向
- this.feedSaw1.Value.CutTarget = dr["CUT_TARGET"].ToString();
- //倍尺数
- this.feedSaw1.Value.DBNum = dr["DB_NUM"].ToString();
- //单倍长度
- this.feedSaw1.Value.DBLength = dr["DB_LENGTH"].ToString();
- //单倍重
- this.feedSaw1.Value.DBHeight = dr["DB_HEIGHT"].ToString();
- //单支重量
- this.feedSaw1.Value.MatHeight = dr["MAT_HEIGHT"].ToString();
- //总重量
- this.feedSaw1.Value.MatTotalHeight = dr["MAT_TOTAL_HEIGHT"].ToString();
- //切损长度
- this.feedSaw1.Value.CutLength = dr["CUT_LENGTH"].ToString();
- //切损总重量
- this.feedSaw1.Value.CutWeight = dr["CUT_WEIGHT"].ToString();
- //切损单支重 = 切损重量/上料支数
- double CutDZWeight = double.Parse(dr["CUT_WEIGHT"].ToString3()) / (double.Parse(dr["FEED_NUM_PLAN"].ToString3()));
- //切前剔除支数
- this.feedSaw1.Value.ScrapNumOld = dr["SCRAP_FEEDNUM"].ToString();
- //切后剔除支数
- this.feedSaw1.Value.ScrapNum = dr["SCRAP_DBNUM"].ToString();
- //交接班支数
- if (!string.IsNullOrEmpty(dr["CHANGE_NUM"].ToString()))
- {
- this.feedSaw1.Value.ChangeNum = dr["CHANGE_NUM"].ToString();
- }
- else
- {
- this.feedSaw1.Value.ChangeNum = "0";
- }
- //交接班总支数
- if (!string.IsNullOrEmpty(dr["CHANGE_NUM_TOTAL"].ToString()))
- {
- this.feedSaw1.Value.ChangeNumTotal = dr["CHANGE_NUM_TOTAL"].ToString();
- }
- else
- {
- this.feedSaw1.Value.ChangeNumTotal = "0";
- }
- if (!string.IsNullOrEmpty(GetTime("0", dr["JUDGE_STOVE_NO"].ToString())))
- {
- //开始时间
- this.feedSaw1.Value.StartTime = GetTime("0", dr["JUDGE_STOVE_NO"].ToString());
- }
- else
- {
- //开始时间
- this.feedSaw1.Value.StartTime = "";
- }
- if (!string.IsNullOrEmpty(GetTime("1", dr["JUDGE_STOVE_NO"].ToString())))
- {
- //结束时间
- this.feedSaw1.Value.EndTime = GetTime("1", dr["JUDGE_STOVE_NO"].ToString());
- }
- else
- {
- //结束时间
- this.feedSaw1.Value.EndTime = "";
- }
- this.feedSaw1.Value.ReMark = dr["REMARK"].ToString();
- this.feedSaw1.UpdateData(CutDZWeight);
- }
- }
- public void RollingCardEditGrid(DataTable dt, string heatno)
- {
- if (dt.Rows.Count > 0)
- {
- //上料切前剔除支数
- this.rollingCard1.Value.FeedScrapNum = dt.Rows[0]["SCRAP_FEED"].ToString();
- //上料切前合格支数
- this.rollingCard1.Value.FeedQualifiedNum = dt.Rows[0]["QUALIFIED_FEED"].ToString();
- //上料剔除支数
- this.rollingCard1.Value.FeedScrapDBNum = dt.Rows[0]["SCRAP_DBFEED"].ToString();
- //上料合格支数
- this.rollingCard1.Value.FeedQualifiedDBNum = dt.Rows[0]["QUALIFIED_DBFEED"].ToString();
- //加热炉剔除支数
- this.rollingCard1.Value.FurScrapNum = dt.Rows[0]["SCRAP_FUR"].ToString();
- //加热炉合格支数
- this.rollingCard1.Value.FurQualifiedNum = dt.Rows[0]["QUALIFIED_FUR"].ToString();
- //穿孔剔除支数
- this.rollingCard1.Value.PerScrapNum = dt.Rows[0]["SCRAP_PER"].ToString();
- //穿孔合格支数
- this.rollingCard1.Value.PerQualifiedNum = dt.Rows[0]["QUALIFIED_PER"].ToString();
- //连轧剔除支数
- this.rollingCard1.Value.RollingScrapNum = dt.Rows[0]["SCRAP_ROLLING"].ToString();
- //连轧合格支数
- this.rollingCard1.Value.RollingQualifiedNum = dt.Rows[0]["QUALIFIED_ROLLING"].ToString();
- //再加热炉剔除支数
- this.rollingCard1.Value.RefurScrapNum = dt.Rows[0]["SCRAP_REFUR"].ToString();
- //再加热炉合格支数
- this.rollingCard1.Value.RefurQualifiedNum = dt.Rows[0]["QUALIFIED_REFUR"].ToString();
- //定径剔除支数
- this.rollingCard1.Value.SizingScrapNum = dt.Rows[0]["SCRAP_SIZING"].ToString();
- //定径合格支数
- this.rollingCard1.Value.SizingQualifiedNum = dt.Rows[0]["QUALIFIED_SIZING"].ToString();
- //分切前剔除支数
- this.rollingCard1.Value.SawScrapNumBE = dt.Rows[0]["SCRAP_SAW_BE"].ToString();
- //分切前合格支数
- this.rollingCard1.Value.SawQualifiedNumBE = dt.Rows[0]["QUALIFIED_SAW_BE"].ToString();
- //分切剔除支数
- this.rollingCard1.Value.SawScrapNum = dt.Rows[0]["SCRAP_SAW"].ToString();
- //分切合格支数
- this.rollingCard1.Value.SawQualifiedNum = dt.Rows[0]["QUALIFIED_SAW"].ToString();
- //矫直剔除支数
- this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString();
- //矫直合格支数
- this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString();
- //矫直下线支数
- this.rollingCard1.Value.OfflineStraight = dt.Rows[0]["OFFLINE_STRAIGHT"].ToString();
- //探伤剔除支数
- this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString();
- //探伤合格支数
- this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString();
- NativeMethodNew na = new NativeMethodNew(this.ob);
- if (na.isBegineNode(heatno, 8) || na.isBegineNode(heatno, 9) || na.isBegineNode(heatno, 10))
- {
- //探伤下线支数
- this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
- }
- else
- {
- if (dt.Rows[0]["OFFLINE_TESTING"].ToString() == "0")
- {
- this.rollingCard1.Value.OfflineTesting = "";
- }
- else
- {
- //探伤下线支数
- this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
- }
- }
- //表检合格支数
- this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
- //表检废品支数
- this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
- //表检下线支数
- this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
- //表检返线支数
- //this.rollingCard1.Value.SurfaceBackLineNum= dt.Rows[0]["OFFLINE_TESTING"].ToString();
- this.rollingCard1.UpdateData();
- }
- else
- {
- this.rollingCard1.ClearData();
- }
- }
- #endregion
- private void chkNodeQuery_InitializeLayout(object sender, InitializeLayoutEventArgs e)
- {
- }
- /// <summary>
- /// 上料行信息Grid赋值 -用于操作
- /// </summary>
- /// <param name="dt">上料行计划信息datatable</param>
- public void FeedRowEditGridForRack(DataTable dtFP)
- {
- if (dtFP.Rows.Count > 0)
- {
- DataRow dr = dtFP.Rows[0];
- //无料总重量
- this.feedSaw1.Value.MatTotalHeight = dr["MAT_TOTAL_HEIGHT"].ToString();
- //切损长度
- this.feedSaw1.Value.CutLength = dr["CUT_LENGTH"].ToString();
- //切损重量
- this.feedSaw1.Value.CutWeight = dr["CUT_WEIGHT"].ToString();
- //切前剔除支数
- this.feedSaw1.Value.ScrapNumOld = dr["SCRAP_FEEDNUM"].ToString();
- //切后剔除支数
- this.feedSaw1.Value.ScrapNum = dr["SCRAP_DBNUM"].ToString();
- //实际上料支数
- this.feedSaw1.Value.FeedNum = dr["FEED_NUM"].ToString();
- //交接班支数
- if (!string.IsNullOrEmpty(dr["CHANGE_NUM"].ToString()))
- {
- this.feedSaw1.Value.ChangeNum = dr["CHANGE_NUM"].ToString();
- }
- else
- {
- this.feedSaw1.Value.ChangeNum = "0";
- }
- //交接班总支数
- if (!string.IsNullOrEmpty(dr["CHANGE_NUM_TOTAL"].ToString()))
- {
- this.feedSaw1.Value.ChangeNumTotal = dr["CHANGE_NUM_TOTAL"].ToString();
- }
- else
- {
- this.feedSaw1.Value.ChangeNumTotal = "0";
- }
- //切损单支重 = 切损重量/上料支数
- double CutDZWeight = double.Parse(dr["CUT_WEIGHT"].ToString()) / (double.Parse(dr["FEED_NUM_PLAN"].ToString()));
- this.feedSaw1.UpdateDataForRack(CutDZWeight);
- }
- }
- /// <summary>
- /// 到点提示交班
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void timer2_Tick(object sender, EventArgs e)
- {
- if (!PlineCode.Equals("C072"))
- {
- DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
- string Time = SeverTime.ToLongTimeString();
- Time = Time.Replace(":", "");
- if (ChangeFlag == 0)
- {
- if (int.Parse(Time) > 065459 && int.Parse(Time) < 065600 || int.Parse(Time) > 070359 && int.Parse(Time) < 070500)
- {
- if (Shift == "3")
- {
- if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
- {
- }
- ChangeFlag = 1;
- return;
- }
- }
- if (int.Parse(Time) > 135359 && int.Parse(Time) < 135500 || int.Parse(Time) > 140359 && int.Parse(Time) < 140500)
- {
- if (Shift == "1")
- {
- if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
- {
- }
- ChangeFlag = 1;
- return;
- }
- }
- if (int.Parse(Time) > 205359 && int.Parse(Time) < 205500 || int.Parse(Time) > 210359 && int.Parse(Time) < 210500)
- {
- if (Shift == "2")
- {
- if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
- {
- }
- ChangeFlag = 1;
- return;
- }
- }
- }
- }
-
- }
- }
- }
|