frmPipeInTemp.cs 251 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153
  1. using System;
  2. using System.Data;
  3. using System.Windows.Forms;
  4. using CoreFS.CA06;
  5. using Core.Mes.Client.Comm.Server;
  6. using Core.Mes.Client.Comm.Control;
  7. using Infragistics.Win.UltraWinGrid;
  8. using Core.StlMes.Client.YdmBase;
  9. using System.Linq;
  10. using System.Collections;
  11. using System.Drawing;
  12. using Infragistics.Win.UltraWinEditors;
  13. using Core.Mes.Client.Comm.Tool;
  14. using Infragistics.Win;
  15. using Core.StlMes.Client.YdmPipeManage.Controls;
  16. using Core.StlMes.Client.YdmPipeManage.Tool;
  17. using Core.StlMes.Client.YdmPipeManage;
  18. namespace Core.StlMes.Client.YdmPipeManage
  19. {
  20. public partial class frmPipeInTemp : FrmBase
  21. {
  22. UltraComboEditor uceReson = new UltraComboEditor();
  23. public frmPipeInTemp()
  24. {
  25. InitializeComponent();
  26. this.IsLoadUserView = true;
  27. }
  28. /// <summary>
  29. /// 重写基类方法
  30. /// </summary>
  31. /// <param name="sender"></param>
  32. /// <param name="ToolbarKey"></param>
  33. public override void ToolBar_Click(object sender, string ToolbarKey)
  34. {
  35. switch (ToolbarKey)
  36. {
  37. case "DataMatch":
  38. DataMatch();
  39. break;
  40. case "Maint":
  41. doMaint();
  42. break;
  43. case "Query":
  44. QueryOrder();
  45. break;
  46. case "Query1":
  47. QueryMatData();
  48. break;
  49. case "Query2":
  50. QueryPipedData();
  51. break;
  52. case"QueryInList":
  53. QueryInList();
  54. break;
  55. case "PipeIn":
  56. DoPipeIn();
  57. break;
  58. case "PipeIn1":
  59. DoForcePipeIn();
  60. break;
  61. case "CanclePipe":
  62. DoCanclePipeIn();
  63. break;
  64. case "Refresh":
  65. QueryMatData();
  66. break;
  67. case "updateStoreNo":
  68. updateStoreNo();
  69. break;
  70. case "updateCarryOverDate":
  71. updateCarryOverDate();
  72. break;
  73. case"pipRed":
  74. pipRed();
  75. break;
  76. case"adjustStoreButress":
  77. adjustStoreButress();
  78. break;
  79. case"updateStaus":
  80. updateStaus();
  81. break;
  82. case"updateMemo":
  83. updatePipMemo();
  84. break;
  85. case "updateFinishedProduct":
  86. updateFinishedProduct();
  87. break;
  88. case"getRealTimeStore":
  89. getRealTimeStore();
  90. break;
  91. case"Export":
  92. Export();
  93. break;
  94. case "Close":
  95. this.Close();
  96. break;
  97. }
  98. }
  99. /// <summary>
  100. /// 获取实时库存
  101. /// </summary>
  102. private void getRealTimeStore()
  103. {
  104. string time = DateTime.Now.ToString("dd");
  105. string bathYear = DateTime.Now.ToString("yyyyMM");
  106. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  107. if (!time.Equals("01"))
  108. {
  109. MessageUtil.ShowTips("此按钮只允许每月一号进行操作!");
  110. return;
  111. }
  112. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.selectNowInial", new object[] { arr,bathYear }, ob);
  113. if (int.Parse(ds.Rows[0][0].ToString()) > 0)
  114. {
  115. }
  116. else
  117. {
  118. MessageUtil.ShowTips("无本月期初数据,不允许获取期初库存!");
  119. return;
  120. }
  121. int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getRealTimeStore", new object[] { arr, bathYear }, ob);
  122. if (count > 0)
  123. {
  124. MessageUtil.ShowTips("获取实时期末库存成功!");
  125. }
  126. }
  127. /// <summary>
  128. /// 导出
  129. /// </summary>
  130. private void Export()
  131. {
  132. if (ultraTabControl1.SelectedTab.Key == "1")
  133. {
  134. GridHelper.ulGridToExcel(ultraGrid1,"质保数据");
  135. }
  136. else if (ultraTabControl1.SelectedTab.Key == "2")
  137. {
  138. GridHelper.ulGridToExcel(ultraGrid2, "库存实绩明细");
  139. }
  140. else
  141. {
  142. GridHelper.ulGridToExcel(ultraGrid4, "缴库实绩明细");
  143. }
  144. }
  145. /// <summary>
  146. /// 缴库红冲
  147. /// </summary>
  148. private void pipRed()
  149. {
  150. int m = 0;
  151. UltraGridRow rows = null;
  152. foreach (UltraGridRow row in ultraGrid1.Rows)
  153. {
  154. if(Convert.ToBoolean(row.Cells["CHK"].Text) == true)
  155. {
  156. if (row.Cells["CXSTUPP"].Text.Trim() == "")
  157. {
  158. MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库红冲!");
  159. return;
  160. }
  161. if (row.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
  162. {
  163. MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库红冲!");
  164. return;
  165. }
  166. if (int.Parse(row.Cells["hgunit"].Text.Trim()) > 0)
  167. {
  168. MessageUtil.ShowTips("选择的数据支数大于零,不能进行缴库红冲!");
  169. return;
  170. }
  171. if (!row.Cells["ordername"].Text.Contains("/"))
  172. {
  173. MessageUtil.ShowTips("合同号不规范,不允许缴库红冲!");
  174. return;
  175. }
  176. m++;
  177. rows = row;
  178. }
  179. }
  180. if (m > 1)
  181. {
  182. MessageUtil.ShowTips("不允许多炉缴库红冲!");
  183. return;
  184. }
  185. if (m < 1)
  186. {
  187. MessageUtil.ShowTips("请勾选需要缴库红冲的质保数据!");
  188. return;
  189. }
  190. if (this.cmbFactory.Text.ToString() == "")
  191. {
  192. factoryCode = "";
  193. factoryNo = "";
  194. }
  195. else
  196. {
  197. factoryCode = this.cmbFactory.Value.ToString();
  198. factoryNo = this.cmbFactory.Text.ToString();
  199. }
  200. if (this.cmbSteel.Text.ToString() == "")
  201. {
  202. steelCode = "";
  203. steelName = "";
  204. }
  205. else
  206. {
  207. steelCode = this.cmbSteel.Value.ToString();
  208. steelName = this.cmbSteel.Text.ToString();
  209. }
  210. frmPipRedDashed redDas = new frmPipRedDashed(this.ob);
  211. redDas.Rccid = rows.Cells["rcdid"].Text;
  212. redDas.PlineCode = factoryCode;
  213. redDas.PlineName = factoryNo;
  214. redDas.GradeCode = steelCode;
  215. redDas.GradeName = steelName;
  216. redDas.ShowDialog();
  217. if (redDas.buttonValue == "1")
  218. {
  219. QueryMatData();
  220. MessageUtil.ShowTips("缴库红冲成功!");
  221. }
  222. }
  223. /// <summary>
  224. /// 修改结转年月
  225. /// </summary>
  226. private void updateCarryOverDate()
  227. {
  228. ultraGrid4.UpdateData();
  229. ArrayList parmList = new ArrayList();
  230. string userName = UserInfo.GetUserName();
  231. int m = 0;
  232. int count = 0;
  233. int n = 0;
  234. //string moth = DateTime.Now.AddMonths(1).ToString("yyyyMM");
  235. string moth = "";
  236. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
  237. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows)
  238. {
  239. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  240. {
  241. if (uRow.Cells["BAL_YEAR_MONTH"].Text.Trim() == "")
  242. {
  243. n++;
  244. }
  245. m++;
  246. //if (uRow.Cells["BAL_YEAR_MONTH"].Text.Trim().Length != 6)
  247. //{
  248. // MessageUtil.ShowTips("结算日期只能是6位,请重新输入!");
  249. // return;
  250. //}
  251. //if (!isDateTime(uRow.Cells["BAL_YEAR_MONTH"].Text.Trim()))
  252. //{
  253. // MessageUtil.ShowTips("结算日期输入格式不正确!");
  254. // return;
  255. //}
  256. }
  257. }
  258. if (m < 1)
  259. {
  260. MessageUtil.ShowTips("请选择需要操作的数据!");
  261. return;
  262. }
  263. if (n > 0)
  264. {
  265. MessageUtil.ShowTips("结转年月不能为空!");
  266. return;
  267. }
  268. if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
  269. {
  270. return;
  271. }
  272. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows)
  273. {
  274. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  275. {
  276. ArrayList list = new ArrayList();
  277. ArrayList _list = new ArrayList();
  278. moth = DateTime.Parse(uRow.Cells["BAL_YEAR_MONTH"].Text).AddMonths(1).ToString("yyyyMM");
  279. //if (int.Parse(uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(0, 4) + uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(5, 2)) < int.Parse(DateTime.Now.ToString("yyyyMM")))
  280. //{
  281. // MessageUtil.ShowTips("调整结转年月不能小于当前年月!");
  282. // return;
  283. //}
  284. //_list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text);
  285. //_list.Add(uRow.Cells["BATCH_NO"].Text);
  286. //_list.Add(uRow.Cells["BATCH_GROUD_NO"].Text);
  287. _list.Add(moth);
  288. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { _list, arr }, ob);
  289. if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0)
  290. {
  291. MessageUtil.ShowTips("此炉" + uRow.Cells["JUDGE_STOVE_NO"].Text + "已进行结转,不允许调整结转年月!");
  292. return;
  293. }
  294. list.Add(uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(0, 4) + uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(5,2));
  295. list.Add(uRow.Cells["ORDER_NO"].Text);
  296. list.Add(uRow.Cells["ORDER_SEQ"].Text);
  297. list.Add(uRow.Cells["DELIVERY_NO"].Text);
  298. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text);
  299. list.Add(uRow.Cells["BATCH_NO"].Text);
  300. list.Add(uRow.Cells["PRODUCNAME"].Text);
  301. //list.Add(uRow.Cells["STD_NAME"].Text);
  302. list.Add(uRow.Cells["STEELNAME"].Text);
  303. list.Add(uRow.Cells["SPEC_NAME"].Text);
  304. list.Add(uRow.Cells["MODEL_DESC"].Text);
  305. list.Add(userName);
  306. list.Add(uRow.Cells["ACT_LEN_MIN"].Text);
  307. list.Add(uRow.Cells["ACT_LEN_MAX"].Text);
  308. list.Add(uRow.Cells["BATCH_GROUD_NO"].Text);
  309. list.Add(uRow.Cells["INSTOCK_DOC"].Text);
  310. parmList.Add(list);
  311. }
  312. }
  313. count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateCarryOverDate", new Object[] { parmList }, this.ob);
  314. if (count > 0)
  315. {
  316. QueryInList();
  317. MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  318. }
  319. }
  320. /// <summary>
  321. /// 修改库存位置
  322. /// </summary>
  323. private void updateStoreNo()
  324. {
  325. ultraGrid2.UpdateData();
  326. ArrayList parmList = new ArrayList();
  327. string orderNo = "";//合同号
  328. string orderSeqNo = "";//合同行
  329. string order_No = "";//交货行
  330. string heatNo = "";//炉号
  331. string batchNo = "";//批号
  332. string producName = "";//品名
  333. string std_Name = "";//标准名称
  334. string steelName = "";//钢级
  335. string specName = "";//规格
  336. string mescCode = "";//扣型
  337. string storeNo = "";//仓库号
  338. string userName = UserInfo.GetUserName();
  339. int m = 0;
  340. int count = 0;
  341. int n = 0;
  342. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  343. {
  344. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  345. {
  346. if (uRow.Cells["STORAGE_NO"].Text.Trim() == "")
  347. {
  348. n++;
  349. }
  350. m++;
  351. }
  352. }
  353. if (m < 1)
  354. {
  355. MessageUtil.ShowTips("请选择需要操作的数据!");
  356. return;
  357. }
  358. if (n > 0)
  359. {
  360. MessageUtil.ShowTips("仓库名称不能为空!");
  361. return;
  362. }
  363. if(MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
  364. {
  365. return;
  366. }
  367. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  368. {
  369. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  370. {
  371. if (uRow.Cells["MAT_STATUS"].Value.ToString() != "80150301" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150202" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150203"&&uRow.Cells["MAT_STATUS"].Value.ToString() != "80150204"&&uRow.Cells["MAT_STATUS"].Value.ToString() != "80150205")
  372. {
  373. MessageUtil.ShowTips("材料状态已被改变,不允许修改库存地点!");
  374. return;
  375. }
  376. ArrayList list = new ArrayList();
  377. list.Add(uRow.Cells["STORAGE_NO"].Value.ToString());
  378. //list.Add(uceReson.Value.ToString());
  379. list.Add(uRow.Cells["ORDER_NO"].Text.Trim());
  380. list.Add(uRow.Cells["ORDER_SEQ"].Text.Trim());
  381. list.Add(uRow.Cells["ORDER_SEQ_NO"].Text.Trim());
  382. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
  383. list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
  384. list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
  385. //list.Add(uRow.Cells["STD_NAME"].Text.Trim());
  386. list.Add(uRow.Cells["STEELNAME"].Text.Trim());
  387. list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
  388. list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
  389. list.Add(userName);
  390. list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
  391. list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
  392. list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
  393. if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
  394. {
  395. list.Add("801403");
  396. }
  397. else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
  398. {
  399. list.Add("801402");
  400. }
  401. else
  402. {
  403. list.Add("801401");
  404. }
  405. //list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
  406. parmList.Add(list);
  407. }
  408. }
  409. CoreClientParam ccp = new CoreClientParam();
  410. ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
  411. ccp.MethodName = "updateStoreNo";
  412. ccp.ServerParams = new object[] { parmList };
  413. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  414. //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateStoreNo", new Object[] { parmList }, this.ob);
  415. if (ccp.ReturnCode != -1)
  416. {
  417. MessageUtil.ShowTips(ccp.ReturnInfo);
  418. if (ccp.ReturnInfo.Equals("修改成功!"))
  419. {
  420. QueryPipedData();
  421. // MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  422. }
  423. }
  424. }
  425. /// <summary>
  426. /// 修改入库备注
  427. /// </summary>
  428. private void updatePipMemo()
  429. {
  430. ultraGrid2.UpdateData();
  431. ArrayList parmList = new ArrayList();
  432. string userName = UserInfo.GetUserName();
  433. int m = 0;
  434. foreach (UltraGridRow uRow in ultraGrid2.Rows)
  435. {
  436. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  437. {
  438. m++;
  439. }
  440. }
  441. if (m < 1)
  442. {
  443. MessageUtil.ShowTips("请选择需要操作的数据!");
  444. return;
  445. }
  446. if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
  447. {
  448. return;
  449. }
  450. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  451. {
  452. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  453. {
  454. if (uRow.Cells["MAT_STATUS"].Value.ToString() != "80150301" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150202" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150203" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150204" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150205")
  455. {
  456. MessageUtil.ShowTips("材料状态已被改变,不允许修改入库备注!");
  457. return;
  458. }
  459. ArrayList list = new ArrayList();
  460. list.Add(uRow.Cells["PIPMEMO"].Value.ToString());
  461. //list.Add(uceReson.Value.ToString());
  462. list.Add(uRow.Cells["ORDER_NO"].Text.Trim());
  463. list.Add(uRow.Cells["ORDER_SEQ"].Text.Trim());
  464. list.Add(uRow.Cells["ORDER_SEQ_NO"].Text.Trim());
  465. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
  466. list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
  467. list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
  468. //list.Add(uRow.Cells["STD_NAME"].Text.Trim());
  469. list.Add(uRow.Cells["STEELNAME"].Text.Trim());
  470. list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
  471. list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
  472. list.Add(userName);
  473. list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
  474. list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
  475. list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
  476. if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
  477. {
  478. list.Add("801403");
  479. }
  480. else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
  481. {
  482. list.Add("801402");
  483. }
  484. else
  485. {
  486. list.Add("801401");
  487. }
  488. //list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
  489. parmList.Add(list);
  490. }
  491. }
  492. CoreClientParam ccp = new CoreClientParam();
  493. ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
  494. ccp.MethodName = "updatePipMemo";
  495. ccp.ServerParams = new object[] { parmList };
  496. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  497. //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateStoreNo", new Object[] { parmList }, this.ob);
  498. if (ccp.ReturnCode != -1)
  499. {
  500. MessageUtil.ShowTips(ccp.ReturnInfo);
  501. if (ccp.ReturnInfo.Equals("修改成功!"))
  502. {
  503. QueryPipedData();
  504. // MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  505. }
  506. }
  507. }
  508. /// <summary>
  509. /// 修改成品区分
  510. /// </summary>
  511. private void updateFinishedProduct()
  512. {
  513. ultraGrid2.UpdateData();
  514. ArrayList parmList = new ArrayList();
  515. string userName = UserInfo.GetUserName();
  516. int m = 0;
  517. foreach (UltraGridRow uRow in ultraGrid2.Rows)
  518. {
  519. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  520. {
  521. m++;
  522. }
  523. }
  524. if (m < 1)
  525. {
  526. MessageUtil.ShowTips("请选择需要操作的数据!");
  527. return;
  528. }
  529. if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
  530. {
  531. return;
  532. }
  533. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  534. {
  535. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  536. {
  537. if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
  538. {
  539. MessageUtil.ShowTips("材料类别为商品的,不允许修改成品区分!");
  540. return;
  541. }
  542. ArrayList list = new ArrayList();
  543. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
  544. list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
  545. list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
  546. //list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
  547. //list.Add(uRow.Cells["STEELNAME"].Text.Trim());
  548. //list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
  549. //list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
  550. //list.Add(userName);
  551. //list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
  552. //list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
  553. if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
  554. {
  555. list.Add("801403");
  556. }
  557. else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
  558. {
  559. list.Add("801402");
  560. }
  561. else
  562. {
  563. list.Add("801401");
  564. }
  565. list.Add(uRow.Cells["PIPMEMO"].Value.ToString());
  566. list.Add(uRow.Cells["IN_MOLD"].Value.ToString());
  567. list.Add(uRow.Cells["FINISHPRO_MOLD"].Value.ToString2());
  568. parmList.Add(list);
  569. }
  570. }
  571. CoreClientParam ccp = new CoreClientParam();
  572. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmFinishAfrim";
  573. ccp.MethodName = "updateFinishedProduct";
  574. ccp.ServerParams = new object[] { parmList };
  575. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  576. if (ccp.ReturnCode != -1)
  577. {
  578. if (ccp.ReturnInfo.Equals("修改成功!"))
  579. {
  580. QueryPipedData();
  581. MessageUtil.ShowTips(ccp.ReturnInfo);
  582. }
  583. else
  584. {
  585. MessageUtil.ShowTips(ccp.ReturnInfo);
  586. }
  587. }
  588. }
  589. /// <summary>
  590. /// 批量调整位置
  591. /// </summary>
  592. private void adjustStoreButress()
  593. {
  594. ultraGrid2.UpdateData();
  595. int n = 0;
  596. int m = -1;
  597. ArrayList list = new ArrayList();
  598. string heatNo = "";
  599. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  600. {
  601. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  602. {
  603. heatNo = uRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
  604. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  605. list.Add(uRow.Cells["BATCH_NO"].Value.ToString());
  606. list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
  607. if (uRow.Cells["PRODUCT_FLAG"].Value.ToString().Equals("商品"))
  608. {
  609. list.Add("801403");
  610. }else
  611. {
  612. list.Add("801402");
  613. }
  614. list.Add(uRow.Cells["ORDER_NO"].Value.ToString());
  615. list.Add(uRow.Cells["ORDER_SEQ"].Value.ToString());
  616. list.Add(uRow.Cells["ORDER_SEQ_NO"].Value.ToString());
  617. list.Add(uRow.Cells["FINISHPRO_MOLD"].Value.ToString());
  618. list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
  619. n++;
  620. m = uRow.Index;
  621. }
  622. }
  623. if (n < 1)
  624. {
  625. MessageUtil.ShowTips("请选择主信息进行批量调整位置!");
  626. return;
  627. }
  628. if(n>1)
  629. {
  630. MessageUtil.ShowTips("批量调整位置不允许多条调整库存位置!");
  631. return;
  632. }
  633. if (MessageUtil.ShowYesNoAndQuestion("是否批量修改选择数据的库存位置?") == DialogResult.No)
  634. {
  635. return;
  636. }
  637. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipupdateStoreButress.selectMatStu", new object[] { list }, ob);
  638. if (int.Parse(dt.Rows[0]["ACOUNT"].ToString()) > 0)
  639. {
  640. MessageUtil.ShowTips("此炉【"+heatNo+"】物料状态有改变,不允许调整位置!");
  641. return;
  642. }
  643. DataTable ds = new DataTable();
  644. ds.Clear();
  645. ds = dataTable2.Clone();
  646. ds.ImportRow(dataTable2.Rows[m]);
  647. frmPipeMoveStoreButress moveButress = new frmPipeMoveStoreButress(this.ob);
  648. moveButress.Dt = ds;
  649. moveButress.ShowDialog();
  650. if (moveButress.buttonValue == "1")
  651. {
  652. QueryPipedData();
  653. MessageUtil.ShowTips("修改成功!");
  654. }
  655. }
  656. /// <summary>
  657. /// 缴库实绩查询
  658. /// </summary>
  659. private void QueryInList()
  660. {
  661. string heatNo = "";
  662. string orderNo = "";
  663. string storgeNo = "";
  664. string startTim = "";
  665. string endTim = "";
  666. string bathYear = "";
  667. ArrayList list = new ArrayList();
  668. if (ultraCheckEditor5.Checked)
  669. {
  670. startTim = StartTime.Value.ToString("yyyy-MM-dd");
  671. endTim = EndTime.Value.ToString("yyyy-MM-dd");
  672. }
  673. if (chkJudge.Checked)
  674. {
  675. if (this.cmbJudge.Text == "")
  676. {
  677. MessageUtil.ShowTips("请选择炉号!");
  678. return;
  679. }else
  680. {
  681. heatNo = this.cmbJudge.Text.Trim();
  682. }
  683. }
  684. if (chkOrder.Checked)
  685. {
  686. if (this.cmbOrder.Text == "")
  687. {
  688. MessageUtil.ShowTips("请选择合同号!");
  689. return;
  690. }
  691. else
  692. {
  693. orderNo = this.cmbOrder.Text.Trim();
  694. }
  695. }
  696. if (chkStrong.Checked)
  697. {
  698. if (this.cmbStorager.Text == "")
  699. {
  700. MessageUtil.ShowTips("请选择仓库!");
  701. return;
  702. }
  703. else
  704. {
  705. storgeNo = this.cmbStorager.Value.ToString();
  706. }
  707. }
  708. if (chkBathYear.Checked)
  709. {
  710. bathYear = this.dtBathYear.Value.ToString("yyyyMM");
  711. }
  712. list.Add(heatNo);
  713. list.Add(orderNo);
  714. list.Add(storgeNo);
  715. list.Add(bathYear);
  716. //string arr = UserInfo.GetDeptid();
  717. string areaNo = "";
  718. string userName = UserInfo.GetUserName();
  719. //if (!userName.Equals("admin"))
  720. //{
  721. // DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.querySaleOrg", new object[] { arr }, this.ob);
  722. // if (ds.Rows.Count > 0)
  723. // {
  724. // areaNo = ds.Rows[0][0].ToString();
  725. // }
  726. //}
  727. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
  728. //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryInList", new object[] { list, userName, areaNo }, this.ob);
  729. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryInList", new object[] { list, arr, startTim, endTim }, this.ob);
  730. GridHelper.CopyDataToDatatable(ref dt, ref dataTable4,true);
  731. //GridHelper.RefreshAndAutoSize(this.ultraGrid4);
  732. }
  733. ArrayList storageParm = new ArrayList();//库位
  734. ArrayList matParm = new ArrayList();//材料表
  735. ArrayList statusUpdate = new ArrayList();//质保
  736. ArrayList plnSpale = new ArrayList();//销售合同提报
  737. string storageno = "";
  738. string storagetype = "";
  739. string storagetypedesc = "";
  740. string manageno = "";
  741. string managedesc="";
  742. string strInbound = "800701";//入库类型
  743. string strIndoc = "";//入库单号
  744. string strInMemo = "";
  745. string factoryNo = "";
  746. string factoryCode = "";
  747. string steelCode = "";
  748. string steelName = "";
  749. string sourceCode = "";
  750. string sourceName = "";
  751. string ks = "";
  752. UltraComboEditor ucePro = new UltraComboEditor();
  753. UltraComboEditor uceSpec = new UltraComboEditor();
  754. UltraComboEditor uceSteel = new UltraComboEditor();
  755. UltraComboEditor uceModel = new UltraComboEditor();
  756. UltraComboEditor uceFinished = new UltraComboEditor();
  757. /// <summary>
  758. /// 初始化
  759. /// </summary>
  760. /// <param name="sender"></param>
  761. /// <param name="e"></param>
  762. private void frmPipeInTemp_Load(object sender, EventArgs e)
  763. {
  764. //cmbSteel.Enabled = false;
  765. //StartTime.Value =DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
  766. //StartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00");
  767. StartTime.Value = DateTime.Parse("2015-10-01" + " 00:00:00");
  768. //DateTime.Today.AddDays(-7);
  769. //DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + " 00:00:00";
  770. //EndTime.Value = DateTime.Parse(DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).ToString("yyyy-MM-dd") + " 23:59:59");
  771. DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
  772. EndTime.Value = DateTime.Parse(d1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59");
  773. dtBathYear.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM"));
  774. //DateTime.Today.AddDays(1).AddSeconds(-1);
  775. //DateTime.Today.ToString("yyyy-MM-dd") + " 23:59:59";
  776. this.StartTime.Enabled = false;
  777. this.EndTime.Enabled = false;
  778. this.ultraCheckEditor5.Checked = true;
  779. InitStorage();
  780. InitBindColumn();
  781. YdmBaseClass.InitComboEditor(uceReson, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  782. YdmBaseClass.BindColumn(uceReson, "STORAGE_NO", this.Controls, this.ultraGrid2, 0);
  783. YdmBaseClass.InitComboEditor(uceFinished, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFinishedProduct", "BASECODE", this.ob, false);
  784. YdmBaseClass.BindColumn(uceFinished, "FINISHPRO_MOLD", this.Controls, this.ultraGrid2, 0);
  785. //this.ultraGrid4.DisplayLayout.Bands[0].Columns["BAL_YEAR_MONTH"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTime;
  786. //this.ultraGrid4.DisplayLayout.Bands[0].Columns["BAL_YEAR_MONTH"].MaskInput = "yyyymm";
  787. this.cmbStorager.Enabled = false;
  788. }
  789. private void InitBindColumn()
  790. {
  791. //材料状态
  792. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出等待");
  793. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料管理封锁");
  794. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料质量封锁");
  795. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料可编计划");
  796. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料已编计划");
  797. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150106", "材料为余材");
  798. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)");
  799. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定");
  800. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(已综合判定)");
  801. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)");
  802. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150205", "材料缴库余材(销售组织缴库)");
  803. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编提单");
  804. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编提单");
  805. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂");
  806. //string[] arr = new string[3] { "801501", "801502", "801503" };
  807. //DataTable dt = ClsLoad.GetValueListDataTable(arr, this.ob);
  808. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["MAT_STATUS"].ValueList = ClsLoad.GeneralValuelist(ref dt, "BASECODE", "BASENAME");
  809. this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801701", "超合同量");
  810. this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801702", "无合同");
  811. this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801703", "按合同");
  812. this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801704", "退货");
  813. this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801705", "压库");
  814. this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801706", "合同长尺");
  815. this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801707", "合同短尺");
  816. }
  817. /// <summary>
  818. /// 下拉框绑定数据
  819. /// </summary>
  820. private void InitStorage()
  821. {
  822. string time = DateTime.Now.ToString();
  823. string time1 = DateTime.Now.AddDays(-15).ToString();
  824. BaseMethod.InitSourse(cmbSource, this.ob);
  825. YdmBaseClass.InitComboEditor(cmbSteel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getGradeDetail", "GRADECODE", this.ob, false);
  826. //YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
  827. YdmBaseClass.InitComboEditor(cmbStorager, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  828. YdmBaseClass.InitComboEditor(cmbStorage, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  829. //YdmBaseClass.InitComboEditorWithParm(cmbJudge, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStoveNo", "lcode", this.ob, false,new object []{time1,time});
  830. //YdmBaseClass.InitComboEditor(cmbOrder, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getOrderNo", "ORDER_NO", this.ob, false);
  831. YdmBaseClass.InitComboEditor(ucePro, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getKind", "PRODUCCODE", this.ob, true);
  832. YdmBaseClass.InitComboEditor(uceSpec, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSpec", "SPEC_CODE", this.ob, true);
  833. YdmBaseClass.InitComboEditor(uceSteel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSteel", "STEELCODE", this.ob, true);
  834. YdmBaseClass.InitComboEditor(uceModel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getModel", "MODEL_CODE", this.ob, true);
  835. YdmBaseClass.BindColumn(ucePro, "CXKIND", this.Controls, ultraGrid1, 0);
  836. YdmBaseClass.BindColumn(uceSpec, "CXGG", this.Controls, ultraGrid1, 0);
  837. YdmBaseClass.BindColumn(uceSteel, "CXSTEELLEVEL", this.Controls, ultraGrid1, 0);
  838. YdmBaseClass.BindColumn(uceModel, "CXTYPEOFTHREAD", this.Controls, ultraGrid1, 0);
  839. }
  840. /// <summary>
  841. /// 品种维护
  842. /// </summary>
  843. private void doMaint()
  844. {
  845. FrmVarietie var = new FrmVarietie(ob, "2010-01-01 00:00:00");
  846. var.AutoSize = true;
  847. var.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  848. var.WindowState = FormWindowState.Maximized;
  849. var.Show();
  850. }
  851. /// <summary>
  852. /// 数据匹配
  853. /// </summary>
  854. private void DataMatch()
  855. {
  856. ultraGrid1.UpdateData();
  857. UltraGridRow row = ultraGrid1.ActiveRow;
  858. if (row == null) return;
  859. int counm = 0;
  860. string strOrder = "";
  861. string strOrderSeq = "";//合同行号
  862. string strKind = "";//品种
  863. string strTeel = "";//钢级
  864. string strSpec = "";//规格
  865. string strMode = "";//扣型
  866. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  867. {
  868. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  869. {
  870. counm += 1;
  871. }
  872. }
  873. if (counm == 0)
  874. {
  875. MessageUtil.ShowWarning("请选择需要匹对的质保判定数据!");
  876. return;
  877. }
  878. if (counm > 50)
  879. {
  880. MessageUtil.ShowWarning("一次只能选50条记录进行匹配!");
  881. return;
  882. }
  883. try
  884. {
  885. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  886. if (Constant.WaitingForm == null)
  887. {
  888. Constant.WaitingForm = new WaitingForm();
  889. }
  890. Constant.WaitingForm.ShowToUser = true;
  891. Constant.WaitingForm.Show();
  892. Constant.WaitingForm.Update();
  893. string strMatch = "";//是否匹配
  894. ArrayList pram = new ArrayList();
  895. DataTable dtkind = new DataTable();
  896. DataTable dtSteel = new DataTable();
  897. DataTable dtSpec = new DataTable();
  898. DataTable dtModel = new DataTable();
  899. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  900. {
  901. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  902. {
  903. ArrayList list = new ArrayList();
  904. strOrder = uRow.Cells["ordername"].Text;
  905. //if (YdmBaseClass.WordsIScn(strOrder))
  906. //{
  907. // MessageUtil.ShowTips("合同号有中文字符!");
  908. // break;
  909. //}
  910. //strVarieties = uRow.Cells["kind"].Text + "、" + uRow.Cells["steellevel"].Text + "、" + uRow.Cells["spec"].Text + "、" + uRow.Cells["typeofThread"].Text;
  911. //strKind = uRow.Cells["KIND"].Text.Trim();
  912. //strTeel = uRow.Cells["STEELLEVEL"].Text.Trim();
  913. //strSpec = uRow.Cells["GG"].Text.Trim();
  914. //strMode = uRow.Cells["TYPEOFTHREAD"].Text.Trim();
  915. #region 物料对应
  916. ArrayList listSave = new ArrayList();
  917. listSave.Clear();
  918. listSave.Add(uRow.Cells["kind"].Text);
  919. dtkind.Clear();
  920. dtkind = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryKind1", new object[] { listSave }, this.ob);
  921. if (dtkind.Rows.Count > 0)
  922. {
  923. strKind = dtkind.Rows[0]["PRODUCCODE"].ToString().Trim();
  924. }
  925. else
  926. {
  927. strKind = "";
  928. }
  929. listSave.Clear();
  930. listSave.Add(uRow.Cells["steellevel"].Text);
  931. dtSteel.Clear();
  932. dtSteel = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySteel1", new object[] { listSave }, this.ob);
  933. if (dtSteel.Rows.Count > 0)
  934. {
  935. strTeel = dtSteel.Rows[0]["STEELCODE"].ToString().Trim();
  936. }
  937. else
  938. {
  939. strTeel = "";
  940. }
  941. listSave.Clear();
  942. listSave.Add(uRow.Cells["GG"].Text);
  943. dtSpec.Clear();
  944. dtSpec = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySpec1", new object[] { listSave }, this.ob);
  945. if (dtSpec.Rows.Count > 0)
  946. {
  947. strSpec = dtSpec.Rows[0]["SPEC_CODE"].ToString().Trim();
  948. }
  949. else
  950. {
  951. strSpec = "";
  952. }
  953. listSave.Clear();
  954. if (uRow.Cells["typeofThread"].Text.Trim() == "")
  955. {
  956. listSave.Add("/");
  957. }
  958. else
  959. {
  960. listSave.Add(uRow.Cells["typeofThread"].Text);
  961. }
  962. dtModel.Clear();
  963. dtModel = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryModel1", new object[] { listSave }, this.ob);
  964. if (dtModel.Rows.Count > 0)
  965. {
  966. strMode = dtModel.Rows[0]["MODEL_CODE"].ToString().Trim();
  967. }
  968. else
  969. {
  970. strMode = "";
  971. }
  972. #endregion
  973. if (strKind != "" && strTeel != "" && strSpec != "" && strMode != "")
  974. {
  975. strMatch = "01";//(物料匹配)
  976. }
  977. else
  978. {
  979. strMatch = "02";//(物料不匹配)
  980. }
  981. list.Add(strMatch);
  982. list.Add(strKind);
  983. list.Add(strTeel);
  984. list.Add(strSpec);
  985. list.Add(strMode);
  986. list.Add(uRow.Cells["rcdid"].Text);
  987. list.Add(uRow.Cells["lcode"].Text);
  988. list.Add(uRow.Cells["lotno"].Text);
  989. list.Add(uRow.Cells["ordername"].Text);
  990. pram.Add(list);
  991. }
  992. }
  993. int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getUpdateZbMatch", new object[] { pram }, this.ob);
  994. this.Cursor = Cursors.Default;
  995. Constant.WaitingForm.ShowToUser = false;
  996. Constant.WaitingForm.Close();
  997. Constant.WaitingForm = null;
  998. QueryMatData();
  999. }
  1000. catch (Exception e)
  1001. {
  1002. this.Cursor = Cursors.Default;
  1003. Constant.WaitingForm.ShowToUser = false;
  1004. Constant.WaitingForm.Close();
  1005. Constant.WaitingForm = null;
  1006. }
  1007. }
  1008. /// <summary>
  1009. /// 合同查询
  1010. /// </summary>
  1011. private void QueryOrder()
  1012. {
  1013. string strStratTime = "";
  1014. string strEndTime = "";
  1015. string orderno = "";
  1016. string orderSeq = "";
  1017. if (this.ultraCheckEditor5.Checked)
  1018. {
  1019. if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
  1020. {
  1021. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  1022. return;
  1023. }
  1024. else
  1025. {
  1026. strStratTime = StartTime.Value.ToString();
  1027. strEndTime = EndTime.Value.ToString();
  1028. }
  1029. }
  1030. if (chkOrder.Checked)
  1031. {
  1032. if (cmbOrder.Text.Trim() != "")
  1033. {
  1034. orderno = cmbOrder.Text.Trim();
  1035. int dex = orderno.IndexOf("/");
  1036. if (dex > 0)
  1037. {
  1038. orderno = orderno.Substring(0, dex);
  1039. orderSeq = cmbOrder.Text.Trim().Substring(dex + 1);
  1040. if (orderSeq.Length < 3)
  1041. {
  1042. orderSeq = orderSeq.PadLeft(3, '0');
  1043. }
  1044. }
  1045. }
  1046. else
  1047. {
  1048. MessageUtil.ShowTips("请选择合同号!");
  1049. return;
  1050. }
  1051. }
  1052. //string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,this.ob);
  1053. string[] arr = this.ValidDataPurviewIds;
  1054. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder", new Object[] { orderno, orderSeq, arr }, this.ob);
  1055. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  1056. UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
  1057. ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
  1058. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
  1059. this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  1060. }
  1061. /// <summary>
  1062. /// 材料查询
  1063. /// </summary>
  1064. private void QueryMatData()
  1065. {
  1066. string judgetimeStart = ""; //判定起始时间
  1067. string judgetimeEnd = ""; //判定结束时间
  1068. string stoveno = ""; //炉号
  1069. string batchno = ""; //批号
  1070. string order = "";
  1071. string stu="";//匹配状态
  1072. string departNo = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
  1073. string departMent = "";
  1074. if (chkJudge.Checked)
  1075. {
  1076. if (this.cmbJudge.Text == "")
  1077. {
  1078. MessageUtil.ShowTips("请选择炉号!");
  1079. return;
  1080. }
  1081. else
  1082. {
  1083. stoveno = cmbJudge.Text.Trim();
  1084. }
  1085. }
  1086. if (chkOrder.Checked)
  1087. {
  1088. if (this.cmbOrder.Text == "")
  1089. {
  1090. MessageUtil.ShowTips("请选择合同号!");
  1091. return;
  1092. }
  1093. else
  1094. {
  1095. order = cmbOrder.Text.Trim();
  1096. }
  1097. }
  1098. if (this.ultraCheckEditor5.Checked)
  1099. {
  1100. if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
  1101. {
  1102. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  1103. return;
  1104. }
  1105. else
  1106. {
  1107. judgetimeStart= StartTime.Value.ToString();
  1108. judgetimeEnd = EndTime.Value.ToString();
  1109. }
  1110. }
  1111. else
  1112. {
  1113. if (this.cmbOrder.Text == "" && this.cmbJudge.Text == "")
  1114. {
  1115. MessageUtil.ShowTips("炉号或者合同号条件需要选择一个!");
  1116. return;
  1117. }
  1118. }
  1119. if (ultraCheckEditor1.Checked && cmbMatch.Text.Trim() != "")
  1120. {
  1121. stu=cmbMatch.Value.ToString();
  1122. }
  1123. //if (YdmBaseClass.getMonth(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString()))>1)
  1124. //{
  1125. // MessageUtil.ShowTips("请选择一个月之内的时间!");
  1126. // return;
  1127. //}
  1128. ArrayList list = new ArrayList();
  1129. list.Add(judgetimeStart);
  1130. list.Add(judgetimeEnd);
  1131. list.Add(stoveno);
  1132. //list.Add(batchno);
  1133. list.Add(order);
  1134. list.Add(stu);
  1135. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
  1136. //string[] _arr = new string[3];
  1137. //string sore = "";
  1138. //for (int i = 0; i < arr.Length; i++)
  1139. //{
  1140. // sore = arr[i];
  1141. // if (sore.Equals("100101") || sore.Equals("100102"))
  1142. // {
  1143. // sore = "";
  1144. // }
  1145. // else if (sore.Equals("100103"))
  1146. // {
  1147. // sore = "国贸";
  1148. // }
  1149. //}
  1150. try
  1151. {
  1152. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  1153. if (Constant.WaitingForm == null)
  1154. {
  1155. Constant.WaitingForm = new WaitingForm();
  1156. }
  1157. Constant.WaitingForm.ShowToUser = true;
  1158. Constant.WaitingForm.Show();
  1159. Constant.WaitingForm.Update();
  1160. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryMatData", new Object[] { list, arr }, this.ob);//MatData
  1161. //if (dt.Rows.Count > 0)
  1162. //{
  1163. // for (int i = 0; i < dt.Rows.Count; i++)
  1164. // {
  1165. // if (dt.Rows[i]["CXSTUPP"].ToString() == "物料不匹配")
  1166. // {
  1167. // this.ultraGrid1.DisplayLayout.Bands[i].Columns["CXSTUPP"].ce.CellAppearance.BackColor = Color.Red;
  1168. // }
  1169. // }
  1170. //}
  1171. GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
  1172. // UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid1.DisplayLayout.Bands[0].Columns["remark"], ultraGrid1.DisplayLayout.Bands[0].Columns["standard"]
  1173. //,ultraGrid1.DisplayLayout.Bands[0].Columns["testidea"] };
  1174. // GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col);
  1175. // this.ultraGrid1.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  1176. this.Cursor = Cursors.Default;
  1177. Constant.WaitingForm.ShowToUser = false;
  1178. Constant.WaitingForm.Close();
  1179. Constant.WaitingForm = null;
  1180. }
  1181. catch (Exception e)
  1182. {
  1183. this.Cursor = Cursors.Default;
  1184. Constant.WaitingForm.ShowToUser = false;
  1185. Constant.WaitingForm.Close();
  1186. Constant.WaitingForm = null;
  1187. }
  1188. this.chkAll.Checked = false;
  1189. }
  1190. /// <summary>
  1191. /// 把负质保数据置走
  1192. /// </summary>
  1193. private void updateStaus()
  1194. {
  1195. ultraGrid1.UpdateData();
  1196. UltraGridRow row = ultraGrid1.ActiveRow;
  1197. if (row == null) return;
  1198. int m = 0;
  1199. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  1200. {
  1201. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  1202. {
  1203. if (!(uRow.Cells["hgunit"].Text.Contains("-")) && !(uRow.Cells["hgunit"].Text == "") && !(uRow.Cells["hgweight"].Text.Contains("-")) && !(uRow.Cells["hgweight"].Text == ""))
  1204. {
  1205. m++;
  1206. }
  1207. }
  1208. }
  1209. if(m>0)
  1210. {
  1211. MessageUtil.ShowTips("不允许剔除正常的质保数据!");
  1212. return;
  1213. }
  1214. ArrayList parm = new ArrayList();
  1215. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  1216. {
  1217. if (Convert.ToBoolean(uRow.Cells["CHK"].Value))
  1218. {
  1219. ArrayList list = new ArrayList();
  1220. list.Add(uRow.Cells["rcdid"].Value.ToString());
  1221. parm.Add(list);
  1222. }
  1223. }
  1224. CoreClientParam ccp = new CoreClientParam();
  1225. ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
  1226. ccp.MethodName = "updateStaus";
  1227. ccp.ServerParams = new object[] { parm };
  1228. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1229. if (ccp.ReturnCode != -1)
  1230. {
  1231. if (ccp.ReturnInfo.Equals("剔除成功!"))
  1232. {
  1233. QueryMatData();
  1234. }
  1235. MessageUtil.ShowTips(ccp.ReturnInfo);
  1236. }
  1237. }
  1238. /// <summary>
  1239. /// 强制缴库
  1240. /// </summary>
  1241. private void DoForcePipeIn()
  1242. {
  1243. ultraGrid3.UpdateData();
  1244. ultraGrid1.UpdateData();
  1245. storageParm = new ArrayList();
  1246. matParm = new ArrayList();
  1247. statusUpdate = new ArrayList();
  1248. plnSpale = new ArrayList();
  1249. ArrayList listdt = new ArrayList();
  1250. int conu = 0;
  1251. string buttonValue = "";//返回的按钮值
  1252. string frmcount = "";//返回的支数
  1253. string frmWgt = "";//返回的重量值
  1254. string frmFinishedCode = "";
  1255. int count = 0;
  1256. UltraGridRow ugr3 = ultraGrid3.ActiveRow;
  1257. UltraGridRow row = ultraGrid1.ActiveRow;
  1258. //if (ugr3 == null) { MessageUtil.ShowTips("待缴库无数据,不能进行此操作"); return; }
  1259. if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
  1260. string[] arr = this.ValidDataPurviewIds;
  1261. double strWgt = 0;//炉重
  1262. double endWgt = 0;//已缴库量
  1263. double orderWgt = 0;//合同量
  1264. int m = 0;
  1265. int number = 0;
  1266. string orderType = "";
  1267. foreach (UltraGridRow row5 in ultraGrid3.Rows)
  1268. {
  1269. if (Convert.ToBoolean(row5.Cells["CHK"].Text) == true)
  1270. {
  1271. number++;
  1272. }
  1273. }
  1274. foreach (UltraGridRow row1 in ultraGrid1.Rows)
  1275. {
  1276. if (Convert.ToBoolean(row1.Cells["CHK"].Text) == true)
  1277. {
  1278. if (row1.Cells["hgweight"].Text == "")
  1279. {
  1280. MessageUtil.ShowTips("该炉还未生产,无法缴库!");
  1281. return;
  1282. }
  1283. if (double.Parse(row1.Cells["hgweight"].Text) < 0)
  1284. {
  1285. MessageUtil.ShowWarning("已缴库量无法进行冲销!");
  1286. return;
  1287. }
  1288. strWgt += double.Parse(row1.Cells["hgweight"].Value.ToString());
  1289. m++;
  1290. }
  1291. }
  1292. if (m < 1)
  1293. {
  1294. MessageUtil.ShowTips("请勾选需要强制缴库的质保数据!");
  1295. return;
  1296. }
  1297. if (m > 1)
  1298. {
  1299. MessageUtil.ShowTips("缴库时不允许多炉同时缴库!");
  1300. return;
  1301. }
  1302. //endWgt = double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString());
  1303. //orderWgt = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString());
  1304. //string strRANGE_MIN = ugr3.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
  1305. //string strRANGE_MAX = ugr3.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
  1306. //double dbQtyMin = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) - double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//交货量差下限值
  1307. //double dbQtyMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
  1308. string _length = "";//长度范围
  1309. int d = 0;
  1310. double downLength = 0;//下限
  1311. double upLength = 0;//上限
  1312. DataTable ds = new DataTable();
  1313. string prouceName = "";//品名
  1314. string steelLev = "";//钢级
  1315. string guige = "";//规格
  1316. string modelDesc = "";//扣型
  1317. DataTable dtOrder = new DataTable();
  1318. string ordername = "";//判定数据合同号
  1319. string orderNo = "";//判定数据拆分合同号
  1320. string orderSeQ = "";//判定数据拆分合同行号
  1321. string[] wgtList = new string[3];
  1322. int dex = 0;
  1323. string orderUnit = "";//长度单位
  1324. double reckonWgt = 0;//估算量上限
  1325. string gSwgt = "";//合同估算总量
  1326. string pipSwgt = "";//合同缴库总量
  1327. string dSwgt = "";//订货总量
  1328. foreach (UltraGridRow row2 in ultraGrid1.Rows)
  1329. {
  1330. if (Convert.ToBoolean(row2.Cells["CHK"].Text) == true)
  1331. {
  1332. if (row2.Cells["CXSTUPP"].Text.Trim() == "")
  1333. {
  1334. MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
  1335. return;
  1336. }
  1337. ds.Clear();
  1338. ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSqlServerStaus", new object[] { row2.Cells["ordername"].Text.Trim(), row2.Cells["lcode"].Text.Trim(), row2.Cells["lotno"].Text.Trim(), row2.Cells["hgunit"].Text.Trim(), row2.Cells["hgweight"].Text.Trim(), row2.Cells["rcdid"].Text.Trim() }, this.ob);
  1339. if (ds.Rows[0][0].ToString() == "20")
  1340. {
  1341. MessageUtil.ShowTips("您选中的【" + row2.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
  1342. return;
  1343. }
  1344. ordername = row2.Cells["ordername"].Text.Trim();
  1345. if (!ordername.Contains("/"))
  1346. {
  1347. MessageUtil.ShowTips("此判定数据合同号异常,不允许缴库!");
  1348. return;
  1349. }
  1350. dex = ordername.IndexOf("/");
  1351. orderNo = ordername.Substring(0, dex);
  1352. orderSeQ = ordername.Substring(dex + 1).PadLeft(4, '0');
  1353. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder1", new object[] { orderNo, orderSeQ }, this.ob);
  1354. if (dt.Rows.Count > 0)
  1355. {
  1356. if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("吨") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("支"))
  1357. {
  1358. if (double.Parse(dt.Rows[0]["PAYDOWNWEIGHT"].ToString()) < (double.Parse(dt.Rows[0]["ORDER_QTY"].ToString()) + double.Parse(dt.Rows[0]["ORDER_QTY"].ToString()) * (double.Parse(dt.Rows[0]["DELVRY_RANGE_MAX"].ToString()) / 100)))
  1359. {
  1360. MessageUtil.ShowTips("此判定物料有对应合同号合同行号数据存在,不允许强制缴库!");
  1361. return;
  1362. }
  1363. }
  1364. else if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("英尺") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("米"))
  1365. {
  1366. if (double.Parse(dt.Rows[0]["PAYDOWNWEIGHT"].ToString()) < (double.Parse(dt.Rows[0]["ORDERWEIGHT"].ToString()) + double.Parse(dt.Rows[0]["ORDERWEIGHT"].ToString()) * (double.Parse(dt.Rows[0]["DELVRY_RANGE_MAX"].ToString()) / 100)))
  1367. {
  1368. MessageUtil.ShowTips("此判定物料有对应合同号合同行号数据存在,不允许强制缴库!");
  1369. return;
  1370. }
  1371. }
  1372. }
  1373. else
  1374. {
  1375. ArrayList list = new ArrayList();
  1376. prouceName = row2.Cells["cxkind"].Text.Trim();
  1377. steelLev = row2.Cells["cxsteellevel"].Text.Trim();
  1378. guige = row2.Cells["cxstandard"].Text.Trim();
  1379. modelDesc = row2.Cells["cxtypeofthread"].Text.Trim();
  1380. list.Add(prouceName);
  1381. list.Add(steelLev);
  1382. list.Add(guige);
  1383. list.Add(modelDesc);
  1384. dtOrder = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getMatchOrderNo", new object[] { list}, this.ob);
  1385. if (dtOrder.Rows.Count > 0)
  1386. {
  1387. for (int i = 0; i < dtOrder.Rows.Count; i++)
  1388. {
  1389. if (dtOrder.Rows[i]["ORDER_NO"].ToString() == orderNo && int.Parse(dtOrder.Rows[i]["ORDER_SEQ"].ToString()) == int.Parse(orderSeQ))
  1390. {
  1391. if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("吨") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("支"))
  1392. {
  1393. if (double.Parse(dt.Rows[0]["PAYDOWNWEIGHT"].ToString()) < (double.Parse(dt.Rows[0]["ORDER_QTY"].ToString()) + double.Parse(dt.Rows[0]["ORDER_QTY"].ToString()) * (double.Parse(dt.Rows[0]["DELVRY_RANGE_MAX"].ToString()) / 100)))
  1394. {
  1395. MessageUtil.ShowTips("当前判定合同【" + ordername + "】在产销系统中有对应合同,需正常缴库!");
  1396. return;
  1397. }
  1398. }
  1399. else if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("英尺") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("米"))
  1400. {
  1401. if (double.Parse(dt.Rows[0]["PAYDOWNWEIGHT"].ToString()) < (double.Parse(dt.Rows[0]["ORDERWEIGHT"].ToString()) + double.Parse(dt.Rows[0]["ORDERWEIGHT"].ToString()) * (double.Parse(dt.Rows[0]["DELVRY_RANGE_MAX"].ToString()) / 100)))
  1402. {
  1403. MessageUtil.ShowTips("当前判定合同【" + ordername + "】在产销系统中有对应合同,需正常缴库!");
  1404. return;
  1405. }
  1406. }
  1407. }
  1408. }
  1409. }
  1410. }
  1411. }
  1412. }
  1413. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
  1414. {
  1415. if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
  1416. {
  1417. if (double.Parse(row3.Cells["hgweight"].Text.Trim()) < 0)
  1418. {
  1419. if (double.Parse(row3.Cells["hgweight"].Text.Trim()) + double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
  1420. {
  1421. MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
  1422. return;
  1423. }
  1424. else
  1425. {
  1426. if (int.Parse(row3.Cells["hgunit"].Text.Trim()) > int.Parse(ugr3.Cells["PAYDOWN_NUM"].Text.Trim()))
  1427. {
  1428. MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
  1429. return;
  1430. }
  1431. }
  1432. }
  1433. }
  1434. }
  1435. if (cmbStorage.SelectedItem == null)
  1436. {
  1437. MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1438. return;
  1439. }
  1440. else
  1441. {
  1442. storageno = this.cmbStorage.Value.ToString();
  1443. }
  1444. if (this.cmbFactory.Text.ToString() == "")
  1445. {
  1446. //MessageUtil.ShowTips("产线不允许为空!");
  1447. //return;
  1448. factoryCode = "";
  1449. factoryNo = "";
  1450. }
  1451. else
  1452. {
  1453. factoryCode = this.cmbFactory.Value.ToString();
  1454. factoryNo = this.cmbFactory.Text.ToString();
  1455. }
  1456. //if (this.cmbSteel.Text.ToString() == "")
  1457. //{
  1458. // //MessageUtil.ShowTips("钢种不允许为空!");
  1459. // //return;
  1460. // steelCode = "";
  1461. // steelName = "";
  1462. //}
  1463. //else
  1464. //{
  1465. // steelCode = this.cmbSteel.Value.ToString();
  1466. // steelName = this.cmbSteel.Text.ToString();
  1467. //}
  1468. if (this.cmbSource.Text.ToString() == "")
  1469. {
  1470. sourceCode = "";
  1471. sourceName = "";
  1472. }
  1473. else
  1474. {
  1475. sourceCode = this.cmbSource.Value.ToString();
  1476. sourceName = this.cmbSource.Text.ToString();
  1477. }
  1478. if (this.txt_Ks.Value == null)
  1479. {
  1480. ks = "0";
  1481. }
  1482. else
  1483. {
  1484. ks = this.txt_Ks.Value.ToString();
  1485. }
  1486. string strOrder = "";
  1487. if (ugr3 != null)
  1488. {
  1489. strOrder = ugr3.Cells["ORDER_NO"].Text.Trim() + "/" + ugr3.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
  1490. }
  1491. double delPla = 0;//已缴库量
  1492. UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
  1493. .OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
  1494. double dbDelvry = 0;
  1495. double dbweigh = 0;
  1496. double dbcount = 0;
  1497. double endweigth = 0;
  1498. string strRANGE_MIN = "";
  1499. string strRANGE_MAX = "";
  1500. double dbQtyMin = 0;
  1501. double dbQtyMax = 0;
  1502. double dbJhMax = 0;
  1503. #region 强制缴库有合同时
  1504. if (number > 0)
  1505. {
  1506. UltraGridRow grid3Row =null;
  1507. foreach (UltraGridRow row6 in ultraGrid3.Rows)
  1508. {
  1509. if (Convert.ToBoolean(row6.Cells["CHK"].Text) == true)
  1510. {
  1511. //if (row6.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
  1512. //{
  1513. // MessageUtil.ShowTips("待缴库合同在生产中,不能进行强制缴库!");
  1514. // return;
  1515. //}
  1516. if (row6.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
  1517. {
  1518. MessageUtil.ShowTips("物料不匹配不允许缴库!");
  1519. return;
  1520. }
  1521. orderUnit = row6.Cells["ORDER_UNIT"].Text.Trim();
  1522. endWgt = double.Parse(row6.Cells["PAYDOWNWEIGHT"].Value.ToString());
  1523. orderWgt = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString());
  1524. strRANGE_MIN = row6.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
  1525. strRANGE_MAX = row6.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
  1526. dbQtyMin = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
  1527. dbQtyMax = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
  1528. dbJhMax = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
  1529. wgtList = getOrderWgt(row6.Cells["ORDER_NO"].Text.ToString());
  1530. if (wgtList.Length > 0)
  1531. {
  1532. gSwgt = wgtList[0];
  1533. pipSwgt = wgtList[1];
  1534. dSwgt = wgtList[2];
  1535. }
  1536. grid3Row = row6;
  1537. }
  1538. }
  1539. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  1540. {
  1541. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  1542. {
  1543. ArrayList matList = new ArrayList();
  1544. ArrayList plnList = new ArrayList();
  1545. //if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
  1546. //{
  1547. // if (uRow.Cells["hgm"].Text.Trim() == "")
  1548. // {
  1549. // MessageUtil.ShowTips("此合同不是按吨交货,长度为空不能缴库!");
  1550. // return;
  1551. // }
  1552. //}
  1553. orderType = doQueryOrderType(uRow.Cells["ordername"].Text.Trim().Substring(0, uRow.Cells["ordername"].Text.Trim().IndexOf("/")));
  1554. if (orderType.Equals("120103"))
  1555. {
  1556. MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
  1557. return;
  1558. }
  1559. else if (orderType.Equals("120104"))
  1560. {
  1561. MessageUtil.ShowTips("该合同为预排合同,只允许缴库成成品!");
  1562. return;
  1563. }
  1564. _length = uRow.Cells["leng"].Text.Trim();
  1565. if (_length != "")
  1566. {
  1567. d = _length.IndexOf("-");
  1568. downLength = double.Parse(_length.Substring(0, d));
  1569. upLength = double.Parse(_length.Substring(d + 1));
  1570. if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
  1571. {
  1572. if (!(compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), downLength) && compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), upLength)))
  1573. {
  1574. if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + uRow.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + grid3Row.Cells["LEN"].Text + "】,是否继续缴库?") == DialogResult.No)
  1575. {
  1576. return;
  1577. }
  1578. }
  1579. }
  1580. else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
  1581. {
  1582. if (!(compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), downLength) && compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), upLength)))
  1583. {
  1584. if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())).ToString() + "-" + FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())).ToString() + "】(英尺换算),是否缴库?") == DialogResult.No)
  1585. {
  1586. return;
  1587. }
  1588. }
  1589. }
  1590. }
  1591. else
  1592. {
  1593. MessageUtil.ShowTips("强制缴库到对应合同中,长度上下限不允许为空!");
  1594. return;
  1595. }
  1596. if (strWgt > 0)
  1597. {
  1598. if (orderUnit.Equals("吨") || orderUnit.Equals("支"))
  1599. {
  1600. if (endWgt > dbJhMax)
  1601. {
  1602. //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
  1603. //return;
  1604. if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
  1605. {
  1606. return;
  1607. }
  1608. }else
  1609. {
  1610. if ((strWgt + endWgt) > dbJhMax)
  1611. {
  1612. frmBatchesPip frm = new frmBatchesPip(ob);
  1613. frm.AllCount = uRow.Cells["hgunit"].Text.Trim();
  1614. frm.AllWgt = uRow.Cells["hgweight"].Text.Trim();
  1615. frm.SxWgt = (dbQtyMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  1616. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  1617. frm.ShowDialog();
  1618. buttonValue = frm.buttonValue;
  1619. frmcount = frm.count;
  1620. frmWgt = frm.outWgt;
  1621. frmFinishedCode = frm.finishedProduct;
  1622. if (!frm.flag)
  1623. {
  1624. return;
  1625. }
  1626. if (buttonValue == "0")
  1627. {
  1628. return;
  1629. }
  1630. if (buttonValue == "2")
  1631. {
  1632. if (int.Parse(frmcount) > int.Parse(uRow.Cells["hgunit"].Text.Trim()))
  1633. {
  1634. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  1635. return;
  1636. }
  1637. if (double.Parse(frmWgt) + endWgt > dbJhMax)
  1638. {
  1639. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  1640. {
  1641. return;
  1642. }
  1643. }
  1644. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  1645. {
  1646. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  1647. {
  1648. return;
  1649. }
  1650. }
  1651. }
  1652. if (buttonValue == "1")
  1653. {
  1654. if ((strWgt + endWgt) > dbJhMax)
  1655. {
  1656. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  1657. {
  1658. return;
  1659. }
  1660. }
  1661. }
  1662. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  1663. {
  1664. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  1665. {
  1666. return;
  1667. }
  1668. }
  1669. }
  1670. }
  1671. }
  1672. else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
  1673. {
  1674. if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
  1675. {
  1676. MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
  1677. return;
  1678. }
  1679. reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
  1680. if (endWgt > reckonWgt)
  1681. {
  1682. //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
  1683. //return;
  1684. if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
  1685. {
  1686. return;
  1687. }
  1688. }else
  1689. {
  1690. if ((strWgt + endWgt) > reckonWgt)
  1691. {
  1692. frmBatchesPip frm = new frmBatchesPip(ob);
  1693. frm.AllCount = uRow.Cells["hgunit"].Text.Trim();
  1694. frm.AllWgt = uRow.Cells["hgweight"].Text.Trim();
  1695. frm.SxWgt = (reckonWgt - double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  1696. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  1697. frm.ShowDialog();
  1698. buttonValue = frm.buttonValue;
  1699. frmcount = frm.count;
  1700. frmWgt = frm.outWgt;
  1701. frmFinishedCode = frm.finishedProduct;
  1702. if (!frm.flag)
  1703. {
  1704. return;
  1705. }
  1706. if (buttonValue == "0")
  1707. {
  1708. return;
  1709. }
  1710. if (buttonValue == "2")
  1711. {
  1712. if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
  1713. {
  1714. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  1715. return;
  1716. }
  1717. if (double.Parse(frmWgt) + endWgt > reckonWgt)
  1718. {
  1719. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  1720. {
  1721. return;
  1722. }
  1723. }
  1724. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  1725. {
  1726. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  1727. {
  1728. return;
  1729. }
  1730. }
  1731. }
  1732. if (buttonValue == "1")
  1733. {
  1734. if ((strWgt + endWgt) > reckonWgt)
  1735. {
  1736. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  1737. {
  1738. return;
  1739. }
  1740. }
  1741. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  1742. {
  1743. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  1744. {
  1745. return;
  1746. }
  1747. }
  1748. }
  1749. }
  1750. }
  1751. }
  1752. }
  1753. double stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//炉(重量)
  1754. double dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//炉(支数)
  1755. ArrayList storageList = new ArrayList(); //仓库位置参数
  1756. storageList.Add(uRow.Cells["lcode"].Text.Trim());
  1757. storageList.Add(uRow.Cells["lotno"].Text.Trim());
  1758. storageList.Add(uRow.Cells["hgunit"].Text.Trim());
  1759. storageList.Add(storageno);
  1760. storageList.Add(storageno + "10101");
  1761. storageList.Add(storagetype);
  1762. storageList.Add(storagetypedesc);
  1763. //storageList.Add(manageno);
  1764. //storageList.Add(managedesc);
  1765. storageList.Add(this.UserInfo.GetUserName());
  1766. storageList.Add(uRow.Cells["hgweight"].Value.ToString());
  1767. storageList.Add(this.UserInfo.GetDeptid());
  1768. storageList.Add(this.UserInfo.GetDepartment());
  1769. storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  1770. storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  1771. storageParm.Add(storageList);
  1772. #region 要缴库的每一炉重量小于要缴库的重量
  1773. matList.Add(uRow.Cells["lcode"].Text.Trim()); //炉号
  1774. matList.Add(uRow.Cells["lotno"].Text.Trim());//批号
  1775. matList.Add(uRow.Cells["hgunit"].Text.Trim());//支数
  1776. matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
  1777. matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
  1778. if (uRow.Cells["cxsteellevel"].Text == "N80Q")
  1779. {
  1780. matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());
  1781. matList.Add(uRow.Cells["cxsteellevel"].Text);
  1782. }
  1783. else
  1784. {
  1785. matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
  1786. matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
  1787. }
  1788. matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
  1789. matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
  1790. matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
  1791. matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
  1792. matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
  1793. matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
  1794. matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
  1795. matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
  1796. matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
  1797. matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
  1798. matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
  1799. matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
  1800. matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
  1801. matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
  1802. matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
  1803. matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
  1804. matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
  1805. matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
  1806. matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
  1807. matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
  1808. matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
  1809. string length = uRow.Cells["leng"].Text.Trim();
  1810. if (length != "")
  1811. {
  1812. int n = length.IndexOf("-");
  1813. string lengMin = length.Substring(0, n);
  1814. string lengMax = length.Substring(n + 1);
  1815. matList.Add(lengMin);//下限
  1816. matList.Add(lengMax);//上限
  1817. }
  1818. else
  1819. {
  1820. matList.Add("");//下限
  1821. matList.Add("");//上限
  1822. }
  1823. matList.Add(this.UserInfo.GetUserName());//操作人
  1824. matList.Add("0");
  1825. matList.Add("1");
  1826. matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
  1827. matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
  1828. double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
  1829. double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
  1830. DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
  1831. if (dtMemo.Rows.Count >= 1)
  1832. {
  1833. strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  1834. }
  1835. //strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
  1836. matList.Add(strInMemo);
  1837. matList.Add(this.UserInfo.GetDeptid());
  1838. matList.Add(this.UserInfo.GetDepartment());//37
  1839. matList.Add(strInbound);
  1840. matList.Add(this.cmbStorage.Value.ToString());//仓库号
  1841. matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());
  1842. matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());
  1843. if (buttonValue == "2")
  1844. {
  1845. matList.Add(frmcount);//42
  1846. }
  1847. else
  1848. {
  1849. matList.Add(uRow.Cells["hgunit"].Value.ToString());
  1850. }
  1851. // matList.Add(uRow.Cells["hgunit"].Value.ToString());
  1852. matList.Add(uRow.Cells["rcdid"].Value.ToString());
  1853. matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
  1854. matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  1855. matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  1856. matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
  1857. //matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));//判定时间
  1858. matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
  1859. matList.Add(factoryCode);
  1860. matList.Add(factoryNo);
  1861. //matList.Add(steelCode);
  1862. //matList.Add(steelName);
  1863. matList.Add("");
  1864. matList.Add(uRow.Cells["steelgrade"].Text.ToString());
  1865. matList.Add(this.txtMemo.Text.Trim());
  1866. matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
  1867. matList.Add(sourceCode);//材料来源代码
  1868. matList.Add(sourceName);//材料名称
  1869. matList.Add(ks);
  1870. if (buttonValue == "1")
  1871. {
  1872. matList.Add("801703");//成品区分
  1873. }
  1874. else if (buttonValue == "2")
  1875. {
  1876. matList.Add("801701");//成品区分
  1877. }
  1878. matParm.Add(matList);
  1879. plnList.Add(stWeight.ToString("f3"));
  1880. plnList.Add(dbunit.ToString());
  1881. plnList.Add(this.UserInfo.GetUserName());
  1882. plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
  1883. plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
  1884. plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
  1885. plnSpale.Add(plnList);
  1886. //break;
  1887. #endregion
  1888. ArrayList statusList = new ArrayList();
  1889. statusList.Add(uRow.Cells["lcode"].Text.Trim());
  1890. statusList.Add(uRow.Cells["lotno"].Text.Trim());
  1891. statusList.Add(uRow.Cells["factory"].Value.ToString());
  1892. statusList.Add(uRow.Cells["testdate"].Value.ToString());
  1893. statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
  1894. statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
  1895. statusList.Add(uRow.Cells["RCDID"].Value.ToString());
  1896. statusUpdate.Add(statusList);
  1897. }
  1898. }
  1899. }
  1900. #endregion
  1901. else
  1902. {
  1903. #region 无合同时
  1904. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  1905. {
  1906. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  1907. {
  1908. orderType = doQueryOrderType(uRow.Cells["ordername"].Text.Trim().Substring(0, uRow.Cells["ordername"].Text.Trim().IndexOf("/")));
  1909. if (orderType.Equals("120103"))
  1910. {
  1911. MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
  1912. return;
  1913. }
  1914. if (MessageUtil.ShowYesNoAndQuestion("此炉号【" + uRow.Cells["lcode"].Text.Trim() + "】是否全部缴库为计划外的成品?") == DialogResult.No)
  1915. {
  1916. return;
  1917. }
  1918. ArrayList matList = new ArrayList();
  1919. ArrayList plnList = new ArrayList();
  1920. double stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//炉(重量)
  1921. double dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//炉(支数)
  1922. ArrayList storageList = new ArrayList(); //仓库位置参数
  1923. storageList.Add(uRow.Cells["lcode"].Value.ToString());
  1924. storageList.Add(uRow.Cells["lotno"].Value.ToString());
  1925. storageList.Add(uRow.Cells["hgunit"].Value.ToString());
  1926. storageList.Add(storageno);
  1927. storageList.Add(storageno + "10101");
  1928. storageList.Add(storagetype);
  1929. storageList.Add(storagetypedesc);
  1930. //storageList.Add(manageno);
  1931. //storageList.Add(managedesc);
  1932. storageList.Add(this.UserInfo.GetUserName());
  1933. storageList.Add(uRow.Cells["hgweight"].Value.ToString());
  1934. storageList.Add(this.UserInfo.GetDeptid());
  1935. storageList.Add(this.UserInfo.GetDepartment());
  1936. storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  1937. storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  1938. storageParm.Add(storageList);
  1939. #region 要缴库的每一炉重量小于要缴库的重量
  1940. matList.Add(uRow.Cells["lcode"].Value.ToString()); //炉号
  1941. matList.Add(uRow.Cells["lotno"].Value.ToString());//批号
  1942. matList.Add(uRow.Cells["hgunit"].Value.ToString());//支数
  1943. matList.Add(uRow.Cells["cxkind"].Value.ToString());//品名代码
  1944. matList.Add(uRow.Cells["cxkind"].Text.ToString());//品名名称
  1945. matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());//钢级(牌号)代码
  1946. matList.Add(uRow.Cells["cxsteellevel"].Text.ToString());//钢级名称
  1947. matList.Add(uRow.Cells["cxgg"].Value.ToString());//产品规格代码
  1948. matList.Add(uRow.Cells["cxgg"].Text.ToString());//产品规格描述
  1949. matList.Add(uRow.Cells["cxtypeofthread"].Value.ToString());//扣型代码
  1950. matList.Add(uRow.Cells["cxtypeofthread"].Text.ToString());//扣型描述 10
  1951. matList.Add("");//标准代码
  1952. matList.Add("");//标准名称
  1953. matList.Add("");
  1954. matList.Add("");
  1955. matList.Add("");//标准类别代码
  1956. matList.Add(uRow.Cells["STDSTYLE"].Value.ToString());//标准类别描述
  1957. matList.Add("");//合同号
  1958. matList.Add("");//合同行号
  1959. matList.Add("");//交货行号
  1960. matList.Add("");//合同主键
  1961. matList.Add("");//合同行主键
  1962. matList.Add("");//交货行主键
  1963. DataTable ts = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getDiamter", new object[] { uRow.Cells["cxgg"].Value.ToString() }, this.ob);
  1964. if (ts.Rows.Count > 0)
  1965. {
  1966. matList.Add(ts.Rows[0]["DIMATER"].ToString());// 外径
  1967. matList.Add(ts.Rows[0]["HEIGHT"].ToString());//壁厚
  1968. }
  1969. else
  1970. {
  1971. MessageUtil.ShowTips("此产品规格【" + uRow.Cells["cxgg"].Value.ToString() + "】未维护外径壁厚,无法缴库");
  1972. return;
  1973. }
  1974. matList.Add("");//长度编码(订货)
  1975. matList.Add("");//长度描述(订货)
  1976. matList.Add("");//长度单位 27
  1977. string length = row.Cells["leng"].Text.Trim();
  1978. if (length != "")
  1979. {
  1980. int n = length.IndexOf("-");
  1981. string lengMin = length.Substring(0, n);
  1982. string lengMax = length.Substring(n + 1);
  1983. matList.Add(lengMin);//下限
  1984. matList.Add(lengMax);//上限
  1985. }
  1986. else
  1987. {
  1988. matList.Add("");//下限
  1989. matList.Add("");//上限
  1990. }
  1991. matList.Add(this.UserInfo.GetUserName());//操作人
  1992. matList.Add("0");
  1993. matList.Add("1");
  1994. matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
  1995. matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
  1996. double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
  1997. double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
  1998. DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
  1999. if (dtMemo.Rows.Count >= 1)
  2000. {
  2001. strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  2002. }
  2003. //strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
  2004. matList.Add(strInMemo);
  2005. matList.Add(this.UserInfo.GetDeptid());
  2006. matList.Add(this.UserInfo.GetDepartment());//37
  2007. matList.Add(strInbound);
  2008. matList.Add(this.cmbStorage.Value.ToString());//仓库号
  2009. if (uRow.Cells["DEPARTM"].Text.ToString().Contains("国贸"))
  2010. {
  2011. matList.Add("100102");//销售组织代码
  2012. matList.Add("国贸公司");
  2013. }
  2014. else
  2015. {
  2016. matList.Add("100101");//销售组织代码
  2017. matList.Add("销售公司");
  2018. }
  2019. matList.Add(uRow.Cells["hgunit"].Value.ToString());
  2020. matList.Add(uRow.Cells["rcdid"].Value.ToString());
  2021. matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
  2022. matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  2023. matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  2024. matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
  2025. //matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + uRow.Cells["testdate"].Value.ToString().Substring(5, 2));//判定时间
  2026. matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
  2027. matList.Add(factoryCode);
  2028. matList.Add(factoryNo);
  2029. //matList.Add(steelCode);
  2030. //matList.Add(steelName);
  2031. matList.Add("");
  2032. matList.Add(uRow.Cells["steelgrade"].Text.ToString());
  2033. matList.Add(this.txtMemo.Text.Trim());
  2034. matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
  2035. matList.Add(sourceCode);//材料来源代码
  2036. matList.Add(sourceName);//材料名称
  2037. matList.Add(ks);
  2038. matList.Add("801702");//成品区分
  2039. matParm.Add(matList);
  2040. plnList.Add(stWeight.ToString("f3"));
  2041. plnList.Add(dbunit.ToString());
  2042. plnList.Add(this.UserInfo.GetUserName());
  2043. plnList.Add("");
  2044. plnList.Add("");
  2045. plnList.Add("");
  2046. plnSpale.Add(plnList);
  2047. //break;
  2048. #endregion
  2049. ArrayList statusList = new ArrayList();
  2050. statusList.Add(uRow.Cells["lcode"].Value.ToString());
  2051. statusList.Add(uRow.Cells["lotno"].Value.ToString());
  2052. statusList.Add(uRow.Cells["factory"].Value.ToString());
  2053. statusList.Add(uRow.Cells["testdate"].Value.ToString());
  2054. statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
  2055. statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
  2056. statusList.Add(uRow.Cells["RCDID"].Value.ToString());
  2057. statusUpdate.Add(statusList);
  2058. }
  2059. }
  2060. #endregion
  2061. }
  2062. //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
  2063. CoreClientParam ccp = new CoreClientParam();
  2064. ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
  2065. ccp.MethodName = "doPipeIn";
  2066. ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
  2067. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  2068. if (ccp.ReturnCode != -1)
  2069. {
  2070. if (ccp.ReturnInfo.Equals("缴库成功!"))
  2071. {
  2072. QueryMatData();
  2073. this.cmbSteel.Text = "";
  2074. this.cmbFactory.Text = "";
  2075. this.txt_Ks.Value = "0";
  2076. if (ugr3 != null)
  2077. {
  2078. QueryOrder(ugr3.Cells["ORDER_NO"].Text.Trim(), ugr3.Cells["ORDER_SEQ"].Text.Trim());
  2079. }
  2080. MessageUtil.ShowTips(ccp.ReturnInfo);
  2081. }
  2082. else
  2083. {
  2084. MessageUtil.ShowTips(ccp.ReturnInfo);
  2085. }
  2086. }
  2087. }
  2088. /// <summary>
  2089. /// 缴库
  2090. /// </summary>
  2091. private void DoPipeIn()
  2092. {
  2093. ultraGrid3.UpdateData();
  2094. ultraGrid1.UpdateData();
  2095. string buttonValue = "";//返回的按钮值
  2096. string frmcount = "";//返回的支数
  2097. string frmWgt = "";//返回的重量值
  2098. string frmFinishedCode = "";
  2099. storageParm = new ArrayList();
  2100. matParm = new ArrayList();
  2101. statusUpdate = new ArrayList();
  2102. plnSpale = new ArrayList();
  2103. ArrayList listdt = new ArrayList();
  2104. string[] wgtList = new string[3];
  2105. int conu = 0;
  2106. string orderType = "";
  2107. int count = 0;
  2108. UltraGridRow ugr3 = ultraGrid3.ActiveRow;
  2109. UltraGridRow row = ultraGrid1.ActiveRow;
  2110. if (ugr3 == null) { MessageUtil.ShowTips("待缴库无合同数据,不能进行此操作"); return; }
  2111. if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
  2112. double strWgt = 0;//炉重
  2113. double endWgt = 0;//已缴库量
  2114. double orderWgt = 0;//合同量
  2115. int m = 0;
  2116. int nn = 0;
  2117. foreach (UltraGridRow row1 in ultraGrid1.Rows)
  2118. {
  2119. if (Convert.ToBoolean(row1.Cells["CHK"].Text) == true)
  2120. {
  2121. if (row1.Cells["hgweight"].Text == "")
  2122. {
  2123. MessageUtil.ShowTips("该炉还未生产,无法缴库!");
  2124. return;
  2125. }
  2126. if (double.Parse(row1.Cells["hgweight"].Text) < 0)
  2127. {
  2128. MessageUtil.ShowWarning("已缴库量无法进行冲销!");
  2129. return;
  2130. }
  2131. strWgt += double.Parse(row1.Cells["hgweight"].Value.ToString());
  2132. m++;
  2133. }
  2134. }
  2135. if (m < 1)
  2136. {
  2137. MessageUtil.ShowTips("请勾选需要操作的记录!");
  2138. return;
  2139. }
  2140. if (m > 1)
  2141. {
  2142. MessageUtil.ShowTips("缴库时不允许多炉同时缴库!");
  2143. return;
  2144. }
  2145. foreach (UltraGridRow row7 in ultraGrid3.Rows)
  2146. {
  2147. if (Convert.ToBoolean(row7.Cells["CHK"].Text) == true)
  2148. {
  2149. nn++;
  2150. }
  2151. }
  2152. if (nn < 1)
  2153. {
  2154. MessageUtil.ShowTips("请勾选待缴库合同数据!");
  2155. return;
  2156. }
  2157. double delPla = 0;//已缴库量
  2158. string _length = "";//长度范围
  2159. int d = 0;
  2160. double downLength = 0;//下限
  2161. double upLength = 0;//上限
  2162. string orderUnit = "";//长度单位
  2163. double reckonWgt = 0;//估算量上限
  2164. string gSwgt = "";//合同估算总量
  2165. string pipSwgt = "";//合同缴库总量
  2166. string dSwgt = "";//订货总量
  2167. if (cmbStorage.Text.ToString() == "")
  2168. {
  2169. MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  2170. return;
  2171. }
  2172. else
  2173. {
  2174. storageno = this.cmbStorage.Value.ToString();
  2175. }
  2176. if (this.cmbFactory.Text.ToString() == "")
  2177. {
  2178. //MessageUtil.ShowTips("产线不允许为空!");
  2179. //return;
  2180. factoryCode = "";
  2181. factoryNo = "";
  2182. }
  2183. else
  2184. {
  2185. factoryCode = this.cmbFactory.Value.ToString();
  2186. factoryNo = this.cmbFactory.Text.ToString();
  2187. }
  2188. //if (this.cmbSteel.Text.ToString() == "")
  2189. //{
  2190. // //MessageUtil.ShowTips("钢种不允许为空!");
  2191. // //return;
  2192. // steelCode = "";
  2193. // steelName = "";
  2194. //}
  2195. //else
  2196. //{
  2197. // steelCode = this.cmbSteel.Value.ToString();
  2198. // steelName = this.cmbSteel.Text.ToString();
  2199. //}
  2200. if (this.cmbSource.Text.ToString() == "")
  2201. {
  2202. //MessageUtil.ShowTips("钢种不允许为空!");
  2203. //return;
  2204. sourceCode = "";
  2205. sourceName = "";
  2206. }
  2207. else
  2208. {
  2209. sourceCode = this.cmbSource.Value.ToString();
  2210. sourceName = this.cmbSource.Text.ToString();
  2211. }
  2212. if (this.txt_Ks.Value == null)
  2213. {
  2214. ks = "0";
  2215. }
  2216. else
  2217. {
  2218. ks = this.txt_Ks.Value.ToString();
  2219. }
  2220. DataTable ds = new DataTable();
  2221. UltraGridRow grid3Row = null;
  2222. string strRANGE_MIN = "";
  2223. string strRANGE_MAX = "";
  2224. double dbQtyMin = 0;
  2225. double dbQtyMax = 0;
  2226. double dbJhMax = 0;//估算量上限
  2227. double dbOrderMax = 0;//合同订货量上限
  2228. string strOrder = "";
  2229. //int dex = 0;
  2230. //string ordername = "";
  2231. //string orderNo = "";
  2232. //string orderSeQ = "";
  2233. foreach (UltraGridRow row5 in ultraGrid3.Rows)
  2234. {
  2235. if (Convert.ToBoolean(row5.Cells["CHK"].Text) == true)
  2236. {
  2237. if (row5.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
  2238. {
  2239. MessageUtil.ShowTips("合同物料不匹配不允许缴库!");
  2240. return;
  2241. }
  2242. if (row5.Cells["MATCHORDER"].Text.Trim().Contains("合同不匹配"))
  2243. {
  2244. MessageUtil.ShowTips("合同不匹配不允许缴库,可强制缴库!");
  2245. return;
  2246. }
  2247. strOrder = ugr3.Cells["ORDER_NO"].Text.Trim() + "/" + ugr3.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
  2248. orderUnit = ugr3.Cells["ORDER_UNIT"].Text.Trim();
  2249. endWgt = double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString());
  2250. orderWgt = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString());
  2251. strRANGE_MIN = ugr3.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
  2252. strRANGE_MAX = ugr3.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
  2253. dbQtyMin = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
  2254. dbQtyMax = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
  2255. dbJhMax = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
  2256. if (orderUnit.Contains("支") || orderUnit.Equals("吨"))
  2257. {
  2258. dbOrderMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);
  2259. }
  2260. else if (orderUnit.Contains("磅"))
  2261. {
  2262. dbOrderMax = Math.Round(double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString())*0.45359/1000 + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString())*0.45359/1000 * (double.Parse(strRANGE_MAX) / 100),3);
  2263. }
  2264. wgtList = getOrderWgt(ugr3.Cells["ORDER_NO"].Text.ToString());
  2265. if (wgtList.Length > 0)
  2266. {
  2267. gSwgt = wgtList[0];
  2268. pipSwgt = wgtList[1];
  2269. dSwgt = wgtList[2];
  2270. }
  2271. grid3Row = row5;
  2272. }
  2273. }
  2274. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
  2275. {
  2276. if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
  2277. {
  2278. if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
  2279. {
  2280. if (row3.Cells["CXSTUPP"].Text.Trim() == "")
  2281. {
  2282. MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
  2283. return;
  2284. }
  2285. if (row3.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
  2286. {
  2287. MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库!");
  2288. return;
  2289. }
  2290. ds.Clear();
  2291. ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSqlServerStaus", new object[] { row3.Cells["ordername"].Text.Trim(), row3.Cells["lcode"].Text.Trim(), row3.Cells["lotno"].Text.Trim(), row3.Cells["hgunit"].Text.Trim(), row3.Cells["hgweight"].Text.Trim(), row3.Cells["rcdid"].Text.Trim() }, this.ob);
  2292. if (ds.Rows[0][0].ToString() == "20")
  2293. {
  2294. MessageUtil.ShowTips("您选中的【" + row3.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
  2295. return;
  2296. }
  2297. //ordername = row3.Cells["ordername"].Text.Trim();
  2298. //dex = ordername.IndexOf("/");
  2299. //orderNo = ordername.Substring(0, dex);
  2300. //orderSeQ = ordername.Substring(dex + 1).PadLeft(3, '0');
  2301. //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder", new object[] { orderNo, orderSeQ }, this.ob);
  2302. //if (dt.Rows.Count > 0)
  2303. //{
  2304. // MessageUtil.ShowTips("此缴库合同号有对应合同号合同行号数据存在,请勾选相应待缴合同!");
  2305. // return;
  2306. //}
  2307. //if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
  2308. //{
  2309. // if (row3.Cells["hgm"].Text.Trim() == "")
  2310. // {
  2311. // MessageUtil.ShowTips("此合同不是按吨交货,长度为空不能缴库!");
  2312. // return;
  2313. // }
  2314. //}
  2315. _length = row3.Cells["leng"].Text.Trim();
  2316. if (_length != "")
  2317. {
  2318. d = _length.IndexOf("-");
  2319. downLength = double.Parse(_length.Substring(0, d));
  2320. upLength = double.Parse(_length.Substring(d + 1));
  2321. if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
  2322. {
  2323. if (!(compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), downLength) && compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), upLength)))
  2324. {
  2325. if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row3.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + grid3Row.Cells["LEN"].Text + "】米,是否缴库?") == DialogResult.No)
  2326. {
  2327. return;
  2328. }
  2329. }
  2330. }
  2331. else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
  2332. {
  2333. if (!(compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), downLength) && compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), upLength)))
  2334. {
  2335. //if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】英尺,是否缴库?") == DialogResult.No)
  2336. //{
  2337. // return;
  2338. //}
  2339. if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())).ToString() + "-" + FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())).ToString() + "】(英尺换算),是否缴库?") == DialogResult.No)
  2340. {
  2341. return;
  2342. }
  2343. }
  2344. }
  2345. }
  2346. else
  2347. {
  2348. MessageUtil.ShowTips("长度上下限为空,不允许缴库可进行强制缴库!");
  2349. return;
  2350. }
  2351. }
  2352. string newSql_no = "";
  2353. //conu += 1;
  2354. int index = row3.Cells["ordername"].Text.Trim().IndexOf("/");
  2355. string sql_no = row3.Cells["ordername"].Text.Trim().Substring(index + 1);
  2356. if (sql_no.Length < 4)
  2357. {
  2358. sql_no = sql_no.PadLeft(4, '0');
  2359. }
  2360. if (strOrder != (row3.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no))
  2361. {
  2362. MessageUtil.ShowTips("质保数据合同号" + (row3.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no) + "信息与待缴合同" + strOrder + "信息不一致,不能缴库可强制缴库!");
  2363. return;
  2364. }
  2365. delPla += double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim());
  2366. orderType = doQueryOrderType(row3.Cells["ordername"].Text.Trim().Substring(0, index));
  2367. if (orderType.Equals("120103"))
  2368. {
  2369. MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
  2370. return;
  2371. }
  2372. else if (orderType.Equals("120104"))
  2373. {
  2374. MessageUtil.ShowTips("该合同为预排合同,只允许强制缴库成成品!");
  2375. return;
  2376. }
  2377. if (strWgt > 0)
  2378. {
  2379. if (orderUnit.Equals("吨") || orderUnit.Equals("支") || orderUnit.Contains("磅"))
  2380. {
  2381. if (endWgt > dbOrderMax)
  2382. {
  2383. if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
  2384. {
  2385. //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
  2386. return;
  2387. }
  2388. frmBatchesPip frm = new frmBatchesPip(ob);
  2389. frm.AllCount = row3.Cells["hgunit"].Text.Trim();
  2390. frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
  2391. if (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
  2392. {
  2393. frm.SxWgt = "0";
  2394. }
  2395. else
  2396. {
  2397. frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  2398. }
  2399. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  2400. frm.ShowDialog();
  2401. buttonValue = frm.buttonValue;
  2402. frmcount = frm.count;
  2403. frmWgt = frm.outWgt;
  2404. frmFinishedCode = frm.finishedProduct;
  2405. if (!frm.flag)
  2406. {
  2407. return;
  2408. }
  2409. if (buttonValue == "0")
  2410. {
  2411. return;
  2412. }
  2413. if (buttonValue == "2")
  2414. {
  2415. if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
  2416. {
  2417. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  2418. return;
  2419. }
  2420. if (double.Parse(frmWgt) + endWgt > dbOrderMax)
  2421. {
  2422. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  2423. {
  2424. return;
  2425. }
  2426. }
  2427. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  2428. {
  2429. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  2430. {
  2431. return;
  2432. }
  2433. }
  2434. }
  2435. if (buttonValue == "1")
  2436. {
  2437. if ((strWgt + endWgt) > dbOrderMax)
  2438. {
  2439. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  2440. {
  2441. return;
  2442. }
  2443. }
  2444. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  2445. {
  2446. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  2447. {
  2448. return;
  2449. }
  2450. }
  2451. }
  2452. }
  2453. else
  2454. {
  2455. if ((strWgt + endWgt) > dbOrderMax)
  2456. {
  2457. frmBatchesPip frm = new frmBatchesPip(ob);
  2458. frm.AllCount = row3.Cells["hgunit"].Text.Trim();
  2459. frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
  2460. frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  2461. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  2462. frm.ShowDialog();
  2463. buttonValue = frm.buttonValue;
  2464. frmcount = frm.count;
  2465. frmWgt = frm.outWgt;
  2466. frmFinishedCode = frm.finishedProduct;
  2467. if (!frm.flag)
  2468. {
  2469. return;
  2470. }
  2471. if (buttonValue == "0")
  2472. {
  2473. return;
  2474. }
  2475. if (buttonValue == "2")
  2476. {
  2477. if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
  2478. {
  2479. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  2480. return;
  2481. }
  2482. if (double.Parse(frmWgt) + endWgt > dbJhMax)
  2483. {
  2484. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  2485. {
  2486. return;
  2487. }
  2488. }
  2489. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  2490. {
  2491. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  2492. {
  2493. return;
  2494. }
  2495. }
  2496. }
  2497. if (buttonValue == "1")
  2498. {
  2499. if ((strWgt + endWgt) > dbJhMax)
  2500. {
  2501. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  2502. {
  2503. return;
  2504. }
  2505. }
  2506. }
  2507. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  2508. {
  2509. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  2510. {
  2511. return;
  2512. }
  2513. }
  2514. }
  2515. }
  2516. }
  2517. else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
  2518. {
  2519. if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
  2520. {
  2521. MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
  2522. return;
  2523. }
  2524. reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
  2525. if (endWgt > reckonWgt)
  2526. {
  2527. //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
  2528. //return;
  2529. if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
  2530. {
  2531. return;
  2532. }
  2533. frmBatchesPip frm = new frmBatchesPip(ob);
  2534. frm.AllCount = row3.Cells["hgunit"].Text.Trim();
  2535. frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
  2536. if (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
  2537. {
  2538. frm.SxWgt = "0";
  2539. }
  2540. else
  2541. {
  2542. frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  2543. }
  2544. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  2545. frm.ShowDialog();
  2546. buttonValue = frm.buttonValue;
  2547. frmcount = frm.count;
  2548. frmWgt = frm.outWgt;
  2549. frmFinishedCode = frm.finishedProduct;
  2550. if (!frm.flag)
  2551. {
  2552. return;
  2553. }
  2554. if (buttonValue == "0")
  2555. {
  2556. return;
  2557. }
  2558. if (buttonValue == "2")
  2559. {
  2560. //if (int.Parse(frmcount).Equals(0))
  2561. //{
  2562. // MessageUtil.ShowTips("合同上限已满,不能按合同上限入库!");
  2563. // return;
  2564. //}
  2565. if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
  2566. {
  2567. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  2568. return;
  2569. }
  2570. if (double.Parse(frmWgt) + endWgt > reckonWgt)
  2571. {
  2572. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  2573. {
  2574. return;
  2575. }
  2576. }
  2577. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  2578. {
  2579. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  2580. {
  2581. return;
  2582. }
  2583. }
  2584. }
  2585. if (buttonValue == "1")
  2586. {
  2587. if ((strWgt + endWgt) > reckonWgt)
  2588. {
  2589. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  2590. {
  2591. return;
  2592. }
  2593. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  2594. {
  2595. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  2596. {
  2597. return;
  2598. }
  2599. }
  2600. }
  2601. }
  2602. }
  2603. else
  2604. {
  2605. if ((strWgt + endWgt) > reckonWgt)
  2606. {
  2607. frmBatchesPip frm = new frmBatchesPip(ob);
  2608. frm.AllCount = row3.Cells["hgunit"].Text.Trim();
  2609. frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
  2610. frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  2611. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  2612. frm.ShowDialog();
  2613. buttonValue = frm.buttonValue;
  2614. frmcount = frm.count;
  2615. frmWgt = frm.outWgt;
  2616. frmFinishedCode = frm.finishedProduct;
  2617. if (!frm.flag)
  2618. {
  2619. return;
  2620. }
  2621. if (buttonValue == "0")
  2622. {
  2623. return;
  2624. }
  2625. if (buttonValue == "2")
  2626. {
  2627. //if (int.Parse(frmcount).Equals(0))
  2628. //{
  2629. // MessageUtil.ShowTips("合同上限已满,不能按合同上限入库!");
  2630. // return;
  2631. //}
  2632. if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
  2633. {
  2634. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  2635. return;
  2636. }
  2637. if (double.Parse(frmWgt) + endWgt > reckonWgt)
  2638. {
  2639. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  2640. {
  2641. return;
  2642. }
  2643. }
  2644. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  2645. {
  2646. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  2647. {
  2648. return;
  2649. }
  2650. }
  2651. }
  2652. if (buttonValue == "1")
  2653. {
  2654. if ((strWgt + endWgt) > reckonWgt)
  2655. {
  2656. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  2657. {
  2658. return;
  2659. }
  2660. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  2661. {
  2662. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  2663. {
  2664. return;
  2665. }
  2666. }
  2667. }
  2668. }
  2669. }
  2670. }
  2671. }
  2672. }
  2673. }
  2674. }
  2675. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row4 in ultraGrid1.Rows)
  2676. {
  2677. if (Convert.ToBoolean(row4.Cells["CHK"].Text) == true)
  2678. {
  2679. if (double.Parse(row4.Cells["hgweight"].Text.Trim()) < 0)
  2680. {
  2681. if (double.Parse(row4.Cells["hgweight"].Text.Trim()) + double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
  2682. {
  2683. MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
  2684. return;
  2685. }
  2686. else
  2687. {
  2688. if (int.Parse(row4.Cells["hgunit"].Text.Trim()) > int.Parse(grid3Row.Cells["PAYDOWN_NUM"].Text.Trim()))
  2689. {
  2690. MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
  2691. return;
  2692. }
  2693. }
  2694. }
  2695. }
  2696. }
  2697. UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
  2698. .OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
  2699. double dbDelvry = 0;
  2700. double dbweigh = 0;
  2701. double dbcount = 0;
  2702. double endweigth = 0;
  2703. //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale, row.Cells["hgunit"].Value.ToString() }, this.ob);
  2704. if (MessageUtil.ShowYesNoAndQuestion("是否确认缴库?") == DialogResult.No) return;
  2705. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  2706. {
  2707. if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  2708. {
  2709. ArrayList matList = new ArrayList();
  2710. ArrayList plnList = new ArrayList();
  2711. double stWeight = 0;
  2712. double dbunit = 0;
  2713. //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] {}, this.ob);
  2714. //if (grid3Row.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
  2715. //{
  2716. // MessageUtil.ShowTips("待缴库合同在生产中,不能进行缴库!");
  2717. // return;
  2718. //}
  2719. if (buttonValue == "2")
  2720. {
  2721. stWeight = double.Parse(frmWgt);
  2722. dbunit = double.Parse(frmcount);
  2723. }
  2724. else
  2725. {
  2726. stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//已缴库量+炉(重量)
  2727. dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//已缴库支数+炉(支数)
  2728. }
  2729. ArrayList storageList = new ArrayList(); //仓库位置参数
  2730. storageList.Add(uRow.Cells["lcode"].Text.Trim());
  2731. storageList.Add(uRow.Cells["lotno"].Text.Trim());
  2732. storageList.Add(uRow.Cells["hgunit"].Text.Trim());
  2733. storageList.Add(storageno);
  2734. storageList.Add(storageno + "10101");
  2735. storageList.Add(storagetype);
  2736. storageList.Add(storagetypedesc);
  2737. //storageList.Add(manageno);
  2738. //storageList.Add(managedesc);
  2739. storageList.Add(this.UserInfo.GetUserName());
  2740. storageList.Add(uRow.Cells["hgweight"].Value.ToString());
  2741. storageList.Add(this.UserInfo.GetDeptid());
  2742. storageList.Add(this.UserInfo.GetDepartment());
  2743. storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  2744. storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  2745. storageParm.Add(storageList);
  2746. #region 要缴库的每一炉重量小于要缴库的重量
  2747. matList.Add(uRow.Cells["lcode"].Text.Trim()); //炉号
  2748. matList.Add(uRow.Cells["lotno"].Text.Trim());//批号
  2749. matList.Add(uRow.Cells["hgunit"].Text.Trim());//支数
  2750. matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
  2751. matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
  2752. if (uRow.Cells["cxsteellevel"].Text == "N80Q")
  2753. {
  2754. matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());
  2755. matList.Add(uRow.Cells["cxsteellevel"].Text);
  2756. }
  2757. else
  2758. {
  2759. matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
  2760. matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
  2761. }
  2762. matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
  2763. matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
  2764. matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
  2765. matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
  2766. matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
  2767. //matList.Add("");//标准代码
  2768. //matList.Add(uRow.Cells["standard"].Value.ToString());
  2769. matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
  2770. matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
  2771. matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
  2772. matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
  2773. matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
  2774. matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
  2775. matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
  2776. matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
  2777. matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
  2778. matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
  2779. matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
  2780. matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
  2781. matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
  2782. matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
  2783. matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
  2784. matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
  2785. string length = uRow.Cells["leng"].Text.Trim();
  2786. int n = length.IndexOf("-");
  2787. string lengMin = length.Substring(0, n);
  2788. string lengMax = length.Substring(n + 1);
  2789. matList.Add(lengMin);//下限
  2790. matList.Add(lengMax);//上限
  2791. matList.Add(this.UserInfo.GetUserName());//操作人30
  2792. matList.Add("0");
  2793. matList.Add("1");
  2794. matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
  2795. matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
  2796. double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
  2797. double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
  2798. //生成入库单号
  2799. //ArrayList pram = new ArrayList();
  2800. //pram.Add(DateTime.Now.ToString("yyyy/MM/dd"));
  2801. //pram.Add(strInbound);
  2802. //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getInListDoc", new object[] { pram }, ob);
  2803. //string str = "";
  2804. //if (dt.Rows.Count >= 1)
  2805. //{
  2806. // str = dt.Rows[0]["INSTOCK_DOC"].ToString();
  2807. //}
  2808. DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
  2809. if (dtMemo.Rows.Count >= 1)
  2810. {
  2811. strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  2812. }
  2813. //strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
  2814. matList.Add(strInMemo);
  2815. matList.Add(this.UserInfo.GetDeptid());
  2816. matList.Add(this.UserInfo.GetDepartment());//37
  2817. matList.Add(strInbound);
  2818. matList.Add(this.cmbStorage.Value.ToString());//仓库号851731
  2819. matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());
  2820. matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());
  2821. if (buttonValue == "2")
  2822. {
  2823. matList.Add(frmcount);//42
  2824. }
  2825. else
  2826. {
  2827. matList.Add(uRow.Cells["hgunit"].Value.ToString());
  2828. }
  2829. matList.Add(uRow.Cells["rcdid"].Value.ToString());
  2830. matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
  2831. matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(),this.ob));
  2832. matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  2833. matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
  2834. //matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));// 判定时间
  2835. matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
  2836. matList.Add(factoryCode);
  2837. matList.Add(factoryNo);//50
  2838. //matList.Add(steelCode);
  2839. //matList.Add(steelName);
  2840. matList.Add("");
  2841. matList.Add(uRow.Cells["steelgrade"].Text.ToString());
  2842. matList.Add(this.txtMemo.Text.Trim());//手动输入的备注
  2843. matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
  2844. matList.Add(sourceCode);//材料来源代码
  2845. matList.Add(sourceName);//材料名称
  2846. matList.Add(ks);//捆数
  2847. if (buttonValue == "1")
  2848. {
  2849. matList.Add("801703");//成品区分
  2850. }
  2851. else if (buttonValue == "2")
  2852. {
  2853. matList.Add("801701");//成品区分
  2854. }
  2855. matParm.Add(matList);
  2856. plnList.Add(stWeight.ToString("f3"));
  2857. if (double.Parse(uRow.Cells["hgweight"].Value.ToString()) > 0)
  2858. {
  2859. plnList.Add(dbunit.ToString());
  2860. }
  2861. else
  2862. {
  2863. plnList.Add(int.Parse(ugr3.Cells["hgunit"].Text.Trim()).ToString());
  2864. }
  2865. plnList.Add(this.UserInfo.GetUserName());
  2866. plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
  2867. plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
  2868. plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
  2869. plnSpale.Add(plnList);
  2870. //break;
  2871. #endregion
  2872. //}
  2873. //else
  2874. //{
  2875. // return;
  2876. //}
  2877. ArrayList statusList = new ArrayList();
  2878. statusList.Add(uRow.Cells["lcode"].Text.Trim());
  2879. statusList.Add(uRow.Cells["lotno"].Text.Trim());
  2880. statusList.Add(uRow.Cells["factory"].Value.ToString());
  2881. statusList.Add(uRow.Cells["testdate"].Value.ToString());
  2882. statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
  2883. statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
  2884. statusList.Add(uRow.Cells["RCDID"].Value.ToString());
  2885. statusUpdate.Add(statusList);
  2886. }
  2887. }
  2888. //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
  2889. CoreClientParam ccp = new CoreClientParam();
  2890. ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
  2891. ccp.MethodName = "doPipeIn";
  2892. ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
  2893. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  2894. if (ccp.ReturnCode != -1)
  2895. {
  2896. if (ccp.ReturnInfo.Equals("缴库成功!"))
  2897. {
  2898. QueryMatData();
  2899. this.cmbSteel.Text = "";
  2900. this.cmbFactory.Text = "";
  2901. this.txt_Ks.Value = "0";
  2902. QueryOrder(grid3Row.Cells["ORDER_NO"].Text.Trim(), grid3Row.Cells["ORDER_SEQ"].Text.Trim());
  2903. MessageUtil.ShowTips(ccp.ReturnInfo);
  2904. }
  2905. else
  2906. {
  2907. MessageUtil.ShowTips(ccp.ReturnInfo);
  2908. }
  2909. }
  2910. }
  2911. /// <summary>
  2912. /// 查询合同类型
  2913. /// </summary>
  2914. /// <param name="orderNo"></param>
  2915. /// <param name="orderSeq"></param>
  2916. private string doQueryOrderType(string orderNo)
  2917. {
  2918. string orderType = "";
  2919. //判断合同类型
  2920. DataTable orderDs = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryOrderType", new object[] { orderNo }, ob);
  2921. if (orderDs.Rows.Count > 0)
  2922. {
  2923. orderType = orderDs.Rows[0]["ORDER_TYP"].ToString();
  2924. }
  2925. return orderType;
  2926. }
  2927. /// <summary>
  2928. /// 按合同号、合同行号查询已缴库合同
  2929. /// </summary>
  2930. /// <param name="orderNo"></param>
  2931. /// <param name="OrderSeqNo"></param>
  2932. private void QueryOrder(string orderNo, string orderSeqNo)
  2933. {
  2934. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder1", new object[] { orderNo, orderSeqNo }, this.ob);
  2935. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  2936. }
  2937. /// <summary>
  2938. /// 撤销缴库
  2939. /// </summary>
  2940. private void DoCanclePipeIn()
  2941. {
  2942. ultraGrid4.UpdateData();
  2943. UltraGridRow ugr = ultraGrid4.ActiveRow;
  2944. if (ugr == null)
  2945. return;
  2946. ArrayList list = new ArrayList();
  2947. ArrayList list1 = new ArrayList();
  2948. ArrayList list2 = new ArrayList();
  2949. int n = 0;
  2950. string moth = "";
  2951. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
  2952. foreach(UltraGridRow us in ultraGrid4.Rows)
  2953. {
  2954. if (Convert.ToBoolean(us.Cells["CHK"].Text) == true)
  2955. {
  2956. n++;
  2957. }
  2958. }
  2959. if (n < 1)
  2960. {
  2961. MessageBox.Show("请选择要操作的数据!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
  2962. return;
  2963. }
  2964. int m = 0;
  2965. foreach (UltraGridRow pro in ultraGrid4.Rows)
  2966. {
  2967. if (Convert.ToBoolean(pro.Cells["CHK"].Value))
  2968. {
  2969. if (double.Parse(pro.Cells["ACT_WEIGHT"].Text.Trim()) > 0)
  2970. {
  2971. if (pro.Cells["PRODUCT_FLAG"].Text.Trim() == "成品" || pro.Cells["PRODUCT_FLAG"].Text.Trim() == "在制品")
  2972. {
  2973. ArrayList prolist = new ArrayList();
  2974. prolist.Add(pro.Cells["INSTOCK_DOC"].Value.ToString());
  2975. prolist.Add(pro.Cells["JUDGE_STOVE_NO"].Value.ToString());
  2976. prolist.Add(pro.Cells["BATCH_NO"].Value.ToString());
  2977. prolist.Add(pro.Cells["BATCH_GROUD_NO"].Value.ToString());
  2978. DataTable prodt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryProFlag", new object[] { prolist }, ob);
  2979. if (int.Parse(prodt.Rows[0]["ACOUNT"].ToString()) > 0)
  2980. {
  2981. m = m + 1;
  2982. }
  2983. }
  2984. }
  2985. }
  2986. }
  2987. if (m > 0)
  2988. {
  2989. MessageUtil.ShowTips("请勾选类别为商品的数据撤销!");
  2990. return;
  2991. }
  2992. foreach (UltraGridRow row in ultraGrid4.Rows)
  2993. {
  2994. if (Convert.ToBoolean(row.Cells["CHK"].Value))
  2995. {
  2996. //if (double.Parse(row.Cells["ACT_WEIGHT"].Text.Trim()) > 0)
  2997. //{
  2998. // if (row.Cells["PRODUCT_FLAG"].Text.Trim() == "成品" || row.Cells["PRODUCT_FLAG"].Text.Trim() == "在制品")
  2999. // {
  3000. // ArrayList prolist = new ArrayList();
  3001. // prolist.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
  3002. // prolist.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
  3003. // prolist.Add(row.Cells["BATCH_NO"].Value.ToString());
  3004. // prolist.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
  3005. // DataTable prodt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryProFlag", new object[] { prolist }, ob);
  3006. // if (int.Parse(prodt.Rows[0]["ACOUNT"].ToString()) > 0)
  3007. // {
  3008. // m = m + 1;
  3009. // }
  3010. // MessageUtil.ShowTips("请勾选类别为商品的数据撤销!");
  3011. // return;
  3012. // }
  3013. //}
  3014. //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.querySendPlan", new Object[] { row.Cells["ORDER_NO"].Value.ToString(), row.Cells["ORDER_SEQ"].Value.ToString(), row.Cells["DELIVERY_NO"].Value.ToString() }, this.ob);
  3015. //if (dt.Rows.Count > 0)
  3016. //{
  3017. // MessageUtil.ShowWarning("[合同号为:" + row.Cells["ORDER_NO"].Value.ToString() + "、合同行号为:" + row.Cells["ORDER_SEQ"].Value.ToString() + "、交货行为:" + row.Cells["DELIVERY_NO"].Value.ToString() + "]的数据已做计划,无法撤销!");
  3018. // return;
  3019. //}
  3020. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryMatNoStatus", new object[] { row.Cells["ORDER_NO"].Value.ToString(), row.Cells["ORDER_SEQ"].Value.ToString(), row.Cells["DELIVERY_NO"].Value.ToString(), row.Cells["JUDGE_STOVE_NO"].Value.ToString(), row.Cells["BATCH_NO"].Value.ToString(), row.Cells["BATCH_GROUD_NO"].Value.ToString(), row.Cells["INSTOCK_DOC"].Text }, this.ob);
  3021. if (ds.Rows.Count == 0)
  3022. {
  3023. MessageUtil.ShowTips("此炉批组已发运,不允许撤销!");
  3024. return;
  3025. }
  3026. else if (ds.Rows.Count == 1)
  3027. {
  3028. if (ds.Rows[0].ToString().Equals("80150302"))
  3029. {
  3030. MessageUtil.ShowWarning("该炉批组的数据不是可编提单状态,无法撤销!");
  3031. return;
  3032. }
  3033. }
  3034. else if (ds.Rows.Count > 1)
  3035. {
  3036. for (int i = 0; i < ds.Rows.Count; i++)
  3037. {
  3038. if (ds.Rows[i].ToString().Equals("80150302"))
  3039. {
  3040. MessageUtil.ShowWarning("该炉批组的数据不是可编提单状态,无法撤销!");
  3041. return;
  3042. }
  3043. }
  3044. }
  3045. DataTable dd = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getLockFlag", new object[] { row.Cells["JUDGE_STOVE_NO"].Text, row.Cells["BATCH_NO"].Text, row.Cells["BATCH_GROUD_NO"].Text }, ob);
  3046. if (int.Parse(dd.Rows[0]["ACOUNT"].ToString()) > 0)
  3047. {
  3048. MessageUtil.ShowTips("炉号:" + row.Cells["JUDGE_STOVE_NO"].Text + "、批号:" + row.Cells["BATCH_NO"].Text + "的数据有被封锁的,不能撤销!");
  3049. return;
  3050. }
  3051. ArrayList parm = new ArrayList();
  3052. moth = DateTime.Parse(row.Cells["BAL_YEAR_MONTH"].Text).AddMonths(1).ToString("yyyyMM");
  3053. parm.Add(moth);
  3054. DataTable dg = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { parm, arr }, ob);
  3055. if (int.Parse(dg.Rows[0]["ACOUNT"].ToString()) > 0)
  3056. {
  3057. MessageUtil.ShowTips("此炉【" + row.Cells["JUDGE_STOVE_NO"].Text + "】已进行结转,不允许撤销!");
  3058. return;
  3059. }
  3060. ArrayList pram = new ArrayList();
  3061. ArrayList pram1 = new ArrayList();
  3062. ArrayList pram2 = new ArrayList();
  3063. pram1.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
  3064. pram1.Add(row.Cells["BATCH_NO"].Value.ToString());
  3065. DataTable td = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSumWgt", new object[] { row.Cells["INSTOCK_DOC"].Text.Trim() }, this.ob);
  3066. pram1.Add(td.Rows[0]["ACT_COUNT"].ToString());
  3067. pram1.Add(td.Rows[0]["ACT_WEIGHT"].ToString());
  3068. pram1.Add(row.Cells["ZB_RCDID"].Value.ToString());
  3069. pram1.Add(row.Cells["SPEC_NAME"].Value.ToString());
  3070. pram1.Add(row.Cells["MODEL_DESC"].Value.ToString());
  3071. pram1.Add(row.Cells["STD_NAME"].Value.ToString());
  3072. pram1.Add(row.Cells["ACT_LEN_MIN"].Value.ToString());
  3073. pram1.Add(row.Cells["ACT_LEN_MAX"].Value.ToString());
  3074. pram1.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
  3075. pram1.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
  3076. list1.Add(pram1);
  3077. pram.Add(row.Cells["ORDER_NO"].Value.ToString());
  3078. pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
  3079. pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
  3080. pram.Add(row.Cells["ACT_COUNT"].Value.ToString());
  3081. pram.Add(row.Cells["ORDER_NO"].Value.ToString());
  3082. pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
  3083. pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
  3084. pram.Add(row.Cells["ACT_WEIGHT"].Value.ToString());
  3085. //pram.Add(this.UserInfo.GetUserName());
  3086. pram.Add(row.Cells["ORDER_NO"].Value.ToString());
  3087. pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
  3088. pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
  3089. if (row.Cells["PRODUCT_FLAG"].Value.ToString() == "成品")
  3090. {
  3091. pram.Add("801402");//类别
  3092. }
  3093. else if (row.Cells["PRODUCT_FLAG"].Value.ToString() == "商品")
  3094. {
  3095. pram.Add("801403");//类别
  3096. }
  3097. list.Add(pram);
  3098. pram2.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
  3099. pram2.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
  3100. pram2.Add(row.Cells["BATCH_NO"].Value.ToString());
  3101. pram2.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
  3102. list2.Add(pram2);
  3103. }
  3104. }
  3105. if (MessageBox.Show("是否确认撤销缴库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  3106. return;
  3107. int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.canclePipein", new Object[] { list1, list,list2 }, this.ob);
  3108. if (count > 0)
  3109. {
  3110. QueryInList();
  3111. MessageBox.Show("撤销缴库成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  3112. }
  3113. }
  3114. /// <summary>
  3115. /// 库存查询
  3116. /// </summary>
  3117. private void QueryPipedData()
  3118. {
  3119. ArrayList pram = new ArrayList();
  3120. string intimeStart = ""; //缴库起始时间
  3121. string intimeEnd = ""; //缴库结束时间
  3122. string stoveno = ""; //炉号
  3123. string order = "";
  3124. string stroage = "";
  3125. if (ultraCheckEditor5.Checked)
  3126. {
  3127. intimeStart = StartTime.Value.ToString();
  3128. intimeEnd = EndTime.Value.ToString();
  3129. }
  3130. if (chkJudge.Checked)
  3131. {
  3132. if (cmbJudge.Text.Trim()=="")
  3133. {
  3134. MessageUtil.ShowTips("炉号不能为空,请选择!");
  3135. return;
  3136. }
  3137. stoveno = cmbJudge.Text.Trim();
  3138. }
  3139. if (chkOrder.Checked)
  3140. {
  3141. if (cmbOrder.Text.Trim()=="")
  3142. {
  3143. MessageUtil.ShowTips("合同号不能为空,请选择!");
  3144. return;
  3145. }
  3146. order = cmbOrder.Text.Trim();
  3147. }
  3148. if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
  3149. {
  3150. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  3151. return;
  3152. }
  3153. if (chkStrong.Checked)
  3154. {
  3155. if (cmbStorager.Text.Trim() == "")
  3156. {
  3157. MessageUtil.ShowTips("仓库不能为空,请选择!");
  3158. return;
  3159. }
  3160. stroage = cmbStorager.Value.ToString();
  3161. }
  3162. //pram.Add(stoveno);
  3163. //pram.Add(stoveno);
  3164. pram.Add(stoveno);
  3165. //pram.Add(order);
  3166. //pram.Add(order);
  3167. pram.Add(order);
  3168. //pram.Add(stroage);
  3169. //pram.Add(stroage);
  3170. pram.Add(stroage);
  3171. //string arr = UserInfo.GetDeptid();
  3172. string areaNo = "";
  3173. string userName = UserInfo.GetUserName();
  3174. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
  3175. //if (!userName.Equals("admin"))
  3176. //{
  3177. // DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.querySaleOrg", new object[] { arr }, this.ob);
  3178. // if (ds.Rows.Count > 0)
  3179. // {
  3180. // areaNo = ds.Rows[0][0].ToString();
  3181. // }
  3182. //}
  3183. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryMat", new object[] { pram, arr, intimeStart, intimeEnd }, this.ob);//MatData
  3184. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  3185. //padWgt(ultraGrid2, "ACT_WEIGHT");
  3186. //UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid2.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid2.DisplayLayout.Bands[0].Columns["STD_NAME"] };
  3187. //GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, col);
  3188. //this.ultraGrid2.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  3189. }
  3190. /// <summary>
  3191. /// 补充重量小数位
  3192. /// </summary>
  3193. /// <param name="urd"></param>
  3194. /// <param name="colums"></param>
  3195. public void padWgt(UltraGrid urd,string colums)
  3196. {
  3197. foreach (UltraGridRow ugr in urd.Rows)
  3198. {
  3199. if (!StringUtil.IsInt(ugr.Cells[colums].Value.ToString()))
  3200. {
  3201. int d = ugr.Cells[colums].Value.ToString().IndexOf(".");
  3202. if (ugr.Cells[colums].Value.ToString().Substring(d + 1).Length > 0)
  3203. {
  3204. if (ugr.Cells[colums].Value.ToString().Substring(d + 1).Length < 3)
  3205. {
  3206. ugr.Cells[colums].Value = ugr.Cells[colums].Value.ToString().Substring(0, d + 1) + ugr.Cells[colums].Value.ToString().Substring(d + 1).PadRight(3, '0');
  3207. }
  3208. }
  3209. }
  3210. else
  3211. {
  3212. ugr.Cells[colums].Value = ugr.Cells[colums].Value.ToString() + ".000";
  3213. }
  3214. }
  3215. }
  3216. /// <summary>
  3217. /// CheckBox选择事件
  3218. /// </summary>
  3219. /// <param name="sender"></param>
  3220. /// <param name="e"></param>
  3221. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  3222. {
  3223. if (chkJudge.Checked)
  3224. cmbJudge.Enabled = true;
  3225. else
  3226. {
  3227. cmbJudge.Enabled = false;
  3228. //cmbJudge.Text = "";
  3229. }
  3230. if (chkOrder.Checked)
  3231. cmbOrder.Enabled = true;
  3232. else
  3233. {
  3234. cmbOrder.Enabled = false;
  3235. //cmbOrder.Text = "";
  3236. }
  3237. if (ultraCheckEditor1.Checked)
  3238. cmbMatch.Enabled = true;
  3239. else
  3240. {
  3241. cmbMatch.Enabled = false;
  3242. //cmbMatch.Text = "";
  3243. }
  3244. }
  3245. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  3246. {
  3247. if (toolMenu == null) return;
  3248. if (ultraTabControl1.SelectedTab.Key == "2")
  3249. {
  3250. if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
  3251. {
  3252. toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.False;
  3253. }
  3254. if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
  3255. {
  3256. toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.False;
  3257. }
  3258. if (toolMenu.Toolbars[0].Tools.Exists("Query"))
  3259. {
  3260. toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
  3261. }
  3262. if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
  3263. {
  3264. toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False;
  3265. }
  3266. if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
  3267. {
  3268. toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.False;
  3269. }
  3270. if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
  3271. {
  3272. toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.False;
  3273. }
  3274. if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
  3275. {
  3276. toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
  3277. }
  3278. if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
  3279. {
  3280. toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.True;
  3281. }
  3282. if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
  3283. {
  3284. toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
  3285. }
  3286. if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
  3287. {
  3288. toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
  3289. }
  3290. if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
  3291. {
  3292. toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.True;
  3293. }
  3294. if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
  3295. {
  3296. toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
  3297. }
  3298. if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
  3299. {
  3300. toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.False;
  3301. }
  3302. if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
  3303. {
  3304. toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.True;
  3305. }
  3306. if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
  3307. {
  3308. toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.False;
  3309. }
  3310. if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
  3311. {
  3312. toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.True;
  3313. }
  3314. if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
  3315. {
  3316. toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.True;
  3317. }
  3318. if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
  3319. {
  3320. toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.False;
  3321. }
  3322. chkStrong.Visible = true;
  3323. cmbStorager.Visible = true;
  3324. ultraCheckEditor1.Visible = false;
  3325. cmbMatch.Visible = false;
  3326. ultraCheckEditor5.Enabled = true;
  3327. this.ultraCheckEditor5.Text = "入库时间";
  3328. chkBathYear.Visible = false;
  3329. dtBathYear.Visible = false;
  3330. }
  3331. else if (ultraTabControl1.SelectedTab.Key == "1")
  3332. {
  3333. if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
  3334. {
  3335. toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.True;
  3336. }
  3337. if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
  3338. {
  3339. toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.True;
  3340. }
  3341. if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
  3342. {
  3343. toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.True;
  3344. }
  3345. if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
  3346. {
  3347. toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.True;
  3348. }
  3349. if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
  3350. {
  3351. toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.True;
  3352. }
  3353. //toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
  3354. if (toolMenu.Toolbars[0].Tools.Exists("Query"))
  3355. {
  3356. toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
  3357. }
  3358. if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
  3359. {
  3360. toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.True;
  3361. }
  3362. if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
  3363. {
  3364. toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
  3365. }
  3366. if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
  3367. {
  3368. toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
  3369. }
  3370. if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
  3371. {
  3372. toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
  3373. }
  3374. if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
  3375. {
  3376. toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
  3377. }
  3378. if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
  3379. {
  3380. toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
  3381. }
  3382. if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
  3383. {
  3384. toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.True;
  3385. }
  3386. if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
  3387. {
  3388. toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
  3389. }
  3390. if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
  3391. {
  3392. toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.True;
  3393. }
  3394. if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
  3395. {
  3396. toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
  3397. }
  3398. if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
  3399. {
  3400. toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
  3401. }
  3402. if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
  3403. {
  3404. toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.True;
  3405. }
  3406. chkStrong.Visible = false;
  3407. cmbStorager.Visible = false;
  3408. chkBathYear.Visible = false;
  3409. dtBathYear.Visible = false;
  3410. this.ultraCheckEditor5.Enabled = true;
  3411. this.ultraCheckEditor1.Enabled = true;
  3412. ultraCheckEditor1.Visible = true;
  3413. cmbMatch.Visible = true;
  3414. this.ultraCheckEditor5.Text = "判定时间";
  3415. }
  3416. else
  3417. {
  3418. if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
  3419. {
  3420. toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.False;
  3421. }
  3422. if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
  3423. {
  3424. toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.False;
  3425. }
  3426. if (toolMenu.Toolbars[0].Tools.Exists("Query"))
  3427. {
  3428. toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
  3429. }
  3430. if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
  3431. {
  3432. toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False;
  3433. }
  3434. if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
  3435. {
  3436. toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.False;
  3437. }
  3438. if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
  3439. {
  3440. toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.False;
  3441. }
  3442. if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
  3443. {
  3444. toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
  3445. }
  3446. if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
  3447. {
  3448. toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
  3449. }
  3450. if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
  3451. {
  3452. toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.True;
  3453. }
  3454. if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
  3455. {
  3456. toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.True;
  3457. }
  3458. if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
  3459. {
  3460. toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
  3461. }
  3462. if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
  3463. {
  3464. toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.True;
  3465. }
  3466. if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
  3467. {
  3468. toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.False;
  3469. }
  3470. if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
  3471. {
  3472. toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
  3473. }
  3474. if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
  3475. {
  3476. toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.False;
  3477. }
  3478. if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
  3479. {
  3480. toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
  3481. }
  3482. if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
  3483. {
  3484. toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
  3485. }
  3486. if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
  3487. {
  3488. toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.False;
  3489. }
  3490. this.ultraCheckEditor1.Enabled = false;
  3491. chkStrong.Visible = true;
  3492. cmbStorager.Visible = true;
  3493. chkBathYear.Visible = true;
  3494. dtBathYear.Visible = true;
  3495. this.ultraCheckEditor5.Text = "入库时间";
  3496. ultraCheckEditor1.Visible = false;
  3497. cmbMatch.Visible = false;
  3498. }
  3499. }
  3500. /// <summary>
  3501. /// 选择仓库之后获取对应的信息
  3502. /// </summary>
  3503. /// <param name="sender"></param>
  3504. /// <param name="e"></param>
  3505. private void ultraComboEditor4_ValueChanged(object sender, EventArgs e)
  3506. {
  3507. storageno = cmbStorage.Value.ToString();
  3508. DataRow[] dr = ((DataTable)cmbStorage.DataSource).Select("STORAGE_NO='" + storageno+ "'");
  3509. if (dr.Length > 0)
  3510. {
  3511. storagetype=dr[0]["STORAGE_TYPE_NO"].ToString();
  3512. storagetypedesc=dr[0]["STORAGE_TYPE_NAME"].ToString();
  3513. manageno=dr[0]["MANAGEMENT_NO"].ToString();
  3514. managedesc=dr[0]["MANAGEMENT_NAME"].ToString();
  3515. }
  3516. }
  3517. /// <summary>
  3518. /// 根据质保合同号,合同行号查询待缴库合同
  3519. /// </summary>
  3520. /// <param name="ugr"></param>
  3521. private void GetOrderNo(UltraGridRow ugr)
  3522. {
  3523. ultraGrid1.UpdateData();
  3524. if (ugr == null)
  3525. return;
  3526. string orderNm = ugr.Cells["ordername"].Text.Trim();
  3527. string prodceName = ugr.Cells["cxkind"].Value.ToString();
  3528. string steelName = ugr.Cells["cxsteellevel"].Value.ToString();
  3529. string specName = ugr.Cells["cxgg"].Value.ToString();
  3530. string modelDesc = ugr.Cells["cxtypeofthread"].Value.ToString();
  3531. string styleDesc = ugr.Cells["STDSTYLE"].Text;
  3532. ArrayList list = new ArrayList();
  3533. list.Add(prodceName);
  3534. list.Add(steelName);
  3535. list.Add(specName);
  3536. list.Add(modelDesc);
  3537. string orderSeq = "";
  3538. //string[] arr = this.ValidDataPurviewIds;
  3539. string[] arr = YdmBaseClass.Section(this.ValidDataPurviewIds,this.ob);
  3540. string strMatchOrder = "";
  3541. string strMactchMat = "";
  3542. if (orderNm != "")
  3543. {
  3544. if (!orderNm.Contains("/"))
  3545. {
  3546. MessageUtil.ShowTips("此判定数据合同号异常,不允许缴库!");
  3547. return;
  3548. }
  3549. int i = orderNm.IndexOf("/");
  3550. if (i == -1) return;
  3551. orderSeq = orderNm.Substring(i + 1, orderNm.Length - i - 1).PadLeft(4, '0');
  3552. orderNm = orderNm.Substring(0, i);
  3553. }
  3554. else
  3555. {
  3556. MessageUtil.ShowTips("判定数据合同号为空!,数据异常!");
  3557. return;
  3558. }
  3559. if (ugr.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
  3560. {
  3561. //string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,this.ob);
  3562. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderClick", new Object[] { orderNm, orderSeq, arr }, this.ob);
  3563. if (dt.Rows.Count > 0)
  3564. {
  3565. for (int i = 0; i < dt.Rows.Count; i++)
  3566. {
  3567. if (dt.Rows[i]["ORDER_NO"].ToString() == orderNm && dt.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4,'0') == orderSeq)
  3568. {
  3569. dt.Rows[i]["MATCHORDER"] = "合同匹配,物料不匹配";
  3570. }
  3571. //if(dt.Rows[i][""].ToString() == ugr.Cells[""])
  3572. }
  3573. }
  3574. else
  3575. {
  3576. }
  3577. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  3578. UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
  3579. ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
  3580. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
  3581. this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  3582. }
  3583. else if (ugr.Cells["CXSTUPP"].Text.Trim() == "物料匹配")
  3584. {
  3585. if (orderNm != "")
  3586. {
  3587. DataTable dd = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder2", new object[] { orderNm, orderSeq }, this.ob);//查询合同是否存在 不存在在找物料
  3588. if (dd.Rows.Count > 0)
  3589. {
  3590. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderClick", new Object[] { orderNm, orderSeq, arr }, this.ob);
  3591. if (dt.Rows.Count > 0)
  3592. {
  3593. for (int i = 0; i < dt.Rows.Count; i++)
  3594. {
  3595. if (dt.Rows[i]["ORDER_NO"].ToString() == orderNm && dt.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4, '0') == orderSeq)
  3596. {
  3597. //dt.Rows[i]["MATCHORDER"] = "合同匹配,物料匹配";
  3598. strMatchOrder = "1";
  3599. }
  3600. else
  3601. {
  3602. strMatchOrder = "0";
  3603. }
  3604. if (steelName.Equals("C335"))
  3605. {
  3606. if (dt.Rows[i]["STEELCODE"].ToString() == "C333")
  3607. {
  3608. if (dt.Rows[i]["PRODUCCODE"].ToString().Equals(prodceName) && dt.Rows[i]["SPEC_CODE"].ToString().Equals(specName) && dt.Rows[i]["MODEL_CODE"].ToString().Equals(modelDesc) && dt.Rows[i]["STD_STYLE_DESC"].ToString().Equals(styleDesc))
  3609. {
  3610. strMactchMat = "1";
  3611. }
  3612. else
  3613. {
  3614. strMactchMat = "0";
  3615. }
  3616. }
  3617. else
  3618. {
  3619. if (dt.Rows[i]["PRODUCCODE"].ToString().Equals(prodceName) && dt.Rows[i]["STEELCODE"].ToString().Equals(steelName) && dt.Rows[i]["SPEC_CODE"].ToString().Equals(specName) && dt.Rows[i]["MODEL_CODE"].ToString().Equals(modelDesc) && dt.Rows[i]["STD_STYLE_DESC"].ToString().Equals(styleDesc))
  3620. {
  3621. strMactchMat = "1";
  3622. }
  3623. else
  3624. {
  3625. strMactchMat = "0";
  3626. }
  3627. }
  3628. }
  3629. else
  3630. {
  3631. if (dt.Rows[i]["PRODUCCODE"].ToString().Equals(prodceName) && dt.Rows[i]["STEELCODE"].ToString().Equals(steelName) && dt.Rows[i]["SPEC_CODE"].ToString().Equals(specName) && dt.Rows[i]["MODEL_CODE"].ToString().Equals(modelDesc) && dt.Rows[i]["STD_STYLE_DESC"].ToString().Equals(styleDesc))
  3632. {
  3633. strMactchMat = "1";
  3634. }
  3635. else
  3636. {
  3637. strMactchMat = "0";
  3638. }
  3639. }
  3640. if (strMatchOrder == "1" && strMactchMat == "1")
  3641. {
  3642. //dt.Rows[i]["MATCHORDER"] = "合同匹配,合同物料匹配";
  3643. dt.Rows[i]["MATCHORDER"] = "OK";
  3644. }
  3645. else if (strMatchOrder == "1" && strMactchMat == "0")
  3646. {
  3647. dt.Rows[i]["MATCHORDER"] = "合同匹配,合同物料不匹配";
  3648. }
  3649. else if (strMatchOrder == "0" && strMactchMat == "1")
  3650. {
  3651. dt.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料匹配";
  3652. }
  3653. else
  3654. {
  3655. dt.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料不匹配";
  3656. }
  3657. }
  3658. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  3659. UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
  3660. ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
  3661. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
  3662. this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  3663. if (dt.Rows.Count == 1)
  3664. {
  3665. foreach (UltraGridRow row in ultraGrid3.Rows)
  3666. {
  3667. if (row.Cells["MATCHORDER"].Text == "OK")
  3668. {
  3669. row.Cells["CHK"].Value = true;
  3670. }
  3671. }
  3672. }
  3673. }
  3674. else
  3675. {
  3676. this.dataTable1.Clear();
  3677. }
  3678. }
  3679. else
  3680. {
  3681. DataTable ds = new DataTable();
  3682. if (steelName.Equals("C335"))
  3683. {
  3684. ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderCxN", new object[] { list,arr }, this.ob);
  3685. }
  3686. else
  3687. {
  3688. ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderCx", new Object[] { list, arr }, this.ob);
  3689. }
  3690. if (ds.Rows.Count > 0)
  3691. {
  3692. for (int i = 0; i < ds.Rows.Count; i++)
  3693. {
  3694. if (ds.Rows[i]["ORDER_NO"].ToString() == orderNm && ds.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4,'0') == orderSeq)
  3695. {
  3696. //ds.Rows[i]["MATCHORDER"] = "合同匹配,合同物料匹配";
  3697. ds.Rows[i]["MATCHORDER"] = "OK";
  3698. }
  3699. else
  3700. {
  3701. ds.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料匹配";
  3702. }
  3703. }
  3704. }
  3705. GridHelper.CopyDataToDatatable(ref ds, ref dataTable1, true);
  3706. UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
  3707. ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
  3708. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
  3709. this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  3710. }
  3711. }
  3712. }
  3713. else
  3714. {
  3715. dataTable1.Clear();
  3716. }
  3717. }
  3718. /// <summary>
  3719. /// 获取产销产线
  3720. /// </summary>
  3721. /// <param name="ugr"></param>
  3722. private void getFactory(UltraGridRow ugr)
  3723. {
  3724. if (ugr == null)
  3725. {
  3726. return;
  3727. }
  3728. string factory = ugr.Cells["factory"].Text;
  3729. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactory", new object[] { factory }, this.ob);
  3730. if (dt.Rows.Count > 0)
  3731. {
  3732. this.cmbFactory.Text = dt.Rows[0]["PLINE_NAME"].ToString();
  3733. //this.cmbFactory.DataSource = dt;
  3734. //this.cmbFactory.SelectedIndex = 0;
  3735. }
  3736. else
  3737. {
  3738. this.cmbFactory.Text = "";
  3739. }
  3740. }
  3741. /// <summary>
  3742. /// 获取产销钢种
  3743. /// </summary>
  3744. /// <param name="ugr"></param>
  3745. private void getGrade(UltraGridRow ugr)
  3746. {
  3747. if (ugr == null)
  3748. {
  3749. return;
  3750. }
  3751. string grade = ugr.Cells["steelgrade"].Text;
  3752. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getGrade", new object[] { grade }, this.ob);
  3753. if (dt.Rows.Count > 0)
  3754. {
  3755. this.cmbSteel.Text = dt.Rows[0]["GRADENAME"].ToString();
  3756. //this.cmbFactory.DataSource = dt;
  3757. //this.cmbFactory.SelectedIndex = 0;
  3758. }
  3759. else
  3760. {
  3761. this.cmbSteel.Text = grade;
  3762. }
  3763. }
  3764. /// <summary>
  3765. /// 获取合同总量、已缴库总量、估算总量
  3766. /// </summary>
  3767. /// <param name="orderNo"></param>
  3768. /// <returns></returns>
  3769. private string[] getOrderWgt(string orderNo)
  3770. {
  3771. string[] str = new string[3];
  3772. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getOrderWgt", new object[] { orderNo }, this.ob);
  3773. if (dt.Rows.Count > 0)
  3774. {
  3775. str[0] = dt.Rows[0]["ORDERWEIGHT"].ToString();//估算量
  3776. str[1] = dt.Rows[0]["PAYDOWNWEIGHT"].ToString();//已缴库量
  3777. str[2] = dt.Rows[0]["ORDER_QTY"].ToString();//订货量
  3778. }
  3779. return str;
  3780. }
  3781. /// <summary>
  3782. /// ultraGrid1内置按钮点击事件
  3783. /// </summary>
  3784. /// <param name="sender"></param>
  3785. /// <param name="e"></param>
  3786. private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
  3787. {
  3788. ultraGrid3.UpdateData();
  3789. ultraGrid1.UpdateData();
  3790. string buttonValue = "";//返回的按钮值
  3791. string frmcount = "";//返回的支数
  3792. string frmWgt = "";//返回的重量值
  3793. string frmFinishedCode = "";
  3794. storageParm = new ArrayList();
  3795. matParm = new ArrayList();
  3796. statusUpdate = new ArrayList();
  3797. plnSpale = new ArrayList();
  3798. ArrayList listdt = new ArrayList();
  3799. string[] wgtList = new string[3];
  3800. int conu = 0;
  3801. string orderType = "";
  3802. int count = 0;
  3803. UltraGridRow ugr3 = ultraGrid3.ActiveRow;
  3804. UltraGridRow row = ultraGrid1.ActiveRow;
  3805. if (ugr3 == null) { MessageUtil.ShowTips("待缴库无合同数据,不能进行此操作"); return; }
  3806. if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
  3807. double strWgt = 0;//炉重
  3808. double endWgt = 0;//已缴库量
  3809. double orderWgt = 0;//合同量
  3810. int nn = 0;
  3811. foreach (UltraGridRow row7 in ultraGrid3.Rows)
  3812. {
  3813. if (Convert.ToBoolean(row7.Cells["CHK"].Text) == true)
  3814. {
  3815. nn++;
  3816. }
  3817. }
  3818. if (nn < 1)
  3819. {
  3820. MessageUtil.ShowTips("请勾选待缴库合同数据!");
  3821. return;
  3822. }
  3823. if (row.Cells["hgweight"].Text == "")
  3824. {
  3825. MessageUtil.ShowTips("该炉还未生产,无法缴库!");
  3826. return;
  3827. }
  3828. if (double.Parse(row.Cells["hgweight"].Text) < 0)
  3829. {
  3830. MessageUtil.ShowWarning("已缴库量无法进行冲销!");
  3831. return;
  3832. }
  3833. strWgt += double.Parse(row.Cells["hgweight"].Value.ToString());
  3834. UltraGridRow grid3Row = null;
  3835. foreach (UltraGridRow row8 in ultraGrid3.Rows)
  3836. {
  3837. if (Convert.ToBoolean(row8.Cells["CHK"].Text) == true)
  3838. {
  3839. grid3Row = row8;
  3840. }
  3841. }
  3842. string strOrder = grid3Row.Cells["ORDER_NO"].Text.Trim() + "/" + grid3Row.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
  3843. double delPla = 0;//已缴库量
  3844. string _length = "";//长度范围
  3845. int d = 0;
  3846. double downLength = 0;//下限
  3847. double upLength = 0;//上限
  3848. string orderUnit = "";//长度单位
  3849. double dbOrderMax = 0;
  3850. double reckonWgt = 0;//估算量上限
  3851. string gSwgt = "";//合同估算总量
  3852. string pipSwgt = "";//合同缴库总量
  3853. string dSwgt = "";//订货总量
  3854. DataTable ds = new DataTable();
  3855. if (row.Cells["CXSTUPP"].Text.Trim() == "")
  3856. {
  3857. MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
  3858. return;
  3859. }
  3860. if (row.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
  3861. {
  3862. MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库!");
  3863. return;
  3864. }
  3865. if (grid3Row.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
  3866. {
  3867. MessageUtil.ShowTips("合同物料不匹配不允许缴库!");
  3868. return;
  3869. }
  3870. if (grid3Row.Cells["MATCHORDER"].Text.Trim().Contains("合同不匹配"))
  3871. {
  3872. MessageUtil.ShowTips("合同不匹配不允许缴库,可强制缴库!");
  3873. return;
  3874. }
  3875. ds.Clear();
  3876. ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSqlServerStaus", new object[] { row.Cells["ordername"].Text, row.Cells["lcode"].Text, row.Cells["lotno"].Text, row.Cells["hgunit"].Text, row.Cells["hgweight"].Text, row.Cells["rcdid"].Text }, this.ob);
  3877. if (ds.Rows[0][0].ToString() == "20")
  3878. {
  3879. MessageUtil.ShowTips("您选中的【" + row.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
  3880. return;
  3881. }
  3882. if (cmbStorage.Text.ToString() == "")
  3883. {
  3884. MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  3885. return;
  3886. }
  3887. else
  3888. {
  3889. storageno = cmbStorage.Value.ToString();
  3890. }
  3891. if (this.cmbFactory.Text.ToString() == "")
  3892. {
  3893. //MessageUtil.ShowTips("产线不允许为空!");
  3894. //return;
  3895. factoryCode = "";
  3896. factoryNo = "";
  3897. }
  3898. else
  3899. {
  3900. factoryCode = this.cmbFactory.Value.ToString();
  3901. factoryNo = this.cmbFactory.Text.ToString();
  3902. }
  3903. //if (this.cmbSteel.Text.ToString() == "")
  3904. //{
  3905. // //MessageUtil.ShowTips("钢种不允许为空!");
  3906. // //return;
  3907. // steelCode = "";
  3908. // steelName = "";
  3909. //}
  3910. //else
  3911. //{
  3912. // steelCode = this.cmbSteel.Value.ToString();
  3913. // steelName = this.cmbSteel.Text.ToString();
  3914. //}
  3915. if (this.cmbSource.Text.ToString() == "")
  3916. {
  3917. sourceCode = "";
  3918. sourceName = "";
  3919. }
  3920. else
  3921. {
  3922. sourceCode = this.cmbSource.Value.ToString();
  3923. sourceName = this.cmbSource.Text.ToString();
  3924. }
  3925. //if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
  3926. //{
  3927. // if (row.Cells["hgm"].Text.Trim() == "")
  3928. // {
  3929. // MessageUtil.ShowTips("此合同是按长度交货,长度为空不能缴库!");
  3930. // return;
  3931. // }
  3932. //}
  3933. if (this.txt_Ks.Value == null)
  3934. {
  3935. ks = "0";
  3936. }
  3937. else
  3938. {
  3939. ks = this.txt_Ks.Value.ToString();
  3940. }
  3941. _length = row.Cells["leng"].Text.Trim();
  3942. if (_length != "")
  3943. {
  3944. d = _length.IndexOf("-");
  3945. downLength = double.Parse(_length.Substring(0, d));
  3946. upLength = double.Parse(_length.Substring(d + 1));
  3947. if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
  3948. {
  3949. if (!(compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), downLength) && compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), upLength)))
  3950. {
  3951. if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】米,是否缴库?") == DialogResult.No)
  3952. {
  3953. return;
  3954. }
  3955. }
  3956. }
  3957. else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
  3958. {
  3959. if (!(compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), downLength) && compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())),FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), upLength)))
  3960. {
  3961. //if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】英尺,是否缴库?") == DialogResult.No)
  3962. //{
  3963. // return;
  3964. //}
  3965. if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())).ToString() + "-" + FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())).ToString() + "】(英尺换算),是否缴库?") == DialogResult.No)
  3966. {
  3967. return;
  3968. }
  3969. }
  3970. }
  3971. }
  3972. else
  3973. {
  3974. MessageUtil.ShowTips("长度上下限为空,不允许缴库可进行强制缴库!");
  3975. return;
  3976. }
  3977. string newSql_no = "";
  3978. //conu += 1;
  3979. int index = row.Cells["ordername"].Text.Trim().IndexOf("/");
  3980. string sql_no = row.Cells["ordername"].Text.Trim().Substring(index + 1);
  3981. if (sql_no.Length < 4)
  3982. {
  3983. sql_no = sql_no.PadLeft(4, '0');
  3984. }
  3985. if (strOrder != (row.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no))
  3986. {
  3987. MessageUtil.ShowTips("质保数据合同号" + (row.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no) + "信息与待缴合同" + strOrder + "信息不一致,不能缴库可强制缴库!");
  3988. return;
  3989. }
  3990. delPla += double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim());
  3991. orderType = doQueryOrderType(row.Cells["ordername"].Text.Trim().Substring(0, index));
  3992. if (orderType.Equals("120103"))
  3993. {
  3994. MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
  3995. return;
  3996. }else if(orderType.Equals("120104"))
  3997. {
  3998. MessageUtil.ShowTips("该合同为预排合同,只允许强制缴库成成品!");
  3999. return;
  4000. }
  4001. if (strWgt > 0)
  4002. {
  4003. orderUnit = grid3Row.Cells["ORDER_UNIT"].Text.Trim();
  4004. endWgt = double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString());
  4005. orderWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString());
  4006. string strRANGE_MIN = grid3Row.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
  4007. string strRANGE_MAX = grid3Row.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
  4008. double dbQtyMin = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
  4009. double dbQtyMax = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
  4010. double dbJhMax = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
  4011. if (orderUnit.Contains("支") || orderUnit.Equals("吨"))
  4012. {
  4013. dbOrderMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);
  4014. }
  4015. else if (orderUnit.Contains("磅"))
  4016. {
  4017. dbOrderMax = Math.Round(double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * 0.45359 / 1000 + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * 0.45359 / 1000 * (double.Parse(strRANGE_MAX) / 100), 3);
  4018. }
  4019. wgtList = getOrderWgt(grid3Row.Cells["ORDER_NO"].Text.ToString());
  4020. if (wgtList.Length > 0)
  4021. {
  4022. gSwgt = wgtList[0];
  4023. pipSwgt = wgtList[1];
  4024. dSwgt = wgtList[2];
  4025. }
  4026. if (orderUnit.Equals("吨")||orderUnit.Equals("支")||orderUnit.Contains("磅"))
  4027. {
  4028. if (endWgt > dbOrderMax)
  4029. {
  4030. if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
  4031. {
  4032. return;
  4033. }
  4034. frmBatchesPip frm = new frmBatchesPip(ob);
  4035. frm.AllCount = row.Cells["hgunit"].Text.Trim();
  4036. frm.AllWgt = row.Cells["hgweight"].Text.Trim();
  4037. if (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
  4038. {
  4039. frm.SxWgt = "0";
  4040. }
  4041. else
  4042. {
  4043. frm.SxWgt = (dbQtyMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  4044. }
  4045. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  4046. frm.ShowDialog();
  4047. buttonValue = frm.buttonValue;
  4048. frmcount = frm.count;
  4049. frmWgt = frm.outWgt;
  4050. frmFinishedCode = frm.finishedProduct;
  4051. if (!frm.flag)
  4052. {
  4053. return;
  4054. }
  4055. if (buttonValue == "0")
  4056. {
  4057. return;
  4058. }
  4059. if (buttonValue == "2")
  4060. {
  4061. if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
  4062. {
  4063. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  4064. return;
  4065. }
  4066. if (double.Parse(frmWgt) + endWgt > dbOrderMax)
  4067. {
  4068. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  4069. {
  4070. return;
  4071. }
  4072. }
  4073. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  4074. {
  4075. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  4076. {
  4077. return;
  4078. }
  4079. }
  4080. }
  4081. if (buttonValue == "1")
  4082. {
  4083. if ((strWgt + endWgt) > dbOrderMax)
  4084. {
  4085. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  4086. {
  4087. return;
  4088. }
  4089. }
  4090. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  4091. {
  4092. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  4093. {
  4094. return;
  4095. }
  4096. }
  4097. }
  4098. }
  4099. else
  4100. {
  4101. if ((strWgt + endWgt) > dbOrderMax)
  4102. {
  4103. frmBatchesPip frm = new frmBatchesPip(ob);
  4104. frm.AllCount = row.Cells["hgunit"].Text.Trim();
  4105. frm.AllWgt = row.Cells["hgweight"].Text.Trim();
  4106. frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  4107. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  4108. frm.ShowDialog();
  4109. buttonValue = frm.buttonValue;
  4110. frmcount = frm.count;
  4111. frmWgt = frm.outWgt;
  4112. frmFinishedCode = frm.finishedProduct;
  4113. if (!frm.flag)
  4114. {
  4115. return;
  4116. }
  4117. if (buttonValue == "0")
  4118. {
  4119. return;
  4120. }
  4121. if (buttonValue == "2")
  4122. {
  4123. if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
  4124. {
  4125. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  4126. return;
  4127. }
  4128. if (double.Parse(frmWgt) + endWgt > dbOrderMax)
  4129. {
  4130. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  4131. {
  4132. return;
  4133. }
  4134. }
  4135. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  4136. {
  4137. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  4138. {
  4139. return;
  4140. }
  4141. }
  4142. }
  4143. if (buttonValue == "1")
  4144. {
  4145. if ((strWgt + endWgt) > dbOrderMax)
  4146. {
  4147. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  4148. {
  4149. return;
  4150. }
  4151. }
  4152. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
  4153. {
  4154. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  4155. {
  4156. return;
  4157. }
  4158. }
  4159. }
  4160. }
  4161. }
  4162. }
  4163. else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
  4164. {
  4165. if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
  4166. {
  4167. MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
  4168. return;
  4169. }
  4170. reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
  4171. if (endWgt > reckonWgt)
  4172. {
  4173. //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
  4174. //return;
  4175. if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
  4176. {
  4177. return;
  4178. }
  4179. frmBatchesPip frm = new frmBatchesPip(ob);
  4180. frm.AllCount = row.Cells["hgunit"].Text.Trim();
  4181. frm.AllWgt = row.Cells["hgweight"].Text.Trim();
  4182. if (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
  4183. {
  4184. frm.SxWgt = "0";
  4185. }else
  4186. {
  4187. frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  4188. }
  4189. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  4190. frm.ShowDialog();
  4191. buttonValue = frm.buttonValue;
  4192. frmcount = frm.count;
  4193. frmWgt = frm.outWgt;
  4194. frmFinishedCode = frm.finishedProduct;
  4195. if (!frm.flag)
  4196. {
  4197. return;
  4198. }
  4199. if (buttonValue == "0")
  4200. {
  4201. return;
  4202. }
  4203. if (buttonValue == "2")
  4204. {
  4205. if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
  4206. {
  4207. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  4208. return;
  4209. }
  4210. if (double.Parse(frmWgt) + endWgt > reckonWgt)
  4211. {
  4212. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  4213. {
  4214. return;
  4215. }
  4216. }
  4217. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  4218. {
  4219. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  4220. {
  4221. return;
  4222. }
  4223. }
  4224. }
  4225. if (buttonValue == "1")
  4226. {
  4227. if ((strWgt + endWgt) > reckonWgt)
  4228. {
  4229. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  4230. {
  4231. return;
  4232. }
  4233. }
  4234. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  4235. {
  4236. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  4237. {
  4238. return;
  4239. }
  4240. }
  4241. }
  4242. }
  4243. else
  4244. {
  4245. if ((strWgt + endWgt) > reckonWgt)
  4246. {
  4247. frmBatchesPip frm = new frmBatchesPip(ob);
  4248. frm.AllCount = row.Cells["hgunit"].Text.Trim();
  4249. frm.AllWgt = row.Cells["hgweight"].Text.Trim();
  4250. frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
  4251. frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
  4252. frm.ShowDialog();
  4253. buttonValue = frm.buttonValue;
  4254. frmcount = frm.count;
  4255. frmWgt = frm.outWgt;
  4256. frmFinishedCode = frm.finishedProduct;
  4257. if (!frm.flag)
  4258. {
  4259. return;
  4260. }
  4261. if (buttonValue == "0")
  4262. {
  4263. return;
  4264. }
  4265. if (buttonValue == "2")
  4266. {
  4267. if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
  4268. {
  4269. MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
  4270. return;
  4271. }
  4272. if (double.Parse(frmWgt) + endWgt > reckonWgt)
  4273. {
  4274. if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
  4275. {
  4276. return;
  4277. }
  4278. }
  4279. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  4280. {
  4281. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  4282. {
  4283. return;
  4284. }
  4285. }
  4286. }
  4287. if (buttonValue == "1")
  4288. {
  4289. if ((strWgt + endWgt) > reckonWgt)
  4290. {
  4291. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
  4292. {
  4293. return;
  4294. }
  4295. }
  4296. if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
  4297. {
  4298. if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
  4299. {
  4300. return;
  4301. }
  4302. }
  4303. }
  4304. }
  4305. }
  4306. }
  4307. }
  4308. //foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
  4309. //{
  4310. // if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
  4311. // {
  4312. // if (double.Parse(row3.Cells["hgweight"].Text.Trim()) < 0)
  4313. // {
  4314. // if (double.Parse(row3.Cells["hgweight"].Text.Trim()) + double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
  4315. // {
  4316. // MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
  4317. // return;
  4318. // }
  4319. // else
  4320. // {
  4321. // if (int.Parse(row3.Cells["hgunit"].Text.Trim()) > int.Parse(ugr3.Cells["PAYDOWN_NUM"].Text.Trim()))
  4322. // {
  4323. // MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
  4324. // return;
  4325. // }
  4326. // }
  4327. // }
  4328. // }
  4329. //}
  4330. UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
  4331. .OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
  4332. double dbDelvry = 0;
  4333. double dbweigh = 0;
  4334. double dbcount = 0;
  4335. double endweigth = 0;
  4336. //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale, row.Cells["hgunit"].Value.ToString() }, this.ob);
  4337. if (MessageUtil.ShowYesNoAndQuestion("是否确认缴库?") == DialogResult.No) return;
  4338. ArrayList matList = new ArrayList();
  4339. ArrayList plnList = new ArrayList();
  4340. double stWeight = 0;
  4341. double dbunit = 0;
  4342. //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] {}, this.ob);
  4343. //if (grid3Row.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
  4344. //{
  4345. // MessageUtil.ShowTips("待缴库合同在生产中,不能进行缴库!");
  4346. // return;
  4347. //}
  4348. if (buttonValue == "2")
  4349. {
  4350. stWeight = double.Parse(frmWgt);
  4351. dbunit = double.Parse(frmcount);
  4352. }
  4353. else
  4354. {
  4355. stWeight = double.Parse(row.Cells["hgweight"].Value.ToString());//已缴库量+炉(重量)
  4356. dbunit = double.Parse(row.Cells["hgunit"].Value.ToString());//已缴库支数+炉(支数)
  4357. }
  4358. ArrayList storageList = new ArrayList(); //仓库位置参数
  4359. storageList.Add(row.Cells["lcode"].Text.Trim());
  4360. storageList.Add(row.Cells["lotno"].Text.Trim());
  4361. storageList.Add(row.Cells["hgunit"].Text.Trim());
  4362. storageList.Add(storageno);
  4363. storageList.Add(storageno + "10101");
  4364. storageList.Add(storagetype);
  4365. storageList.Add(storagetypedesc);
  4366. //storageList.Add(manageno);
  4367. //storageList.Add(managedesc);
  4368. storageList.Add(this.UserInfo.GetUserName());
  4369. storageList.Add(row.Cells["hgweight"].Value.ToString());
  4370. storageList.Add(this.UserInfo.GetDeptid());
  4371. storageList.Add(this.UserInfo.GetDepartment());//37
  4372. storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  4373. storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  4374. storageParm.Add(storageList);
  4375. #region 要缴库的每一炉重量小于要缴库的重量
  4376. matList.Add(row.Cells["lcode"].Text.Trim()); //炉号
  4377. matList.Add(row.Cells["lotno"].Text.Trim());//批号
  4378. matList.Add(row.Cells["hgunit"].Text.Trim());//支数
  4379. matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
  4380. matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
  4381. if (row.Cells["cxsteellevel"].Text == "N80Q")
  4382. {
  4383. matList.Add(row.Cells["cxsteellevel"].Value.ToString());
  4384. matList.Add(row.Cells["cxsteellevel"].Text);
  4385. }
  4386. else
  4387. {
  4388. matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
  4389. matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
  4390. }
  4391. matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
  4392. matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
  4393. matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
  4394. matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
  4395. matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
  4396. //matList.Add("");
  4397. //matList.Add(row.Cells["standard"].Value.ToString());
  4398. matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
  4399. matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
  4400. matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
  4401. matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
  4402. matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
  4403. matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
  4404. matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
  4405. matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
  4406. matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
  4407. matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
  4408. matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
  4409. matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
  4410. matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
  4411. matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
  4412. matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
  4413. matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
  4414. string length = row.Cells["leng"].Text.Trim();
  4415. int n = length.IndexOf("-");
  4416. string lengMin = length.Substring(0, n);
  4417. string lengMax = length.Substring(n + 1);
  4418. matList.Add(lengMin);//下限
  4419. matList.Add(lengMax);//上限
  4420. matList.Add(this.UserInfo.GetUserName());//操作人
  4421. matList.Add("0");
  4422. matList.Add("1");
  4423. matList.Add(row.Cells["testidea"].Value.ToString());//备注
  4424. matList.Add(row.Cells["HGWEIGHT"].Value.ToString());
  4425. double weight = Convert.ToDouble(row.Cells["HGWEIGHT"].Value.ToString());
  4426. double unit = Convert.ToDouble(row.Cells["HGUNIT"].Value.ToString());
  4427. DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
  4428. if (dtMemo.Rows.Count >= 1)
  4429. {
  4430. strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  4431. }
  4432. matList.Add(strInMemo);
  4433. matList.Add(this.UserInfo.GetDeptid());
  4434. matList.Add(this.UserInfo.GetDepartment());//37
  4435. matList.Add(strInbound);
  4436. matList.Add(this.cmbStorage.Value.ToString());//仓库号
  4437. matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());//片区
  4438. matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());//销售组织
  4439. if (buttonValue == "2")
  4440. {
  4441. matList.Add(frmcount);//42
  4442. }
  4443. else
  4444. {
  4445. matList.Add(row.Cells["hgunit"].Value.ToString());
  4446. }
  4447. matList.Add(row.Cells["rcdid"].Value.ToString());
  4448. matList.Add(row.Cells["hgm"].Value.ToString());//长度
  4449. matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
  4450. matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
  4451. matList.Add(row.Cells["standard"].Value.ToString());//判定标准
  4452. //matList.Add(row.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));// 判定时间
  4453. matList.Add(row.Cells["testdate"].Value.ToString());//判定时间
  4454. matList.Add(factoryCode);
  4455. matList.Add(factoryNo);
  4456. //matList.Add(steelCode);
  4457. //matList.Add(steelName);
  4458. matList.Add("");
  4459. matList.Add(row.Cells["steelgrade"].Text.ToString());
  4460. matList.Add(this.txtMemo.Text.Trim());
  4461. matList.Add(row.Cells["ordername"].Value.ToString());//质保合同号
  4462. matList.Add(sourceCode);//材料来源代码
  4463. matList.Add(sourceName);//材料名称
  4464. matList.Add(ks);
  4465. if (buttonValue == "1")
  4466. {
  4467. matList.Add("801703");//成品区分
  4468. }
  4469. else if (buttonValue == "2")
  4470. {
  4471. matList.Add("801701");//成品区分
  4472. }
  4473. matParm.Add(matList);
  4474. plnList.Add(stWeight.ToString("f3"));
  4475. if (double.Parse(row.Cells["hgweight"].Value.ToString()) > 0)
  4476. {
  4477. plnList.Add(dbunit.ToString());
  4478. }
  4479. else
  4480. {
  4481. plnList.Add(int.Parse(ugr3.Cells["hgunit"].Text.Trim()).ToString());
  4482. }
  4483. plnList.Add(this.UserInfo.GetUserName());
  4484. plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
  4485. plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
  4486. plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
  4487. plnSpale.Add(plnList);
  4488. //break;
  4489. #endregion
  4490. //}
  4491. //else
  4492. //{
  4493. // return;
  4494. //}
  4495. ArrayList statusList = new ArrayList();
  4496. statusList.Add(row.Cells["lcode"].Value.ToString());
  4497. statusList.Add(row.Cells["lotno"].Value.ToString());
  4498. statusList.Add(row.Cells["factory"].Value.ToString());
  4499. statusList.Add(row.Cells["testdate"].Value.ToString());
  4500. statusList.Add(row.Cells["hgunit"].Value.ToString()); //支数
  4501. statusList.Add(row.Cells["hgweight"].Value.ToString());//重量
  4502. statusList.Add(row.Cells["RCDID"].Value.ToString());
  4503. statusUpdate.Add(statusList);
  4504. //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
  4505. CoreClientParam ccp = new CoreClientParam();
  4506. ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
  4507. ccp.MethodName = "doPipeIn";
  4508. ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
  4509. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  4510. if (ccp.ReturnCode != -1)
  4511. {
  4512. if (ccp.ReturnInfo.Equals("缴库成功!"))
  4513. {
  4514. QueryMatData();
  4515. this.cmbSteel.Text = "";
  4516. this.cmbFactory.Text = "";
  4517. this.txt_Ks.Value = "0";
  4518. QueryOrder(grid3Row.Cells["ORDER_NO"].Text.Trim(), grid3Row.Cells["ORDER_SEQ"].Text.Trim());
  4519. MessageUtil.ShowTips(ccp.ReturnInfo);
  4520. }
  4521. else
  4522. {
  4523. MessageUtil.ShowTips(ccp.ReturnInfo);
  4524. }
  4525. }
  4526. }
  4527. /// <summary>
  4528. /// ultraGrid1 托选
  4529. /// </summary>
  4530. /// <param name="sender"></param>
  4531. /// <param name="e"></param>
  4532. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  4533. {
  4534. try
  4535. {
  4536. ultraGrid1.UpdateData();
  4537. foreach (UltraGridRow r in ultraGrid1.Rows)
  4538. {
  4539. r.Cells["CHK"].Value = r.Selected;
  4540. }
  4541. }
  4542. catch { }
  4543. }
  4544. /// <summary>
  4545. /// ultraGrid3 托选
  4546. /// </summary>
  4547. /// <param name="sender"></param>
  4548. /// <param name="e"></param>
  4549. private void ultraGrid3_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  4550. {
  4551. try
  4552. {
  4553. ultraGrid3.UpdateData();
  4554. foreach (UltraGridRow r in ultraGrid3.Rows)
  4555. {
  4556. r.Cells["CHK"].Value = r.Selected;
  4557. }
  4558. }
  4559. catch { }
  4560. }
  4561. private void frmPipeInTemp_Shown(object sender, EventArgs e)
  4562. {
  4563. if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
  4564. {
  4565. toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.True;
  4566. }
  4567. if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
  4568. {
  4569. toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.True;
  4570. }
  4571. if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
  4572. {
  4573. toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.True;
  4574. }
  4575. if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
  4576. {
  4577. toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.True;
  4578. }
  4579. if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
  4580. {
  4581. toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.True;
  4582. }
  4583. //toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
  4584. if (toolMenu.Toolbars[0].Tools.Exists("Query"))
  4585. {
  4586. toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
  4587. }
  4588. if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
  4589. {
  4590. toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.True;
  4591. }
  4592. if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
  4593. {
  4594. toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
  4595. }
  4596. if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
  4597. {
  4598. toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
  4599. }
  4600. if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
  4601. {
  4602. toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
  4603. }
  4604. if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
  4605. {
  4606. toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
  4607. }
  4608. if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
  4609. {
  4610. toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
  4611. }
  4612. if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
  4613. {
  4614. toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
  4615. }
  4616. if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
  4617. {
  4618. toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.True;
  4619. }
  4620. if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
  4621. {
  4622. toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
  4623. }
  4624. if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
  4625. {
  4626. toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
  4627. }
  4628. this.chkBathYear.Visible = false;
  4629. this.dtBathYear.Visible = false;
  4630. }
  4631. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  4632. {
  4633. string strqux = "";
  4634. iSelectG3Row = -1;
  4635. UltraGridRow uRow = ultraGrid1.ActiveRow;
  4636. if (uRow == null) return;
  4637. strqux = "炉号:" + uRow.Cells["lcode"].Text.Trim() +" "+ "去向:" + uRow.Cells["destination"].Text.Trim() + " " + "产线:" + uRow.Cells["factory"].Text.Trim() + " " + "备注:" + uRow.Cells["testidea"].Text.Trim();
  4638. ultraLabel1.Text = strqux;
  4639. //if (uRow.Cells["destination"].Text.Trim() != "")
  4640. //{
  4641. // this.cmbStorage.Text = uRow.Cells["destination"].Text.Trim();
  4642. //}
  4643. GetOrderNo(uRow);
  4644. getFactory(uRow);
  4645. getGrade(uRow);
  4646. }
  4647. /// <summary>
  4648. /// 仓库号选中条件
  4649. /// </summary>
  4650. /// <param name="sender"></param>
  4651. /// <param name="e"></param>
  4652. private void chkStrong_CheckedChanged(object sender, EventArgs e)
  4653. {
  4654. //if (chkStrong.Checked)
  4655. //{
  4656. // cmbStorager.ReadOnly = false;
  4657. //}
  4658. //else
  4659. //{
  4660. // cmbStorager.ReadOnly = true;
  4661. // cmbStorager.Text = "";
  4662. //}
  4663. this.cmbStorager.Enabled = this.chkStrong.Checked;
  4664. }
  4665. //全选
  4666. private void chkAll_CheckedChanged(object sender, EventArgs e)
  4667. {
  4668. int chkint = 0;
  4669. if (chkAll.Checked)
  4670. {
  4671. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  4672. {
  4673. if (uRow.Cells["CXSTUPP"].Value.ToString().Equals(""))
  4674. {
  4675. chkint += 1;
  4676. if (chkint > 50) return;
  4677. uRow.Cells["CHK"].Value = true;
  4678. }
  4679. }
  4680. }
  4681. else
  4682. {
  4683. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  4684. {
  4685. uRow.Cells["CHK"].Value = false;
  4686. }
  4687. }
  4688. }
  4689. private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  4690. {
  4691. foreach (UltraGridRow uRow in ultraGrid2.Selected.Rows)
  4692. {
  4693. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  4694. {
  4695. uRow.Cells["CHOOSE"].Value = true;
  4696. }
  4697. }
  4698. }
  4699. private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e)
  4700. {
  4701. StartTime.Enabled = this.ultraCheckEditor5.Checked;
  4702. this.EndTime.Enabled = this.ultraCheckEditor5.Checked;
  4703. }
  4704. private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
  4705. {
  4706. string strqux = "";
  4707. UltraGridRow uRow = ultraGrid1.ActiveRow;
  4708. if (uRow == null) return;
  4709. strqux = "炉号:" + uRow.Cells["lcode"].Text.Trim() +" "+ "去向:" + uRow.Cells["destination"].Text.Trim() + " " + "产线:" + uRow.Cells["factory"].Text.Trim() + " " + "备注:" + uRow.Cells["testidea"].Text.Trim();
  4710. ultraLabel1.Text = strqux;
  4711. //if (uRow.Cells["destination"].Text.Trim() != "")
  4712. //{
  4713. // this.cmbStorage.Text = uRow.Cells["destination"].Text.Trim();
  4714. //}
  4715. GetOrderNo(uRow);
  4716. getFactory(uRow);
  4717. getGrade(uRow);
  4718. // QueryOrder();
  4719. }
  4720. private void ultraGrid4_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  4721. {
  4722. foreach (UltraGridRow uRow in ultraGrid4.Selected.Rows)
  4723. {
  4724. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  4725. {
  4726. uRow.Cells["CHK"].Value = true;
  4727. }
  4728. }
  4729. }
  4730. /// <summary>
  4731. /// 判断值在某范围内
  4732. /// </summary>
  4733. /// <param name="min"></param>
  4734. /// <param name="max"></param>
  4735. /// <param name="value"></param>
  4736. /// <returns></returns>
  4737. private bool compareToValue(double min,double max,double value)
  4738. {
  4739. if(value>=min && max>=value)
  4740. {
  4741. return true;
  4742. }else
  4743. {
  4744. return false;
  4745. }
  4746. }
  4747. int iSelectG3Row = -1;
  4748. private void ultraGrid3_CellChange(object sender, CellEventArgs e)
  4749. {
  4750. ultraGrid3.UpdateData();
  4751. if (e.Cell.Column.Key.ToString().ToUpper() == "CHK")
  4752. {
  4753. if (e.Cell.Value.ToString().ToUpper() == "TRUE")
  4754. {
  4755. if (iSelectG3Row != -1)
  4756. ultraGrid3.Rows[iSelectG3Row].Cells["CHK"].Value = false;
  4757. iSelectG3Row = e.Cell.Row.Index;
  4758. }
  4759. else
  4760. {
  4761. iSelectG3Row = -1;
  4762. }
  4763. }
  4764. //bool chk = (bool)e.Cell.Value;
  4765. //UltraGridRow[] rows = GridHelper.GetRowsWithKey(ultraGrid2,
  4766. // new string[] { "CHK" }, new string[] { "True" });
  4767. //foreach (UltraGridRow row in rows)
  4768. //{
  4769. // if (e.Cell.Row.Equals(row)) continue;
  4770. // row.Cells["CHK"].Value = false;
  4771. //}
  4772. }
  4773. /// 单位英尺长度转米
  4774. /// </summary>
  4775. /// <param name="lenth">英尺长度</param>
  4776. /// <returns>米长度</returns>
  4777. public static double FootoMi(double lenth)
  4778. {
  4779. double converate = 0.3048; //换算率
  4780. return Math.Round((lenth * converate), 2);
  4781. }
  4782. private void cmbJudge_KeyDown(object sender, KeyEventArgs e)
  4783. {
  4784. if (ultraTabControl1.SelectedTab.Key == "1")
  4785. {
  4786. if (e.KeyValue == 13)
  4787. {
  4788. QueryMatData();
  4789. }
  4790. }
  4791. else if (ultraTabControl1.SelectedTab.Key == "2")
  4792. {
  4793. if (e.KeyValue == 13)
  4794. {
  4795. QueryPipedData();
  4796. }
  4797. }
  4798. else
  4799. {
  4800. if (e.KeyValue == 13)
  4801. {
  4802. QueryInList();
  4803. }
  4804. }
  4805. }
  4806. private void cmbOrder_KeyDown(object sender, KeyEventArgs e)
  4807. {
  4808. if (ultraTabControl1.SelectedTab.Key == "1")
  4809. {
  4810. if (e.KeyValue == 13)
  4811. {
  4812. QueryMatData();
  4813. }
  4814. }
  4815. else if (ultraTabControl1.SelectedTab.Key == "2")
  4816. {
  4817. if (e.KeyValue == 13)
  4818. {
  4819. QueryPipedData();
  4820. }
  4821. }
  4822. else
  4823. {
  4824. if (e.KeyValue == 13)
  4825. {
  4826. QueryInList();
  4827. }
  4828. }
  4829. }
  4830. private void cmbMatch_KeyDown(object sender, KeyEventArgs e)
  4831. {
  4832. if (e.KeyValue == 13)
  4833. {
  4834. QueryMatData();
  4835. }
  4836. }
  4837. //private void ultraGrid4_CellChange(object sender, CellEventArgs e)
  4838. //{
  4839. // ultraGrid4.UpdateData();
  4840. // UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  4841. // string ss = ugr.Cells["BAL_YEAR_MONTH"].Text;
  4842. // if (ss.Length == 6)
  4843. // {
  4844. // string dd = ss.Substring(0, 4);
  4845. // string gg = ss.Substring(4, 2);
  4846. // if (dd.Length < 4 || int.Parse(dd) > 2015)
  4847. // {
  4848. // MessageUtil.ShowTips("年份输入不正确");
  4849. // return;
  4850. // }
  4851. // if (gg.Length < 2 || int.Parse(gg) > 12 || int.Parse(gg) < 1)
  4852. // {
  4853. // MessageUtil.ShowTips("月份输入不正确");
  4854. // return;
  4855. // }
  4856. // if (!StringUtil.IsNotDateTime(dd))
  4857. // {
  4858. // MessageUtil.ShowTips("输入的值不为日期格式,请重新输入!");
  4859. // return;
  4860. // }
  4861. // }
  4862. // else
  4863. // {
  4864. // MessageUtil.ShowTips("结算日期输入不正确!");
  4865. // }
  4866. //}
  4867. private void ultraGrid4_KeyUp(object sender, KeyEventArgs e)
  4868. {
  4869. BaseMethod.setGridCopyActColumn(ultraGrid4, e, "BAL_YEAR_MONTH");
  4870. }
  4871. private void ultraGrid2_KeyUp(object sender, KeyEventArgs e)
  4872. {
  4873. BaseMethod.setGridCopyActColumn1(ultraGrid2, e, "STORAGE_NO");
  4874. }
  4875. private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
  4876. {
  4877. //BandUnitDepartments(e);
  4878. if (e.Row.Cells["CXSTUPP"].Value.ToString().Equals("物料不匹配"))
  4879. {
  4880. e.Row.Appearance.ForeColor = Color.Red;
  4881. }
  4882. }
  4883. /// <summary>
  4884. /// 连动
  4885. /// </summary>
  4886. /// <param name="sender"></param>
  4887. /// <param name="e"></param>
  4888. private void cmbSource_ValueChanged(object sender, EventArgs e)
  4889. {
  4890. if (this.cmbSource.Text != "")
  4891. {
  4892. if (this.cmbSource.Value.ToString() == "801302")//产线
  4893. {
  4894. YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
  4895. }
  4896. else if (this.cmbSource.Value.ToString() == "801301")//外购
  4897. {
  4898. YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWg", "BASE_CODE", this.ob, false);
  4899. }
  4900. else if (this.cmbSource.Value.ToString() == "801303")//倒库
  4901. {
  4902. YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getDk", "BASE_CODE", this.ob, false);
  4903. }
  4904. else if (this.cmbSource.Value.ToString() == "801304")//外委
  4905. {
  4906. YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWw", "BASE_CODE", this.ob, false);
  4907. }
  4908. }
  4909. }
  4910. private void chkBathYear_CheckedChanged(object sender, EventArgs e)
  4911. {
  4912. this.dtBathYear.Enabled = this.chkBathYear.Checked;
  4913. }
  4914. }
  4915. }