| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153 |
- using System;
- using System.Data;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using Core.StlMes.Client.YdmBase;
- using System.Linq;
- using System.Collections;
- using System.Drawing;
- using Infragistics.Win.UltraWinEditors;
- using Core.Mes.Client.Comm.Tool;
- using Infragistics.Win;
- using Core.StlMes.Client.YdmPipeManage.Controls;
- using Core.StlMes.Client.YdmPipeManage.Tool;
- using Core.StlMes.Client.YdmPipeManage;
-
-
- namespace Core.StlMes.Client.YdmPipeManage
- {
- public partial class frmPipeInTemp : FrmBase
- {
- UltraComboEditor uceReson = new UltraComboEditor();
- public frmPipeInTemp()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DataMatch":
- DataMatch();
- break;
- case "Maint":
- doMaint();
- break;
- case "Query":
- QueryOrder();
- break;
- case "Query1":
- QueryMatData();
- break;
- case "Query2":
- QueryPipedData();
- break;
- case"QueryInList":
- QueryInList();
- break;
- case "PipeIn":
- DoPipeIn();
- break;
- case "PipeIn1":
- DoForcePipeIn();
- break;
- case "CanclePipe":
- DoCanclePipeIn();
- break;
- case "Refresh":
- QueryMatData();
- break;
- case "updateStoreNo":
- updateStoreNo();
- break;
- case "updateCarryOverDate":
- updateCarryOverDate();
- break;
- case"pipRed":
- pipRed();
- break;
- case"adjustStoreButress":
- adjustStoreButress();
- break;
- case"updateStaus":
- updateStaus();
- break;
- case"updateMemo":
- updatePipMemo();
- break;
- case "updateFinishedProduct":
- updateFinishedProduct();
- break;
- case"getRealTimeStore":
- getRealTimeStore();
- break;
- case"Export":
- Export();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 获取实时库存
- /// </summary>
- private void getRealTimeStore()
- {
- string time = DateTime.Now.ToString("dd");
- string bathYear = DateTime.Now.ToString("yyyyMM");
- string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
- if (!time.Equals("01"))
- {
- MessageUtil.ShowTips("此按钮只允许每月一号进行操作!");
- return;
- }
- DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.selectNowInial", new object[] { arr,bathYear }, ob);
- if (int.Parse(ds.Rows[0][0].ToString()) > 0)
- {
- }
- else
- {
- MessageUtil.ShowTips("无本月期初数据,不允许获取期初库存!");
- return;
- }
-
- int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getRealTimeStore", new object[] { arr, bathYear }, ob);
- if (count > 0)
- {
- MessageUtil.ShowTips("获取实时期末库存成功!");
- }
- }
-
- /// <summary>
- /// 导出
- /// </summary>
- private void Export()
- {
- if (ultraTabControl1.SelectedTab.Key == "1")
- {
- GridHelper.ulGridToExcel(ultraGrid1,"质保数据");
- }
- else if (ultraTabControl1.SelectedTab.Key == "2")
- {
- GridHelper.ulGridToExcel(ultraGrid2, "库存实绩明细");
- }
- else
- {
- GridHelper.ulGridToExcel(ultraGrid4, "缴库实绩明细");
- }
- }
- /// <summary>
- /// 缴库红冲
- /// </summary>
- private void pipRed()
- {
- int m = 0;
- UltraGridRow rows = null;
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if(Convert.ToBoolean(row.Cells["CHK"].Text) == true)
- {
- if (row.Cells["CXSTUPP"].Text.Trim() == "")
- {
- MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库红冲!");
- return;
- }
- if (row.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
- {
- MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库红冲!");
- return;
- }
- if (int.Parse(row.Cells["hgunit"].Text.Trim()) > 0)
- {
- MessageUtil.ShowTips("选择的数据支数大于零,不能进行缴库红冲!");
- return;
- }
- if (!row.Cells["ordername"].Text.Contains("/"))
- {
- MessageUtil.ShowTips("合同号不规范,不允许缴库红冲!");
- return;
- }
- m++;
- rows = row;
- }
- }
- if (m > 1)
- {
- MessageUtil.ShowTips("不允许多炉缴库红冲!");
- return;
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请勾选需要缴库红冲的质保数据!");
- return;
- }
- if (this.cmbFactory.Text.ToString() == "")
- {
- factoryCode = "";
- factoryNo = "";
- }
- else
- {
- factoryCode = this.cmbFactory.Value.ToString();
- factoryNo = this.cmbFactory.Text.ToString();
- }
- if (this.cmbSteel.Text.ToString() == "")
- {
- steelCode = "";
- steelName = "";
- }
- else
- {
- steelCode = this.cmbSteel.Value.ToString();
- steelName = this.cmbSteel.Text.ToString();
- }
- frmPipRedDashed redDas = new frmPipRedDashed(this.ob);
- redDas.Rccid = rows.Cells["rcdid"].Text;
- redDas.PlineCode = factoryCode;
- redDas.PlineName = factoryNo;
- redDas.GradeCode = steelCode;
- redDas.GradeName = steelName;
- redDas.ShowDialog();
- if (redDas.buttonValue == "1")
- {
- QueryMatData();
- MessageUtil.ShowTips("缴库红冲成功!");
- }
-
- }
- /// <summary>
- /// 修改结转年月
- /// </summary>
- private void updateCarryOverDate()
- {
- ultraGrid4.UpdateData();
- ArrayList parmList = new ArrayList();
- string userName = UserInfo.GetUserName();
- int m = 0;
- int count = 0;
- int n = 0;
- //string moth = DateTime.Now.AddMonths(1).ToString("yyyyMM");
- string moth = "";
- string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- if (uRow.Cells["BAL_YEAR_MONTH"].Text.Trim() == "")
- {
- n++;
- }
- m++;
- //if (uRow.Cells["BAL_YEAR_MONTH"].Text.Trim().Length != 6)
- //{
- // MessageUtil.ShowTips("结算日期只能是6位,请重新输入!");
- // return;
- //}
- //if (!isDateTime(uRow.Cells["BAL_YEAR_MONTH"].Text.Trim()))
- //{
- // MessageUtil.ShowTips("结算日期输入格式不正确!");
- // return;
- //}
- }
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请选择需要操作的数据!");
- return;
- }
- if (n > 0)
- {
- MessageUtil.ShowTips("结转年月不能为空!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
- {
- return;
- }
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- ArrayList list = new ArrayList();
- ArrayList _list = new ArrayList();
- moth = DateTime.Parse(uRow.Cells["BAL_YEAR_MONTH"].Text).AddMonths(1).ToString("yyyyMM");
- //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")))
- //{
- // MessageUtil.ShowTips("调整结转年月不能小于当前年月!");
- // return;
- //}
- //_list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text);
- //_list.Add(uRow.Cells["BATCH_NO"].Text);
- //_list.Add(uRow.Cells["BATCH_GROUD_NO"].Text);
- _list.Add(moth);
- DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { _list, arr }, ob);
- if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0)
- {
- MessageUtil.ShowTips("此炉" + uRow.Cells["JUDGE_STOVE_NO"].Text + "已进行结转,不允许调整结转年月!");
- return;
- }
- list.Add(uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(0, 4) + uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(5,2));
- list.Add(uRow.Cells["ORDER_NO"].Text);
- list.Add(uRow.Cells["ORDER_SEQ"].Text);
- list.Add(uRow.Cells["DELIVERY_NO"].Text);
- list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text);
- list.Add(uRow.Cells["BATCH_NO"].Text);
- list.Add(uRow.Cells["PRODUCNAME"].Text);
- //list.Add(uRow.Cells["STD_NAME"].Text);
- list.Add(uRow.Cells["STEELNAME"].Text);
- list.Add(uRow.Cells["SPEC_NAME"].Text);
- list.Add(uRow.Cells["MODEL_DESC"].Text);
- list.Add(userName);
- list.Add(uRow.Cells["ACT_LEN_MIN"].Text);
- list.Add(uRow.Cells["ACT_LEN_MAX"].Text);
- list.Add(uRow.Cells["BATCH_GROUD_NO"].Text);
- list.Add(uRow.Cells["INSTOCK_DOC"].Text);
- parmList.Add(list);
- }
- }
- count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateCarryOverDate", new Object[] { parmList }, this.ob);
- if (count > 0)
- {
-
- QueryInList();
- MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- /// <summary>
- /// 修改库存位置
- /// </summary>
- private void updateStoreNo()
- {
- ultraGrid2.UpdateData();
- ArrayList parmList = new ArrayList();
- string orderNo = "";//合同号
- string orderSeqNo = "";//合同行
- string order_No = "";//交货行
- string heatNo = "";//炉号
- string batchNo = "";//批号
- string producName = "";//品名
- string std_Name = "";//标准名称
- string steelName = "";//钢级
- string specName = "";//规格
- string mescCode = "";//扣型
- string storeNo = "";//仓库号
- string userName = UserInfo.GetUserName();
- int m = 0;
- int count = 0;
- int n = 0;
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- if (uRow.Cells["STORAGE_NO"].Text.Trim() == "")
- {
- n++;
- }
- m++;
- }
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请选择需要操作的数据!");
- return;
- }
- if (n > 0)
- {
- MessageUtil.ShowTips("仓库名称不能为空!");
- return;
- }
- if(MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
- {
- return;
- }
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- 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")
- {
- MessageUtil.ShowTips("材料状态已被改变,不允许修改库存地点!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["STORAGE_NO"].Value.ToString());
- //list.Add(uceReson.Value.ToString());
- list.Add(uRow.Cells["ORDER_NO"].Text.Trim());
- list.Add(uRow.Cells["ORDER_SEQ"].Text.Trim());
- list.Add(uRow.Cells["ORDER_SEQ_NO"].Text.Trim());
- list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
- list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
- list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
- //list.Add(uRow.Cells["STD_NAME"].Text.Trim());
- list.Add(uRow.Cells["STEELNAME"].Text.Trim());
- list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
- list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
- list.Add(userName);
- list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
- list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
- list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
- if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
- {
- list.Add("801403");
- }
- else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
- {
- list.Add("801402");
- }
- else
- {
- list.Add("801401");
- }
- //list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
- parmList.Add(list);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
- ccp.MethodName = "updateStoreNo";
- ccp.ServerParams = new object[] { parmList };
- ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateStoreNo", new Object[] { parmList }, this.ob);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- QueryPipedData();
- // MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- }
- /// <summary>
- /// 修改入库备注
- /// </summary>
- private void updatePipMemo()
- {
- ultraGrid2.UpdateData();
- ArrayList parmList = new ArrayList();
- string userName = UserInfo.GetUserName();
- int m = 0;
- foreach (UltraGridRow uRow in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- m++;
- }
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请选择需要操作的数据!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
- {
- return;
- }
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- 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")
- {
- MessageUtil.ShowTips("材料状态已被改变,不允许修改入库备注!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["PIPMEMO"].Value.ToString());
- //list.Add(uceReson.Value.ToString());
- list.Add(uRow.Cells["ORDER_NO"].Text.Trim());
- list.Add(uRow.Cells["ORDER_SEQ"].Text.Trim());
- list.Add(uRow.Cells["ORDER_SEQ_NO"].Text.Trim());
- list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
- list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
- list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
- //list.Add(uRow.Cells["STD_NAME"].Text.Trim());
- list.Add(uRow.Cells["STEELNAME"].Text.Trim());
- list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
- list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
- list.Add(userName);
- list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
- list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
- list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
- if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
- {
- list.Add("801403");
- }
- else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
- {
- list.Add("801402");
- }
- else
- {
- list.Add("801401");
- }
- //list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
- parmList.Add(list);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
- ccp.MethodName = "updatePipMemo";
- ccp.ServerParams = new object[] { parmList };
- ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateStoreNo", new Object[] { parmList }, this.ob);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- QueryPipedData();
- // MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- }
- /// <summary>
- /// 修改成品区分
- /// </summary>
- private void updateFinishedProduct()
- {
- ultraGrid2.UpdateData();
- ArrayList parmList = new ArrayList();
- string userName = UserInfo.GetUserName();
- int m = 0;
- foreach (UltraGridRow uRow in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- m++;
- }
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请选择需要操作的数据!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
- {
- return;
- }
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
- {
- MessageUtil.ShowTips("材料类别为商品的,不允许修改成品区分!");
- return;
- }
- ArrayList list = new ArrayList();
-
- list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
- list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
- list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
- //list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
- //list.Add(uRow.Cells["STEELNAME"].Text.Trim());
- //list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
- //list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
- //list.Add(userName);
- //list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
- //list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
-
- if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
- {
- list.Add("801403");
- }
- else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
- {
- list.Add("801402");
- }
- else
- {
- list.Add("801401");
- }
- list.Add(uRow.Cells["PIPMEMO"].Value.ToString());
- list.Add(uRow.Cells["IN_MOLD"].Value.ToString());
- list.Add(uRow.Cells["FINISHPRO_MOLD"].Value.ToString2());
- parmList.Add(list);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmFinishAfrim";
- ccp.MethodName = "updateFinishedProduct";
- ccp.ServerParams = new object[] { parmList };
- ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- QueryPipedData();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 批量调整位置
- /// </summary>
- private void adjustStoreButress()
- {
- ultraGrid2.UpdateData();
- int n = 0;
- int m = -1;
- ArrayList list = new ArrayList();
- string heatNo = "";
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- heatNo = uRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
- list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
- list.Add(uRow.Cells["BATCH_NO"].Value.ToString());
- list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
- if (uRow.Cells["PRODUCT_FLAG"].Value.ToString().Equals("商品"))
- {
- list.Add("801403");
- }else
- {
- list.Add("801402");
- }
- list.Add(uRow.Cells["ORDER_NO"].Value.ToString());
- list.Add(uRow.Cells["ORDER_SEQ"].Value.ToString());
- list.Add(uRow.Cells["ORDER_SEQ_NO"].Value.ToString());
- list.Add(uRow.Cells["FINISHPRO_MOLD"].Value.ToString());
- list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
- n++;
- m = uRow.Index;
- }
- }
- if (n < 1)
- {
- MessageUtil.ShowTips("请选择主信息进行批量调整位置!");
- return;
- }
- if(n>1)
- {
- MessageUtil.ShowTips("批量调整位置不允许多条调整库存位置!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否批量修改选择数据的库存位置?") == DialogResult.No)
- {
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipupdateStoreButress.selectMatStu", new object[] { list }, ob);
- if (int.Parse(dt.Rows[0]["ACOUNT"].ToString()) > 0)
- {
- MessageUtil.ShowTips("此炉【"+heatNo+"】物料状态有改变,不允许调整位置!");
- return;
- }
- DataTable ds = new DataTable();
- ds.Clear();
- ds = dataTable2.Clone();
- ds.ImportRow(dataTable2.Rows[m]);
- frmPipeMoveStoreButress moveButress = new frmPipeMoveStoreButress(this.ob);
- moveButress.Dt = ds;
- moveButress.ShowDialog();
- if (moveButress.buttonValue == "1")
- {
- QueryPipedData();
- MessageUtil.ShowTips("修改成功!");
- }
- }
- /// <summary>
- /// 缴库实绩查询
- /// </summary>
- private void QueryInList()
- {
- string heatNo = "";
- string orderNo = "";
- string storgeNo = "";
- string startTim = "";
- string endTim = "";
- string bathYear = "";
- ArrayList list = new ArrayList();
- if (ultraCheckEditor5.Checked)
- {
- startTim = StartTime.Value.ToString("yyyy-MM-dd");
- endTim = EndTime.Value.ToString("yyyy-MM-dd");
- }
- if (chkJudge.Checked)
- {
- if (this.cmbJudge.Text == "")
- {
- MessageUtil.ShowTips("请选择炉号!");
- return;
- }else
- {
- heatNo = this.cmbJudge.Text.Trim();
- }
- }
- if (chkOrder.Checked)
- {
- if (this.cmbOrder.Text == "")
- {
- MessageUtil.ShowTips("请选择合同号!");
- return;
- }
- else
- {
- orderNo = this.cmbOrder.Text.Trim();
- }
- }
- if (chkStrong.Checked)
- {
- if (this.cmbStorager.Text == "")
- {
- MessageUtil.ShowTips("请选择仓库!");
- return;
- }
- else
- {
- storgeNo = this.cmbStorager.Value.ToString();
- }
- }
- if (chkBathYear.Checked)
- {
- bathYear = this.dtBathYear.Value.ToString("yyyyMM");
- }
- list.Add(heatNo);
- list.Add(orderNo);
- list.Add(storgeNo);
- list.Add(bathYear);
- //string arr = UserInfo.GetDeptid();
- string areaNo = "";
- string userName = UserInfo.GetUserName();
- //if (!userName.Equals("admin"))
- //{
- // DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.querySaleOrg", new object[] { arr }, this.ob);
- // if (ds.Rows.Count > 0)
- // {
- // areaNo = ds.Rows[0][0].ToString();
- // }
-
- //}
- string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
- //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryInList", new object[] { list, userName, areaNo }, this.ob);
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryInList", new object[] { list, arr, startTim, endTim }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable4,true);
- //GridHelper.RefreshAndAutoSize(this.ultraGrid4);
-
- }
-
- ArrayList storageParm = new ArrayList();//库位
- ArrayList matParm = new ArrayList();//材料表
- ArrayList statusUpdate = new ArrayList();//质保
- ArrayList plnSpale = new ArrayList();//销售合同提报
- string storageno = "";
- string storagetype = "";
- string storagetypedesc = "";
- string manageno = "";
- string managedesc="";
- string strInbound = "800701";//入库类型
- string strIndoc = "";//入库单号
- string strInMemo = "";
- string factoryNo = "";
- string factoryCode = "";
- string steelCode = "";
- string steelName = "";
- string sourceCode = "";
- string sourceName = "";
- string ks = "";
- UltraComboEditor ucePro = new UltraComboEditor();
- UltraComboEditor uceSpec = new UltraComboEditor();
- UltraComboEditor uceSteel = new UltraComboEditor();
- UltraComboEditor uceModel = new UltraComboEditor();
- UltraComboEditor uceFinished = new UltraComboEditor();
- /// <summary>
- /// 初始化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void frmPipeInTemp_Load(object sender, EventArgs e)
- {
-
- //cmbSteel.Enabled = false;
- //StartTime.Value =DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
- //StartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00");
- StartTime.Value = DateTime.Parse("2015-10-01" + " 00:00:00");
- //DateTime.Today.AddDays(-7);
- //DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + " 00:00:00";
- //EndTime.Value = DateTime.Parse(DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).ToString("yyyy-MM-dd") + " 23:59:59");
- DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
- EndTime.Value = DateTime.Parse(d1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59");
- dtBathYear.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM"));
- //DateTime.Today.AddDays(1).AddSeconds(-1);
- //DateTime.Today.ToString("yyyy-MM-dd") + " 23:59:59";
- this.StartTime.Enabled = false;
- this.EndTime.Enabled = false;
- this.ultraCheckEditor5.Checked = true;
-
- InitStorage();
- InitBindColumn();
-
- YdmBaseClass.InitComboEditor(uceReson, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
- YdmBaseClass.BindColumn(uceReson, "STORAGE_NO", this.Controls, this.ultraGrid2, 0);
- YdmBaseClass.InitComboEditor(uceFinished, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFinishedProduct", "BASECODE", this.ob, false);
- YdmBaseClass.BindColumn(uceFinished, "FINISHPRO_MOLD", this.Controls, this.ultraGrid2, 0);
- //this.ultraGrid4.DisplayLayout.Bands[0].Columns["BAL_YEAR_MONTH"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTime;
- //this.ultraGrid4.DisplayLayout.Bands[0].Columns["BAL_YEAR_MONTH"].MaskInput = "yyyymm";
- this.cmbStorager.Enabled = false;
- }
- private void InitBindColumn()
- {
- //材料状态
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出等待");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料管理封锁");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料质量封锁");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料可编计划");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料已编计划");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150106", "材料为余材");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(已综合判定)");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150205", "材料缴库余材(销售组织缴库)");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编提单");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编提单");
- this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂");
- //string[] arr = new string[3] { "801501", "801502", "801503" };
- //DataTable dt = ClsLoad.GetValueListDataTable(arr, this.ob);
- //this.ultraGrid2.DisplayLayout.Bands[0].Columns["MAT_STATUS"].ValueList = ClsLoad.GeneralValuelist(ref dt, "BASECODE", "BASENAME");
- this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801701", "超合同量");
- this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801702", "无合同");
- this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801703", "按合同");
- this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801704", "退货");
- this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801705", "压库");
- this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801706", "合同长尺");
- this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801707", "合同短尺");
- }
- /// <summary>
- /// 下拉框绑定数据
- /// </summary>
- private void InitStorage()
- {
- string time = DateTime.Now.ToString();
- string time1 = DateTime.Now.AddDays(-15).ToString();
- BaseMethod.InitSourse(cmbSource, this.ob);
- YdmBaseClass.InitComboEditor(cmbSteel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getGradeDetail", "GRADECODE", this.ob, false);
- //YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
- YdmBaseClass.InitComboEditor(cmbStorager, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
- YdmBaseClass.InitComboEditor(cmbStorage, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
- //YdmBaseClass.InitComboEditorWithParm(cmbJudge, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStoveNo", "lcode", this.ob, false,new object []{time1,time});
- //YdmBaseClass.InitComboEditor(cmbOrder, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getOrderNo", "ORDER_NO", this.ob, false);
- YdmBaseClass.InitComboEditor(ucePro, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getKind", "PRODUCCODE", this.ob, true);
- YdmBaseClass.InitComboEditor(uceSpec, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSpec", "SPEC_CODE", this.ob, true);
- YdmBaseClass.InitComboEditor(uceSteel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSteel", "STEELCODE", this.ob, true);
- YdmBaseClass.InitComboEditor(uceModel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getModel", "MODEL_CODE", this.ob, true);
- YdmBaseClass.BindColumn(ucePro, "CXKIND", this.Controls, ultraGrid1, 0);
- YdmBaseClass.BindColumn(uceSpec, "CXGG", this.Controls, ultraGrid1, 0);
- YdmBaseClass.BindColumn(uceSteel, "CXSTEELLEVEL", this.Controls, ultraGrid1, 0);
- YdmBaseClass.BindColumn(uceModel, "CXTYPEOFTHREAD", this.Controls, ultraGrid1, 0);
- }
- /// <summary>
- /// 品种维护
- /// </summary>
- private void doMaint()
- {
- FrmVarietie var = new FrmVarietie(ob, "2010-01-01 00:00:00");
- var.AutoSize = true;
- var.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- var.WindowState = FormWindowState.Maximized;
- var.Show();
- }
- /// <summary>
- /// 数据匹配
- /// </summary>
- private void DataMatch()
- {
- ultraGrid1.UpdateData();
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- int counm = 0;
- string strOrder = "";
- string strOrderSeq = "";//合同行号
- string strKind = "";//品种
- string strTeel = "";//钢级
- string strSpec = "";//规格
- string strMode = "";//扣型
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- counm += 1;
- }
- }
- if (counm == 0)
- {
- MessageUtil.ShowWarning("请选择需要匹对的质保判定数据!");
- return;
- }
- if (counm > 50)
- {
- MessageUtil.ShowWarning("一次只能选50条记录进行匹配!");
- return;
- }
- try
- {
- this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- if (Constant.WaitingForm == null)
- {
- Constant.WaitingForm = new WaitingForm();
- }
- Constant.WaitingForm.ShowToUser = true;
- Constant.WaitingForm.Show();
- Constant.WaitingForm.Update();
- string strMatch = "";//是否匹配
- ArrayList pram = new ArrayList();
- DataTable dtkind = new DataTable();
- DataTable dtSteel = new DataTable();
- DataTable dtSpec = new DataTable();
- DataTable dtModel = new DataTable();
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- ArrayList list = new ArrayList();
- strOrder = uRow.Cells["ordername"].Text;
- //if (YdmBaseClass.WordsIScn(strOrder))
- //{
- // MessageUtil.ShowTips("合同号有中文字符!");
- // break;
- //}
- //strVarieties = uRow.Cells["kind"].Text + "、" + uRow.Cells["steellevel"].Text + "、" + uRow.Cells["spec"].Text + "、" + uRow.Cells["typeofThread"].Text;
- //strKind = uRow.Cells["KIND"].Text.Trim();
- //strTeel = uRow.Cells["STEELLEVEL"].Text.Trim();
- //strSpec = uRow.Cells["GG"].Text.Trim();
- //strMode = uRow.Cells["TYPEOFTHREAD"].Text.Trim();
- #region 物料对应
- ArrayList listSave = new ArrayList();
- listSave.Clear();
- listSave.Add(uRow.Cells["kind"].Text);
- dtkind.Clear();
- dtkind = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryKind1", new object[] { listSave }, this.ob);
- if (dtkind.Rows.Count > 0)
- {
- strKind = dtkind.Rows[0]["PRODUCCODE"].ToString().Trim();
- }
- else
- {
- strKind = "";
- }
- listSave.Clear();
- listSave.Add(uRow.Cells["steellevel"].Text);
- dtSteel.Clear();
- dtSteel = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySteel1", new object[] { listSave }, this.ob);
- if (dtSteel.Rows.Count > 0)
- {
- strTeel = dtSteel.Rows[0]["STEELCODE"].ToString().Trim();
- }
- else
- {
- strTeel = "";
- }
- listSave.Clear();
- listSave.Add(uRow.Cells["GG"].Text);
- dtSpec.Clear();
- dtSpec = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySpec1", new object[] { listSave }, this.ob);
- if (dtSpec.Rows.Count > 0)
- {
- strSpec = dtSpec.Rows[0]["SPEC_CODE"].ToString().Trim();
- }
- else
- {
- strSpec = "";
- }
- listSave.Clear();
- if (uRow.Cells["typeofThread"].Text.Trim() == "")
- {
- listSave.Add("/");
- }
- else
- {
- listSave.Add(uRow.Cells["typeofThread"].Text);
- }
- dtModel.Clear();
- dtModel = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryModel1", new object[] { listSave }, this.ob);
- if (dtModel.Rows.Count > 0)
- {
- strMode = dtModel.Rows[0]["MODEL_CODE"].ToString().Trim();
- }
- else
- {
- strMode = "";
- }
- #endregion
- if (strKind != "" && strTeel != "" && strSpec != "" && strMode != "")
- {
- strMatch = "01";//(物料匹配)
- }
- else
- {
- strMatch = "02";//(物料不匹配)
- }
- list.Add(strMatch);
- list.Add(strKind);
- list.Add(strTeel);
- list.Add(strSpec);
- list.Add(strMode);
- list.Add(uRow.Cells["rcdid"].Text);
- list.Add(uRow.Cells["lcode"].Text);
- list.Add(uRow.Cells["lotno"].Text);
- list.Add(uRow.Cells["ordername"].Text);
- pram.Add(list);
- }
- }
- int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getUpdateZbMatch", new object[] { pram }, this.ob);
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- QueryMatData();
- }
- catch (Exception e)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- }
- /// <summary>
- /// 合同查询
- /// </summary>
- private void QueryOrder()
- {
- string strStratTime = "";
- string strEndTime = "";
- string orderno = "";
- string orderSeq = "";
- if (this.ultraCheckEditor5.Checked)
- {
- if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
- {
- MessageUtil.ShowTips("开始时间不能大于结束时间!");
- return;
- }
- else
- {
- strStratTime = StartTime.Value.ToString();
- strEndTime = EndTime.Value.ToString();
- }
- }
- if (chkOrder.Checked)
- {
- if (cmbOrder.Text.Trim() != "")
- {
- orderno = cmbOrder.Text.Trim();
- int dex = orderno.IndexOf("/");
- if (dex > 0)
- {
- orderno = orderno.Substring(0, dex);
- orderSeq = cmbOrder.Text.Trim().Substring(dex + 1);
- if (orderSeq.Length < 3)
- {
- orderSeq = orderSeq.PadLeft(3, '0');
- }
- }
- }
- else
- {
- MessageUtil.ShowTips("请选择合同号!");
- return;
- }
- }
- //string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,this.ob);
- string[] arr = this.ValidDataPurviewIds;
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder", new Object[] { orderno, orderSeq, arr }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
- ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
- GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
- this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
- }
- /// <summary>
- /// 材料查询
- /// </summary>
- private void QueryMatData()
- {
- string judgetimeStart = ""; //判定起始时间
- string judgetimeEnd = ""; //判定结束时间
- string stoveno = ""; //炉号
- string batchno = ""; //批号
- string order = "";
- string stu="";//匹配状态
- string departNo = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
- string departMent = "";
- if (chkJudge.Checked)
- {
- if (this.cmbJudge.Text == "")
- {
- MessageUtil.ShowTips("请选择炉号!");
- return;
- }
- else
- {
- stoveno = cmbJudge.Text.Trim();
- }
- }
- if (chkOrder.Checked)
- {
- if (this.cmbOrder.Text == "")
- {
- MessageUtil.ShowTips("请选择合同号!");
- return;
- }
- else
- {
- order = cmbOrder.Text.Trim();
- }
- }
- if (this.ultraCheckEditor5.Checked)
- {
- if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
- {
- MessageUtil.ShowTips("开始时间不能大于结束时间!");
- return;
- }
- else
- {
- judgetimeStart= StartTime.Value.ToString();
- judgetimeEnd = EndTime.Value.ToString();
- }
- }
- else
- {
- if (this.cmbOrder.Text == "" && this.cmbJudge.Text == "")
- {
- MessageUtil.ShowTips("炉号或者合同号条件需要选择一个!");
- return;
- }
- }
- if (ultraCheckEditor1.Checked && cmbMatch.Text.Trim() != "")
- {
- stu=cmbMatch.Value.ToString();
- }
- //if (YdmBaseClass.getMonth(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString()))>1)
- //{
- // MessageUtil.ShowTips("请选择一个月之内的时间!");
- // return;
- //}
-
- ArrayList list = new ArrayList();
- list.Add(judgetimeStart);
- list.Add(judgetimeEnd);
- list.Add(stoveno);
- //list.Add(batchno);
- list.Add(order);
- list.Add(stu);
- string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
- //string[] _arr = new string[3];
- //string sore = "";
- //for (int i = 0; i < arr.Length; i++)
- //{
- // sore = arr[i];
- // if (sore.Equals("100101") || sore.Equals("100102"))
- // {
- // sore = "";
- // }
- // else if (sore.Equals("100103"))
- // {
- // sore = "国贸";
- // }
- //}
- try
- {
- this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- if (Constant.WaitingForm == null)
- {
- Constant.WaitingForm = new WaitingForm();
- }
- Constant.WaitingForm.ShowToUser = true;
- Constant.WaitingForm.Show();
- Constant.WaitingForm.Update();
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryMatData", new Object[] { list, arr }, this.ob);//MatData
- //if (dt.Rows.Count > 0)
- //{
- // for (int i = 0; i < dt.Rows.Count; i++)
- // {
- // if (dt.Rows[i]["CXSTUPP"].ToString() == "物料不匹配")
- // {
- // this.ultraGrid1.DisplayLayout.Bands[i].Columns["CXSTUPP"].ce.CellAppearance.BackColor = Color.Red;
- // }
- // }
- //}
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
- // UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid1.DisplayLayout.Bands[0].Columns["remark"], ultraGrid1.DisplayLayout.Bands[0].Columns["standard"]
- //,ultraGrid1.DisplayLayout.Bands[0].Columns["testidea"] };
- // GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col);
- // this.ultraGrid1.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- catch (Exception e)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- this.chkAll.Checked = false;
- }
- /// <summary>
- /// 把负质保数据置走
- /// </summary>
- private void updateStaus()
- {
- ultraGrid1.UpdateData();
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- int m = 0;
- foreach (UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- if (!(uRow.Cells["hgunit"].Text.Contains("-")) && !(uRow.Cells["hgunit"].Text == "") && !(uRow.Cells["hgweight"].Text.Contains("-")) && !(uRow.Cells["hgweight"].Text == ""))
- {
- m++;
- }
- }
- }
- if(m>0)
- {
- MessageUtil.ShowTips("不允许剔除正常的质保数据!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Value))
- {
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["rcdid"].Value.ToString());
- parm.Add(list);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
- ccp.MethodName = "updateStaus";
- ccp.ServerParams = new object[] { parm };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("剔除成功!"))
- {
- QueryMatData();
- }
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- /// <summary>
- /// 强制缴库
- /// </summary>
- private void DoForcePipeIn()
- {
- ultraGrid3.UpdateData();
- ultraGrid1.UpdateData();
- storageParm = new ArrayList();
- matParm = new ArrayList();
- statusUpdate = new ArrayList();
- plnSpale = new ArrayList();
- ArrayList listdt = new ArrayList();
- int conu = 0;
- string buttonValue = "";//返回的按钮值
- string frmcount = "";//返回的支数
- string frmWgt = "";//返回的重量值
- string frmFinishedCode = "";
- int count = 0;
- UltraGridRow ugr3 = ultraGrid3.ActiveRow;
- UltraGridRow row = ultraGrid1.ActiveRow;
- //if (ugr3 == null) { MessageUtil.ShowTips("待缴库无数据,不能进行此操作"); return; }
- if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
- string[] arr = this.ValidDataPurviewIds;
- double strWgt = 0;//炉重
- double endWgt = 0;//已缴库量
- double orderWgt = 0;//合同量
- int m = 0;
- int number = 0;
- string orderType = "";
- foreach (UltraGridRow row5 in ultraGrid3.Rows)
- {
- if (Convert.ToBoolean(row5.Cells["CHK"].Text) == true)
- {
- number++;
- }
- }
- foreach (UltraGridRow row1 in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row1.Cells["CHK"].Text) == true)
- {
- if (row1.Cells["hgweight"].Text == "")
- {
- MessageUtil.ShowTips("该炉还未生产,无法缴库!");
- return;
- }
- if (double.Parse(row1.Cells["hgweight"].Text) < 0)
- {
- MessageUtil.ShowWarning("已缴库量无法进行冲销!");
- return;
- }
- strWgt += double.Parse(row1.Cells["hgweight"].Value.ToString());
- m++;
- }
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请勾选需要强制缴库的质保数据!");
- return;
- }
- if (m > 1)
- {
- MessageUtil.ShowTips("缴库时不允许多炉同时缴库!");
- return;
- }
- //endWgt = double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString());
- //orderWgt = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString());
- //string strRANGE_MIN = ugr3.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
- //string strRANGE_MAX = ugr3.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
- //double dbQtyMin = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) - double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//交货量差下限值
- //double dbQtyMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
- string _length = "";//长度范围
- int d = 0;
- double downLength = 0;//下限
- double upLength = 0;//上限
- DataTable ds = new DataTable();
- string prouceName = "";//品名
- string steelLev = "";//钢级
- string guige = "";//规格
- string modelDesc = "";//扣型
- DataTable dtOrder = new DataTable();
- string ordername = "";//判定数据合同号
- string orderNo = "";//判定数据拆分合同号
- string orderSeQ = "";//判定数据拆分合同行号
- string[] wgtList = new string[3];
- int dex = 0;
- string orderUnit = "";//长度单位
- double reckonWgt = 0;//估算量上限
- string gSwgt = "";//合同估算总量
- string pipSwgt = "";//合同缴库总量
- string dSwgt = "";//订货总量
- foreach (UltraGridRow row2 in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row2.Cells["CHK"].Text) == true)
- {
- if (row2.Cells["CXSTUPP"].Text.Trim() == "")
- {
- MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
- return;
- }
- ds.Clear();
- 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);
- if (ds.Rows[0][0].ToString() == "20")
- {
- MessageUtil.ShowTips("您选中的【" + row2.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
- return;
- }
- ordername = row2.Cells["ordername"].Text.Trim();
- if (!ordername.Contains("/"))
- {
- MessageUtil.ShowTips("此判定数据合同号异常,不允许缴库!");
- return;
- }
- dex = ordername.IndexOf("/");
- orderNo = ordername.Substring(0, dex);
- orderSeQ = ordername.Substring(dex + 1).PadLeft(4, '0');
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder1", new object[] { orderNo, orderSeQ }, this.ob);
- if (dt.Rows.Count > 0)
- {
- if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("吨") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("支"))
- {
- 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)))
- {
- MessageUtil.ShowTips("此判定物料有对应合同号合同行号数据存在,不允许强制缴库!");
- return;
- }
- }
- else if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("英尺") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("米"))
- {
- 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)))
- {
- MessageUtil.ShowTips("此判定物料有对应合同号合同行号数据存在,不允许强制缴库!");
- return;
- }
- }
- }
- else
- {
- ArrayList list = new ArrayList();
- prouceName = row2.Cells["cxkind"].Text.Trim();
- steelLev = row2.Cells["cxsteellevel"].Text.Trim();
- guige = row2.Cells["cxstandard"].Text.Trim();
- modelDesc = row2.Cells["cxtypeofthread"].Text.Trim();
- list.Add(prouceName);
- list.Add(steelLev);
- list.Add(guige);
- list.Add(modelDesc);
- dtOrder = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getMatchOrderNo", new object[] { list}, this.ob);
- if (dtOrder.Rows.Count > 0)
- {
- for (int i = 0; i < dtOrder.Rows.Count; i++)
- {
- if (dtOrder.Rows[i]["ORDER_NO"].ToString() == orderNo && int.Parse(dtOrder.Rows[i]["ORDER_SEQ"].ToString()) == int.Parse(orderSeQ))
- {
- if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("吨") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("支"))
- {
- 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)))
- {
- MessageUtil.ShowTips("当前判定合同【" + ordername + "】在产销系统中有对应合同,需正常缴库!");
- return;
- }
- }
- else if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("英尺") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("米"))
- {
- 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)))
- {
- MessageUtil.ShowTips("当前判定合同【" + ordername + "】在产销系统中有对应合同,需正常缴库!");
- return;
- }
- }
-
- }
- }
- }
- }
- }
- }
-
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
- {
- if (double.Parse(row3.Cells["hgweight"].Text.Trim()) < 0)
- {
- if (double.Parse(row3.Cells["hgweight"].Text.Trim()) + double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
- {
- MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
- return;
- }
- else
- {
- if (int.Parse(row3.Cells["hgunit"].Text.Trim()) > int.Parse(ugr3.Cells["PAYDOWN_NUM"].Text.Trim()))
- {
- MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
- return;
- }
- }
- }
- }
- }
- if (cmbStorage.SelectedItem == null)
- {
- MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else
- {
- storageno = this.cmbStorage.Value.ToString();
- }
- if (this.cmbFactory.Text.ToString() == "")
- {
- //MessageUtil.ShowTips("产线不允许为空!");
- //return;
- factoryCode = "";
- factoryNo = "";
- }
- else
- {
- factoryCode = this.cmbFactory.Value.ToString();
- factoryNo = this.cmbFactory.Text.ToString();
- }
- //if (this.cmbSteel.Text.ToString() == "")
- //{
- // //MessageUtil.ShowTips("钢种不允许为空!");
- // //return;
- // steelCode = "";
- // steelName = "";
- //}
- //else
- //{
- // steelCode = this.cmbSteel.Value.ToString();
- // steelName = this.cmbSteel.Text.ToString();
- //}
-
- if (this.cmbSource.Text.ToString() == "")
- {
- sourceCode = "";
- sourceName = "";
- }
- else
- {
- sourceCode = this.cmbSource.Value.ToString();
- sourceName = this.cmbSource.Text.ToString();
- }
- if (this.txt_Ks.Value == null)
- {
- ks = "0";
- }
- else
- {
- ks = this.txt_Ks.Value.ToString();
- }
- string strOrder = "";
- if (ugr3 != null)
- {
- strOrder = ugr3.Cells["ORDER_NO"].Text.Trim() + "/" + ugr3.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
- }
- double delPla = 0;//已缴库量
- UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
- .OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
- double dbDelvry = 0;
- double dbweigh = 0;
- double dbcount = 0;
- double endweigth = 0;
- string strRANGE_MIN = "";
- string strRANGE_MAX = "";
- double dbQtyMin = 0;
- double dbQtyMax = 0;
- double dbJhMax = 0;
- #region 强制缴库有合同时
- if (number > 0)
- {
- UltraGridRow grid3Row =null;
- foreach (UltraGridRow row6 in ultraGrid3.Rows)
- {
- if (Convert.ToBoolean(row6.Cells["CHK"].Text) == true)
- {
- //if (row6.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
- //{
- // MessageUtil.ShowTips("待缴库合同在生产中,不能进行强制缴库!");
- // return;
- //}
- if (row6.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
- {
- MessageUtil.ShowTips("物料不匹配不允许缴库!");
- return;
- }
-
-
- orderUnit = row6.Cells["ORDER_UNIT"].Text.Trim();
- endWgt = double.Parse(row6.Cells["PAYDOWNWEIGHT"].Value.ToString());
- orderWgt = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString());
- strRANGE_MIN = row6.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
- strRANGE_MAX = row6.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
- dbQtyMin = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
- dbQtyMax = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
- dbJhMax = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
- wgtList = getOrderWgt(row6.Cells["ORDER_NO"].Text.ToString());
- if (wgtList.Length > 0)
- {
- gSwgt = wgtList[0];
- pipSwgt = wgtList[1];
- dSwgt = wgtList[2];
- }
- grid3Row = row6;
- }
-
- }
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- ArrayList matList = new ArrayList();
- ArrayList plnList = new ArrayList();
- //if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
- //{
- // if (uRow.Cells["hgm"].Text.Trim() == "")
- // {
- // MessageUtil.ShowTips("此合同不是按吨交货,长度为空不能缴库!");
- // return;
- // }
- //}
- orderType = doQueryOrderType(uRow.Cells["ordername"].Text.Trim().Substring(0, uRow.Cells["ordername"].Text.Trim().IndexOf("/")));
- if (orderType.Equals("120103"))
- {
- MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
- return;
- }
- else if (orderType.Equals("120104"))
- {
- MessageUtil.ShowTips("该合同为预排合同,只允许缴库成成品!");
- return;
- }
- _length = uRow.Cells["leng"].Text.Trim();
- if (_length != "")
- {
- d = _length.IndexOf("-");
- downLength = double.Parse(_length.Substring(0, d));
- upLength = double.Parse(_length.Substring(d + 1));
- if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
- {
- 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)))
- {
- if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + uRow.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + grid3Row.Cells["LEN"].Text + "】,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
- {
- 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)))
- {
- 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)
- {
- return;
- }
- }
- }
- }
- else
- {
- MessageUtil.ShowTips("强制缴库到对应合同中,长度上下限不允许为空!");
- return;
- }
- if (strWgt > 0)
- {
-
- if (orderUnit.Equals("吨") || orderUnit.Equals("支"))
- {
- if (endWgt > dbJhMax)
- {
- //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
- //return;
- if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }else
- {
- if ((strWgt + endWgt) > dbJhMax)
- {
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = uRow.Cells["hgunit"].Text.Trim();
- frm.AllWgt = uRow.Cells["hgweight"].Text.Trim();
- frm.SxWgt = (dbQtyMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- if (int.Parse(frmcount) > int.Parse(uRow.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > dbJhMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > dbJhMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- }
- }
- else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
- {
- if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
- {
- MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
- return;
- }
- reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
- if (endWgt > reckonWgt)
- {
- //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
- //return;
- if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }else
- {
- if ((strWgt + endWgt) > reckonWgt)
- {
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = uRow.Cells["hgunit"].Text.Trim();
- frm.AllWgt = uRow.Cells["hgweight"].Text.Trim();
- frm.SxWgt = (reckonWgt - double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- }
- }
- }
- }
- double stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//炉(重量)
- double dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//炉(支数)
- ArrayList storageList = new ArrayList(); //仓库位置参数
- storageList.Add(uRow.Cells["lcode"].Text.Trim());
- storageList.Add(uRow.Cells["lotno"].Text.Trim());
- storageList.Add(uRow.Cells["hgunit"].Text.Trim());
- storageList.Add(storageno);
- storageList.Add(storageno + "10101");
- storageList.Add(storagetype);
- storageList.Add(storagetypedesc);
- //storageList.Add(manageno);
- //storageList.Add(managedesc);
- storageList.Add(this.UserInfo.GetUserName());
- storageList.Add(uRow.Cells["hgweight"].Value.ToString());
- storageList.Add(this.UserInfo.GetDeptid());
- storageList.Add(this.UserInfo.GetDepartment());
- storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
- storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- storageParm.Add(storageList);
- #region 要缴库的每一炉重量小于要缴库的重量
- matList.Add(uRow.Cells["lcode"].Text.Trim()); //炉号
- matList.Add(uRow.Cells["lotno"].Text.Trim());//批号
- matList.Add(uRow.Cells["hgunit"].Text.Trim());//支数
- matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
- matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
- if (uRow.Cells["cxsteellevel"].Text == "N80Q")
- {
- matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());
- matList.Add(uRow.Cells["cxsteellevel"].Text);
- }
- else
- {
- matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
- matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
- }
- matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
- matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
- matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
- matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
- matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
- matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
- matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
- matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
- matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
- matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
- matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
- matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
- matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
- matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
- matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
- matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
- matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
- matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
- matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
- matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
- matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
- string length = uRow.Cells["leng"].Text.Trim();
- if (length != "")
- {
- int n = length.IndexOf("-");
- string lengMin = length.Substring(0, n);
- string lengMax = length.Substring(n + 1);
- matList.Add(lengMin);//下限
- matList.Add(lengMax);//上限
- }
- else
- {
- matList.Add("");//下限
- matList.Add("");//上限
- }
- matList.Add(this.UserInfo.GetUserName());//操作人
- matList.Add("0");
- matList.Add("1");
- matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
- matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
- double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
- double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
- DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
- if (dtMemo.Rows.Count >= 1)
- {
- strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
- }
- //strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
- matList.Add(strInMemo);
- matList.Add(this.UserInfo.GetDeptid());
- matList.Add(this.UserInfo.GetDepartment());//37
- matList.Add(strInbound);
- matList.Add(this.cmbStorage.Value.ToString());//仓库号
- matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());
- matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());
- if (buttonValue == "2")
- {
- matList.Add(frmcount);//42
- }
- else
- {
- matList.Add(uRow.Cells["hgunit"].Value.ToString());
- }
- // matList.Add(uRow.Cells["hgunit"].Value.ToString());
- matList.Add(uRow.Cells["rcdid"].Value.ToString());
- matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
- matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
- matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
- //matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));//判定时间
- matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
- matList.Add(factoryCode);
- matList.Add(factoryNo);
- //matList.Add(steelCode);
- //matList.Add(steelName);
- matList.Add("");
- matList.Add(uRow.Cells["steelgrade"].Text.ToString());
- matList.Add(this.txtMemo.Text.Trim());
- matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
- matList.Add(sourceCode);//材料来源代码
- matList.Add(sourceName);//材料名称
- matList.Add(ks);
- if (buttonValue == "1")
- {
- matList.Add("801703");//成品区分
- }
- else if (buttonValue == "2")
- {
- matList.Add("801701");//成品区分
- }
- matParm.Add(matList);
- plnList.Add(stWeight.ToString("f3"));
- plnList.Add(dbunit.ToString());
- plnList.Add(this.UserInfo.GetUserName());
- plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
- plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
- plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
- plnSpale.Add(plnList);
- //break;
- #endregion
- ArrayList statusList = new ArrayList();
- statusList.Add(uRow.Cells["lcode"].Text.Trim());
- statusList.Add(uRow.Cells["lotno"].Text.Trim());
- statusList.Add(uRow.Cells["factory"].Value.ToString());
- statusList.Add(uRow.Cells["testdate"].Value.ToString());
- statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
- statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
- statusList.Add(uRow.Cells["RCDID"].Value.ToString());
- statusUpdate.Add(statusList);
- }
- }
- }
- #endregion
- else
- {
- #region 无合同时
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
- {
-
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
-
- orderType = doQueryOrderType(uRow.Cells["ordername"].Text.Trim().Substring(0, uRow.Cells["ordername"].Text.Trim().IndexOf("/")));
- if (orderType.Equals("120103"))
- {
- MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("此炉号【" + uRow.Cells["lcode"].Text.Trim() + "】是否全部缴库为计划外的成品?") == DialogResult.No)
- {
- return;
- }
- ArrayList matList = new ArrayList();
- ArrayList plnList = new ArrayList();
-
- double stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//炉(重量)
- double dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//炉(支数)
- ArrayList storageList = new ArrayList(); //仓库位置参数
- storageList.Add(uRow.Cells["lcode"].Value.ToString());
- storageList.Add(uRow.Cells["lotno"].Value.ToString());
- storageList.Add(uRow.Cells["hgunit"].Value.ToString());
- storageList.Add(storageno);
- storageList.Add(storageno + "10101");
- storageList.Add(storagetype);
- storageList.Add(storagetypedesc);
- //storageList.Add(manageno);
- //storageList.Add(managedesc);
- storageList.Add(this.UserInfo.GetUserName());
- storageList.Add(uRow.Cells["hgweight"].Value.ToString());
- storageList.Add(this.UserInfo.GetDeptid());
- storageList.Add(this.UserInfo.GetDepartment());
- storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
- storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- storageParm.Add(storageList);
- #region 要缴库的每一炉重量小于要缴库的重量
- matList.Add(uRow.Cells["lcode"].Value.ToString()); //炉号
- matList.Add(uRow.Cells["lotno"].Value.ToString());//批号
- matList.Add(uRow.Cells["hgunit"].Value.ToString());//支数
- matList.Add(uRow.Cells["cxkind"].Value.ToString());//品名代码
- matList.Add(uRow.Cells["cxkind"].Text.ToString());//品名名称
- matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());//钢级(牌号)代码
- matList.Add(uRow.Cells["cxsteellevel"].Text.ToString());//钢级名称
- matList.Add(uRow.Cells["cxgg"].Value.ToString());//产品规格代码
- matList.Add(uRow.Cells["cxgg"].Text.ToString());//产品规格描述
- matList.Add(uRow.Cells["cxtypeofthread"].Value.ToString());//扣型代码
- matList.Add(uRow.Cells["cxtypeofthread"].Text.ToString());//扣型描述 10
- matList.Add("");//标准代码
- matList.Add("");//标准名称
- matList.Add("");
- matList.Add("");
- matList.Add("");//标准类别代码
- matList.Add(uRow.Cells["STDSTYLE"].Value.ToString());//标准类别描述
- matList.Add("");//合同号
- matList.Add("");//合同行号
- matList.Add("");//交货行号
- matList.Add("");//合同主键
- matList.Add("");//合同行主键
- matList.Add("");//交货行主键
- DataTable ts = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getDiamter", new object[] { uRow.Cells["cxgg"].Value.ToString() }, this.ob);
- if (ts.Rows.Count > 0)
- {
- matList.Add(ts.Rows[0]["DIMATER"].ToString());// 外径
- matList.Add(ts.Rows[0]["HEIGHT"].ToString());//壁厚
- }
- else
- {
- MessageUtil.ShowTips("此产品规格【" + uRow.Cells["cxgg"].Value.ToString() + "】未维护外径壁厚,无法缴库");
- return;
- }
- matList.Add("");//长度编码(订货)
- matList.Add("");//长度描述(订货)
- matList.Add("");//长度单位 27
- string length = row.Cells["leng"].Text.Trim();
- if (length != "")
- {
- int n = length.IndexOf("-");
- string lengMin = length.Substring(0, n);
- string lengMax = length.Substring(n + 1);
- matList.Add(lengMin);//下限
- matList.Add(lengMax);//上限
- }
- else
- {
- matList.Add("");//下限
- matList.Add("");//上限
- }
- matList.Add(this.UserInfo.GetUserName());//操作人
- matList.Add("0");
- matList.Add("1");
- matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
- matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
- double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
- double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
- DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
- if (dtMemo.Rows.Count >= 1)
- {
- strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
- }
- //strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
- matList.Add(strInMemo);
- matList.Add(this.UserInfo.GetDeptid());
- matList.Add(this.UserInfo.GetDepartment());//37
- matList.Add(strInbound);
- matList.Add(this.cmbStorage.Value.ToString());//仓库号
- if (uRow.Cells["DEPARTM"].Text.ToString().Contains("国贸"))
- {
- matList.Add("100102");//销售组织代码
- matList.Add("国贸公司");
- }
- else
- {
- matList.Add("100101");//销售组织代码
- matList.Add("销售公司");
- }
- matList.Add(uRow.Cells["hgunit"].Value.ToString());
- matList.Add(uRow.Cells["rcdid"].Value.ToString());
- matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
- matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
- matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
- //matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + uRow.Cells["testdate"].Value.ToString().Substring(5, 2));//判定时间
- matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
- matList.Add(factoryCode);
- matList.Add(factoryNo);
- //matList.Add(steelCode);
- //matList.Add(steelName);
- matList.Add("");
- matList.Add(uRow.Cells["steelgrade"].Text.ToString());
- matList.Add(this.txtMemo.Text.Trim());
- matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
- matList.Add(sourceCode);//材料来源代码
- matList.Add(sourceName);//材料名称
- matList.Add(ks);
- matList.Add("801702");//成品区分
- matParm.Add(matList);
- plnList.Add(stWeight.ToString("f3"));
- plnList.Add(dbunit.ToString());
- plnList.Add(this.UserInfo.GetUserName());
- plnList.Add("");
- plnList.Add("");
- plnList.Add("");
- plnSpale.Add(plnList);
- //break;
- #endregion
- ArrayList statusList = new ArrayList();
- statusList.Add(uRow.Cells["lcode"].Value.ToString());
- statusList.Add(uRow.Cells["lotno"].Value.ToString());
- statusList.Add(uRow.Cells["factory"].Value.ToString());
- statusList.Add(uRow.Cells["testdate"].Value.ToString());
- statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
- statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
- statusList.Add(uRow.Cells["RCDID"].Value.ToString());
- statusUpdate.Add(statusList);
- }
- }
- #endregion
- }
-
- //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
- ccp.MethodName = "doPipeIn";
- ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("缴库成功!"))
- {
- QueryMatData();
- this.cmbSteel.Text = "";
- this.cmbFactory.Text = "";
- this.txt_Ks.Value = "0";
- if (ugr3 != null)
- {
- QueryOrder(ugr3.Cells["ORDER_NO"].Text.Trim(), ugr3.Cells["ORDER_SEQ"].Text.Trim());
- }
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
-
- }
- /// <summary>
- /// 缴库
- /// </summary>
- private void DoPipeIn()
- {
- ultraGrid3.UpdateData();
- ultraGrid1.UpdateData();
- string buttonValue = "";//返回的按钮值
- string frmcount = "";//返回的支数
- string frmWgt = "";//返回的重量值
- string frmFinishedCode = "";
- storageParm = new ArrayList();
- matParm = new ArrayList();
- statusUpdate = new ArrayList();
- plnSpale = new ArrayList();
- ArrayList listdt = new ArrayList();
- string[] wgtList = new string[3];
- int conu = 0;
- string orderType = "";
- int count = 0;
- UltraGridRow ugr3 = ultraGrid3.ActiveRow;
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (ugr3 == null) { MessageUtil.ShowTips("待缴库无合同数据,不能进行此操作"); return; }
- if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
- double strWgt = 0;//炉重
- double endWgt = 0;//已缴库量
- double orderWgt = 0;//合同量
- int m = 0;
- int nn = 0;
- foreach (UltraGridRow row1 in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row1.Cells["CHK"].Text) == true)
- {
- if (row1.Cells["hgweight"].Text == "")
- {
- MessageUtil.ShowTips("该炉还未生产,无法缴库!");
- return;
- }
- if (double.Parse(row1.Cells["hgweight"].Text) < 0)
- {
- MessageUtil.ShowWarning("已缴库量无法进行冲销!");
- return;
- }
- strWgt += double.Parse(row1.Cells["hgweight"].Value.ToString());
- m++;
- }
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请勾选需要操作的记录!");
- return;
- }
- if (m > 1)
- {
- MessageUtil.ShowTips("缴库时不允许多炉同时缴库!");
- return;
- }
- foreach (UltraGridRow row7 in ultraGrid3.Rows)
- {
- if (Convert.ToBoolean(row7.Cells["CHK"].Text) == true)
- {
- nn++;
- }
- }
- if (nn < 1)
- {
- MessageUtil.ShowTips("请勾选待缴库合同数据!");
- return;
- }
-
- double delPla = 0;//已缴库量
- string _length = "";//长度范围
- int d = 0;
- double downLength = 0;//下限
- double upLength = 0;//上限
- string orderUnit = "";//长度单位
- double reckonWgt = 0;//估算量上限
- string gSwgt = "";//合同估算总量
- string pipSwgt = "";//合同缴库总量
- string dSwgt = "";//订货总量
-
- if (cmbStorage.Text.ToString() == "")
- {
- MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else
- {
- storageno = this.cmbStorage.Value.ToString();
- }
- if (this.cmbFactory.Text.ToString() == "")
- {
- //MessageUtil.ShowTips("产线不允许为空!");
- //return;
- factoryCode = "";
- factoryNo = "";
- }
- else
- {
- factoryCode = this.cmbFactory.Value.ToString();
- factoryNo = this.cmbFactory.Text.ToString();
- }
- //if (this.cmbSteel.Text.ToString() == "")
- //{
- // //MessageUtil.ShowTips("钢种不允许为空!");
- // //return;
- // steelCode = "";
- // steelName = "";
- //}
- //else
- //{
- // steelCode = this.cmbSteel.Value.ToString();
- // steelName = this.cmbSteel.Text.ToString();
- //}
- if (this.cmbSource.Text.ToString() == "")
- {
- //MessageUtil.ShowTips("钢种不允许为空!");
- //return;
- sourceCode = "";
- sourceName = "";
- }
- else
- {
- sourceCode = this.cmbSource.Value.ToString();
- sourceName = this.cmbSource.Text.ToString();
- }
- if (this.txt_Ks.Value == null)
- {
- ks = "0";
- }
- else
- {
- ks = this.txt_Ks.Value.ToString();
- }
- DataTable ds = new DataTable();
- UltraGridRow grid3Row = null;
- string strRANGE_MIN = "";
- string strRANGE_MAX = "";
- double dbQtyMin = 0;
- double dbQtyMax = 0;
- double dbJhMax = 0;//估算量上限
- double dbOrderMax = 0;//合同订货量上限
- string strOrder = "";
- //int dex = 0;
- //string ordername = "";
- //string orderNo = "";
- //string orderSeQ = "";
- foreach (UltraGridRow row5 in ultraGrid3.Rows)
- {
- if (Convert.ToBoolean(row5.Cells["CHK"].Text) == true)
- {
- if (row5.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
- {
- MessageUtil.ShowTips("合同物料不匹配不允许缴库!");
- return;
- }
- if (row5.Cells["MATCHORDER"].Text.Trim().Contains("合同不匹配"))
- {
- MessageUtil.ShowTips("合同不匹配不允许缴库,可强制缴库!");
- return;
- }
- strOrder = ugr3.Cells["ORDER_NO"].Text.Trim() + "/" + ugr3.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
- orderUnit = ugr3.Cells["ORDER_UNIT"].Text.Trim();
- endWgt = double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString());
- orderWgt = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString());
- strRANGE_MIN = ugr3.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
- strRANGE_MAX = ugr3.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
- dbQtyMin = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
- dbQtyMax = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
- dbJhMax = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
- if (orderUnit.Contains("支") || orderUnit.Equals("吨"))
- {
- dbOrderMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);
- }
- else if (orderUnit.Contains("磅"))
- {
- 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);
- }
- wgtList = getOrderWgt(ugr3.Cells["ORDER_NO"].Text.ToString());
- if (wgtList.Length > 0)
- {
- gSwgt = wgtList[0];
- pipSwgt = wgtList[1];
- dSwgt = wgtList[2];
- }
- grid3Row = row5;
- }
- }
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
- {
- if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
- {
- if (row3.Cells["CXSTUPP"].Text.Trim() == "")
- {
- MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
- return;
- }
- if (row3.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
- {
- MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库!");
- return;
- }
-
- ds.Clear();
- 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);
- if (ds.Rows[0][0].ToString() == "20")
- {
- MessageUtil.ShowTips("您选中的【" + row3.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
- return;
- }
- //ordername = row3.Cells["ordername"].Text.Trim();
- //dex = ordername.IndexOf("/");
- //orderNo = ordername.Substring(0, dex);
- //orderSeQ = ordername.Substring(dex + 1).PadLeft(3, '0');
- //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder", new object[] { orderNo, orderSeQ }, this.ob);
- //if (dt.Rows.Count > 0)
- //{
- // MessageUtil.ShowTips("此缴库合同号有对应合同号合同行号数据存在,请勾选相应待缴合同!");
- // return;
- //}
- //if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
- //{
- // if (row3.Cells["hgm"].Text.Trim() == "")
- // {
- // MessageUtil.ShowTips("此合同不是按吨交货,长度为空不能缴库!");
- // return;
- // }
- //}
- _length = row3.Cells["leng"].Text.Trim();
- if (_length != "")
- {
- d = _length.IndexOf("-");
- downLength = double.Parse(_length.Substring(0, d));
- upLength = double.Parse(_length.Substring(d + 1));
- if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
- {
- 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)))
- {
- if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row3.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + grid3Row.Cells["LEN"].Text + "】米,是否缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
- {
- 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)))
- {
- //if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】英尺,是否缴库?") == DialogResult.No)
- //{
- // return;
- //}
- 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)
- {
- return;
- }
- }
- }
- }
- else
- {
- MessageUtil.ShowTips("长度上下限为空,不允许缴库可进行强制缴库!");
- return;
- }
- }
- string newSql_no = "";
- //conu += 1;
- int index = row3.Cells["ordername"].Text.Trim().IndexOf("/");
- string sql_no = row3.Cells["ordername"].Text.Trim().Substring(index + 1);
- if (sql_no.Length < 4)
- {
- sql_no = sql_no.PadLeft(4, '0');
- }
- if (strOrder != (row3.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no))
- {
- MessageUtil.ShowTips("质保数据合同号" + (row3.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no) + "信息与待缴合同" + strOrder + "信息不一致,不能缴库可强制缴库!");
- return;
- }
- delPla += double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim());
- orderType = doQueryOrderType(row3.Cells["ordername"].Text.Trim().Substring(0, index));
- if (orderType.Equals("120103"))
- {
- MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
- return;
- }
- else if (orderType.Equals("120104"))
- {
- MessageUtil.ShowTips("该合同为预排合同,只允许强制缴库成成品!");
- return;
- }
- if (strWgt > 0)
- {
- if (orderUnit.Equals("吨") || orderUnit.Equals("支") || orderUnit.Contains("磅"))
- {
- if (endWgt > dbOrderMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
- {
- //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
- return;
- }
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = row3.Cells["hgunit"].Text.Trim();
- frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
- if (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
- {
- frm.SxWgt = "0";
- }
- else
- {
- frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- }
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > dbOrderMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > dbOrderMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
-
- }
- else
- {
- if ((strWgt + endWgt) > dbOrderMax)
- {
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = row3.Cells["hgunit"].Text.Trim();
- frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
- frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > dbJhMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > dbJhMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- }
- }
- else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
- {
- if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
- {
- MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
- return;
- }
- reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
- if (endWgt > reckonWgt)
- {
- //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
- //return;
- if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = row3.Cells["hgunit"].Text.Trim();
- frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
- if (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
- {
- frm.SxWgt = "0";
- }
- else
- {
- frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- }
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- //if (int.Parse(frmcount).Equals(0))
- //{
- // MessageUtil.ShowTips("合同上限已满,不能按合同上限入库!");
- // return;
- //}
- if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- }
- }
- else
- {
- if ((strWgt + endWgt) > reckonWgt)
- {
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = row3.Cells["hgunit"].Text.Trim();
- frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
- frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- //if (int.Parse(frmcount).Equals(0))
- //{
- // MessageUtil.ShowTips("合同上限已满,不能按合同上限入库!");
- // return;
- //}
- if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
-
- }
- }
- }
- }
- }
- }
- }
-
-
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row4 in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row4.Cells["CHK"].Text) == true)
- {
- if (double.Parse(row4.Cells["hgweight"].Text.Trim()) < 0)
- {
- if (double.Parse(row4.Cells["hgweight"].Text.Trim()) + double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
- {
- MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
- return;
- }
- else
- {
- if (int.Parse(row4.Cells["hgunit"].Text.Trim()) > int.Parse(grid3Row.Cells["PAYDOWN_NUM"].Text.Trim()))
- {
- MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
- return;
- }
- }
- }
- }
- }
- UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
- .OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
- double dbDelvry = 0;
- double dbweigh = 0;
- double dbcount = 0;
- double endweigth = 0;
- //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale, row.Cells["hgunit"].Value.ToString() }, this.ob);
- if (MessageUtil.ShowYesNoAndQuestion("是否确认缴库?") == DialogResult.No) return;
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- ArrayList matList = new ArrayList();
- ArrayList plnList = new ArrayList();
- double stWeight = 0;
- double dbunit = 0;
- //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] {}, this.ob);
- //if (grid3Row.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
- //{
- // MessageUtil.ShowTips("待缴库合同在生产中,不能进行缴库!");
- // return;
- //}
- if (buttonValue == "2")
- {
- stWeight = double.Parse(frmWgt);
- dbunit = double.Parse(frmcount);
- }
- else
- {
- stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//已缴库量+炉(重量)
- dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//已缴库支数+炉(支数)
- }
-
- ArrayList storageList = new ArrayList(); //仓库位置参数
- storageList.Add(uRow.Cells["lcode"].Text.Trim());
- storageList.Add(uRow.Cells["lotno"].Text.Trim());
- storageList.Add(uRow.Cells["hgunit"].Text.Trim());
- storageList.Add(storageno);
- storageList.Add(storageno + "10101");
- storageList.Add(storagetype);
- storageList.Add(storagetypedesc);
- //storageList.Add(manageno);
- //storageList.Add(managedesc);
- storageList.Add(this.UserInfo.GetUserName());
- storageList.Add(uRow.Cells["hgweight"].Value.ToString());
- storageList.Add(this.UserInfo.GetDeptid());
- storageList.Add(this.UserInfo.GetDepartment());
- storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
- storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- storageParm.Add(storageList);
- #region 要缴库的每一炉重量小于要缴库的重量
- matList.Add(uRow.Cells["lcode"].Text.Trim()); //炉号
- matList.Add(uRow.Cells["lotno"].Text.Trim());//批号
- matList.Add(uRow.Cells["hgunit"].Text.Trim());//支数
- matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
- matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
- if (uRow.Cells["cxsteellevel"].Text == "N80Q")
- {
- matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());
- matList.Add(uRow.Cells["cxsteellevel"].Text);
- }
- else
- {
- matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
- matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
- }
- matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
- matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
- matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
- matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
- matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
- //matList.Add("");//标准代码
- //matList.Add(uRow.Cells["standard"].Value.ToString());
- matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
- matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
- matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
- matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
- matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
- matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
- matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
- matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
- matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
- matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
- matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
- matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
- matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
- matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
- matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
- matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
- string length = uRow.Cells["leng"].Text.Trim();
- int n = length.IndexOf("-");
- string lengMin = length.Substring(0, n);
- string lengMax = length.Substring(n + 1);
- matList.Add(lengMin);//下限
- matList.Add(lengMax);//上限
- matList.Add(this.UserInfo.GetUserName());//操作人30
- matList.Add("0");
- matList.Add("1");
- matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
- matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
- double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
- double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
- //生成入库单号
- //ArrayList pram = new ArrayList();
- //pram.Add(DateTime.Now.ToString("yyyy/MM/dd"));
- //pram.Add(strInbound);
- //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getInListDoc", new object[] { pram }, ob);
- //string str = "";
- //if (dt.Rows.Count >= 1)
- //{
- // str = dt.Rows[0]["INSTOCK_DOC"].ToString();
- //}
- DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
- if (dtMemo.Rows.Count >= 1)
- {
- strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
- }
- //strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
- matList.Add(strInMemo);
- matList.Add(this.UserInfo.GetDeptid());
- matList.Add(this.UserInfo.GetDepartment());//37
- matList.Add(strInbound);
- matList.Add(this.cmbStorage.Value.ToString());//仓库号851731
- matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());
- matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());
- if (buttonValue == "2")
- {
- matList.Add(frmcount);//42
- }
- else
- {
- matList.Add(uRow.Cells["hgunit"].Value.ToString());
- }
- matList.Add(uRow.Cells["rcdid"].Value.ToString());
- matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
- matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(),this.ob));
- matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
- //matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));// 判定时间
- matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
- matList.Add(factoryCode);
- matList.Add(factoryNo);//50
- //matList.Add(steelCode);
- //matList.Add(steelName);
- matList.Add("");
- matList.Add(uRow.Cells["steelgrade"].Text.ToString());
- matList.Add(this.txtMemo.Text.Trim());//手动输入的备注
- matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
- matList.Add(sourceCode);//材料来源代码
- matList.Add(sourceName);//材料名称
- matList.Add(ks);//捆数
- if (buttonValue == "1")
- {
- matList.Add("801703");//成品区分
- }
- else if (buttonValue == "2")
- {
- matList.Add("801701");//成品区分
- }
- matParm.Add(matList);
- plnList.Add(stWeight.ToString("f3"));
- if (double.Parse(uRow.Cells["hgweight"].Value.ToString()) > 0)
- {
- plnList.Add(dbunit.ToString());
- }
- else
- {
- plnList.Add(int.Parse(ugr3.Cells["hgunit"].Text.Trim()).ToString());
- }
- plnList.Add(this.UserInfo.GetUserName());
- plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
- plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
- plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
- plnSpale.Add(plnList);
- //break;
- #endregion
- //}
- //else
- //{
- // return;
- //}
- ArrayList statusList = new ArrayList();
- statusList.Add(uRow.Cells["lcode"].Text.Trim());
- statusList.Add(uRow.Cells["lotno"].Text.Trim());
- statusList.Add(uRow.Cells["factory"].Value.ToString());
- statusList.Add(uRow.Cells["testdate"].Value.ToString());
- statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
- statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
- statusList.Add(uRow.Cells["RCDID"].Value.ToString());
- statusUpdate.Add(statusList);
- }
- }
- //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
- ccp.MethodName = "doPipeIn";
- ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
- ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("缴库成功!"))
- {
- QueryMatData();
- this.cmbSteel.Text = "";
- this.cmbFactory.Text = "";
- this.txt_Ks.Value = "0";
- QueryOrder(grid3Row.Cells["ORDER_NO"].Text.Trim(), grid3Row.Cells["ORDER_SEQ"].Text.Trim());
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
-
- }
-
- }
- /// <summary>
- /// 查询合同类型
- /// </summary>
- /// <param name="orderNo"></param>
- /// <param name="orderSeq"></param>
- private string doQueryOrderType(string orderNo)
- {
- string orderType = "";
- //判断合同类型
- DataTable orderDs = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryOrderType", new object[] { orderNo }, ob);
- if (orderDs.Rows.Count > 0)
- {
- orderType = orderDs.Rows[0]["ORDER_TYP"].ToString();
- }
- return orderType;
- }
- /// <summary>
- /// 按合同号、合同行号查询已缴库合同
- /// </summary>
- /// <param name="orderNo"></param>
- /// <param name="OrderSeqNo"></param>
- private void QueryOrder(string orderNo, string orderSeqNo)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder1", new object[] { orderNo, orderSeqNo }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- }
- /// <summary>
- /// 撤销缴库
- /// </summary>
- private void DoCanclePipeIn()
- {
- ultraGrid4.UpdateData();
- UltraGridRow ugr = ultraGrid4.ActiveRow;
- if (ugr == null)
- return;
- ArrayList list = new ArrayList();
- ArrayList list1 = new ArrayList();
- ArrayList list2 = new ArrayList();
- int n = 0;
- string moth = "";
- string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
- foreach(UltraGridRow us in ultraGrid4.Rows)
- {
- if (Convert.ToBoolean(us.Cells["CHK"].Text) == true)
- {
- n++;
- }
- }
- if (n < 1)
- {
- MessageBox.Show("请选择要操作的数据!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
- return;
- }
- int m = 0;
- foreach (UltraGridRow pro in ultraGrid4.Rows)
- {
- if (Convert.ToBoolean(pro.Cells["CHK"].Value))
- {
- if (double.Parse(pro.Cells["ACT_WEIGHT"].Text.Trim()) > 0)
- {
- if (pro.Cells["PRODUCT_FLAG"].Text.Trim() == "成品" || pro.Cells["PRODUCT_FLAG"].Text.Trim() == "在制品")
- {
- ArrayList prolist = new ArrayList();
- prolist.Add(pro.Cells["INSTOCK_DOC"].Value.ToString());
- prolist.Add(pro.Cells["JUDGE_STOVE_NO"].Value.ToString());
- prolist.Add(pro.Cells["BATCH_NO"].Value.ToString());
- prolist.Add(pro.Cells["BATCH_GROUD_NO"].Value.ToString());
- DataTable prodt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryProFlag", new object[] { prolist }, ob);
- if (int.Parse(prodt.Rows[0]["ACOUNT"].ToString()) > 0)
- {
- m = m + 1;
- }
- }
- }
- }
- }
- if (m > 0)
- {
- MessageUtil.ShowTips("请勾选类别为商品的数据撤销!");
- return;
- }
- foreach (UltraGridRow row in ultraGrid4.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Value))
- {
- //if (double.Parse(row.Cells["ACT_WEIGHT"].Text.Trim()) > 0)
- //{
- // if (row.Cells["PRODUCT_FLAG"].Text.Trim() == "成品" || row.Cells["PRODUCT_FLAG"].Text.Trim() == "在制品")
- // {
- // ArrayList prolist = new ArrayList();
- // prolist.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
- // prolist.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
- // prolist.Add(row.Cells["BATCH_NO"].Value.ToString());
- // prolist.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
- // DataTable prodt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryProFlag", new object[] { prolist }, ob);
- // if (int.Parse(prodt.Rows[0]["ACOUNT"].ToString()) > 0)
- // {
- // m = m + 1;
- // }
- // MessageUtil.ShowTips("请勾选类别为商品的数据撤销!");
- // return;
- // }
- //}
- //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);
- //if (dt.Rows.Count > 0)
- //{
- // MessageUtil.ShowWarning("[合同号为:" + row.Cells["ORDER_NO"].Value.ToString() + "、合同行号为:" + row.Cells["ORDER_SEQ"].Value.ToString() + "、交货行为:" + row.Cells["DELIVERY_NO"].Value.ToString() + "]的数据已做计划,无法撤销!");
- // return;
- //}
- 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);
- if (ds.Rows.Count == 0)
- {
- MessageUtil.ShowTips("此炉批组已发运,不允许撤销!");
- return;
- }
- else if (ds.Rows.Count == 1)
- {
- if (ds.Rows[0].ToString().Equals("80150302"))
- {
- MessageUtil.ShowWarning("该炉批组的数据不是可编提单状态,无法撤销!");
- return;
- }
- }
- else if (ds.Rows.Count > 1)
- {
- for (int i = 0; i < ds.Rows.Count; i++)
- {
- if (ds.Rows[i].ToString().Equals("80150302"))
- {
- MessageUtil.ShowWarning("该炉批组的数据不是可编提单状态,无法撤销!");
- return;
- }
- }
- }
- 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);
- if (int.Parse(dd.Rows[0]["ACOUNT"].ToString()) > 0)
- {
- MessageUtil.ShowTips("炉号:" + row.Cells["JUDGE_STOVE_NO"].Text + "、批号:" + row.Cells["BATCH_NO"].Text + "的数据有被封锁的,不能撤销!");
- return;
- }
- ArrayList parm = new ArrayList();
- moth = DateTime.Parse(row.Cells["BAL_YEAR_MONTH"].Text).AddMonths(1).ToString("yyyyMM");
- parm.Add(moth);
- DataTable dg = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { parm, arr }, ob);
- if (int.Parse(dg.Rows[0]["ACOUNT"].ToString()) > 0)
- {
- MessageUtil.ShowTips("此炉【" + row.Cells["JUDGE_STOVE_NO"].Text + "】已进行结转,不允许撤销!");
- return;
- }
- ArrayList pram = new ArrayList();
- ArrayList pram1 = new ArrayList();
- ArrayList pram2 = new ArrayList();
- pram1.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
- pram1.Add(row.Cells["BATCH_NO"].Value.ToString());
- DataTable td = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSumWgt", new object[] { row.Cells["INSTOCK_DOC"].Text.Trim() }, this.ob);
- pram1.Add(td.Rows[0]["ACT_COUNT"].ToString());
- pram1.Add(td.Rows[0]["ACT_WEIGHT"].ToString());
- pram1.Add(row.Cells["ZB_RCDID"].Value.ToString());
- pram1.Add(row.Cells["SPEC_NAME"].Value.ToString());
- pram1.Add(row.Cells["MODEL_DESC"].Value.ToString());
- pram1.Add(row.Cells["STD_NAME"].Value.ToString());
- pram1.Add(row.Cells["ACT_LEN_MIN"].Value.ToString());
- pram1.Add(row.Cells["ACT_LEN_MAX"].Value.ToString());
- pram1.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
- pram1.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
- list1.Add(pram1);
-
- pram.Add(row.Cells["ORDER_NO"].Value.ToString());
- pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
- pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
- pram.Add(row.Cells["ACT_COUNT"].Value.ToString());
- pram.Add(row.Cells["ORDER_NO"].Value.ToString());
- pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
- pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
- pram.Add(row.Cells["ACT_WEIGHT"].Value.ToString());
- //pram.Add(this.UserInfo.GetUserName());
- pram.Add(row.Cells["ORDER_NO"].Value.ToString());
- pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
- pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
- if (row.Cells["PRODUCT_FLAG"].Value.ToString() == "成品")
- {
- pram.Add("801402");//类别
- }
- else if (row.Cells["PRODUCT_FLAG"].Value.ToString() == "商品")
- {
- pram.Add("801403");//类别
- }
-
- list.Add(pram);
- pram2.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
- pram2.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
- pram2.Add(row.Cells["BATCH_NO"].Value.ToString());
- pram2.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
- list2.Add(pram2);
- }
- }
- if (MessageBox.Show("是否确认撤销缴库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- return;
- int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.canclePipein", new Object[] { list1, list,list2 }, this.ob);
- if (count > 0)
- {
- QueryInList();
- MessageBox.Show("撤销缴库成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
-
- }
- }
- /// <summary>
- /// 库存查询
- /// </summary>
- private void QueryPipedData()
- {
- ArrayList pram = new ArrayList();
- string intimeStart = ""; //缴库起始时间
- string intimeEnd = ""; //缴库结束时间
- string stoveno = ""; //炉号
- string order = "";
- string stroage = "";
- if (ultraCheckEditor5.Checked)
- {
- intimeStart = StartTime.Value.ToString();
- intimeEnd = EndTime.Value.ToString();
- }
- if (chkJudge.Checked)
- {
- if (cmbJudge.Text.Trim()=="")
- {
- MessageUtil.ShowTips("炉号不能为空,请选择!");
- return;
- }
- stoveno = cmbJudge.Text.Trim();
- }
- if (chkOrder.Checked)
- {
- if (cmbOrder.Text.Trim()=="")
- {
- MessageUtil.ShowTips("合同号不能为空,请选择!");
- return;
- }
- order = cmbOrder.Text.Trim();
- }
- if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
- {
- MessageUtil.ShowTips("开始时间不能大于结束时间!");
- return;
- }
- if (chkStrong.Checked)
- {
- if (cmbStorager.Text.Trim() == "")
- {
- MessageUtil.ShowTips("仓库不能为空,请选择!");
- return;
- }
- stroage = cmbStorager.Value.ToString();
- }
-
- //pram.Add(stoveno);
- //pram.Add(stoveno);
- pram.Add(stoveno);
- //pram.Add(order);
- //pram.Add(order);
- pram.Add(order);
- //pram.Add(stroage);
- //pram.Add(stroage);
- pram.Add(stroage);
- //string arr = UserInfo.GetDeptid();
- string areaNo = "";
- string userName = UserInfo.GetUserName();
- string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
- //if (!userName.Equals("admin"))
- //{
- // DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.querySaleOrg", new object[] { arr }, this.ob);
- // if (ds.Rows.Count > 0)
- // {
- // areaNo = ds.Rows[0][0].ToString();
- // }
- //}
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryMat", new object[] { pram, arr, intimeStart, intimeEnd }, this.ob);//MatData
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
- //padWgt(ultraGrid2, "ACT_WEIGHT");
- //UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid2.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid2.DisplayLayout.Bands[0].Columns["STD_NAME"] };
- //GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, col);
- //this.ultraGrid2.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
- }
- /// <summary>
- /// 补充重量小数位
- /// </summary>
- /// <param name="urd"></param>
- /// <param name="colums"></param>
- public void padWgt(UltraGrid urd,string colums)
- {
- foreach (UltraGridRow ugr in urd.Rows)
- {
- if (!StringUtil.IsInt(ugr.Cells[colums].Value.ToString()))
- {
- int d = ugr.Cells[colums].Value.ToString().IndexOf(".");
- if (ugr.Cells[colums].Value.ToString().Substring(d + 1).Length > 0)
- {
- if (ugr.Cells[colums].Value.ToString().Substring(d + 1).Length < 3)
- {
- ugr.Cells[colums].Value = ugr.Cells[colums].Value.ToString().Substring(0, d + 1) + ugr.Cells[colums].Value.ToString().Substring(d + 1).PadRight(3, '0');
- }
- }
- }
- else
- {
- ugr.Cells[colums].Value = ugr.Cells[colums].Value.ToString() + ".000";
- }
- }
- }
- /// <summary>
- /// CheckBox选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
- {
- if (chkJudge.Checked)
- cmbJudge.Enabled = true;
- else
- {
- cmbJudge.Enabled = false;
- //cmbJudge.Text = "";
- }
- if (chkOrder.Checked)
- cmbOrder.Enabled = true;
- else
- {
- cmbOrder.Enabled = false;
- //cmbOrder.Text = "";
- }
- if (ultraCheckEditor1.Checked)
- cmbMatch.Enabled = true;
- else
- {
- cmbMatch.Enabled = false;
- //cmbMatch.Text = "";
- }
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- if (toolMenu == null) return;
- if (ultraTabControl1.SelectedTab.Key == "2")
- {
- if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
- {
- toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
- {
- toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query"))
- {
- toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
- {
- toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
- {
- toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
- {
- toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
- {
- toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
- {
- toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
- {
- toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
- {
- toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
- {
- toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
- {
- toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
- {
- toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
- {
- toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
- {
- toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
- {
- toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
- {
- toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
- {
- toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- chkStrong.Visible = true;
- cmbStorager.Visible = true;
-
- ultraCheckEditor1.Visible = false;
- cmbMatch.Visible = false;
- ultraCheckEditor5.Enabled = true;
- this.ultraCheckEditor5.Text = "入库时间";
- chkBathYear.Visible = false;
- dtBathYear.Visible = false;
- }
- else if (ultraTabControl1.SelectedTab.Key == "1")
- {
- if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
- {
- toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
- {
- toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
- {
- toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
- {
- toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
- {
- toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- //toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
- if (toolMenu.Toolbars[0].Tools.Exists("Query"))
- {
- toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
- {
- toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
- {
- toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
- {
- toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
- {
- toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
- {
- toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
- {
- toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
- {
- toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
- {
- toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
- {
- toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
- {
- toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
- {
- toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
- {
- toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- chkStrong.Visible = false;
- cmbStorager.Visible = false;
- chkBathYear.Visible = false;
- dtBathYear.Visible = false;
- this.ultraCheckEditor5.Enabled = true;
- this.ultraCheckEditor1.Enabled = true;
- ultraCheckEditor1.Visible = true;
- cmbMatch.Visible = true;
- this.ultraCheckEditor5.Text = "判定时间";
- }
- else
- {
- if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
- {
- toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
- {
- toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query"))
- {
- toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
- {
- toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
- {
- toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
- {
- toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
- {
- toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
- {
- toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
- {
- toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
- {
- toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
- {
- toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
- {
- toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
- {
- toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
- {
- toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
- {
- toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
- {
- toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
- {
- toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
- {
- toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- this.ultraCheckEditor1.Enabled = false;
- chkStrong.Visible = true;
- cmbStorager.Visible = true;
- chkBathYear.Visible = true;
- dtBathYear.Visible = true;
- this.ultraCheckEditor5.Text = "入库时间";
- ultraCheckEditor1.Visible = false;
- cmbMatch.Visible = false;
- }
- }
- /// <summary>
- /// 选择仓库之后获取对应的信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraComboEditor4_ValueChanged(object sender, EventArgs e)
- {
- storageno = cmbStorage.Value.ToString();
- DataRow[] dr = ((DataTable)cmbStorage.DataSource).Select("STORAGE_NO='" + storageno+ "'");
- if (dr.Length > 0)
- {
- storagetype=dr[0]["STORAGE_TYPE_NO"].ToString();
- storagetypedesc=dr[0]["STORAGE_TYPE_NAME"].ToString();
- manageno=dr[0]["MANAGEMENT_NO"].ToString();
- managedesc=dr[0]["MANAGEMENT_NAME"].ToString();
- }
- }
- /// <summary>
- /// 根据质保合同号,合同行号查询待缴库合同
- /// </summary>
- /// <param name="ugr"></param>
- private void GetOrderNo(UltraGridRow ugr)
- {
- ultraGrid1.UpdateData();
- if (ugr == null)
- return;
- string orderNm = ugr.Cells["ordername"].Text.Trim();
- string prodceName = ugr.Cells["cxkind"].Value.ToString();
- string steelName = ugr.Cells["cxsteellevel"].Value.ToString();
- string specName = ugr.Cells["cxgg"].Value.ToString();
- string modelDesc = ugr.Cells["cxtypeofthread"].Value.ToString();
- string styleDesc = ugr.Cells["STDSTYLE"].Text;
- ArrayList list = new ArrayList();
- list.Add(prodceName);
- list.Add(steelName);
- list.Add(specName);
- list.Add(modelDesc);
- string orderSeq = "";
- //string[] arr = this.ValidDataPurviewIds;
- string[] arr = YdmBaseClass.Section(this.ValidDataPurviewIds,this.ob);
- string strMatchOrder = "";
- string strMactchMat = "";
- if (orderNm != "")
- {
- if (!orderNm.Contains("/"))
- {
- MessageUtil.ShowTips("此判定数据合同号异常,不允许缴库!");
- return;
- }
- int i = orderNm.IndexOf("/");
- if (i == -1) return;
- orderSeq = orderNm.Substring(i + 1, orderNm.Length - i - 1).PadLeft(4, '0');
- orderNm = orderNm.Substring(0, i);
- }
- else
- {
- MessageUtil.ShowTips("判定数据合同号为空!,数据异常!");
- return;
- }
- if (ugr.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
- {
-
- //string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,this.ob);
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderClick", new Object[] { orderNm, orderSeq, arr }, this.ob);
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- if (dt.Rows[i]["ORDER_NO"].ToString() == orderNm && dt.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4,'0') == orderSeq)
- {
- dt.Rows[i]["MATCHORDER"] = "合同匹配,物料不匹配";
- }
- //if(dt.Rows[i][""].ToString() == ugr.Cells[""])
- }
- }
- else
- {
- }
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
- ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
- GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
- this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
- }
- else if (ugr.Cells["CXSTUPP"].Text.Trim() == "物料匹配")
- {
- if (orderNm != "")
- {
- DataTable dd = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder2", new object[] { orderNm, orderSeq }, this.ob);//查询合同是否存在 不存在在找物料
- if (dd.Rows.Count > 0)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderClick", new Object[] { orderNm, orderSeq, arr }, this.ob);
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- if (dt.Rows[i]["ORDER_NO"].ToString() == orderNm && dt.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4, '0') == orderSeq)
- {
- //dt.Rows[i]["MATCHORDER"] = "合同匹配,物料匹配";
- strMatchOrder = "1";
- }
- else
- {
- strMatchOrder = "0";
- }
- if (steelName.Equals("C335"))
- {
- if (dt.Rows[i]["STEELCODE"].ToString() == "C333")
- {
- 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))
- {
- strMactchMat = "1";
- }
- else
- {
- strMactchMat = "0";
- }
- }
- else
- {
- 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))
- {
- strMactchMat = "1";
- }
- else
- {
- strMactchMat = "0";
- }
- }
- }
- else
- {
- 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))
- {
- strMactchMat = "1";
- }
- else
- {
- strMactchMat = "0";
- }
- }
- if (strMatchOrder == "1" && strMactchMat == "1")
- {
- //dt.Rows[i]["MATCHORDER"] = "合同匹配,合同物料匹配";
- dt.Rows[i]["MATCHORDER"] = "OK";
- }
- else if (strMatchOrder == "1" && strMactchMat == "0")
- {
- dt.Rows[i]["MATCHORDER"] = "合同匹配,合同物料不匹配";
- }
- else if (strMatchOrder == "0" && strMactchMat == "1")
- {
- dt.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料匹配";
- }
- else
- {
- dt.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料不匹配";
- }
- }
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
- ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
- GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
- this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
- if (dt.Rows.Count == 1)
- {
- foreach (UltraGridRow row in ultraGrid3.Rows)
- {
- if (row.Cells["MATCHORDER"].Text == "OK")
- {
- row.Cells["CHK"].Value = true;
- }
- }
- }
- }
- else
- {
- this.dataTable1.Clear();
- }
- }
- else
- {
- DataTable ds = new DataTable();
- if (steelName.Equals("C335"))
- {
- ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderCxN", new object[] { list,arr }, this.ob);
- }
- else
- {
- ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderCx", new Object[] { list, arr }, this.ob);
- }
- if (ds.Rows.Count > 0)
- {
- for (int i = 0; i < ds.Rows.Count; i++)
- {
- if (ds.Rows[i]["ORDER_NO"].ToString() == orderNm && ds.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4,'0') == orderSeq)
- {
- //ds.Rows[i]["MATCHORDER"] = "合同匹配,合同物料匹配";
- ds.Rows[i]["MATCHORDER"] = "OK";
- }
- else
- {
- ds.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料匹配";
- }
- }
- }
- GridHelper.CopyDataToDatatable(ref ds, ref dataTable1, true);
- UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
- ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
- GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
- this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
- }
- }
-
- }
- else
- {
- dataTable1.Clear();
- }
- }
- /// <summary>
- /// 获取产销产线
- /// </summary>
- /// <param name="ugr"></param>
- private void getFactory(UltraGridRow ugr)
- {
- if (ugr == null)
- {
- return;
- }
- string factory = ugr.Cells["factory"].Text;
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactory", new object[] { factory }, this.ob);
- if (dt.Rows.Count > 0)
- {
- this.cmbFactory.Text = dt.Rows[0]["PLINE_NAME"].ToString();
- //this.cmbFactory.DataSource = dt;
- //this.cmbFactory.SelectedIndex = 0;
- }
- else
- {
- this.cmbFactory.Text = "";
- }
- }
- /// <summary>
- /// 获取产销钢种
- /// </summary>
- /// <param name="ugr"></param>
- private void getGrade(UltraGridRow ugr)
- {
- if (ugr == null)
- {
- return;
- }
- string grade = ugr.Cells["steelgrade"].Text;
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getGrade", new object[] { grade }, this.ob);
- if (dt.Rows.Count > 0)
- {
- this.cmbSteel.Text = dt.Rows[0]["GRADENAME"].ToString();
- //this.cmbFactory.DataSource = dt;
- //this.cmbFactory.SelectedIndex = 0;
- }
- else
- {
- this.cmbSteel.Text = grade;
- }
- }
- /// <summary>
- /// 获取合同总量、已缴库总量、估算总量
- /// </summary>
- /// <param name="orderNo"></param>
- /// <returns></returns>
- private string[] getOrderWgt(string orderNo)
- {
- string[] str = new string[3];
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getOrderWgt", new object[] { orderNo }, this.ob);
- if (dt.Rows.Count > 0)
- {
- str[0] = dt.Rows[0]["ORDERWEIGHT"].ToString();//估算量
- str[1] = dt.Rows[0]["PAYDOWNWEIGHT"].ToString();//已缴库量
- str[2] = dt.Rows[0]["ORDER_QTY"].ToString();//订货量
- }
- return str;
- }
- /// <summary>
- /// ultraGrid1内置按钮点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
- {
- ultraGrid3.UpdateData();
- ultraGrid1.UpdateData();
- string buttonValue = "";//返回的按钮值
- string frmcount = "";//返回的支数
- string frmWgt = "";//返回的重量值
- string frmFinishedCode = "";
- storageParm = new ArrayList();
- matParm = new ArrayList();
- statusUpdate = new ArrayList();
- plnSpale = new ArrayList();
- ArrayList listdt = new ArrayList();
- string[] wgtList = new string[3];
- int conu = 0;
- string orderType = "";
- int count = 0;
- UltraGridRow ugr3 = ultraGrid3.ActiveRow;
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (ugr3 == null) { MessageUtil.ShowTips("待缴库无合同数据,不能进行此操作"); return; }
- if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
- double strWgt = 0;//炉重
- double endWgt = 0;//已缴库量
- double orderWgt = 0;//合同量
- int nn = 0;
- foreach (UltraGridRow row7 in ultraGrid3.Rows)
- {
- if (Convert.ToBoolean(row7.Cells["CHK"].Text) == true)
- {
- nn++;
- }
- }
- if (nn < 1)
- {
- MessageUtil.ShowTips("请勾选待缴库合同数据!");
- return;
- }
-
- if (row.Cells["hgweight"].Text == "")
- {
- MessageUtil.ShowTips("该炉还未生产,无法缴库!");
- return;
- }
- if (double.Parse(row.Cells["hgweight"].Text) < 0)
- {
- MessageUtil.ShowWarning("已缴库量无法进行冲销!");
- return;
- }
- strWgt += double.Parse(row.Cells["hgweight"].Value.ToString());
- UltraGridRow grid3Row = null;
- foreach (UltraGridRow row8 in ultraGrid3.Rows)
- {
- if (Convert.ToBoolean(row8.Cells["CHK"].Text) == true)
- {
- grid3Row = row8;
- }
- }
- string strOrder = grid3Row.Cells["ORDER_NO"].Text.Trim() + "/" + grid3Row.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
- double delPla = 0;//已缴库量
- string _length = "";//长度范围
- int d = 0;
- double downLength = 0;//下限
- double upLength = 0;//上限
- string orderUnit = "";//长度单位
- double dbOrderMax = 0;
- double reckonWgt = 0;//估算量上限
- string gSwgt = "";//合同估算总量
- string pipSwgt = "";//合同缴库总量
- string dSwgt = "";//订货总量
- DataTable ds = new DataTable();
- if (row.Cells["CXSTUPP"].Text.Trim() == "")
- {
- MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
- return;
- }
- if (row.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
- {
- MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库!");
- return;
- }
- if (grid3Row.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
- {
- MessageUtil.ShowTips("合同物料不匹配不允许缴库!");
- return;
- }
- if (grid3Row.Cells["MATCHORDER"].Text.Trim().Contains("合同不匹配"))
- {
- MessageUtil.ShowTips("合同不匹配不允许缴库,可强制缴库!");
- return;
- }
- ds.Clear();
- 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);
- if (ds.Rows[0][0].ToString() == "20")
- {
- MessageUtil.ShowTips("您选中的【" + row.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
- return;
- }
- if (cmbStorage.Text.ToString() == "")
- {
- MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else
- {
- storageno = cmbStorage.Value.ToString();
- }
- if (this.cmbFactory.Text.ToString() == "")
- {
- //MessageUtil.ShowTips("产线不允许为空!");
- //return;
- factoryCode = "";
- factoryNo = "";
- }
- else
- {
- factoryCode = this.cmbFactory.Value.ToString();
- factoryNo = this.cmbFactory.Text.ToString();
- }
- //if (this.cmbSteel.Text.ToString() == "")
- //{
- // //MessageUtil.ShowTips("钢种不允许为空!");
- // //return;
- // steelCode = "";
- // steelName = "";
- //}
- //else
- //{
- // steelCode = this.cmbSteel.Value.ToString();
- // steelName = this.cmbSteel.Text.ToString();
- //}
-
- if (this.cmbSource.Text.ToString() == "")
- {
- sourceCode = "";
- sourceName = "";
- }
- else
- {
- sourceCode = this.cmbSource.Value.ToString();
- sourceName = this.cmbSource.Text.ToString();
- }
- //if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
- //{
- // if (row.Cells["hgm"].Text.Trim() == "")
- // {
- // MessageUtil.ShowTips("此合同是按长度交货,长度为空不能缴库!");
- // return;
- // }
- //}
- if (this.txt_Ks.Value == null)
- {
- ks = "0";
- }
- else
- {
- ks = this.txt_Ks.Value.ToString();
- }
- _length = row.Cells["leng"].Text.Trim();
- if (_length != "")
- {
- d = _length.IndexOf("-");
- downLength = double.Parse(_length.Substring(0, d));
- upLength = double.Parse(_length.Substring(d + 1));
- if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
- {
- 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)))
- {
- if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】米,是否缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
- {
- 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)))
- {
- //if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】英尺,是否缴库?") == DialogResult.No)
- //{
- // return;
- //}
- 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)
- {
- return;
- }
- }
- }
- }
- else
- {
- MessageUtil.ShowTips("长度上下限为空,不允许缴库可进行强制缴库!");
- return;
- }
- string newSql_no = "";
- //conu += 1;
- int index = row.Cells["ordername"].Text.Trim().IndexOf("/");
- string sql_no = row.Cells["ordername"].Text.Trim().Substring(index + 1);
- if (sql_no.Length < 4)
- {
- sql_no = sql_no.PadLeft(4, '0');
- }
- if (strOrder != (row.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no))
- {
- MessageUtil.ShowTips("质保数据合同号" + (row.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no) + "信息与待缴合同" + strOrder + "信息不一致,不能缴库可强制缴库!");
- return;
- }
- delPla += double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim());
- orderType = doQueryOrderType(row.Cells["ordername"].Text.Trim().Substring(0, index));
- if (orderType.Equals("120103"))
- {
- MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
- return;
- }else if(orderType.Equals("120104"))
- {
- MessageUtil.ShowTips("该合同为预排合同,只允许强制缴库成成品!");
- return;
- }
- if (strWgt > 0)
- {
- orderUnit = grid3Row.Cells["ORDER_UNIT"].Text.Trim();
- endWgt = double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString());
- orderWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString());
- string strRANGE_MIN = grid3Row.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
- string strRANGE_MAX = grid3Row.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
- double dbQtyMin = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
- double dbQtyMax = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
- double dbJhMax = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
- if (orderUnit.Contains("支") || orderUnit.Equals("吨"))
- {
- dbOrderMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);
- }
- else if (orderUnit.Contains("磅"))
- {
- 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);
- }
- wgtList = getOrderWgt(grid3Row.Cells["ORDER_NO"].Text.ToString());
- if (wgtList.Length > 0)
- {
- gSwgt = wgtList[0];
- pipSwgt = wgtList[1];
- dSwgt = wgtList[2];
- }
- if (orderUnit.Equals("吨")||orderUnit.Equals("支")||orderUnit.Contains("磅"))
- {
- if (endWgt > dbOrderMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = row.Cells["hgunit"].Text.Trim();
- frm.AllWgt = row.Cells["hgweight"].Text.Trim();
- if (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
- {
- frm.SxWgt = "0";
- }
- else
- {
- frm.SxWgt = (dbQtyMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- }
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > dbOrderMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > dbOrderMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- }
- else
- {
- if ((strWgt + endWgt) > dbOrderMax)
- {
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = row.Cells["hgunit"].Text.Trim();
- frm.AllWgt = row.Cells["hgweight"].Text.Trim();
- frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > dbOrderMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > dbOrderMax)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- }
- }
- }
- else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
- {
- if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
- {
- MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
- return;
- }
- reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
- if (endWgt > reckonWgt)
- {
- //MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
- //return;
- if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = row.Cells["hgunit"].Text.Trim();
- frm.AllWgt = row.Cells["hgweight"].Text.Trim();
- if (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
- {
- frm.SxWgt = "0";
- }else
- {
- frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- }
-
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- }
- else
- {
- if ((strWgt + endWgt) > reckonWgt)
- {
- frmBatchesPip frm = new frmBatchesPip(ob);
- frm.AllCount = row.Cells["hgunit"].Text.Trim();
- frm.AllWgt = row.Cells["hgweight"].Text.Trim();
- frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
- frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
- frm.ShowDialog();
- buttonValue = frm.buttonValue;
- frmcount = frm.count;
- frmWgt = frm.outWgt;
- frmFinishedCode = frm.finishedProduct;
- if (!frm.flag)
- {
- return;
- }
- if (buttonValue == "0")
- {
- return;
- }
- if (buttonValue == "2")
- {
- if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
- {
- MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
- return;
- }
- if (double.Parse(frmWgt) + endWgt > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- if (buttonValue == "1")
- {
- if ((strWgt + endWgt) > reckonWgt)
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
- {
- if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
- {
- return;
- }
- }
- }
- }
- }
- }
-
- }
-
- //foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
- //{
- // if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
- // {
- // if (double.Parse(row3.Cells["hgweight"].Text.Trim()) < 0)
- // {
- // if (double.Parse(row3.Cells["hgweight"].Text.Trim()) + double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
- // {
- // MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
- // return;
- // }
- // else
- // {
- // if (int.Parse(row3.Cells["hgunit"].Text.Trim()) > int.Parse(ugr3.Cells["PAYDOWN_NUM"].Text.Trim()))
- // {
- // MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
- // return;
- // }
- // }
- // }
- // }
- //}
-
- UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
- .OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
- double dbDelvry = 0;
- double dbweigh = 0;
- double dbcount = 0;
- double endweigth = 0;
- //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale, row.Cells["hgunit"].Value.ToString() }, this.ob);
- if (MessageUtil.ShowYesNoAndQuestion("是否确认缴库?") == DialogResult.No) return;
- ArrayList matList = new ArrayList();
- ArrayList plnList = new ArrayList();
- double stWeight = 0;
- double dbunit = 0;
- //DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] {}, this.ob);
- //if (grid3Row.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
- //{
- // MessageUtil.ShowTips("待缴库合同在生产中,不能进行缴库!");
- // return;
- //}
- if (buttonValue == "2")
- {
- stWeight = double.Parse(frmWgt);
- dbunit = double.Parse(frmcount);
- }
- else
- {
- stWeight = double.Parse(row.Cells["hgweight"].Value.ToString());//已缴库量+炉(重量)
- dbunit = double.Parse(row.Cells["hgunit"].Value.ToString());//已缴库支数+炉(支数)
- }
- ArrayList storageList = new ArrayList(); //仓库位置参数
- storageList.Add(row.Cells["lcode"].Text.Trim());
- storageList.Add(row.Cells["lotno"].Text.Trim());
- storageList.Add(row.Cells["hgunit"].Text.Trim());
- storageList.Add(storageno);
- storageList.Add(storageno + "10101");
- storageList.Add(storagetype);
- storageList.Add(storagetypedesc);
- //storageList.Add(manageno);
- //storageList.Add(managedesc);
- storageList.Add(this.UserInfo.GetUserName());
- storageList.Add(row.Cells["hgweight"].Value.ToString());
- storageList.Add(this.UserInfo.GetDeptid());
- storageList.Add(this.UserInfo.GetDepartment());//37
- storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
- storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- storageParm.Add(storageList);
- #region 要缴库的每一炉重量小于要缴库的重量
- matList.Add(row.Cells["lcode"].Text.Trim()); //炉号
- matList.Add(row.Cells["lotno"].Text.Trim());//批号
- matList.Add(row.Cells["hgunit"].Text.Trim());//支数
- matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
- matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
- if (row.Cells["cxsteellevel"].Text == "N80Q")
- {
- matList.Add(row.Cells["cxsteellevel"].Value.ToString());
- matList.Add(row.Cells["cxsteellevel"].Text);
- }
- else
- {
- matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
- matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
- }
- matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
- matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
- matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
- matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
- matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
- //matList.Add("");
- //matList.Add(row.Cells["standard"].Value.ToString());
- matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
- matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
- matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
- matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
- matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
- matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
- matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
- matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
- matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
- matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
- matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
- matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
- matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
- matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
- matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
- matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
- string length = row.Cells["leng"].Text.Trim();
- int n = length.IndexOf("-");
- string lengMin = length.Substring(0, n);
- string lengMax = length.Substring(n + 1);
- matList.Add(lengMin);//下限
- matList.Add(lengMax);//上限
- matList.Add(this.UserInfo.GetUserName());//操作人
- matList.Add("0");
- matList.Add("1");
- matList.Add(row.Cells["testidea"].Value.ToString());//备注
- matList.Add(row.Cells["HGWEIGHT"].Value.ToString());
- double weight = Convert.ToDouble(row.Cells["HGWEIGHT"].Value.ToString());
- double unit = Convert.ToDouble(row.Cells["HGUNIT"].Value.ToString());
- DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
- if (dtMemo.Rows.Count >= 1)
- {
- strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
- }
- matList.Add(strInMemo);
- matList.Add(this.UserInfo.GetDeptid());
- matList.Add(this.UserInfo.GetDepartment());//37
- matList.Add(strInbound);
- matList.Add(this.cmbStorage.Value.ToString());//仓库号
- matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());//片区
- matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());//销售组织
- if (buttonValue == "2")
- {
- matList.Add(frmcount);//42
- }
- else
- {
- matList.Add(row.Cells["hgunit"].Value.ToString());
- }
- matList.Add(row.Cells["rcdid"].Value.ToString());
- matList.Add(row.Cells["hgm"].Value.ToString());//长度
- matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
- matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- matList.Add(row.Cells["standard"].Value.ToString());//判定标准
- //matList.Add(row.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));// 判定时间
- matList.Add(row.Cells["testdate"].Value.ToString());//判定时间
- matList.Add(factoryCode);
- matList.Add(factoryNo);
- //matList.Add(steelCode);
- //matList.Add(steelName);
- matList.Add("");
- matList.Add(row.Cells["steelgrade"].Text.ToString());
- matList.Add(this.txtMemo.Text.Trim());
- matList.Add(row.Cells["ordername"].Value.ToString());//质保合同号
- matList.Add(sourceCode);//材料来源代码
- matList.Add(sourceName);//材料名称
- matList.Add(ks);
- if (buttonValue == "1")
- {
- matList.Add("801703");//成品区分
- }
- else if (buttonValue == "2")
- {
- matList.Add("801701");//成品区分
- }
- matParm.Add(matList);
- plnList.Add(stWeight.ToString("f3"));
- if (double.Parse(row.Cells["hgweight"].Value.ToString()) > 0)
- {
- plnList.Add(dbunit.ToString());
- }
- else
- {
- plnList.Add(int.Parse(ugr3.Cells["hgunit"].Text.Trim()).ToString());
- }
- plnList.Add(this.UserInfo.GetUserName());
- plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
- plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
- plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
- plnSpale.Add(plnList);
- //break;
- #endregion
- //}
- //else
- //{
- // return;
- //}
- ArrayList statusList = new ArrayList();
- statusList.Add(row.Cells["lcode"].Value.ToString());
- statusList.Add(row.Cells["lotno"].Value.ToString());
- statusList.Add(row.Cells["factory"].Value.ToString());
- statusList.Add(row.Cells["testdate"].Value.ToString());
- statusList.Add(row.Cells["hgunit"].Value.ToString()); //支数
- statusList.Add(row.Cells["hgweight"].Value.ToString());//重量
- statusList.Add(row.Cells["RCDID"].Value.ToString());
- statusUpdate.Add(statusList);
- //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
- ccp.MethodName = "doPipeIn";
- ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
- ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("缴库成功!"))
- {
- QueryMatData();
- this.cmbSteel.Text = "";
- this.cmbFactory.Text = "";
- this.txt_Ks.Value = "0";
- QueryOrder(grid3Row.Cells["ORDER_NO"].Text.Trim(), grid3Row.Cells["ORDER_SEQ"].Text.Trim());
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// ultraGrid1 托选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- try
- {
- ultraGrid1.UpdateData();
- foreach (UltraGridRow r in ultraGrid1.Rows)
- {
- r.Cells["CHK"].Value = r.Selected;
- }
- }
- catch { }
- }
- /// <summary>
- /// ultraGrid3 托选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid3_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- try
- {
- ultraGrid3.UpdateData();
-
- foreach (UltraGridRow r in ultraGrid3.Rows)
- {
- r.Cells["CHK"].Value = r.Selected;
- }
- }
- catch { }
- }
- private void frmPipeInTemp_Shown(object sender, EventArgs e)
- {
- if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
- {
- toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
- {
- toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
- {
- toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
- {
- toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
- {
- toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- //toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
- if (toolMenu.Toolbars[0].Tools.Exists("Query"))
- {
- toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
- {
- toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
- {
- toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
- {
- toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
- {
- toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
- {
- toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
- {
- toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
- {
- toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
- {
- toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
- {
- toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
- {
- toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- this.chkBathYear.Visible = false;
- this.dtBathYear.Visible = false;
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- string strqux = "";
- iSelectG3Row = -1;
- UltraGridRow uRow = ultraGrid1.ActiveRow;
- if (uRow == null) return;
- strqux = "炉号:" + uRow.Cells["lcode"].Text.Trim() +" "+ "去向:" + uRow.Cells["destination"].Text.Trim() + " " + "产线:" + uRow.Cells["factory"].Text.Trim() + " " + "备注:" + uRow.Cells["testidea"].Text.Trim();
- ultraLabel1.Text = strqux;
- //if (uRow.Cells["destination"].Text.Trim() != "")
- //{
- // this.cmbStorage.Text = uRow.Cells["destination"].Text.Trim();
- //}
- GetOrderNo(uRow);
- getFactory(uRow);
- getGrade(uRow);
- }
- /// <summary>
- /// 仓库号选中条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkStrong_CheckedChanged(object sender, EventArgs e)
- {
- //if (chkStrong.Checked)
- //{
- // cmbStorager.ReadOnly = false;
- //}
- //else
- //{
- // cmbStorager.ReadOnly = true;
- // cmbStorager.Text = "";
- //}
- this.cmbStorager.Enabled = this.chkStrong.Checked;
- }
- //全选
- private void chkAll_CheckedChanged(object sender, EventArgs e)
- {
- int chkint = 0;
- if (chkAll.Checked)
- {
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (uRow.Cells["CXSTUPP"].Value.ToString().Equals(""))
- {
- chkint += 1;
- if (chkint > 50) return;
- uRow.Cells["CHK"].Value = true;
- }
- }
- }
- else
- {
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
- {
- uRow.Cells["CHK"].Value = false;
- }
- }
- }
- private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGrid2.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["CHOOSE"].Value = true;
- }
- }
- }
- private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e)
- {
- StartTime.Enabled = this.ultraCheckEditor5.Checked;
- this.EndTime.Enabled = this.ultraCheckEditor5.Checked;
- }
- private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
- {
- string strqux = "";
- UltraGridRow uRow = ultraGrid1.ActiveRow;
- if (uRow == null) return;
- strqux = "炉号:" + uRow.Cells["lcode"].Text.Trim() +" "+ "去向:" + uRow.Cells["destination"].Text.Trim() + " " + "产线:" + uRow.Cells["factory"].Text.Trim() + " " + "备注:" + uRow.Cells["testidea"].Text.Trim();
- ultraLabel1.Text = strqux;
- //if (uRow.Cells["destination"].Text.Trim() != "")
- //{
- // this.cmbStorage.Text = uRow.Cells["destination"].Text.Trim();
- //}
- GetOrderNo(uRow);
- getFactory(uRow);
- getGrade(uRow);
- // QueryOrder();
- }
-
- private void ultraGrid4_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGrid4.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["CHK"].Value = true;
- }
- }
- }
- /// <summary>
- /// 判断值在某范围内
- /// </summary>
- /// <param name="min"></param>
- /// <param name="max"></param>
- /// <param name="value"></param>
- /// <returns></returns>
- private bool compareToValue(double min,double max,double value)
- {
- if(value>=min && max>=value)
- {
- return true;
- }else
- {
- return false;
- }
- }
- int iSelectG3Row = -1;
- private void ultraGrid3_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid3.UpdateData();
- if (e.Cell.Column.Key.ToString().ToUpper() == "CHK")
- {
- if (e.Cell.Value.ToString().ToUpper() == "TRUE")
- {
- if (iSelectG3Row != -1)
- ultraGrid3.Rows[iSelectG3Row].Cells["CHK"].Value = false;
- iSelectG3Row = e.Cell.Row.Index;
- }
- else
- {
- iSelectG3Row = -1;
- }
- }
- //bool chk = (bool)e.Cell.Value;
- //UltraGridRow[] rows = GridHelper.GetRowsWithKey(ultraGrid2,
- // new string[] { "CHK" }, new string[] { "True" });
- //foreach (UltraGridRow row in rows)
- //{
- // if (e.Cell.Row.Equals(row)) continue;
- // row.Cells["CHK"].Value = false;
- //}
- }
-
-
- /// 单位英尺长度转米
- /// </summary>
- /// <param name="lenth">英尺长度</param>
- /// <returns>米长度</returns>
- public static double FootoMi(double lenth)
- {
- double converate = 0.3048; //换算率
- return Math.Round((lenth * converate), 2);
- }
- private void cmbJudge_KeyDown(object sender, KeyEventArgs e)
- {
- if (ultraTabControl1.SelectedTab.Key == "1")
- {
- if (e.KeyValue == 13)
- {
- QueryMatData();
- }
- }
- else if (ultraTabControl1.SelectedTab.Key == "2")
- {
- if (e.KeyValue == 13)
- {
- QueryPipedData();
- }
- }
- else
- {
- if (e.KeyValue == 13)
- {
- QueryInList();
- }
- }
- }
- private void cmbOrder_KeyDown(object sender, KeyEventArgs e)
- {
- if (ultraTabControl1.SelectedTab.Key == "1")
- {
- if (e.KeyValue == 13)
- {
- QueryMatData();
- }
- }
- else if (ultraTabControl1.SelectedTab.Key == "2")
- {
- if (e.KeyValue == 13)
- {
- QueryPipedData();
- }
- }
- else
- {
- if (e.KeyValue == 13)
- {
- QueryInList();
- }
- }
- }
- private void cmbMatch_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyValue == 13)
- {
- QueryMatData();
- }
- }
- //private void ultraGrid4_CellChange(object sender, CellEventArgs e)
- //{
- // ultraGrid4.UpdateData();
- // UltraGridRow ugr = this.ultraGrid4.ActiveRow;
-
- // string ss = ugr.Cells["BAL_YEAR_MONTH"].Text;
- // if (ss.Length == 6)
- // {
- // string dd = ss.Substring(0, 4);
- // string gg = ss.Substring(4, 2);
- // if (dd.Length < 4 || int.Parse(dd) > 2015)
- // {
- // MessageUtil.ShowTips("年份输入不正确");
- // return;
- // }
- // if (gg.Length < 2 || int.Parse(gg) > 12 || int.Parse(gg) < 1)
- // {
- // MessageUtil.ShowTips("月份输入不正确");
- // return;
- // }
- // if (!StringUtil.IsNotDateTime(dd))
- // {
- // MessageUtil.ShowTips("输入的值不为日期格式,请重新输入!");
- // return;
- // }
- // }
- // else
- // {
- // MessageUtil.ShowTips("结算日期输入不正确!");
- // }
- //}
- private void ultraGrid4_KeyUp(object sender, KeyEventArgs e)
- {
- BaseMethod.setGridCopyActColumn(ultraGrid4, e, "BAL_YEAR_MONTH");
- }
- private void ultraGrid2_KeyUp(object sender, KeyEventArgs e)
- {
- BaseMethod.setGridCopyActColumn1(ultraGrid2, e, "STORAGE_NO");
- }
- private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- //BandUnitDepartments(e);
- if (e.Row.Cells["CXSTUPP"].Value.ToString().Equals("物料不匹配"))
- {
- e.Row.Appearance.ForeColor = Color.Red;
- }
- }
- /// <summary>
- /// 连动
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void cmbSource_ValueChanged(object sender, EventArgs e)
- {
- if (this.cmbSource.Text != "")
- {
- if (this.cmbSource.Value.ToString() == "801302")//产线
- {
- YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
- }
- else if (this.cmbSource.Value.ToString() == "801301")//外购
- {
- YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWg", "BASE_CODE", this.ob, false);
- }
- else if (this.cmbSource.Value.ToString() == "801303")//倒库
- {
- YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getDk", "BASE_CODE", this.ob, false);
- }
- else if (this.cmbSource.Value.ToString() == "801304")//外委
- {
- YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWw", "BASE_CODE", this.ob, false);
- }
- }
- }
- private void chkBathYear_CheckedChanged(object sender, EventArgs e)
- {
- this.dtBathYear.Enabled = this.chkBathYear.Checked;
- }
- }
- }
|