RenderUtil.js 119 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833
  1. /**
  2. * grid render
  3. */
  4. Ext.QuickTips.init();
  5. Ext.define('erp.util.RenderUtil', {
  6. /**
  7. * @PLM
  8. */
  9. render_change: function(val, meta, record){
  10. if(record && record.data.percentdone < 30)
  11. return '<img src="'+basePath+'resource/images/renderer/remind2.png">'+'<span style="color:#436EEE;padding-left:2px">' + val + '</span>';
  12. else if(record && record.data.percentdone > 30 && record.data.percentdone < 50)
  13. return '<img src="'+basePath+'resource/images/renderer/remind.png">'+'<span style="color:#5F9EA0;padding-left:2px">' + val + '</span>';
  14. else if(record && record.data.point == 100){
  15. return '<img src="'+basePath+'resource/images/renderer/award1.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  16. }else if(record && record.data.point > 80){
  17. return '<img src="'+basePath+'resource/images/renderer/award2.png">'+'<span style="color:green;padding-left:2px">' + val + '</span>';
  18. }
  19. else return val;
  20. },
  21. /**
  22. * @PLM
  23. */
  24. plm_recordchange: function(val, meta, record){
  25. if(record && record.data.wr_percentdone == 100){
  26. if(record.data.wr_haveattach==1){
  27. return '<img src="'+basePath+'resource/images/renderer/finishrecord.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span><img style="padding-right:2px" src="../../resource/images/renderer/attach.png">';
  28. }
  29. else return '<img src="'+basePath+'resource/images/renderer/finishrecord.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  30. }
  31. else {
  32. if(record.data.wr_haveattach==1){
  33. return '<span style="color:green;padding-left:2px">' + val + '</span><img align="right" style="padding-right:2px" src="'+basePath+'resource/images/renderer/attach.png">';
  34. }
  35. else return '<span style="color:green;padding-left:2px">' + val + '</span>';
  36. }
  37. },
  38. /**
  39. * @PLM
  40. */
  41. plm_projectbudget:function(val,meta,record){
  42. if(record.data.cost>record.data.budget){
  43. return '<div class="color-column-inner" style="background-color:red" align="center">&nbsp;</div>';
  44. }else return '<div class="color-column-inner" style="background-color:green" align="center">&nbsp;</div>';
  45. },
  46. plm_projectchange: function(val, meta, record){
  47. if(record && record.data.prjplan_prjname == 'ERP')
  48. return '<img src="'+basePath+'resource/images/renderer/important.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  49. else return '<span style="color:green;padding-left:2px">' + val + '</span>';
  50. },
  51. plm_reduce: function(val, meta, record, x, y, store, view){
  52. var me = this.RenderUtil || this;
  53. var field = this.columns[y].dataIndex;
  54. if(me.args){
  55. var arg = me.args.plm_reduce[field];
  56. var maxValue = 0;
  57. if(arg && arg.length > 0){
  58. var v = 0;
  59. Ext.each(arg, function(a, index){
  60. if(Ext.isNumber(a)){
  61. v = a;
  62. } else {
  63. v = record.data[a] || 0;
  64. }
  65. if(index == 0){
  66. maxValue = Number(v);
  67. } else {
  68. maxValue -= Number(v);
  69. }
  70. });
  71. }
  72. val = (val == null || val == 0) ? maxValue : val;
  73. if(record.data[field] != val){
  74. record.set(field, val);
  75. }
  76. if(val > 0){
  77. return '<img src="' + basePath + 'resource/images/icon/need.png">' +
  78. '<span style="color:blue;padding-left:2px">' + val + '</span>';
  79. } else if(val < 0){
  80. return 0;
  81. } else {
  82. return val;
  83. }
  84. } else {
  85. return val;
  86. }
  87. },
  88. /**
  89. * @PLM
  90. */
  91. plm_resource_rank:function(val,meta,record){
  92. if(record&&record.data.percentdone>89){
  93. return '<img src="'+basePath+'resource/images/renderer/start1.png">'+'<img src="'+basePath+'resource/images/renderer/start1.png">'+'<img src="'+basePath+'resource/images/renderer/start1.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  94. }else if(record&&record.data.percentdone>69&&record.data.percentdone<90){
  95. return '<img src="'+basePath+'resource/images/renderer/start1.png">'+'<img src="'+basePath+'resource/images/renderer/start1.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  96. }else if(record&&record.data.percentdone>50&&record.data.percentdone<70){
  97. return '<img src="'+basePath+'resource/images/renderer/start1.png">'+'<img src="'+basePath+'resource/images/renderer/start2.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  98. }
  99. },
  100. /**
  101. *@PLM
  102. * */
  103. PLM_planstatus:function(val,meta,record){
  104. var statuscode=record.data['prjplan_statuscode'];
  105. if(statuscode=='FINISHED'){
  106. return '<img src="' + basePath + 'resource/images/renderer/finishrecord.png" >' +
  107. '<span style="color:green;padding-left:2px;">' + val + '</span>';
  108. }else if(statuscode=='DOING'){
  109. return '<img src="' + basePath + 'resource/images/renderer/doing.png" >' +
  110. '<span style="color:blue;padding-left:2px;">' + val + '</span>';
  111. }else return '<img src="' + basePath + 'resource/images/renderer/remind2.png" >'+'<span style="color:red;padding-left:2px;">' + val + '</span>';
  112. },
  113. PLM_MainTaskStatus:function(val,meta,record){
  114. var statuscode=record.data['handstatuscode'];
  115. if(statuscode=='FINISHED'){
  116. return '<img src="' + basePath + 'resource/images/renderer/finishrecord.png" >' +
  117. '<span style="color:green;padding-left:2px;">' + val + '</span>';
  118. }else if(statuscode=='DOING'){
  119. return '<img src="' + basePath + 'resource/images/renderer/doing.png" >' +
  120. '<span style="color:blue;padding-left:2px;">' + val + '</span>';
  121. }else if(statuscode=='ACTIVE'||statuscode=='STOP'){
  122. return '<img src="' + basePath + 'resource/images/renderer/key2.png" >' +
  123. '<span style="color:red;padding-left:2px;" >' + val + '</span>';
  124. }else {
  125. return '<img src="' + basePath + 'resource/images/renderer/key1.png">'+'<span style="color:#8B8B83;padding-left:2px ">' + val + '<a/></span>';
  126. }
  127. },
  128. PLM_TaskStatus:function(val,meta,record){
  129. var statuscode=record.data['ra_statuscode'];
  130. if(statuscode=='FINISHED'){
  131. return '<img src="' + basePath + 'resource/images/renderer/finishrecord.png" >' +
  132. '<span style="color:green;padding-left:2px;">' + val + '</span>';
  133. }else if(statuscode=='START'){
  134. return '<img src="' + basePath + 'resource/images/renderer/doing.png" >' +
  135. '<span style="color:blue;padding-left:2px;">' + val + '</span>';
  136. }else if(statuscode=='STOP'){
  137. return '<img src="' + basePath + 'resource/images/renderer/key1.png">'+'<span style="color:#8B8B83;padding-left:2px ">' + val + '<a/></span>';
  138. }else {
  139. return '<img src="' + basePath + 'resource/images/renderer/key2.png">'+'<span style="color:#8B8B83;padding-left:2px ">' + val + '<a/></span>';
  140. }
  141. },
  142. /**
  143. *@PLM
  144. * */
  145. plm_BUGAttach:function(val,meta,record){
  146. if(record&&record.data.cld_attach!=null&&record.data.cld_attach!=""){
  147. var attach=record.data.cld_attach;
  148. //var path="dsd";
  149. // return '<a href=' + basePath + 'common/downloadbyId.action>下载</a>';
  150. return '<img align= style="padding-left:2px" src="'+basePath+'resource/images/renderer/attach.png"></span>'+val+'</br><a href="' + basePath + 'common/downloadbyId.action?id='+attach.split(";")[1]+'">' + attach.split(";")[0] + '</a>';
  151. }else return '<img src="' + basePath + 'resource/images/icon/need.png" title="'+val+'">' +
  152. '<span style="color:blue;padding-left:2px;" title="'+val+'">' + val + '</span>';
  153. },
  154. plm_BUGTurn:function(val,meta,record){
  155. if(record&&record.data.cc_turn!=null&&record.data.cc_turn!=""){
  156. var turn=record.data.cc_turn;
  157. meta.style = "text-align:center";
  158. return '<sapn style="color:blue;padding-left:20px;">'+turn.split(";")[0]+'</span><img style="padding-left:10px;padding-top:3px;padding-right:10px;" src="'+basePath+'resource/images/renderer/turn.png">'+turn.split(";")[1];
  159. }else return "";
  160. },
  161. /**
  162. *@PLM
  163. * */
  164. plm_BUGStatus:function(val,meta,record){
  165. var statuscode=record.data.cld_statuscode?record.data.cld_statuscode:record.data.cbd_statuscode;
  166. if(statuscode=='PENDING'){
  167. return '<img src="' + basePath + 'resource/images/renderer/key2.png" title="'+val+'">' +
  168. '<span style="color:red;padding-left:2px;" title="'+val+'">' + val + '</span>';
  169. }else if(statuscode=='TESTING'){
  170. return '<img src="' + basePath + 'resource/images/renderer/test.png" title="'+val+'">' +
  171. '<span style="color:blue;padding-left:2px;" title="'+val+'">' + val + '</span>';
  172. }else if(statuscode=='HANDED'){
  173. return '<img src="' + basePath + 'resource/images/renderer/finishrecord.png" title="'+val+'">' +
  174. '<span style="color:green;padding-left:2px;" title="'+val+'">' + val + '</span>';
  175. }else if(statuscode=='NOTDEAL'){
  176. return '<img src="' + basePath + 'resource/images/renderer/key1.png" title="'+val+'">' +
  177. '<span style="color:#8B8B83;padding-left:2px;" title="'+val+'">' + val + '</span>';
  178. }
  179. },
  180. plm_BUGTest:function(val,meta,record){
  181. if(val&&val!=null){
  182. if(val=='-1'){
  183. return '<span style="color:green;padding-left:2px;" title="'+val+'">测试通过</span>';
  184. }else if(val=='0'){
  185. return '<span style="color:red;padding-left:2px;" title="'+val+'">测试失败</span>';
  186. }
  187. }else return null;
  188. },
  189. /**
  190. *稽核查看单据信息
  191. * */
  192. SysCheckHref:function(val,meta,record){
  193. var url=null;
  194. if(record.data.scd_url.indexOf('?')>0){
  195. if(record.data.sf_mainfield){
  196. //主从记录都有
  197. url=record.data.scd_url+"&formCondition="+record.data.sf_keyfield+"IS"+record.data.scd_sourceid+"&gridCondition="+record.data.sf_mainfield+"IS"+record.data.scd_sourceid;
  198. }else url=record.data.scd_url+"&formCondition="+record.data.sf_keyfield+"IS"+record.data.scd_sourceid;
  199. }else {
  200. if(record.data.sf_mainfield){
  201. //主从记录都有
  202. url=record.data.scd_url+"?formCondition="+record.data.sf_keyfield+"IS"+record.data.scd_sourceid+"&gridCondition="+record.data.sf_mainfield+"IS"+record.data.scd_sourceid;
  203. }else url=record.data.scd_url+"?formCondition="+record.data.sf_keyfield+"IS"+record.data.scd_sourceid;
  204. }
  205. return '<a href="javascript:openUrl(\''+url+'\');">' + val + '</a>';
  206. },
  207. /**
  208. *查看工作日程
  209. * */
  210. seeCalendar:function(val,meta,record){
  211. if(record.data.epd_emcode!=''&&record.data.epd_starttime!=null && record.data.epd_epid!=0){
  212. var time=Ext.Date.format(record.data.epd_starttime, 'Y-m-d');
  213. return "<input type='button' value='查看工作日程' name='detailbutton' style='color:gray;font-size:13px;cursor:pointer;height:25px;' onClick='Ext.getCmp(\"form\").seec(\""+record.data.epd_emcode+"\",\""+time+"\",\""+record.data.epd_epid+"\",\""+caller+"\")'>";
  214. }
  215. return '';
  216. },
  217. /**
  218. * 生产计划链接
  219. * */
  220. MakePlanHref:function(val,meta,record){
  221. var url='jsps/pm/make/makeBase.jsp?whoami=Make!Base';
  222. var code=record.data.ma_code;
  223. var keyValue=record.data.ma_id;
  224. url+='&formCondition=ma_idIS'+keyValue+'&gridCondition=mm_maidIS'+keyValue;
  225. return '<a href="javascript:openUrl(\''+url+'\');">' + code + '</a>';
  226. },
  227. /**
  228. * 生产计划链接
  229. * */
  230. MakeHref:function(val,meta,record){
  231. var url='jsps/pm/make/makeBase.jsp?whoami=Make';
  232. var code=record.data.ma_code;
  233. var keyValue=record.data.ma_id;
  234. url+='&formCondition=ma_idIS'+keyValue+'&gridCondition=mm_maidIS'+keyValue;
  235. return '<a href="javascript:openUrl(\''+url+'\');">' + code + '</a>';
  236. },
  237. /**
  238. * 应付发票 付款详情
  239. * */
  240. PayApbillHref:function(val,meta,record){
  241. var url='jsps/common/commonpage.jsp?whoami=PayAPBill';
  242. var code=record.data.ppdd_billcode;
  243. url+='&formCondition=ab_codeIS'+code+'&gridCondition=pa_codeIS'+code;
  244. return '<a href="javascript:openUrl(\''+url+'\');">' + code + '</a>';
  245. },
  246. /**
  247. * 采购订单链接
  248. * */
  249. PurchaseHref:function(val,meta,record){
  250. var url='jsps/scm/purchase/purchase.jsp';
  251. var code=record.data.vad_pucode;
  252. url+='?formCondition=pu_codeIS'+code+'&gridCondition=pd_codeIS'+code;
  253. return '<a href="javascript:openUrl(\''+url+'\');">' + code + '</a>';
  254. },
  255. /**
  256. * 付款申请单 应付发票链接
  257. * */
  258. ApbillHref:function(val,meta,record){
  259. var url='jsps/fa/ars/apbill.jsp?whoami=APBill!CWIM';
  260. var code=record.data.ppdd_billcode;
  261. url+='&formCondition=ab_codeIS'+code+'&gridCondition=abd_codeIS'+code;
  262. return '<a href="javascript:openUrl(\''+url+'\');">' + code + '</a>';
  263. },
  264. /**
  265. * 预付款申请单 采购订单链接
  266. * */
  267. PurcYFHref:function(val,meta,record){
  268. var url='jsps/scm/purchase/purchase.jsp';
  269. var code=record.data.ppdd_pucode;
  270. url+='?formCondition=pu_codeIS'+code+'&gridCondition=pd_codeIS'+code;
  271. return '<a href="javascript:openUrl(\''+url+'\');">' + code + '</a>';
  272. },
  273. /**
  274. *
  275. * 检验单链接
  276. * */
  277. IQCHref:function(val,meta,record){
  278. var url='jsps/scm/qc/verifyApplyDetail2.jsp?whoami=VerifyApplyDetail';
  279. var code=record.data.ve_code;
  280. url+='&formCondition=ve_codeIS'+code+'&gridCondition=ved_codeIS'+code;
  281. return '<a href="javascript:openUrl(\''+url+'\');">' + code + '</a>';
  282. },
  283. /**
  284. * 检验单链接 --第二个明细表只能传关联id
  285. */
  286. newIQCHref:function(val,meta,record){
  287. if(!Ext.isEmpty(val)) {
  288. if(!window.__fn) {
  289. var fn = function(ve_code) {
  290. Ext.Ajax.request({
  291. url: basePath + 'common/getFieldData.action',
  292. params: {
  293. caller: 'QUA_VerifyApplyDetail',
  294. field: 've_id',
  295. condition: 've_code=\'' + ve_code + '\''
  296. },
  297. callback: function(opt, s, r) {
  298. if(s) {
  299. var rs = Ext.decode(r.responseText);
  300. if(rs.data != null && rs.data > 0) {
  301. openUrl('jsps/scm/qc/verifyApplyDetail2.jsp?whoami=VerifyApplyDetail&formCondition=ve_idIS' + rs.data +
  302. '&gridCondition=ved_veidIS' + rs.data);
  303. }
  304. }
  305. }
  306. });
  307. };
  308. window.__fn = fn;
  309. }
  310. val = '<a href="javascript:window.__fn(\'' + val + '\');">' + val + '</a>';
  311. }
  312. return val;
  313. },
  314. /**
  315. * 订阅项链接 SubsFormula
  316. */
  317. SubsFHref:function(val,meta,record){
  318. if(!Ext.isEmpty(val)) {
  319. if(!window.__fn) {
  320. var fn = function(code_) {
  321. Ext.Ajax.request({
  322. url: basePath + 'common/getFieldData.action',
  323. params: {
  324. caller: 'SubsFormula',
  325. field: 'id_',
  326. condition: 'code_=\'' + code_ + '\''
  327. },
  328. callback: function(opt, s, r) {
  329. if(s) {
  330. var rs = Ext.decode(r.responseText);
  331. if(rs.data != null && rs.data > 0) {
  332. openUrl('jsps/common/subsformula.jsp?formCondition=id_IS' + rs.data +
  333. '&gridCondition=formula_id_IS' + rs.data);
  334. }
  335. }
  336. }
  337. });
  338. };
  339. window.__fn = fn;
  340. }
  341. val = '<a href="javascript:window.__fn(\'' + val + '\');">' + val + '</a>';
  342. }
  343. return val;
  344. },
  345. /*
  346. *点开链接
  347. */
  348. Href: function(val, meta, record,x,y){
  349. var me = this.RenderUtil || this;
  350. var field = this.columns[y].dataIndex;
  351. var KeyValue = 0;
  352. var url='';
  353. var title='';
  354. var arg = me.args.Href[field];
  355. var keyField=arg[0];
  356. var data=record.data;
  357. if(arg && arg.length > 0){
  358. KeyValue=data[keyField];
  359. url=arg[1];
  360. title=arg[2];
  361. }
  362. if(val==''||val==$I18N.common.grid.emptyText) return val;
  363. if(keyField.indexOf('code')>=0){
  364. return '<a href="javascript:openFormUrl(\'' + KeyValue + '\',\''+keyField+'\',\''+url+'\',\''+title+'\''+ ');">' + val + '</a>';
  365. }
  366. return '<a href="javascript:openFormUrl(' + KeyValue + ',\''+keyField+'\',\''+url+'\',\''+title+'\''+ ');">' + val + '</a>';
  367. },
  368. /**
  369. * 生产计划已分拆
  370. * */
  371. MakePlanSplited:function(val,meta,record){
  372. if(record.data.ma_version){
  373. meta.tdCls = "x-grid-cell-renderer-cl";
  374. }
  375. },
  376. SysCheckStatus:function(val,meta,record){
  377. var statuscode=record.data.scd_statuscode;
  378. if(statuscode=='UNEXECUTE'){
  379. return '<img src="' + basePath + 'resource/images/icon/execute.png">' +
  380. '<span style="color:red;padding-left:2px">' + val + '</span>';
  381. }else if(statuscode=='EXECUTE'){
  382. return '<img src="' + basePath + 'resource/images/renderer/finishrecord.png">' +
  383. '<span style="color:green;padding-left:2px">' + val + '</span>';
  384. }else if(statuscode='FREEZE') return '<img src="' + basePath + 'resource/images/renderer/locked.png">' +
  385. '<span style="color:blue;padding-left:2px">' + val+ '</span>';
  386. else return null;
  387. },
  388. SysCheckMethod:function(val,meta,record){
  389. var method=record.data.scd_method;
  390. if(method=='-1'){
  391. return '<span style="color:red;padding-left:2px">扣分</span>';
  392. }else if(method=='0') return '<span style="color:blue;padding-left:2px">提醒</span>';
  393. else return null;
  394. },
  395. SysCheckPunish:function(val,meta,record){
  396. var method=record.data.scd_method;
  397. meta.align='left';
  398. if(record.data.scd_ispunished=='-1'){
  399. return '<span style="color:blue;padding-left:2px">已生成</span>';
  400. }else if(record.data.scd_ispunished=='0'&&method=='-1'){
  401. return '<span style="color:green;padding-left:2px">未生成</span>';
  402. }else return '<span style="color:#8B8B83;padding-left:2px">无</span>';
  403. },
  404. /**
  405. * 显示所有信息
  406. * */
  407. showAll:function(val,meta,record){
  408. if(val&&val!=null&&val.length>20){
  409. return val.substring(0,20)+'<button onClick="javascript:showAll(' + '\''+val+'\'' +');">详细</button>';
  410. }else return val;
  411. },
  412. /**
  413. * 通过args传递参数到function
  414. */
  415. args: new Object(),
  416. /**
  417. * 公式计算
  418. * 通用方法
  419. * @expression formula:pd_orderprice/(1+pd_taxrate/100)*pd_inqty
  420. *
  421. */
  422. formula: function(val, meta, record, x, y, store, view){
  423. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  424. var editvalue=val;
  425. if(!me || !me.args){
  426. grid = grid.ownerCt, me = grid.RenderUtil;
  427. if(!me || !me.args){
  428. return val;
  429. }
  430. }
  431. var arg = me.args.formula[field];
  432. if(arg && arg.length > 0){
  433. var data = record.data,keys = Ext.Object.getKeys(data),formu = arg[0];
  434. Ext.each(keys, function(k){
  435. if(contains(formu, k, true)) {
  436. formu = formu.replace(new RegExp(k,"gm"), '(' + data[k] + ')');
  437. }
  438. });
  439. var d = 0;
  440. try {
  441. d = eval(formu);
  442. } catch (e) {
  443. d = 0;
  444. }
  445. if(d == null || d == '' || String(d) == 'NaN' || String(d).length == 0)
  446. d = 0;
  447. var _val = val, _d = d,dic=2;
  448. if(column.format) {
  449. dic=column.format.substr(column.format.indexOf('.')+1).length;
  450. d=d.toFixed(dic);
  451. _val = Ext.util.Format.number(val, column.format);
  452. _d = Ext.util.Format.number(d, column.format);
  453. }
  454. val = _val;
  455. //用原值赋值
  456. if(_val != _d) {
  457. val = d;
  458. record.set(field, d);
  459. val = _d;
  460. }
  461. }
  462. if(record.get(field) != 0)
  463. return val;
  464. return "";
  465. },
  466. /**
  467. * 通过args传递参数到function
  468. */
  469. args: new Object(),
  470. /**
  471. * 公式计算
  472. * 通用方法
  473. * @expression formula:pd_orderprice/(1+pd_taxrate/100)*pd_inqty
  474. */
  475. _formula: function(val, meta, record, x, y, store, view){
  476. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  477. if(!me || !me.args){
  478. grid = grid.ownerCt, me = grid.RenderUtil;
  479. if(!me || !me.args){
  480. return val;
  481. }
  482. }
  483. var arg = me.args._formula[field];
  484. if(arg && arg.length > 0){
  485. var data = record.data,keys = Ext.Object.getKeys(data),formu = arg[0];
  486. Ext.each(keys, function(k){
  487. if(contains(formu, k, true)) {
  488. formu = formu.replace(new RegExp(k,"gm"), '(' + data[k] + ')');
  489. }
  490. });
  491. var d = 0;
  492. try {
  493. d = eval(formu);
  494. } catch (e) {
  495. d = 0;
  496. }
  497. if(d == null || d == '' || String(d) == 'NaN' || String(d).length == 0)
  498. d = 0;
  499. var fsize = (column.format && column.format.indexOf('.') > -1) ?
  500. column.format.substr(column.format.indexOf('.') + 1).length : 2,
  501. _d = d.toFixed(fsize);
  502. //按设置的格式长度赋值
  503. if(val != _d) {
  504. record.set(field, _d);
  505. val = _d;
  506. }
  507. val = Ext.util.Format.number(val, column.format || '0,000.00');
  508. }
  509. if(record.get(field) != 0)
  510. return val;
  511. return "";
  512. },
  513. /**
  514. * 公式计算
  515. * 通用方法
  516. * @expression formula:pd_orderprice/(1+pd_taxrate/100)*pd_inqty
  517. */
  518. overqty: function(val, meta, record, x, y, store, view){
  519. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  520. if(!me || !me.args){
  521. grid = grid.ownerCt, me = grid.RenderUtil;
  522. if(!me || !me.args){
  523. return val;
  524. }
  525. }
  526. var arg = me.args.overqty[field];
  527. if(arg && arg.length > 0){
  528. var data = record.data,keys = Ext.Object.getKeys(data),formu = arg[0];
  529. Ext.each(keys, function(k){
  530. if(contains(formu, k, true)) {
  531. formu = formu.replace(new RegExp(k,"gm"), '(' + data[k] + ')');
  532. }
  533. });
  534. var d = 0;
  535. try {
  536. d = eval(formu);
  537. } catch (e) {
  538. d = 0;
  539. }
  540. if(d == null || d == '' || String(d) == 'NaN' || String(d).length == 0)
  541. d = 0;
  542. var _val = val, _d = d;
  543. if(column.format) {
  544. _val = Ext.util.Format.number(val, column.format);
  545. _d = Ext.util.Format.number(d, column.format);
  546. }
  547. val = _val;
  548. if(_val != _d) {
  549. //鉴于小数问题 保留2位小数
  550. if(column.editor || (column.getEditor && column.getEditor())) {
  551. val = (!Ext.isNumber(val) || val == 0) ? d : val;
  552. if(Number(val) - d > 0){
  553. val = d;
  554. showError('请不要输入超过最大数量' + d + "的值!");
  555. }
  556. } else {
  557. val = d;
  558. }
  559. var _v = val;
  560. if(column.xtype == 'numbercolumn') {
  561. _v = Ext.util.Format.number(val, column.format);
  562. }
  563. if(Ext.util.Format.number(record.data[field], column.format) != _v){
  564. record.set(field, val);
  565. }
  566. return _v;
  567. } else {
  568. return val;
  569. }
  570. }
  571. },
  572. /**
  573. * 公式计算
  574. * 通用方法
  575. * @expression eval:pd_orderprice/(1+pd_taxrate/100)*pd_inqty
  576. */
  577. eval: function(val, meta, record, x, y, store, view){
  578. meta.tdCls = "x-grid-cell-renderer-bl";
  579. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  580. if(!me || !me.args){
  581. grid = grid.ownerCt, me = grid.RenderUtil;
  582. if(!me || !me.args){
  583. return val;
  584. }
  585. }
  586. var arg = me.args.eval[field];
  587. if(arg && arg.length > 0){
  588. val = record.get(field);
  589. var data = record.data,keys = Ext.Object.getKeys(data),formu = arg[0];
  590. Ext.each(keys, function(k){
  591. if(contains(formu, k, true)) {
  592. formu = formu.replace(new RegExp(k,"gm"), '(' + data[k] + ')');
  593. }
  594. });
  595. var d = 0;
  596. try {
  597. d = eval(formu);
  598. } catch (e) {
  599. d = 0;
  600. }
  601. if(d == null || d == '' || String(d) == 'NaN' || String(d).length == 0)
  602. return val;
  603. var _val = val, _d = d;
  604. if(column.format) {
  605. _val = Ext.util.Format.number(val, column.format);
  606. _d = Ext.util.Format.number(d, column.format);
  607. }
  608. if(_val != _d) {
  609. if(record.modified == null || record.modified[field] == null) {
  610. val = d;
  611. record.set(field, d);
  612. record.modified[field] = d;
  613. }
  614. }
  615. }
  616. return val;
  617. },
  618. /**
  619. * 适用于所有日期类型
  620. * 超时提示
  621. * 当v < 当前日期时,表示超时
  622. * 需要在dataListDetail表的dld_render 配置 overtime:{dateField}
  623. * 注意:日期类型貌似不能直接render,所以要借助其他字段
  624. * @expression overtime:pu_delivery
  625. */
  626. overtime: function(val, meta, record, x, y, store, view){
  627. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  628. if(!me || !me.args){
  629. grid = grid.ownerCt, me = grid.RenderUtil;
  630. if(!me || !me.args){
  631. return val;
  632. }
  633. }
  634. var d = new Date();
  635. var arg = me.args.overtime[field];
  636. if(arg && arg.length > 0){
  637. d = record.data[arg[0]];//me.args[0]为需要逻辑判断的日期字段
  638. }
  639. if(!Ext.isDate(d)){
  640. d = Ext.Date.parse(d, 'Y-m-d H:i:s') || Ext.Date.parse(d, 'Y-m-d');
  641. }
  642. if(d < new Date()){
  643. return '<img src="' + basePath + 'resource/images/renderer/important.png" title="时间结束:' + Ext.Date.toString(d) + '">' +
  644. '<span style="color:blue;padding-left:2px" title="时间结束:' + Ext.Date.toString(d) + '">' + val + '</span>';
  645. } else {
  646. return val;
  647. }
  648. },
  649. pd_auditstatus_show:function(val, meta, record, x, y, store, view){
  650. var grid = view.ownerCt,column = grid.columns[y],field = column.dataIndex;
  651. var returnStr;
  652. if(val == 'PARTAR'||val == '部分开票'){
  653. returnStr = '部分开票';
  654. }else if(val == 'TURNAR'||val == '已开票'){
  655. returnStr = '已开票';
  656. }else{
  657. returnStr = '未开票';
  658. }
  659. if(val != returnStr) {
  660. val = returnStr;
  661. record.set(field, val);
  662. }
  663. return val;
  664. },
  665. defaultValue:function(val, meta, record, x, y, store, view){
  666. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  667. if(val == null || val == '' || val == 0){
  668. if(!me || !me.args){
  669. grid = grid.ownerCt, me = grid.RenderUtil;
  670. if(!me || !me.args){
  671. return val;
  672. }
  673. }
  674. var v = record.data[field];
  675. if(v == null || v == '' || (column.xtype == 'numbercolumn' && v == 0)){
  676. var arg = me.args.defaultValue[field];
  677. if(arg && arg.length > 0){
  678. val = arg[0];
  679. }
  680. if(val != null && val != '' && val != 0){
  681. record.set(field, val);
  682. }
  683. }
  684. }
  685. if(column.xtype == 'numbercolumn' && val != 0){
  686. val = Ext.util.Format.number(val, column.format);
  687. }
  688. return val;
  689. },
  690. /**
  691. * 解析链接,并打开
  692. * @expression jsps/scm/sale/sendnotify.jsp?formConditionISsn_id={snd_snid}&gridConditionISsnd_snid={snd_snid}
  693. */
  694. link: function(val, m, record, x, y, store, view) {
  695. var grid = view.ownerCt, me = grid.RenderUtil,column = grid.columns[y], url = column.logic|| (me && me.args ? me.args.link[column.dataIndex][0] : '');
  696. if(url) {
  697. var res = '';
  698. if(url == 'necessaryField' || url == 'orNecessField') {
  699. if(!val)
  700. res = '<img src="' + basePath + 'resource/images/icon/need.png" title="必填字段">';
  701. url = me.args ? me.args.link[column.dataIndex][0] : '';
  702. }
  703. var index = 0, length = url.length, s, e;
  704. while(index < length) {
  705. if((s = url.indexOf('{', index)) != -1 && (e = url.indexOf('}', s + 1)) != -1) {
  706. url = url.substring(0, s) + record.get(url.substring(s+1, e)) + url.substring(e+1);
  707. index = e + 1;
  708. } else {
  709. break;
  710. }
  711. }
  712. return res + '<a href="javascript:openUrl(\'' + url + '\');">' + val + '</a>';
  713. }
  714. return val;
  715. },
  716. /**
  717. * val不能小于当前日期
  718. * @expression undertime
  719. */
  720. undertime: function(val, meta, record, x, y, store, view){
  721. meta.style = "background:#C6E2FF;";
  722. var d = Ext.Date.parse(Ext.Date.toString(new Date()), 'Y-m-d');
  723. var grid = view.ownerCt,column = grid.columns[y],field = column.dataIndex;
  724. val = record.data[field];
  725. if(val == null) {
  726. val = Ext.Date.toString(d);
  727. } else {
  728. if(!Ext.isDate(val)){
  729. val = Ext.Date.parse(val, 'Y-m-d');
  730. }
  731. if(val < d){
  732. val = Ext.Date.toString(d);
  733. showError("日期不能小于当前日期!");
  734. } else {
  735. val = Ext.Date.toString(new Date(val));
  736. }
  737. }
  738. if(Ext.isDate(record.data[field])){
  739. if(Ext.Date.toString(record.data[field]) != val){
  740. record.set(field, val);
  741. }
  742. } else {
  743. if(record.data[field] != val){
  744. record.set(field, val);
  745. }
  746. }
  747. return val;
  748. },
  749. /**
  750. * 适用于所有数字类型
  751. * 数量过大提示
  752. * 当val > d时,表示过大
  753. * 需要在dataListDetail表的dld_render 配置 oversize:{num}
  754. * @expression oversize:100
  755. * @expression oversize:pd_qty
  756. */
  757. oversize: function(val, meta, record, x, y, store, view){
  758. meta.style = "background:#C6E2FF;";
  759. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  760. if(!me || !me.args){
  761. grid = grid.ownerCt, me = grid.RenderUtil;
  762. if(!me || !me.args){
  763. return val;
  764. }
  765. }
  766. var d = val;
  767. var arg = me.args.oversize[field];
  768. if(arg && arg.length > 0){
  769. if(Ext.isNumber(arg[0])){
  770. d = Number(arg[0]);
  771. } else {
  772. d = Number(record.data[arg[0]]);
  773. }
  774. }
  775. if(val > d){
  776. return '<img src="' + basePath + 'resource/images/renderer/important.png" title="数值过大:' + val + '>' + d + '">' +
  777. '<span style="color:blue;padding-left:2px" title="数值过大:' + val + '>' + d + '">' + val + '</span>';
  778. } else {
  779. return val;
  780. }
  781. },
  782. /**
  783. * 适用于所有数字类型
  784. * 数量过小提示
  785. * 当val < d时,表示过小
  786. * 需要在dataListDetail表的dld_render 配置 undersize:{num}
  787. * @param arg为number类型或某字段
  788. * @expression undersize:100
  789. * @expression undersize:pd_yqty
  790. */
  791. undersize: function(val, meta, record, x, y, store, view){
  792. meta.style = "background:#CDB5CD;";
  793. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex,uCol = null;
  794. if(!me || !me.args){
  795. grid = grid.ownerCt, me = grid.RenderUtil;
  796. if(!me || !me.args){
  797. return val;
  798. }
  799. }
  800. var d = val;
  801. var arg = me.args.undersize[field];
  802. if(arg && arg.length > 0){
  803. if(!Ext.isNumber(Number(arg[0]))){
  804. d = Number(record.data[arg[0]]);
  805. var rr = grid.columns.filter(function(c){
  806. return c.dataIndex == arg[0];
  807. });
  808. if(rr.length > 0) {
  809. uCol = rr[0];
  810. }
  811. } else {
  812. d = Number(arg[0]);
  813. }
  814. }
  815. if(record.data[field] != val){
  816. record.set(field, val);
  817. }
  818. if(!Ext.isNumber(val)){
  819. val = d;
  820. record.set(field, val);
  821. showError('请输入数字!');
  822. } else{
  823. if(val < d){
  824. if(val != 0) {
  825. var err = '请不要输入低于';
  826. if(uCol != null) {
  827. err += '<' + uCol.text + '>';
  828. }
  829. showError(err + '<' + d + ">的值!");
  830. }
  831. val = d;
  832. record.set(field, val);
  833. }
  834. }
  835. var str = val;
  836. if(column.format) {
  837. str = Ext.util.Format.number(val, column.format);
  838. }
  839. if(val < d){
  840. return '<img src="' + basePath + 'resource/images/renderer/important.png" title="数值过小:' + val + '<' + d + '">' +
  841. '<span style="color:blue;padding-left:2px" title="数值过小:' + val + '<' + d + '">' + str + '</span>';
  842. } else {
  843. return str;
  844. }
  845. },
  846. /**
  847. * 适用于所有数字类型
  848. * 数量介于{min}~{max}
  849. * @expression betweensize:0:100
  850. * @expression betweensize:0:pd_qty
  851. * @expression betweensize:pd_tqty:pd_qty
  852. */
  853. betweensize: function(val, meta, record, x, y, store, view){
  854. meta.style = "background:#C6E2FF;";
  855. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  856. if(!me || !me.args){
  857. grid = grid.ownerCt, me = grid.RenderUtil;
  858. if(!me || !me.args){
  859. return val;
  860. }
  861. }
  862. var arg = me.args.betweensize[field];
  863. var min = 0;
  864. var max = 0;
  865. if(arg && arg.length > 0){
  866. if(!Ext.isNumber(Number(arg[0]))){
  867. min = record.modified[arg[0]];
  868. } else {
  869. min = Number(arg[0]);
  870. }
  871. if(!Ext.isNumber(Number(arg[1]))){
  872. max = record.modified[arg[1]];
  873. } else {
  874. max = Number(arg[1]);
  875. }
  876. }
  877. if(record.data[field] != val){
  878. record.set(field, val);
  879. }
  880. if(!Ext.isNumber(val)){
  881. val = max;
  882. record.set(field, val);
  883. showError('请输入数字!');
  884. } else{
  885. if(val < min){
  886. val = max;
  887. record.set(field, val);
  888. showError('请不要输入低于' + min + "的值!");
  889. } else if(val > max){
  890. val = max;
  891. record.set(field, val);
  892. showError('请不要输入大于' + max + "的值!");
  893. }
  894. }
  895. if(val < min){
  896. return '<img src="' + basePath + 'resource/images/renderer/important.png" title="数值过小:' + val + '<' + min + '">' +
  897. '<span style="color:blue;padding-left:2px" title="数值过小:' + val + '<' + min + '">' + val + '</span>';
  898. } else if(val > max){
  899. return '<img src="' + basePath + 'resource/images/renderer/important.png" title="数值过大:' + val + '<' + max + '">' +
  900. '<span style="color:blue;padding-left:2px" title="数值过大:' + val + '<' + max + '">' + val + '</span>';
  901. } else {
  902. return val;
  903. }
  904. },
  905. /**
  906. * 通用方法
  907. * 值是否为空
  908. * @expression isnull
  909. */
  910. isnull: function(val, meta, record){
  911. meta.style = "background:#C6E2FF;";
  912. if(val == null || val == ''){
  913. return '<img src="' + basePath + 'resource/images/renderer/important.png" title="无数据">' +
  914. '<span style="color:blue;padding-left:2px" title="无数据">' + val + '</span>';
  915. } else {
  916. return val;
  917. }
  918. },
  919. /**
  920. * 通用方法
  921. * 值=arg[0]+arg[1]+...
  922. * @expression plus:pd_tqty:pd_yqty
  923. * @expression plus:pd_tqty:100:pd_yqty
  924. */
  925. plus: function(val, meta, record, x, y, store, view){
  926. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex,format = column.format,type = column.xtype;
  927. if(!me || !me.args){
  928. grid = grid.ownerCt, me = grid.RenderUtil;
  929. if(!me || !me.args){
  930. return val;
  931. }
  932. }
  933. var d = 0;
  934. var arg = me.args.plus[field];
  935. if(arg && arg.length > 0){
  936. Ext.each(arg, function(a, index){
  937. if(Ext.isNumber(a)){
  938. d += Number(a);
  939. } else {
  940. d += Number(record.data[a]);
  941. }
  942. });
  943. }
  944. if(record.data[field] != d){
  945. record.set(field, d);
  946. }
  947. if(format && type =='numbercolumn'){
  948. d = Ext.util.Format.number(d, format);
  949. }
  950. return '<img src="' + basePath + 'resource/images/renderer/finishrecord.png">' +
  951. '<span style="color:blue;padding-left:2px">' + d + '</span>';
  952. },
  953. /**
  954. * 通用乘法方法
  955. * 值=arg[0]*arg[1]*...
  956. * @expression multiply:pd_tqty:pd_price
  957. * @expression multiply:pd_tqty:100:pd_rate
  958. */
  959. multiply: function(val, meta, record, x, y, store, view){
  960. var grid = view.ownerCt, me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex,format = column.format,type = column.xtype;
  961. if(!me || !me.args){
  962. grid = grid.ownerCt, me = grid.RenderUtil;
  963. if(!me || !me.args){
  964. return val;
  965. }
  966. }
  967. var d = 1;
  968. var red= d;
  969. var arg = me.args.multiply[field];
  970. if(arg && arg.length > 0){
  971. Ext.each(arg, function(a, index){
  972. if(Ext.isNumber(a)){
  973. d = d * Number(a);
  974. } else {
  975. d = d * Number(record.data[a]);
  976. }
  977. if(format&&type =='numbercolumn'){
  978. red = Ext.util.Format.number(d,format);
  979. }else{
  980. red = d;
  981. }
  982. });
  983. }
  984. if(record.data[field] != d){
  985. record.set(field, d);
  986. }
  987. return '<img src="' + basePath + 'resource/images/renderer/finishrecord.png">' +
  988. '<span style="color:blue;padding-left:2px">' + red + '</span>';
  989. },
  990. /**
  991. * 通用方法
  992. * A floating:B
  993. * 比较A相对于B的浮动变化
  994. * @expression floating:B
  995. */
  996. floating: function(val, meta, record, x, y, store, view) {
  997. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  998. if(!me || !me.args){
  999. return val;
  1000. }
  1001. var arg = me.args.floating[field], a = null, b = null, f = null, n = null, istxt = true;
  1002. if(column.xtype == 'datecolumn') {
  1003. if(!val) return null;
  1004. a = record.get(arg);
  1005. b = val;
  1006. f = (column.format || 'Y-m-d');
  1007. n = Ext.Date.format(val, f);
  1008. istxt = false;
  1009. } else if(column.xtype == 'numbercolumn') {
  1010. a = Number(record.get(arg));
  1011. b = Number(val);
  1012. f = (column.format || '0,000');
  1013. n = Ext.util.Format.number(val, f);
  1014. istxt = false;
  1015. } else {
  1016. a = record.get(arg);
  1017. b = val;
  1018. }
  1019. if(istxt) {
  1020. if(a != b) {
  1021. return '<span style="color:red;padding-left:2px">' + val + '</span>';
  1022. } else {
  1023. return val;
  1024. }
  1025. } else {
  1026. if(a < b) {
  1027. return '<img src="' + basePath + 'resource/images/16/up.png">' +
  1028. '<span style="color:red;padding-left:2px">' + n + '</span>';
  1029. } else if(a > b) {
  1030. return '<img src="' + basePath + 'resource/images/16/down.png">' +
  1031. '<span style="color:red;padding-left:2px">' + n + '</span>';
  1032. } else if(a == 0 && b == 0) {
  1033. return '';
  1034. }
  1035. }
  1036. return n;
  1037. },
  1038. ars_prodtoapbill_outqty:function(val, meta, record, x, y){
  1039. var inqty = 0;
  1040. var outqty = 0;
  1041. var returnqty = 0;
  1042. if(record.data['pd_inqty']!=null&&record.data['pd_inqty']){
  1043. inqty = Ext.Number.from(record.data['pd_inqty'],0);
  1044. }
  1045. if(record.data['pd_outqty']!=null&&record.data['pd_outqty']){
  1046. inqty = Ext.Number.from(record.data['pd_inqty'],0);
  1047. }
  1048. returnqty=outqty-inqty;
  1049. if(val != returnqty){
  1050. record.set('pd_outqty', returnqty);
  1051. val = returnqty;
  1052. }
  1053. return val;
  1054. },
  1055. ars_prodtoarbill_price:function(val, meta, record, x, y){
  1056. var orderprice = 0.00;
  1057. var sendprice = 0.00;
  1058. var returnprice = 0.00;
  1059. if(record.data['pd_orderprice']!=null&&record.data['pd_orderprice']){
  1060. orderprice = Ext.Number.from(record.data['pd_orderprice'],0.00);
  1061. }
  1062. if(record.data['pd_sendprice']!=null&&record.data['pd_sendprice']){
  1063. sendprice = Ext.Number.from(record.data['pd_sendprice'],0.00);
  1064. }
  1065. returnprice=Math.abs(orderprice-sendprice);
  1066. returnprice=Ext.util.Format.number(returnprice,'0.00');
  1067. if(val != returnprice){
  1068. record.set('pd_showprice', returnprice);
  1069. val = returnprice;
  1070. }
  1071. return val;
  1072. },
  1073. /**
  1074. * 出货数量 outqty - inqty
  1075. * @param val
  1076. * @param meta
  1077. * @param record
  1078. * @param x
  1079. * @param y
  1080. * @returns
  1081. */
  1082. ars_prodtoapbill_outqty:function(val, meta, record, x, y){
  1083. var inqty = 0;
  1084. var outqty = 0;
  1085. var returnqty = 0;
  1086. if(record.data['pd_inqty']!=null&&record.data['pd_inqty']){
  1087. inqty = Ext.Number.from(record.data['pd_inqty'],0);
  1088. }
  1089. if(record.data['pd_outqty']!=null&&record.data['pd_outqty']){
  1090. outqty = Ext.Number.from(record.data['pd_outqty'],0);
  1091. }
  1092. returnqty=outqty-inqty;
  1093. if(val != returnqty){
  1094. record.set('pd_showqty', returnqty);
  1095. val = returnqty;
  1096. }
  1097. return val;
  1098. },
  1099. /**
  1100. * @CRM
  1101. * 客户关系商机状态显示
  1102. */
  1103. chanceAllstatus: function(val, meta, record,x,y){
  1104. var code=record.data['cd_chancecode'];
  1105. var str=val.replace(/1/g,'√');
  1106. str=str.replace(/0/g,'O');
  1107. return '<a href="javascript:showchancestatus(' + '\''+code+'\'' +');">' + str + '</a>';
  1108. },
  1109. /**
  1110. * @CRM
  1111. * 客户关系商机状态显示
  1112. */
  1113. chancestatus: function(val, meta, record,x,y){
  1114. var str='';
  1115. if(val=='0'){
  1116. str='O';
  1117. }
  1118. if(val=='1'){
  1119. str='√';
  1120. }
  1121. return str;
  1122. },
  1123. /**
  1124. * @CRM
  1125. * 客户关系商机状态显示
  1126. */
  1127. inquiryturnstatus: function(val, meta, record,x,y){
  1128. var str='';
  1129. if(val=='0'){
  1130. str='否';
  1131. }
  1132. if(val=='1'){
  1133. str='未选择';
  1134. }
  1135. if(val=='-1'){
  1136. str='是';
  1137. }
  1138. return str;
  1139. },
  1140. oameeting:function(val,meta, record){
  1141. if(val=='0'){
  1142. return ' ';
  1143. }
  1144. var url='jsps/oa/meeting/meetingroomapply.jsp';
  1145. var title='会议室申请单';
  1146. return '<a href="javascript:openGridUrl(\''+val+'\''+',\'ma_id\',\'mad_maid\',\''+url+'\',\''+title+'\''+ ');">' + '√' + '</a>';
  1147. },
  1148. /**
  1149. * 验收数量 inqty - outqty
  1150. * @param val
  1151. * @param meta
  1152. * @param record
  1153. * @param x
  1154. * @param y
  1155. * @returns
  1156. */
  1157. ars_prodtoapbill_inqty:function(val, meta, record, x, y){
  1158. var inqty = 0;
  1159. var outqty = 0;
  1160. var returnqty = 0;
  1161. if(record.data['pd_inqty']!=null&&record.data['pd_inqty']){
  1162. inqty = Ext.Number.from(record.data['pd_inqty'],0);
  1163. }
  1164. if(record.data['pd_outqty']!=null&&record.data['pd_outqty']){
  1165. outqty = Ext.Number.from(record.data['pd_outqty'],0);
  1166. }
  1167. returnqty=inqty-outqty;
  1168. if(val != returnqty){
  1169. record.set('pd_showqty', returnqty);
  1170. val = returnqty;
  1171. }
  1172. return val;
  1173. },
  1174. /**
  1175. * 验收数量的绝对值 pd_inqty -已经转发票数量 pd_showinvoqty = 本次可转发票数量 pd_thisvoqty
  1176. * @param val
  1177. * @param meta
  1178. * @param record
  1179. * @param x
  1180. * @param y
  1181. * @returns
  1182. */
  1183. ars_prodtoapbill_thisqty:function(val, meta, record, x, y){
  1184. meta.style = "background:#C6E2FF;";
  1185. //pd_thisvoqty = pd_inqty-pd_showinvoqty inqty要绝对值
  1186. var thisvoqty = 0;
  1187. var inqty = 0;
  1188. var invoqty = 0;
  1189. if(record.data['pd_showqty']!=null&&record.data['pd_showqty']!=''){
  1190. inqty = Math.abs(Ext.Number.from(record.data['pd_showqty'],0));
  1191. }
  1192. if(record.data['pd_showinvoqty']!=null&&record.data['pd_showinvoqty']){
  1193. invoqty = Ext.Number.from(record.data['pd_showinvoqty'],0);
  1194. }
  1195. thisvoqty=inqty-invoqty;
  1196. if(val != thisvoqty){
  1197. record.set('pd_thisvoqty', thisvoqty);
  1198. val = thisvoqty;
  1199. }
  1200. return val;
  1201. },
  1202. /**
  1203. * 出入库单号链接
  1204. *
  1205. **/
  1206. ProdioHref:function(val,meta,record){
  1207. var url='jsps/scm/reserve/prodInOut.jsp?whoami=';
  1208. var caller;
  1209. var piclass=record.data.pi_class, piid = record.data.pi_id;
  1210. if(piclass == '采购验收单'){
  1211. caller = 'ProdInOut!PurcCheckin';
  1212. } else if(piclass == '采购验退单'){
  1213. caller = 'ProdInOut!PurcCheckout';
  1214. } else if(piclass == '其它采购入库单'){
  1215. caller = 'ProdInOut!OtherPurcIn';
  1216. } else if(piclass == '完工入库单'){
  1217. caller = 'ProdInOut!Make!In';
  1218. } else if(piclass == '其它采购出库单'){
  1219. caller = 'ProdInOut!OtherPurcOut';
  1220. } else if(piclass == '换货出库单'){
  1221. caller = 'ProdInOut!ExchangeOut';
  1222. } else if(piclass == '换货入库单'){
  1223. caller = 'ProdInOut!ExchangeIn';
  1224. } else if(piclass == '出货单'){
  1225. caller = 'ProdInOut!Sale';
  1226. } else if(piclass == '委外领料单'){
  1227. caller = 'ProdInOut!OutsidePicking';
  1228. } else if(piclass == '研发退料单'){
  1229. caller = 'ProdInOut!YFIN';
  1230. } else if(piclass == '研发领料单'){
  1231. caller = 'ProdInOut!YFOUT';
  1232. } else if(piclass == '辅料入库单'){
  1233. caller = 'ProdInOut!FLIN';
  1234. } else if(piclass == '辅料出库单'){
  1235. caller = 'ProdInOut!FLOUT';
  1236. } else if(piclass == '借货出货单'){
  1237. caller = 'ProdInOut!SaleBorrow';
  1238. } else if(piclass == '借货归还单'){
  1239. caller = 'ProdInOut!OutReturn';
  1240. } else if(piclass == '委外补料单'){
  1241. caller = 'ProdInOut!OSMake!Give';
  1242. } else if(piclass == '不良品入库单'){
  1243. caller = 'ProdInOut!DefectIn';
  1244. } else if(piclass == '不良品出库单'){
  1245. caller = 'ProdInOut!DefectOut';
  1246. } else if(piclass == '库存初始化'){
  1247. caller = 'ProdInOut!ReserveInitialize';
  1248. } else if(piclass == '报废单'){
  1249. caller = 'ProdInOut!StockScrap';
  1250. } else if(piclass == '盘亏调整单'){
  1251. caller = 'ProdInOut!StockLoss';
  1252. } else if(piclass == '盘盈调整单'){
  1253. caller = 'ProdInOut!StockProfit';
  1254. } else if(piclass == '拆件入库单'){
  1255. caller = 'ProdInOut!PartitionStockIn';
  1256. } else if(piclass == '其它入库单'){
  1257. caller = 'ProdInOut!OtherIn';
  1258. } else if(piclass == '生产领料单'){
  1259. caller = 'ProdInOut!Picking';
  1260. } else if(piclass == '生产退料单'){
  1261. caller = 'ProdInOut!Make!Return';
  1262. } else if(piclass == '销售退货单'){
  1263. caller = 'ProdInOut!SaleReturn';
  1264. } else if(piclass == '委外验收单'){
  1265. caller = 'ProdInOut!OutsideCheckIn';
  1266. } else if(piclass == '委外验退单'){
  1267. caller = 'ProdInOut!OutesideCheckReturn';
  1268. } else if(piclass == '委外退料单'){
  1269. caller = 'ProdInOut!OutsideReturn';
  1270. } else if(piclass == '拨出单'){
  1271. caller = 'ProdInOut!AppropriationOut';
  1272. } else if(piclass == '拨入单'){
  1273. caller = 'ProdInOut!AppropriationIn';
  1274. } else if(piclass == '销售拨出单'){
  1275. caller = 'ProdInOut!SaleAppropriationOut';
  1276. } else if(piclass == '销售拨入单'){
  1277. caller = 'ProdInOut!SalePutIn';
  1278. } else if(piclass == '其它出库单'){
  1279. caller = 'ProdInOut!OtherOut';
  1280. } else if(piclass == '生产补料单'){
  1281. caller = 'ProdInOut!Make!Give';
  1282. }
  1283. url = url + caller + '&formCondition=pi_idIS'+piid+'&gridCondition=pd_piidIS'+piid;
  1284. return '<a href="javascript:openUrl(\''+url+'\');">' + val + '</a>';
  1285. },
  1286. /**
  1287. * 采购单号链接
  1288. *
  1289. **/
  1290. PuWithOAHref:function(val,meta,record){
  1291. var url=null;
  1292. var caller;
  1293. var piclass=record.data.ppdd_type, pucode = record.data.ppdd_pucode;
  1294. if(piclass == '采购单'){
  1295. url='jsps/scm/purchase/purchase.jsp?formCondition=pu_codeIS'+pucode+'&gridCondition=pd_codeIS'+pucode;
  1296. } else if(piclass == '模具采购单'){
  1297. url='jsps/pm/mould/purcMould.jsp?whoami=Purc!Mould&formCondition=pm_codeIS'+pucode+'&gridCondition=pmd_codeIS'+pucode;
  1298. } else if(piclass == '用品采购单'){
  1299. url='jsps/oa/appliance/oapurchase.jsp?formCondition=op_codeIS'+pucode+'&gridCondition=od_codeIS'+pucode;
  1300. } else if(piclass == '印章申请单'){
  1301. url='jsps/oa/fee/feePleaseYZSYSQ.jsp?whoami=FeePlease!YZSYSQ&formCondition=fp_codeIS'+pucode+'&gridCondition=fpd_codeIS'+pucode;
  1302. }
  1303. if(url != null){
  1304. return '<a href="javascript:openUrl(\''+url+'\');">' + val + '</a>';
  1305. }
  1306. return val;
  1307. },
  1308. /**
  1309. * 应收发票维护 计算不含税金额 不含税金额,需要改为“本次开票不含税金额”=本次开票价税合计 / (1+税率)
  1310. *
  1311. *
  1312. *
  1313. */
  1314. ars_arbill_tax: function(val, meta, record, x, y, store, view){
  1315. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1316. var tax = Number(record.data['abd_qty'])*Number(record.data['abd_thisvoprice'])/(1+Number(record.data['abd_taxrate'])/100);
  1317. if(tax != null && tax >= 0) {
  1318. record.set('abd_noaramount', tax);
  1319. val = tax;
  1320. }
  1321. if(column.format)
  1322. val = Ext.util.Format.number(val, column.format);
  1323. return val;
  1324. },
  1325. /**
  1326. * 应收发票维护 计算不含税金额 不含税金额,需要改为“本次开票不含税金额”=本次开票价税合计 / (1+税率)
  1327. *
  1328. *
  1329. *
  1330. */
  1331. arp_apbill_tax: function(val, meta, record, x, y, store, view){
  1332. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1333. var tax = Number(record.data['abd_apamount'])/(1+Number(record.data['abd_taxrate'])/100);
  1334. if(tax != null && tax >= 0) {
  1335. record.set('abd_noapamount', tax);
  1336. val = tax;
  1337. }
  1338. if(column.format)
  1339. val = Ext.util.Format.number(val, column.format);
  1340. return val;
  1341. },
  1342. /**
  1343. * 应收发票维护 计算不含税金额 不含税金额,需要改为“本次开票不含税金额”=本次开票价税合计 / (1+税率)
  1344. *
  1345. *
  1346. *
  1347. */
  1348. arbill_show_invototal: function(val, meta, record, x, y, store, view){
  1349. var sourcekind = record.data['abd_sourcekind'];
  1350. var grid = view.ownerCt,column = grid.columns[y];
  1351. var pd_invototal = Number(record.data['pd_invototal']); //出入库单转出
  1352. var gsd_invototal = Number(record.data['gsd_invototal']); //发出商品数据
  1353. var abd_totalbillprice = Number(record.data['abd_totalbillprice']);//初始化数据
  1354. //转发类型是发出商品
  1355. if(sourcekind == 'GOODSSEND'){
  1356. if(val!=gsd_invototal){
  1357. record.set('abd_totalbillprice', gsd_invototal);
  1358. gsd_invototal=val;
  1359. }
  1360. return Ext.util.Format.number(gsd_invototal, column.format);
  1361. //出入库单转出
  1362. }else if(sourcekind == 'PRODIODETAIL'){
  1363. if(val!=pd_invototal){
  1364. record.set('abd_totalbillprice', pd_invototal);
  1365. pd_invototal=val;
  1366. }
  1367. return Ext.util.Format.number(pd_invototal, column.format);
  1368. //初始化
  1369. }else if(sourcekind == 'INITIALIZATION'){
  1370. if(val!=abd_totalbillprice){
  1371. record.set('abd_totalbillprice', abd_totalbillprice);
  1372. abd_totalbillprice=val;
  1373. }
  1374. return Ext.util.Format.number(abd_totalbillprice, column.format);
  1375. }
  1376. },
  1377. /**
  1378. * 应收发票维护 计算不含税金额 不含税金额,需要改为“本次开票不含税金额”=本次开票价税合计 / (1+税率)
  1379. *
  1380. *
  1381. *
  1382. */
  1383. apbill_show_invototal: function(val, meta, record, x, y, store, view){
  1384. var sourcekind = record.data['abd_sourcekind'];
  1385. var grid = view.ownerCt,column = grid.columns[y];
  1386. var pd_invototal = Number(record.data['pd_invototal']); //出入库单转出
  1387. var esd_invototal = Number(record.data['esd_invototal']); //发出商品数据
  1388. var abd_totalbillprice = Number(record.data['abd_totalbillprice']);//初始化数据
  1389. //转发类型是发出商品
  1390. if(sourcekind == 'ESTIMATE'){
  1391. if(val!=esd_invototal){
  1392. record.set('abd_totalbillprice', esd_invototal);
  1393. esd_invototal=val;
  1394. }
  1395. return Ext.util.Format.number(esd_invototal,column.format);
  1396. //出入库单转出
  1397. }else if(sourcekind == 'PRODIODETAIL'){
  1398. if(val!=pd_invototal){
  1399. record.set('abd_totalbillprice', pd_invototal);
  1400. pd_invototal=val;
  1401. }
  1402. return Ext.util.Format.number(pd_invototal,column.format);
  1403. //初始化
  1404. }else if(sourcekind == 'INITIALIZATION'){
  1405. if(val!=abd_totalbillprice){
  1406. record.set('abd_totalbillprice', abd_totalbillprice);
  1407. abd_totalbillprice=val;
  1408. }
  1409. return Ext.util.Format.number(abd_totalbillprice, column.format);
  1410. }
  1411. },
  1412. /**
  1413. * 应付发票维护 计算不含税金额 不含税金额,需要改为“本次开票不含税金额”=本次开票价税合计 / (1+税率)
  1414. *
  1415. *
  1416. *
  1417. */
  1418. ars_apbill_tax: function(val, meta, record, x, y){
  1419. var tax = Number(record.data['abd_apamount'])/(1+Number(record.data['abd_taxrate'])/100);
  1420. var tval=Ext.util.Format.number(tax,'0.00');
  1421. if(val != tval){
  1422. record.set('abd_noapamount', tval);
  1423. val = tval;
  1424. }
  1425. return tval;
  1426. },
  1427. colspan: function(val, meta, record, x, y, store, view){
  1428. meta.tdAttr = "rowspan=8;";
  1429. },
  1430. nullcolspan: function(val, meta){
  1431. meta.tdAttr = "rowspan=0;";
  1432. },
  1433. CRMHref:function(val, meta, record,x,y){
  1434. var me = this.RenderUtil || this;
  1435. var field = this.columns[y].dataIndex;
  1436. var KeyValue = 0;
  1437. var url='';
  1438. var title='';
  1439. var arg = me.args.CRMHref[field];
  1440. var keyField=arg[0];
  1441. var data=record.data;
  1442. if(arg && arg.length > 0){
  1443. KeyValue=data[field];
  1444. url=arg[1];
  1445. title=arg[2];
  1446. }
  1447. if(keyField.indexOf('code')>=0){
  1448. url+='?mr_taskcode='+KeyValue;
  1449. Ext.Ajax.request({
  1450. url: basePath+'crm/getReportCode.action',
  1451. async:false,
  1452. params:{
  1453. mt_code:KeyValue
  1454. },
  1455. method:'post',
  1456. callback:function(options,success,response){
  1457. var res = new Ext.decode(response.responseText);
  1458. url+='&whoami='+res.mt_reportcode;
  1459. }
  1460. });
  1461. }else{
  1462. url+='?mr_id='+KeyValue;
  1463. url+='&formCondition=mr_idIS'+KeyValue+'&gridCondition=mrd_mridIS'+KeyValue;
  1464. Ext.Ajax.request({
  1465. url: basePath+'crm/getReportCodeById.action',
  1466. async:false,
  1467. params:{
  1468. mr_id:KeyValue
  1469. },
  1470. method:'post',
  1471. callback:function(options,success,response){
  1472. var res = new Ext.decode(response.responseText);
  1473. url+='&whoami='+res.mr_reportcode;
  1474. }
  1475. });
  1476. }
  1477. if(val==''||val==$I18N.common.grid.emptyText) return val;
  1478. if(keyField.indexOf('code')>=0){
  1479. return '<a href="javascript:openUrl(\''+url+'\');">' + val + '</a>';
  1480. }
  1481. return '<a href="javascript:openFormUrl(' + KeyValue + ',\''+keyField+'\',\''+url+'\',\''+title+'\''+ ');">' + val + '</a>';
  1482. },
  1483. CRMtaskHref:function(val, meta, record,x,y){
  1484. var me = this.RenderUtil || this;
  1485. var rt_foid=record.data['rt_foid'];
  1486. var url='jsps/crm/marketmgr/marketresearch/multiform.jsp?'+
  1487. 'formCondition=fo_idIS'+rt_foid+'&gridCondition=fd_foidIS'+rt_foid+'&whoami='+record.data['rt_code']+'&cond=rt_idIS'+record.data['rt_id']+'&type=crm';
  1488. var keyField='rt_code';
  1489. var KeyValue=record.data['rt_code']
  1490. var title='调研模板';
  1491. return '<a href="javascript:openUrl2(\''+url+'\',\''+title+'\',\''+keyField+'\',\''+KeyValue+'\');">' + KeyValue + '</a>';
  1492. },
  1493. PXtaskHref:function(val, meta, record,x,y){
  1494. var me = this.RenderUtil || this;
  1495. var rt_foid=record.data['px_foid'];
  1496. var url='jsps/crm/marketmgr/marketresearch/multiform.jsp?'+
  1497. 'formCondition=fo_idIS'+rt_foid+'&gridCondition=fd_foidIS'+rt_foid+'&whoami='+record.data['px_code']+'&cond=px_idIS'+record.data['px_id']+'&type=ProductTrain';
  1498. var keyField='px_code';
  1499. var KeyValue=record.data['px_code']
  1500. var title='考核模板';
  1501. return '<a href="javascript:openUrl2(\''+url+'\',\''+title+'\',\''+keyField+'\',\''+KeyValue+'\');">' + KeyValue + '</a>';
  1502. },
  1503. CRMtaskReport:function(val, meta, record,x,y){
  1504. var me = this.RenderUtil || this;
  1505. var reporttemplatecode=record.data['reporttemplatecode'];
  1506. var url='jsps/crm/marketmgr/marketresearch/taskReport.jsp?'+
  1507. 'whoami='+reporttemplatecode+'&cond=idIS'
  1508. +record.data['id'];
  1509. var keyField='taskcode';
  1510. var KeyValue=record.data['taskcode']
  1511. var title='调研报告';
  1512. return '<a href="javascript:openUrl2(\''+url+'\',\''+title+'\',\''+keyField+'\',\''+KeyValue+'\');">' + KeyValue + '</a>';
  1513. },
  1514. CRMResearchReport:function(val, meta, record,x,y){
  1515. var me = this.RenderUtil || this;
  1516. var reporttemplatecode=record.data['manuallyscheduled'];
  1517. var url='jsps/crm/marketmgr/marketresearch/researchReport.jsp?'+
  1518. 'whoami='+reporttemplatecode+'&cond=idIS'
  1519. +record.data['id'];
  1520. if(record.data['mr_id']!=0){
  1521. url=url+'&formCondition=mr_idIS'+record.data['mr_id']+'&gridCondition=mrd_mridIS'+record.data['mr_id'];
  1522. }
  1523. var keyField='taskcode';
  1524. var KeyValue=record.data['taskcode']
  1525. var title='调研报告';
  1526. return '<a href="javascript:openUrl2(\''+url+'\',\''+title+'\',\''+keyField+'\',\''+KeyValue+'\');">' + KeyValue + '</a>';
  1527. },
  1528. CRMTrainReport:function(val, meta, record,x,y){
  1529. var me = this.RenderUtil || this;
  1530. var reporttemplatecode=record.data['to_tpcode'];
  1531. var url="jsps/crm/marketmgr/resourcemgr/trainReport.jsp?whoami="
  1532. +reporttemplatecode+"&cond=to_idIS"+record.data['to_id']+"&formCondition=tr_idIS"+record.data['tr_id'];
  1533. var keyField='tr_code';
  1534. var KeyValue=record.data['tr_code']
  1535. var title='产品培训考核报告';
  1536. return '<a href="javascript:openUrl2(\''+url+'\',\''+title+'\',\''+keyField+'\',\''+KeyValue+'\');">' + KeyValue + '</a>';
  1537. },
  1538. CRMReport:function(val, meta, record,x,y){
  1539. var me = this.RenderUtil || this;
  1540. var reporttemplatecode=record.data['mr_reportcode'];
  1541. var url='jsps/crm/marketmgr/marketresearch/researchReport.jsp?'+
  1542. 'whoami='+reporttemplatecode+'&cond=idIS'
  1543. +record.data['id']+"&formCondition=mr_idIS"+record.data['mr_id']+'&gridCondition=mrd_mridIS'+record.data['mr_id'];
  1544. var keyField='mr_code';
  1545. var KeyValue=record.data['mr_code']
  1546. var title='调研报告';
  1547. return '<a href="javascript:openUrl2(\''+url+'\',\''+title+'\',\''+keyField+'\',\''+KeyValue+'\');">' + KeyValue + '</a>';
  1548. },
  1549. Vehicle:function(val, meta, record,x,y){
  1550. var url='jsps/oa/vehicle/vehiclereturn.jsp?cond=va_code='+val;
  1551. var title='返车维护单';
  1552. var keyField='va_code';
  1553. return '<a href="javascript:openUrl2(\''+url+'\',\''+title+'\',\''+keyField+'\',\''+val+'\');">' + val + '</a>';
  1554. },
  1555. /**
  1556. * 会议室申请,确认出席人员,如果已经确认出席的默认选上
  1557. */
  1558. confirmMan:function(val, meta, record, x, y, store, view){
  1559. var grid = view.ownerCt;
  1560. if(record.data['md_attend']=='是'){
  1561. grid.selModel.select(record,true);
  1562. }
  1563. return val;
  1564. },
  1565. /**
  1566. * 会议室申请,确认出席人员,如果已经确认出席的默认选上
  1567. */
  1568. oa_confirmMan:function(val, meta, record, x, y, store, view){
  1569. var grid = view.ownerCt;
  1570. if(record.data['md_isconfirmed']=='-1'){
  1571. grid.selModel.select(record,true);
  1572. }
  1573. return val;
  1574. },
  1575. /**
  1576. * 通用方法
  1577. * 值=arg[0]-arg[1]-...
  1578. * @expression reduce:pd_qty:pd_yqty
  1579. * @expression reduce:pd_qty:100:pd_yqty
  1580. */
  1581. reduce: function(val, meta, record, x, y, store, view){
  1582. meta.tdCls = "x-grid-cell-renderer-bl";
  1583. var grid = view.ownerCt, me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex,
  1584. format = (column.format || '0,000.00'), perc = format.substring(format.indexOf('.') + 1).length;
  1585. if(!me || !me.args){
  1586. grid = grid.ownerCt, me = grid.RenderUtil;
  1587. if(!me || !me.args){
  1588. return val;
  1589. }
  1590. }
  1591. if(me.args){
  1592. var arg = me.args.reduce[field];
  1593. var maxValue = 0;
  1594. if(arg && arg.length > 0){
  1595. var v = 0;
  1596. Ext.each(arg, function(a, index){
  1597. if(Ext.isNumber(a)){
  1598. v = a;
  1599. } else {
  1600. v = record.data[a] || 0;
  1601. }
  1602. if(index == 0){
  1603. maxValue = Number(v);
  1604. } else {
  1605. maxValue -= Number(v);
  1606. }
  1607. });
  1608. }
  1609. //鉴于小数问题 保留2位小数
  1610. //maxValue=maxValue.toFixed(4);
  1611. if(column.editor || (column.getEditor && column.getEditor())) {//在允许编辑的情况下,修改值不能大于maxValue
  1612. val = (!Ext.isNumber(val) || val == 0) ? maxValue : val;
  1613. if(Number(val) > Ext.Number.toFixed(maxValue, perc) ){
  1614. val = maxValue;
  1615. showError('请不要输入超过最大数量' + maxValue + "的值!");
  1616. }
  1617. } else {
  1618. val = maxValue;
  1619. }
  1620. var f = Ext.Number.toFixed(val, perc), v = record.get(field), _v = val;
  1621. if(column.xtype == 'numbercolumn'){
  1622. _v = Ext.util.Format.number(val, column.format);
  1623. }
  1624. //f != val || f != v
  1625. if( f != v) {
  1626. record.set(field, f);
  1627. }
  1628. return _v;
  1629. } else {
  1630. return val;
  1631. }
  1632. },
  1633. /**
  1634. * @OA
  1635. * 信息发布 Note
  1636. */
  1637. emergency: function(val, meta, record){
  1638. var d = Number(val);
  1639. var str = '';
  1640. switch (d){
  1641. case 1:
  1642. str = '<span style="color:#20B7B9;padding-left:2px">一般</span>';
  1643. break;
  1644. case 2:
  1645. str = '<img src="' + basePath + 'resource/images/renderer/remind.png">' +
  1646. '<span style="color:blue;padding-left:2px">平急</span>';
  1647. break;
  1648. case 3:
  1649. str = '<img src="' + basePath + 'resource/images/renderer/remind2.png">' +
  1650. '<span style="color:red;padding-left:2px">特急</span>';
  1651. break;
  1652. }
  1653. return str;
  1654. },
  1655. /**
  1656. * @OA流程催办
  1657. * */
  1658. remindprocess:function(val,meta,record){
  1659. var min=0,a=0,b=0,str='';
  1660. if(record && record.data.jp_id){
  1661. var launchTime=record.data.jp_launchTime;
  1662. min=parseInt((new Date().getTime()-new Date(launchTime).getTime())/60000);
  1663. a=parseInt(min/60);
  1664. b=min%60;
  1665. if(a>0) str+=a+'小时';
  1666. if(b>0) str+=b+'分钟';
  1667. if(a>2) meta.style = 'color:red;';
  1668. else meta.style='color:green';
  1669. return str;
  1670. }
  1671. else return null;
  1672. },
  1673. /**
  1674. *@OA 版本管理
  1675. **/
  1676. Version: function(val, meta, record){
  1677. if(val == 0)
  1678. return '当前版本|阅读版本';
  1679. else
  1680. return '';
  1681. },
  1682. /**
  1683. *@OA 阅读状态
  1684. */
  1685. State: function(val, meta, record){
  1686. if(val == 0){
  1687. var str = '<img src="' + basePath + 'resource/images/renderer/remind.png">' +
  1688. '<span style="color:blue;padding-left:2px">未阅</span>';
  1689. return str ;
  1690. } else
  1691. return '已阅';
  1692. },
  1693. /**
  1694. *@OA attentionGrade
  1695. */
  1696. Grade:function(val,meta,record,x,y){
  1697. var field = this.columns[y].dataIndex;
  1698. var me = this.RenderUtil || this;
  1699. var arg = me.args.Grade[field];
  1700. var colorfield=arg[0];
  1701. var color=record.data[colorfield];
  1702. if(color) return '<span style="color:#'+color+'">'+val+'</span>';
  1703. },
  1704. GradeColor:function(val,meta,record){
  1705. meta.style = "background:#"+val+";";
  1706. return '';
  1707. } ,
  1708. /**
  1709. *@OA 知识权限控制
  1710. */
  1711. OAHref: function(val, meta, record,x,y){
  1712. var scanpersonid=record.data.kl_scanpersonid+'#';
  1713. var authorid=record.data.kl_authorid;
  1714. var me = this.RenderUtil || this;
  1715. var field = this.columns[y].dataIndex;
  1716. var KeyValue = 0;
  1717. var url='';
  1718. var title='';
  1719. var arg = me.args.OAHref[field];
  1720. var keyField=arg[0];
  1721. var data=record.data;
  1722. if(arg && arg.length > 0){
  1723. KeyValue=data[keyField];
  1724. url=arg[1];
  1725. title=arg[2];
  1726. }
  1727. if(val==''||val==$I18N.common.grid.emptyText) return val;
  1728. if(scanpersonid.indexOf(emid)>0||authorid==emid){
  1729. return '<img src="' + basePath + 'resource/images/renderer/key2.png">'+'<span><a href="javascript:openUrl(' + KeyValue + ',\''+keyField+'\',\''+url+'\',\''+title+'\''+ ');">' + val + '</a></span>';
  1730. }
  1731. return '<img src="' + basePath + 'resource/images/renderer/key1.png">'+'<span style="color:#8B8B83;padding-left:2px "><a href="javascript:openWin();" style="text-decoration: none||blink;" active="color:#8B8B83; text-decoration:none;">' + val + '<a/></span>';
  1732. },
  1733. oa_oaacceptancedetail_status:function(val, meta, record){
  1734. if(val=='1'){
  1735. return '已转采购';
  1736. }else{
  1737. return '未转采购';
  1738. }
  1739. },
  1740. /**
  1741. * @SCM.Purchase
  1742. * 采购明细数量的修改限制
  1743. */
  1744. scm_purc_pdqty: function(val, meta, record){
  1745. meta.style = "background:#C6E2FF;";
  1746. if(!Ext.isNumber(val)) {
  1747. record.set('pd_qty', 0);
  1748. return 0;
  1749. } else {
  1750. var adid = record.data['ad_qty'];oldqty = 0;
  1751. if(adid != null && adid > 0 ) {
  1752. if(val > adid) {
  1753. oldqty = record.modified.pd_qty || record.data.pd_qty || adid;
  1754. if (val != oldqty){
  1755. val = oldqty;
  1756. record.set('pd_qty', oldqty);
  1757. showError('请不要超过请购数<' + adid + '>修改!');
  1758. }
  1759. }
  1760. }
  1761. return val;
  1762. }
  1763. },
  1764. /**
  1765. * @PM.MakeNotice
  1766. * 制造通知单明细数量的修改限制
  1767. */
  1768. pm_mano_mndqty: function(val, meta, record){
  1769. meta.style = "background:#C6E2FF;";
  1770. var sdid = record.data['sd_qty'];oldqty = 0;
  1771. if(sdid != null && sdid > 0) {
  1772. if(val > sdid) {
  1773. oldqty = record.modified.mnd_qty || record.data.mnd_qty || sdid;
  1774. val = oldqty;
  1775. record.set('mnd_qty', oldqty);
  1776. showError('请不要超过订单数<' + sdid + '>修改!');
  1777. }
  1778. }
  1779. return val;
  1780. },
  1781. /**
  1782. * @SCM.Sale
  1783. * 销售通知单明细数量的修改限制
  1784. */
  1785. scm_send_sndqty: function(val, meta, record){
  1786. meta.style = "background:#C6E2FF;";
  1787. var sdid = record.data['sd_qty'];oldqty = 0;
  1788. if(sdid != null && sdid > 0) {
  1789. if(val > sdid) {
  1790. oldqty = record.modified.snd_outqty || record.data.snd_outqty || sdid;
  1791. val = oldqty;
  1792. record.set('snd_outqty', oldqty);
  1793. showError('请不要超过订单数<' + sdid + '>修改!');
  1794. }
  1795. }
  1796. return val;
  1797. },
  1798. /**
  1799. * @SCM.AcceptNotify
  1800. * 收料通知单明细数量的修改限制
  1801. */
  1802. scm_acceptnotify_andinqty: function(val, meta, record){
  1803. meta.style = "background:#C6E2FF;";
  1804. var sdid = record.data['pd_qty'];oldqty = 0;
  1805. if(sdid != null && sdid > 0) {
  1806. if(val > sdid) {
  1807. oldqty = record.modified.and_inqty || record.data.and_inqty || sdid;
  1808. val = oldqty;
  1809. record.set('and_inqty', oldqty);
  1810. showError('请不要超过采购单数<' + sdid + '>修改!');
  1811. }
  1812. }
  1813. return val;
  1814. },
  1815. /**
  1816. * @SCM.VerifyApply
  1817. * 收料单明细数量的修改限制
  1818. */
  1819. scm_acceptnotify_vadqty: function(val, meta, record){
  1820. meta.style = "background:#C6E2FF;";
  1821. var sdid = record.data['pd_qty'];oldqty = 0;
  1822. if(sdid != null && sdid > 0) {
  1823. if(val > sdid) {
  1824. oldqty = record.modified.vad_qty || record.data.vad_qty || sdid;
  1825. val = oldqty;
  1826. record.set('vad_qty', oldqty);
  1827. showError('请不要超过采购单数<' + sdid + '>修改!');
  1828. }
  1829. }
  1830. return val;
  1831. },
  1832. /**
  1833. * @SCM.ProdIODetail
  1834. * 出货单明细数量的修改限制
  1835. */
  1836. scm_prodio_pdqty: function(val, meta, record, x, y, store, view){
  1837. meta.style = "background:#C6E2FF;";
  1838. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1839. if(record.get('pd_snid') != null && record.get('pd_snid') != 0) {
  1840. var snid = record.data['snd_outqty'];oldqty = 0;
  1841. if(snid != null && snid > 0) {
  1842. if(val > snid) {
  1843. oldqty = record.modified.pd_outqty || record.data.pd_outqty || sdid;
  1844. val = oldqty;
  1845. record.set('pd_outqty', oldqty);
  1846. showError('请不要超过通知单数<' + snid + '>修改!');
  1847. }
  1848. }
  1849. }
  1850. if(column.format)
  1851. val = Ext.util.Format.number(val, column.format);
  1852. return val;
  1853. },
  1854. /**
  1855. * @PM.Dispatch
  1856. * 完成数不能大于流程单数量
  1857. */
  1858. pm_dispatch_overqty: function(val, meta, record, x, y, store, view){
  1859. meta.style = "background:#C6E2FF;";
  1860. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1861. var q = record.data['mf_qty'];
  1862. if(q != null && q > 0) {
  1863. if(val > q) {
  1864. val = q;
  1865. record.set('did_overqty', q);
  1866. showError('完成数请不要超过流程单数量<' + q + '>!');
  1867. }
  1868. }
  1869. if(column.format)
  1870. val = Ext.util.Format.number(val, column.format);
  1871. return val;
  1872. },
  1873. /**
  1874. * @SCM.Sale.ReturnApply
  1875. * 退货申请单
  1876. */
  1877. returnapply_qty: function(val, meta, record, x, y, store, view){
  1878. meta.style = "background:#C6E2FF;";
  1879. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1880. var q = record.data['sd_sendqty'];
  1881. if(q != null && q > 0) {
  1882. if(val > q) {
  1883. val = q;
  1884. record.set('rad_qty', q);
  1885. showError('请不要超过订单发货数<' + q + '>退货!');
  1886. }
  1887. }
  1888. if(column.format)
  1889. val = Ext.util.Format.number(val, column.format);
  1890. return val;
  1891. },
  1892. /**
  1893. * @SCM.ProdIODetail
  1894. * 采购验收单明细数量的修改限制
  1895. */
  1896. scm_prodio_okqty: function(val, meta, record, x, y, store, view){
  1897. meta.style = "background:#C6E2FF;";
  1898. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1899. if(record.get('pd_vacode') != null&&record.get('pd_vacode')!="") {
  1900. var vadid = record.data['ve_okqty'];oldqty = 0;
  1901. if(vadid != null && vadid > 0) {
  1902. if(val > vadid) {
  1903. oldqty = record.modified.pd_inqty || record.data.pd_inqty || vadid;
  1904. val = oldqty;
  1905. record.set('pd_inqty', oldqty);
  1906. showError('请不要超过收料合格数<' + vadid + '>修改!');
  1907. }
  1908. }
  1909. }
  1910. if(column.format)
  1911. val = Ext.util.Format.number(val, column.format);
  1912. return val;
  1913. },
  1914. /**
  1915. * 研发采购变更 限制数量
  1916. * @param val
  1917. * @param meta
  1918. * @param record
  1919. * @returns
  1920. */
  1921. plm_pc_yqty: function(val, meta, record, x, y, store, view){
  1922. meta.style = "background:#C6E2FF;";
  1923. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1924. var vadid = record.data['pcd_newqty'];
  1925. if(vadid != null && vadid > 0) {
  1926. if(val > vadid) {
  1927. val = oldqty;
  1928. record.set('pcd_newqty', val);
  1929. showError('新采购数请不要小于已转数量<' + val + '>!');
  1930. }
  1931. }
  1932. if(column.format)
  1933. val = Ext.util.Format.number(val, column.format);
  1934. return val;
  1935. },
  1936. /**
  1937. * @SCM.ProdIODetail
  1938. * 不良品入库单明细数量的修改限制
  1939. */
  1940. scm_prodio_ngqty: function(val, meta, record, x, y, store, view){
  1941. meta.style = "background:#C6E2FF;";
  1942. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1943. if(record.get('pd_vacode') != null) {
  1944. var vadid = record.data['ve_notokqty'];oldqty = 0;
  1945. if(vadid != null && vadid > 0) {
  1946. if(val > vadid) {
  1947. oldqty = record.modified.pd_inqty || record.data.pd_inqty || vadid;
  1948. val = oldqty;
  1949. record.set('pd_inqty', oldqty);
  1950. showError('请不要超过收料不合格数<' + vadid + '>修改!');
  1951. }
  1952. }
  1953. }
  1954. if(column.format)
  1955. val = Ext.util.Format.number(val, column.format);
  1956. return val;
  1957. },
  1958. /**
  1959. * PM.makeScrap 生产报废单报废数量限制
  1960. */
  1961. md_qty_mm_havegetqty: function(val, meta, record, x, y, store, view){
  1962. meta.style = "background:#C6E2FF;";
  1963. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1964. var have = record.data['mm_havegetqty'] || 0,
  1965. oldqty = 0;
  1966. if(val > have) {
  1967. oldqty = record.modified.md_qty || record.data.md_qty || have;
  1968. val = oldqty;
  1969. if(record.data.md_qty != oldqty) {
  1970. record.set('md_qty', oldqty);
  1971. showError('请不要超过已领数<' + have + '>!');
  1972. }
  1973. }
  1974. if(column.format)
  1975. val = Ext.util.Format.number(val, column.format);
  1976. return val;
  1977. },
  1978. /**
  1979. * @SCM.Sale.SaleChange
  1980. * 销售变更单新数量(原数量为0的时候不考虑)
  1981. */
  1982. scm_sale_change_qty: function(val, meta, record, x, y, store, view){
  1983. meta.style = "background:#C6E2FF;";
  1984. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  1985. var adq = record.data['sd_qty'];
  1986. var acq = record.data['sd_sendqty'];
  1987. var yq = Math.min(record.data['sd_yqty'], adq);
  1988. if(adq != null && adq > 0) {
  1989. if(val > adq) {
  1990. showError('请不要超过原订单数<' + adq + '>!');
  1991. val = adq;
  1992. record.set('scd_newqty', adq);
  1993. }
  1994. }
  1995. if(acq != null && acq > 0) {
  1996. if(val == 0) {
  1997. val = acq;
  1998. record.set('scd_newqty', acq);
  1999. } else if(val < acq) {
  2000. showError('请不要小于已发货数<' + acq + '>!');
  2001. val = acq;
  2002. record.set('scd_newqty', acq);
  2003. }
  2004. }
  2005. if(yq != null && yq > 0) {
  2006. if(val == 0) {
  2007. val = yq;
  2008. record.set('scd_newqty', yq);
  2009. } else if(val < yq) {
  2010. showError('请不要小于已转发货通知数<' + yq + '>!');
  2011. val = yq;
  2012. record.set('scd_newqty', yq);
  2013. }
  2014. }
  2015. if(column.format)
  2016. val = Ext.util.Format.number(val, column.format);
  2017. return val;
  2018. },
  2019. /**
  2020. * @SCM.Sale.SaleChange
  2021. * 销售变更单新数量(原数量为0的时候也要考虑)
  2022. */
  2023. scm_sale_change_qty2: function(val, meta, record, x, y, store, view){
  2024. meta.style = "background:#C6E2FF;";
  2025. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  2026. var adq = record.data['sd_qty'];
  2027. var acq = record.data['sd_sendqty'];
  2028. var yq = Math.min(record.data['sd_yqty'], adq);
  2029. if(adq != null && adq >= 0) {
  2030. if(val > adq) {
  2031. showError('请不要超过原订单数<' + adq + '>!');
  2032. val = adq;
  2033. record.set('scd_newqty', adq);
  2034. }
  2035. }
  2036. if(acq != null && acq >= 0) {
  2037. if(val == 0) {
  2038. val = acq;
  2039. record.set('scd_newqty', acq);
  2040. } else if(val < acq) {
  2041. showError('请不要小于已发货数<' + acq + '>!');
  2042. val = acq;
  2043. record.set('scd_newqty', acq);
  2044. }
  2045. }
  2046. if(yq != null && yq >= 0) {
  2047. if(val == 0) {
  2048. val = yq;
  2049. record.set('scd_newqty', yq);
  2050. } else if(val < yq) {
  2051. showError('请不要小于已转发货通知数<' + yq + '>!');
  2052. val = yq;
  2053. record.set('scd_newqty', yq);
  2054. }
  2055. }
  2056. if(column.format)
  2057. val = Ext.util.Format.number(val, column.format);
  2058. return val;
  2059. },
  2060. /**
  2061. * @SCM.Purchase.PurchaseChange
  2062. * 采购变更单新数量
  2063. */
  2064. scm_purc_change_qty: function(val, meta, record, x, y, store, view){
  2065. meta.style = "background:#C6E2FF;";
  2066. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  2067. var adq = record.data['ad_qty'];oldqty = 0;
  2068. var acq = record.data['pd_acceptqty'];
  2069. var yq = record.data['pd_yqty'];
  2070. if(adq != null && adq > 0) {
  2071. if(val > adq) {
  2072. val = adq;
  2073. showError('请不要超过请购数<' + adq + '>!');
  2074. }
  2075. }
  2076. if(acq != null && acq > 0) {
  2077. if(val == 0) {
  2078. val = acq;
  2079. } else if(val < acq) {
  2080. val = acq;
  2081. showError('请不要小于验收数<' + acq + '>!');
  2082. }
  2083. }
  2084. if(yq != null && yq > 0) {
  2085. if(val == 0) {
  2086. val = yq;
  2087. } else if(val < yq) {
  2088. val = yq;
  2089. showError('请不要小于采购已转数<' + yq + '>!');
  2090. }
  2091. }
  2092. if(record.get('pcd_newqty') != val) {
  2093. record.set('pcd_newqty', val);
  2094. }
  2095. if(column.format)
  2096. val = Ext.util.Format.number(val, column.format);
  2097. return val;
  2098. },
  2099. /**
  2100. * @SCM.Purchase.PurchaseChange
  2101. * 采购变更单新数量(易方)
  2102. */
  2103. scm_purc_change_qty2: function(val, meta, record, x, y, store, view){
  2104. meta.style = "background:#C6E2FF;";
  2105. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  2106. var adq = record.data['pcd_oldqty'];oldqty = 0;
  2107. var acq = record.data['pd_acceptqty'];
  2108. var yq = record.data['pd_yqty'];
  2109. if(adq != null && adq > 0) {
  2110. if(val > adq) {
  2111. val = adq;
  2112. showError('请不要超过原采购订单数<' + adq + '>!');
  2113. }
  2114. }
  2115. if(acq != null && acq > 0) {
  2116. if(val == 0) {
  2117. val = acq;
  2118. } else if(val < acq) {
  2119. val = acq;
  2120. showError('请不要小于验收数<' + acq + '>!');
  2121. }
  2122. }
  2123. if(yq != null && yq > 0) {
  2124. if(val == 0) {
  2125. val = yq;
  2126. } else if(val < yq) {
  2127. val = yq;
  2128. showError('请不要小于采购已转数<' + yq + '>!');
  2129. }
  2130. }
  2131. if(record.get('pcd_newqty') != val) {
  2132. record.set('pcd_newqty', val);
  2133. }
  2134. if(column.format)
  2135. val = Ext.util.Format.number(val, column.format);
  2136. return val;
  2137. },
  2138. /**
  2139. * @PM.Make.MakeChange
  2140. * 制造变更单新数量(易方)
  2141. */
  2142. pm_make_change_qty: function(val, meta, record){
  2143. meta.style = "background:#C6E2FF;";
  2144. var adq = record.data['md_qty'];oldqty = 0;
  2145. var acq = record.data['ma_madeqty'];
  2146. var yq = record.data['ma_toquaqty'];
  2147. if(adq != null && adq > 0) {
  2148. if(val > adq) {
  2149. val = adq;
  2150. showError('请不要超过原制造单数<' + adq + '>!');
  2151. }
  2152. }
  2153. if(acq != null && acq > 0) {
  2154. if(val == 0) {
  2155. val = acq;
  2156. } else if(val < acq) {
  2157. val = acq;
  2158. showError('请不要小于已完工数<' + acq + '>!');
  2159. }
  2160. }
  2161. if(yq != null && yq > 0) {
  2162. if(val == 0) {
  2163. val = yq;
  2164. } else if(val < yq) {
  2165. val = yq;
  2166. showError('请不要小于已转检验数<' + yq + '>!');
  2167. }
  2168. }
  2169. if(record.get('md_newqty') != val) {
  2170. record.set('md_newqty', val);
  2171. }
  2172. return val;
  2173. },
  2174. /**
  2175. * @PM.Make.MakeChangeOS
  2176. * 委外变更单新数量(易方)
  2177. */
  2178. pm_makeos_change_qty: function(val, meta, record){
  2179. meta.style = "background:#C6E2FF;";
  2180. var adq = record.data['md_oldqty'];oldqty = 0;
  2181. var acq = record.data['ma_madeqty'];
  2182. var yq = record.data['ma_haveqty'];
  2183. if(adq != null && adq > 0) {
  2184. if(val > adq) {
  2185. val = adq;
  2186. showError('请不要超过原委外单数<' + adq + '>!');
  2187. }
  2188. }
  2189. if(acq != null && acq > 0) {
  2190. if(val == 0) {
  2191. val = acq;
  2192. } else if(val < acq) {
  2193. val = acq;
  2194. showError('请不要小于已生产数量<' + acq + '>!');
  2195. }
  2196. }
  2197. if(yq != null && yq > 0) {
  2198. if(val == 0) {
  2199. val = yq;
  2200. } else if(val < yq) {
  2201. val = yq;
  2202. showError('请不要小于已转收料数<' + yq + '>!');
  2203. }
  2204. }
  2205. if(record.get('md_newqty') != val) {
  2206. record.set('md_newqty', val);
  2207. }
  2208. return val;
  2209. },
  2210. /**
  2211. * @SCM.Sale.SendNotify
  2212. * 出货通知变更单新数量
  2213. */
  2214. scm_sendnotify_change_qty: function(val, meta, record, x, y, store, view){
  2215. meta.style = "background:#C6E2FF;";
  2216. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y];
  2217. var adq = record.data['scd_oldqty'];
  2218. var yq = Math.min(record.data['snd_yqty'], adq);
  2219. if(adq != null && adq > 0) {
  2220. if(val > adq) {
  2221. showError('请不要超过原通知单数<' + adq + '>!');
  2222. val = adq;
  2223. record.set('scd_qty', adq);
  2224. }
  2225. }
  2226. if(yq != null && yq > 0) {
  2227. if(val == 0) {
  2228. val = yq;
  2229. record.set('scd_qty', yq);
  2230. } else if(val < yq) {
  2231. showError('请不要小于已转出货数<' + yq + '>!');
  2232. val = yq;
  2233. record.set('scd_qty', yq);
  2234. }
  2235. }
  2236. if(column.format)
  2237. val = Ext.util.Format.number(val, column.format);
  2238. return val;
  2239. },
  2240. /**
  2241. * @SCM.Sale.SaleForecastChange
  2242. * 预测变更单明细数量的修改限制
  2243. */
  2244. scm_sale_sfchange_qty: function(val, meta, record){
  2245. meta.style = "background:#C6E2FF;";
  2246. var sdq = record.data['scd_oldqty'];
  2247. var kq = record.data['scd_minqty'];
  2248. if(sdq != null && sdq > 0) {
  2249. if(val > sdq) {
  2250. val = sdq;
  2251. showError('请不要超过原预测数量<' + sdq + '>!');
  2252. }
  2253. }
  2254. if(kq != null && kq > 0) {
  2255. if(val == 0) {
  2256. val = kq;
  2257. } else if(val < kq) {
  2258. val = kq;
  2259. showError('请不要小于最小变更数<' + kq + '>!');
  2260. }
  2261. }
  2262. if(record.get('scd_newqty') != val) {
  2263. record.set('scd_newqty', val);
  2264. }
  2265. return val;
  2266. },
  2267. /**
  2268. * @SCM.Sale
  2269. * 销售单明细数量的修改限制
  2270. */
  2271. scm_sale_sdqty: function(val, meta, record){
  2272. meta.style = "background:#C6E2FF;";
  2273. var status = Ext.getCmp('sa_statuscode') == null ? null : Ext.getCmp('sa_statuscode').value;
  2274. var maxValue = record.modified.sd_qty || record.data.sd_qty;
  2275. if(status == null || status == 'ENTERING' || status == 'COMMITED'){
  2276. var sd_sourceid = record.data['sd_sourceid'];
  2277. if(sd_sourceid != null && sd_sourceid != '0' && sd_sourceid != 0){//有来源
  2278. //限制val<maxValue
  2279. if(val > maxValue){
  2280. val = maxValue;
  2281. record.set('sd_qty', val);
  2282. showError('请不要输入超过来源数量' + maxValue + "的值!");
  2283. }
  2284. }
  2285. if(!Ext.isNumber(val)){
  2286. val = maxValue;
  2287. record.set('sd_qty', val);
  2288. showError('请输入数字!');
  2289. }
  2290. if(val < 0){
  2291. val = maxValue;
  2292. record.set('sd_qty', val);
  2293. showError("请不要输入小于0的值!");
  2294. }
  2295. } else {
  2296. if(val != maxValue){
  2297. val = maxValue;
  2298. record.set('sd_qty', val);
  2299. showError("该单据已审核,无法修改,请申请变更!");
  2300. }
  2301. }
  2302. return val;
  2303. },
  2304. /**
  2305. * @SCM.Purchase.VerifyApply
  2306. * 收料单明细数量的修改限制
  2307. */
  2308. scm_purc_vadqty: function(val, meta, record){
  2309. meta.style = "background:#C6E2FF;";
  2310. var andid = record.data['vad_andid'];
  2311. if(andid == null || andid == 0){
  2312. var pdid = record.data['pd_qty'],qty = 0;
  2313. if(pdid != null && pdid > 0) {
  2314. if(val > pdid) {
  2315. qty = record.modified.vad_qty || record.data.vad_qty || pdid;
  2316. val = qty;
  2317. record.set('vad_qty', qty);
  2318. showError('请不要超过采购数<' + pdid + '>修改!');
  2319. }
  2320. }
  2321. } else {
  2322. var andqty = record.data['and_inqty'],oldqty = 0;
  2323. if(andqty != null && andqty > 0) {
  2324. if(val > andqty) {
  2325. oldqty = record.modified.vad_qty || record.data.vad_qty || andqty;
  2326. val = oldqty;
  2327. record.set('vad_qty', oldqty);
  2328. showError('请不要超过收料通知单数<' + andqty + '>修改!');
  2329. }
  2330. }
  2331. }
  2332. return val;
  2333. },
  2334. /**
  2335. * 通用方法
  2336. * 仅仅是改变该列的背景颜色
  2337. * @arg red/black.../C6E2FF/B376F5/..null..
  2338. * @expression color:red
  2339. * @expression color:#C1D0D9
  2340. */
  2341. color: function(val, meta, record, x, y, store, view){
  2342. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  2343. if(!me || !me.args){
  2344. meta.style = "background:#C6E2FF;";
  2345. return val;
  2346. }
  2347. me.args.color = me.args.color || new Object();
  2348. var arg = me.args.color[field];
  2349. if(arg && arg.length > 0){
  2350. meta.style = "background:" + arg[0] + ";";
  2351. } else {
  2352. meta.style = "background:#C6E2FF;";
  2353. }
  2354. return val;
  2355. },
  2356. /**
  2357. * 通用方法
  2358. * 如果当前字段的值为空或空字符串,就获取指定字段的值赋给当前字段
  2359. * @expression copy:pcd_oldprodcode
  2360. */
  2361. copy: function(val, meta, record, x, y, store, view){
  2362. meta.style = "background:#C6E2FF;";
  2363. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  2364. if(val == null || val == '' || val == 0){
  2365. if(!me || !me.args){
  2366. grid = grid.ownerCt, me = grid.RenderUtil;
  2367. if(!me || !me.args){
  2368. return val;
  2369. }
  2370. }
  2371. var v = record.data[field];
  2372. if(v == null || v == '' || (column.xtype == 'numbercolumn' && v == 0)){
  2373. var arg = me.args.copy[field];
  2374. if(arg && arg.length > 0){
  2375. val = record.data[arg[0]];
  2376. }
  2377. if(val != null && val != '' && val != 0){
  2378. record.set(field, val);
  2379. }
  2380. }
  2381. }
  2382. if(column.xtype == 'numbercolumn' && val != 0){
  2383. val = Ext.util.Format.number(val, column.format);
  2384. }
  2385. if(column.xtype == 'datecolumn') {
  2386. if(!val) return null;
  2387. val = Ext.Date.format(val, (column.format || 'Y-m-d'));
  2388. }
  2389. return val;
  2390. },
  2391. /**
  2392. * 通用方法
  2393. * 如果指定字段的值为空或空字符串,就获取当前值赋给指定字段
  2394. * @expression paste:pcd_newprodcode
  2395. */
  2396. paste: function(val, meta, record, x, y, store, view){
  2397. meta.style = "background:#C6E2FF;";
  2398. if(val != null && val != ''){
  2399. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  2400. if(!me || !me.args){
  2401. grid = grid.ownerCt, me = grid.RenderUtil;
  2402. if(!me || !me.args){
  2403. return val;
  2404. }
  2405. }
  2406. var arg = me.args.paste[field];
  2407. var value = null;
  2408. if(arg && arg.length > 0){
  2409. value = record.data[arg[0]];
  2410. if(value == null || value == ''){
  2411. if(column.xtype == 'numbercolumn' && val != 0){
  2412. record.set(arg[0], val);
  2413. } else {
  2414. if(Ext.isDate(val)){
  2415. val = Ext.Date.toString(val);
  2416. }
  2417. record.set(arg[0], val);
  2418. }
  2419. }
  2420. }
  2421. }
  2422. return val;
  2423. },
  2424. /**
  2425. * 必填字段
  2426. */
  2427. necessary: function(val, meta, record, x, y, store, view){
  2428. return '<img src="' + basePath + 'resource/images/icon/need.png" title="必填字段">' +
  2429. '<span style="color:blue;padding-left:2px;" title="必填字段">' + val + '</span>';
  2430. },
  2431. /**
  2432. * @FA
  2433. * 应收系统参数设置
  2434. */
  2435. stringToDate: function(val, meta, record, x, y){
  2436. meta.style = "background:#C6E2FF;";
  2437. var reg = /\d{2}-\d{1,2}月-\d{2}/;
  2438. var field = this.columns[y].dataIndex;
  2439. if(val == 'true'){
  2440. record.set(field,'是');
  2441. }
  2442. if(val == 'false'){
  2443. record.set(field,'否');
  2444. }
  2445. if(reg.test(val)){
  2446. var day = val.split('-')[0];
  2447. var month = val.split('-')[1].replace('月', '');
  2448. if(Number(month) < 10){
  2449. month = '0' + month;
  2450. }
  2451. var year = '20' + val.split('-')[2];
  2452. val = year + '-' + month + '-' + day;
  2453. record.set(field, val);
  2454. }
  2455. return val;
  2456. },
  2457. /**
  2458. * @PM.Make
  2459. * 成套发料,本次发料套数
  2460. */
  2461. pm_make_issue_thisqty: function(val, meta, record, x, y){
  2462. var code = record.data['ma_code'], busy = Ext.getCmp('grid').busy;
  2463. record.hasdataChanged=false;
  2464. if(!Ext.isEmpty(record.data['ma_id']) && !Ext.isEmpty(code)) {
  2465. var nQty = record.data['ma_qty'] - record.data['ma_haveqty'];
  2466. if(record.maxQty!=nQty){
  2467. record.maxQty=nQty;
  2468. record.hasdataChanged=true;
  2469. }
  2470. var maxQty = nQty;
  2471. if(val > maxQty) {
  2472. if(!busy && !record.hasdataChanged)
  2473. showError('本次发料套数不能超过<' + maxQty + '>,单号:' + code);
  2474. val = maxQty;
  2475. if(record.data['ma_thisqty'] != val) {
  2476. record.set('ma_thisqty', val);
  2477. }
  2478. } else{
  2479. if(record.hasdataChanged) val=maxQty;
  2480. val= val==0?maxQty:val;
  2481. if(record.data['ma_thisqty'] != val) {
  2482. record.set('ma_thisqty', val);
  2483. }
  2484. }
  2485. var grid = Ext.getCmp('editorColumnGridPanel'),items = grid.store.data.items;
  2486. if(!grid.lockrender && Ext.getCmp('set').value) {
  2487. Ext.each(items, function(item){
  2488. if(item.data['mm_code'] == code){
  2489. var max = item.data['mm_oneuseqty'] * val;
  2490. var t = 0;
  2491. if(item.data.isrep) {
  2492. t = item.data['mm_canuserepqty'] - item.data['mm_totaluseqty'];
  2493. } else {
  2494. t = item.data['mm_qty'] - item.data['mm_canuserepqty'] - (item.data['mm_havegetqty'] +
  2495. item.data['mm_returnmqty'] - item.data['mm_addqty'] - item.data['mm_haverepqty']) -
  2496. item.data['mm_totaluseqty'];
  2497. }
  2498. max = Math.min(t, max);
  2499. if(item.data['mm_thisqty'] > max){
  2500. item.set('mm_thisqty', max);
  2501. }
  2502. }
  2503. });
  2504. }
  2505. }
  2506. return val;
  2507. },
  2508. /**
  2509. * @PM.Make
  2510. * 制造单本次领料数mm_thisqty=mm_qty(制单数)-mm_canuserepqty(替代维护数)-mm_havegetqty(已领)+mm_returnmqty(不良数)
  2511. * -mm_addqty(补料数)-mm_haverepqty(替代已领)-mm_totaluseqty(已转领料)
  2512. */
  2513. pm_make_thisqty: function(val, meta, record, x, y){
  2514. meta.tdCls = "x-grid-cell-renderer-bl";
  2515. var t = 0,r=0,busy = Ext.getCmp('editorColumnGridPanel').busy;
  2516. //r为该序号总剩余未发料数
  2517. r = record.data['mm_qty'] - (record.data['mm_havegetqty'] - record.data['mm_addqty'] + record.data['mm_returnmqty'] ) - record.data['mm_totaluseqty'] ;
  2518. if(record.data.isrep) {
  2519. t = record.data['mm_qty'] - (record.data['mm_havegetqty'] - record.data['mm_addqty'] + record.data['mm_returnmqty'] ) - record.data['mm_totaluseqty'] ;
  2520. } else {
  2521. t = record.data['mm_qty'] - record.data['mm_canuserepqty'] - (record.data['mm_havegetqty'] - record.data['mm_haverepqty'] +
  2522. record.data['mm_returnmqty'] - record.data['mm_repreturnmqty'] - record.data['mm_addqty'] + record.data['mm_repaddqty']) -
  2523. record.data['mm_totaluseqty'];
  2524. }
  2525. //大于总剩余未发料数则默认等于剩余未发料数
  2526. t = t > r ? r : t;
  2527. t = t < 0 ? 0 : t;
  2528. var max = t.toFixed(3);
  2529. max = max < 0 ? 0 : max;
  2530. //ma_thisqty*mm_oneuseqty
  2531. var tqty = max;
  2532. if(Ext.getCmp('set').value) {
  2533. var items = Ext.getCmp('grid').store.data.items,mItem = null;
  2534. if(ifIncludingLoss){//套料发料包含损耗
  2535. Ext.each(items, function(item){
  2536. if(item.data['ma_code'] != null && item.data['ma_code'].toString().trim() != ''
  2537. && item.data['ma_code'] == record.data['mm_code']){
  2538. mItem = item;
  2539. if(item.data['ma_thisqty'] > 0){
  2540. max = item.data['ma_thisqty'] * record.data['mm_qty']/item.data['ma_qty'];
  2541. if(parseInt(record.data['mm_qty'])== record.data['mm_qty']){//需求数为整数,取整
  2542. max = Math.ceil(max);
  2543. }
  2544. tqty = Math.min(max, t);
  2545. tqty = Number(tqty.toFixed(3));
  2546. }
  2547. }
  2548. });
  2549. }else{
  2550. Ext.each(items, function(item){
  2551. if(item.data['ma_code'] != null && item.data['ma_code'].toString().trim() != ''
  2552. && item.data['ma_code'] == record.data['mm_code']){
  2553. mItem = item;
  2554. if(item.data['ma_thisqty'] > 0 && record.data['mm_oneuseqty'] > 0){
  2555. max = item.data['ma_thisqty'] * record.data['mm_oneuseqty'];
  2556. tqty = Math.min(max, t);
  2557. tqty = Number(tqty.toFixed(3));
  2558. }
  2559. }
  2560. });
  2561. }
  2562. }
  2563. val = Number(val.toFixed(3));
  2564. if(!record.dirty){//未被修改过,并且mm_thisqty与计算值不等
  2565. if(val != tqty){
  2566. val = tqty;
  2567. record.set('mm_thisqty', val);
  2568. }
  2569. }else{
  2570. if(val > tqty) {
  2571. //如果参数设置为不考虑可替代数
  2572. if (ifCanrepqty != true){
  2573. if(!busy)
  2574. showError("本次领料数不得超过" + tqty);
  2575. }else{
  2576. if(val > r){
  2577. showError("本次领料数不得超过" + r);
  2578. }
  2579. }
  2580. val = tqty;
  2581. record.set('mm_thisqty', val);
  2582. } else if(val < 0){
  2583. if(!busy)
  2584. showError("本次领料数不能是负数");
  2585. val = tqty;
  2586. record.set('mm_thisqty', val);
  2587. } else if(val == 0 && tqty != 0){
  2588. val = tqty;
  2589. record.set('mm_thisqty', val);
  2590. } else {
  2591. // if(val < max && mItem) {//本次领料数 <本次发料套数*单位用量
  2592. // mItem.maxQty = Math.ceil(val/record.data['mm_oneuseqty']);
  2593. // mItem.set('ma_thisqty', mItem.maxQty);
  2594. // }
  2595. }
  2596. }
  2597. return val;
  2598. },
  2599. /**
  2600. * @PM.Make
  2601. * 替代料,特殊样式
  2602. */
  2603. pm_isrep: function(val, meta, record, x, y){
  2604. var field = this.columns[y].dataIndex;
  2605. if(record.data.isrep) {
  2606. meta.tdCls = "x-grid-cell-renderer-cl";
  2607. if(field == 'mm_code') {
  2608. return '<img src="' + basePath + 'resource/images/renderer/important.png">' +
  2609. '替代料';
  2610. } else {
  2611. return val;
  2612. }
  2613. }
  2614. return val;
  2615. },
  2616. /**
  2617. * @PM.Make
  2618. * 成套退料,本次退料套数 成套报废,本次报废套数
  2619. */
  2620. pm_make_return_thisqty: function(val, meta, record, x, y){
  2621. var code = record.data['ma_code'], busy = Ext.getCmp('grid').busy;
  2622. record.hasdataChanged=false;
  2623. if(!Ext.isEmpty(record.data['ma_id']) && !Ext.isEmpty(code)) {
  2624. var nQty = record.data['ma_qty'];
  2625. if(!record.maxQty || record.maxQty!=nQty){
  2626. record.maxQty=nQty;
  2627. record.hasdataChanged=true;
  2628. }
  2629. var maxQty = Math.min(record.maxQty, nQty);
  2630. if(val > maxQty) {
  2631. if(!busy && !record.hasdataChanged)
  2632. showError('套数不能超过<' + maxQty + '>,单号:' + code);
  2633. val = maxQty;
  2634. if(record.data['ma_thisqty'] != val) {
  2635. record.set('ma_thisqty', val);
  2636. }
  2637. } else if(val < 0){
  2638. val= 0;
  2639. if(record.data['ma_thisqty'] != val) {
  2640. record.set('ma_thisqty', val);
  2641. }
  2642. }
  2643. var grid = Ext.getCmp('editorColumnGridPanel'),items = grid.store.data.items;
  2644. if(!grid.lockrender) {
  2645. Ext.each(items, function(item){
  2646. if(item.data['mm_code'] == code){
  2647. var max = item.data['mm_oneuseqty'] * val;
  2648. var t = item.data['mm_onlineqty'] || item.data['mm_thisqty'];
  2649. max = Math.min(t, max);
  2650. if(item.data['mm_thisqty'] != max){
  2651. item.set('mm_thisqty', max);
  2652. }
  2653. }
  2654. });
  2655. }
  2656. }
  2657. return val;
  2658. },
  2659. /**
  2660. * @PM.Make
  2661. * 制造单本次退料数mm_thisqty<=mm_onlineqty(在制数) ,本次报废数
  2662. */
  2663. pm_make_rqty: function(val, meta, record, x, y, store){
  2664. meta.style = "background:#C6E2FF;";
  2665. if(record.data['mm_onlineqty'] < 0) {// 返修工单退料
  2666. return val;
  2667. }
  2668. var mrec = record;
  2669. if(record.data.isrep) {
  2670. //替代料 本次数量 按主料本次数量计算
  2671. store.each(function(d){
  2672. if(d.data.mm_id == record.data.mm_id && !d.data.isrep) {
  2673. mrec = d;return;
  2674. }
  2675. });
  2676. }
  2677. var t = ((mrec.data['mm_onlineqty'] || val) - (mrec.data['mm_backqty'] || 0)),
  2678. busy = Ext.getCmp('editorColumnGridPanel').busy;
  2679. var max = t;
  2680. max = max < 0 ? 0 : max;
  2681. var tqty = max;
  2682. var items = Ext.getCmp('grid').store.data.items;
  2683. Ext.each(items, function(item){
  2684. if(item.data['ma_code'] != null && item.data['ma_code'].toString().trim() != ''
  2685. && item.data['ma_code'] == mrec.data['mm_code']){
  2686. mItem = item;
  2687. if(item.data['ma_thisqty'] > 0 && mrec.data['mm_oneuseqty'] > 0){
  2688. max = item.data['ma_thisqty'] * mrec.data['mm_oneuseqty'];
  2689. tqty = Math.min(max, t);
  2690. }
  2691. }
  2692. });
  2693. if(val > tqty) {
  2694. if(!busy)
  2695. showError("本次填写的数量不得超过" + tqty);
  2696. val = tqty;
  2697. } else if(val < 0){
  2698. if(!busy)
  2699. showError("本次填写的数量不能是负数");
  2700. val = tqty;
  2701. } else if(val == 0 && tqty != 0){
  2702. val = tqty;
  2703. }
  2704. if(record.get('mm_thisqty') != val)
  2705. record.set('mm_thisqty', val);
  2706. return val;
  2707. },
  2708. /**
  2709. * @PM.Make 万利达,UAS 先用本次退料数
  2710. * 制造单本次退料数mm_thisqty<=mm_onlineqty(在制数)
  2711. */
  2712. pm_make_rqtyf: function(val, meta, record, x, y, store){
  2713. meta.style = "background:#C6E2FF;";
  2714. if(record.data['mm_onlineqty'] < 0) {// 返修工单退料
  2715. return val;
  2716. }
  2717. var mrec = record;
  2718. if(record.data.isrep) {
  2719. //替代料 本次数量 按主料本次数量计算
  2720. store.each(function(d){
  2721. if(d.data.mm_id == record.data.mm_id && !d.data.isrep) {
  2722. mrec = d;return;
  2723. }
  2724. });
  2725. }
  2726. var t = Math.floor(((mrec.data['mm_onlineqty'] || val) - (mrec.data['mm_backqty'] || 0))),
  2727. busy = Ext.getCmp('editorColumnGridPanel').busy;
  2728. var max = t;
  2729. max = max < 0 ? 0 : max;
  2730. var tqty = max;
  2731. var items = Ext.getCmp('grid').store.data.items;
  2732. Ext.each(items, function(item){
  2733. if(item.data['ma_code'] != null && item.data['ma_code'].toString().trim() != ''
  2734. && item.data['ma_code'] == mrec.data['mm_code']){
  2735. mItem = item;
  2736. if(item.data['ma_thisqty'] > 0 && mrec.data['mm_oneuseqty'] > 0){
  2737. max = item.data['ma_thisqty'] * mrec.data['mm_oneuseqty'];
  2738. tqty = Math.min(max, t);
  2739. }
  2740. }
  2741. });
  2742. if(val > tqty) {
  2743. if(!busy)
  2744. showError("本次退料的数量不得超过" + tqty);
  2745. val = tqty;
  2746. } else if(val < 0){
  2747. if(!busy)
  2748. showError("本次退料的数量不能是负数");
  2749. val = tqty;
  2750. } else if(val == 0 && tqty != 0){
  2751. val = tqty;
  2752. }
  2753. if(record.get('mm_thisqty') != val)
  2754. record.set('mm_thisqty', val);
  2755. return val;
  2756. },
  2757. /**
  2758. * @PM.Make
  2759. * 成套补料,本次补料套数
  2760. */
  2761. pm_make_add_thisqty: function(val, meta, record, x, y){
  2762. var code = record.data['ma_code'], busy = Ext.getCmp('grid').busy;
  2763. if(!Ext.isEmpty(record.data['ma_id']) && !Ext.isEmpty(code)) {
  2764. var nQty = record.data['ma_qty'] - record.data['ma_haveqty'];
  2765. record.maxQty = record.maxQty || nQty;
  2766. var maxQty = Math.min(record.maxQty, nQty);
  2767. if(val > maxQty) {
  2768. if(!busy)
  2769. showError('本次补料套数不能超过<' + maxQty + '>,单号:' + code);
  2770. val = maxQty;
  2771. if(record.data['ma_thisqty'] != val) {
  2772. record.set('ma_thisqty', val);
  2773. }
  2774. } else if(val < 0) {
  2775. val = 0;
  2776. if(record.data['ma_thisqty'] != val) {
  2777. record.set('ma_thisqty', val);
  2778. }
  2779. }
  2780. var grid = Ext.getCmp('editorColumnGridPanel'),items = grid.store.data.items;
  2781. if(!grid.lockrender) {
  2782. Ext.each(items, function(item){
  2783. if(item.data['mm_code'] == code){
  2784. var max = item.data['mm_oneuseqty'] * val;
  2785. var t = 0;
  2786. if(item.data.isrep) {
  2787. t = 0;
  2788. } else {
  2789. if(record.data['mm_qty'] == Math.floor(record.data['mm_qty'])){
  2790. t = record.data['mm_scrapqty'] + record.data['mm_returnmqty'] - Math.floor(record.data['mm_balance'])
  2791. - record.data['mm_addqty'];// - record.data['mm_totaluseqty']
  2792. }else{
  2793. t = record.data['mm_scrapqty'] + record.data['mm_returnmqty'] - record.data['mm_balance']
  2794. - record.data['mm_addqty'];// - record.data['mm_totaluseqty']
  2795. }
  2796. }
  2797. max = Math.min(t, max);
  2798. if(item.data['mm_thisqty'] != max){
  2799. item.set('mm_thisqty', max);
  2800. }
  2801. }
  2802. });
  2803. }
  2804. }
  2805. return val;
  2806. },
  2807. /**
  2808. * @PM.Make
  2809. * 本次补料数: mm_scrapqty(报废) + mm_returnmqty(制程不良退料数) - mm_balance(备损数) - mm_addqty(补料数)// - mm_totaluseqty(已转领料数量)
  2810. *
  2811. */
  2812. pm_make_thisadd: function(val, meta, record, x, y) {
  2813. meta.tdCls = "x-grid-cell-renderer-bl";
  2814. var t = 0,busy = Ext.getCmp('editorColumnGridPanel').busy;
  2815. if(record.data.isrep) {
  2816. return val;
  2817. } else {
  2818. if(record.data['mm_qty'] == Math.floor(record.data['mm_qty'])){
  2819. t = record.data['mm_scrapqty'] + record.data['mm_returnmqty'] - Math.floor(record.data['mm_balance'])
  2820. - record.data['mm_addqty'];// - record.data['mm_totaluseqty']
  2821. }else{
  2822. t = record.data['mm_scrapqty'] + record.data['mm_returnmqty'] - record.data['mm_balance']
  2823. - record.data['mm_addqty'];// - record.data['mm_totaluseqty']
  2824. }
  2825. }
  2826. var max = t;
  2827. max = max < 0 ? 0 : max;
  2828. var tqty = max;
  2829. var items = Ext.getCmp('grid').store.data.items;
  2830. Ext.each(items, function(item){
  2831. if(item.data['ma_code'] != null && item.data['ma_code'].toString().trim() != ''
  2832. && item.data['ma_code'] == record.data['mm_code']){
  2833. mItem = item;
  2834. if(item.data['ma_thisqty'] > 0 && record.data['mm_oneuseqty'] > 0){
  2835. max = item.data['ma_thisqty'] * record.data['mm_oneuseqty'];
  2836. tqty = Math.min(max, t);
  2837. }
  2838. }
  2839. });
  2840. if(val > tqty) {
  2841. if(!busy)
  2842. showError("本次补料数不得超过" + tqty);
  2843. val = tqty;
  2844. record.set('mm_thisqty', val);
  2845. } else if(val < 0){
  2846. if(!busy)
  2847. showError("本次补料数不能是负数");
  2848. val = tqty;
  2849. record.set('mm_thisqty', val);
  2850. } else if(val == 0 && tqty != 0){
  2851. val = tqty;
  2852. record.set('mm_thisqty', val);
  2853. }
  2854. return val;
  2855. },
  2856. /**
  2857. * @PM.Make
  2858. * ProductAll!Query MRP仓剩余可用=pr_mrponhand-pr_commited
  2859. */
  2860. pm_ProductAll_onhandlack: function(val, meta, record, x, y){
  2861. var t = 0 ;
  2862. t = record.data['v_po_mrponhand'] - record.data['v_mrpsaqty'] - record.data['v_forecastqty'] - record.data['v_mrpmmqty'] ;
  2863. var field = this.columns[y].dataIndex;
  2864. return t;
  2865. //record.set(field, t);
  2866. },
  2867. /**
  2868. * @PM.Make
  2869. * ProductAll!Query 收料仓剩余可用=pr_mrponhand+pr_reconhand-pr_commited
  2870. */
  2871. pm_ProductAll_reconhandlack: function(val, meta, record, x, y){
  2872. var t = 0 ;
  2873. t = record.data['v_po_mrponhand'] + record.data['v_reconhand'] - record.data['v_mrpsaqty'] - record.data['v_forecastqty'] - record.data['v_mrpmmqty'] ;
  2874. var field = this.columns[y].dataIndex;
  2875. return t;
  2876. },
  2877. /**
  2878. * @PM.Make
  2879. * ProductAll!Query MRP在途剩余可用=pr_mrponhand+pr_onorder-pr_commited
  2880. */
  2881. pm_ProductAll_onorderlack: function(val, meta, record, x, y){
  2882. var t = 0 ;
  2883. t = record.data['v_po_mrponhand'] + record.data['v_mrppoqty'] + record.data['v_mrpmaqty'] - record.data['v_forecastqty'] - record.data['v_mrpsaqty']- record.data['v_mrpmmqty'] ;
  2884. var field = this.columns[y].dataIndex;
  2885. return t;
  2886. },
  2887. /**
  2888. * @PM.Make
  2889. * ProductAll!Query MRP请购剩余可用=pr_mrponhand+pr_onorder+pr_arkqty-pr_commited
  2890. */
  2891. pm_ProductAll_arklack: function(val, meta, record, x, y){
  2892. var t = 0;
  2893. t = record.data['v_po_mrponhand'] + record.data['v_mrppoqty'] + record.data['v_mrpmaqty'] + record.data['v_arkqty'] - record.data['v_mrpsaqty'] - record.data['v_forecastqty'] - record.data['v_mrpmmqty'] ;
  2894. var field = this.columns[y].dataIndex;
  2895. return t;
  2896. },
  2897. /**
  2898. *@PM.MakePlan 生产计划维护
  2899. * */
  2900. pm_make_presMakePlan:function(val,meta,record,rol){
  2901. if(val)
  2902. return '<a href="javascript:showWin('+ '\''+rol+'\''+');">' + val + '</a>';
  2903. else return null;
  2904. },
  2905. /**
  2906. * 颜色列
  2907. * @expression bgcolor
  2908. */
  2909. bgcolor: function(val, meta, record, x, y){
  2910. return "<div style='background:#" + val + " !important'>" + val + "</div>";
  2911. },
  2912. /**
  2913. * 颜色列
  2914. * @expression bgcolor2
  2915. */
  2916. bgcolor2: function(val, meta, record, x, y){
  2917. return '<div style="background:#' + val + '">&nbsp;</div>';
  2918. },
  2919. /**
  2920. * 超链接列
  2921. */
  2922. href: function(val, meta, record, x, y){
  2923. return '<a href="javascript:void(0);">' + val + '</a>';
  2924. },
  2925. /**
  2926. * 年和月
  2927. */
  2928. yearmonth: function(val, meta, record, x, y){
  2929. meta.style = "background:#C6E2FF;";
  2930. if(val == null || val == ''){
  2931. var date = new Date();
  2932. var year = date.getFullYear();
  2933. var month = date.getMonth() + 1;
  2934. month = month < 10 ? '0' + month : month;
  2935. val = '' + year + month;
  2936. }
  2937. var field = this.columns[y].dataIndex;
  2938. if(record.data[field] != val){
  2939. record.set(field, val);
  2940. }
  2941. return val;
  2942. },
  2943. /**
  2944. * ??
  2945. */
  2946. date: function(val, meta, record){
  2947. meta.style = "background:#C6E2FF;";
  2948. if(val){
  2949. return '<span style="color:blue;padding-left:2px">' + Ext.Date.toString(val); + '</span>';
  2950. } else
  2951. return '<span style="color:blue;padding-left:2px"></span>';
  2952. },
  2953. /**
  2954. * 网络寻呼-状态prd_status
  2955. * -1未读 1已读 0保留
  2956. */
  2957. pagingReleaseStatus: function(val, meta, record){
  2958. var d = Number(val);
  2959. var str = '';
  2960. switch (d){
  2961. case 0:
  2962. str = '<span style="color:#20B7B9;padding-left:2px">保留</span>';
  2963. break;
  2964. case 1:
  2965. str = '<img src="' + basePath + 'resource/images/renderer/remind.png">' +
  2966. '<span style="color:blue;padding-left:2px">已阅</span>';
  2967. break;
  2968. case -1:
  2969. str = '<img src="' + basePath + 'resource/images/renderer/remind2.png">' +
  2970. '<span style="color:red;padding-left:2px">未阅</span>';
  2971. break;
  2972. }
  2973. return str;
  2974. },
  2975. /**
  2976. * @OA
  2977. * 不通过监听itemmousedown来查看明细,
  2978. * 而是点击button
  2979. */
  2980. detailbutton: function(msg, meta, record){
  2981. /**
  2982. * 寻呼内容列表显示时
  2983. * 将表情代码转化成图片。
  2984. * 插入的图片和附件代码不转化
  2985. */
  2986. if(msg){
  2987. msg = msg.toString();
  2988. var faces = msg.match(/&f\d+;/g);
  2989. Ext.each(faces, function(f){//表情
  2990. msg = msg.replace(f, '<img src="' + basePath + 'resource/images/face/' + f.substr(2).replace(';', '') + '.gif">');
  2991. });
  2992. }
  2993. return (msg || ' ') + "<input type='button' value='查看详细' name='detailbutton' style='float:right;color:gray;font-size:13px;cursor:pointer;height:25px;' onClick='Ext.getCmp(\"grid\").onGridItemClick();'/>";
  2994. },
  2995. opendetail: function(val, meta, record) {
  2996. if(!Ext.isEmpty(val)){
  2997. var sd_id = record.get('sd_id');
  2998. return val + "<input type='button' value='出货排程' name='detailbutton' " +
  2999. "style='float:right;color:gray;font-size:13px;cursor:pointer;height:25px;' onClick='window.open(\"" + basePath +
  3000. "jsps/scm/sale/saleDetail.jsp?formCondition=sd_id="+sd_id+"&gridCondition=sdd_sdid="+sd_id+"\", \"测试\", \"width=800,height=600,top=30,left=200\")'/>";
  3001. }
  3002. },
  3003. /**
  3004. * 不直接显示附件的ID字符串,转化显示附件数
  3005. */
  3006. attachcolumn: function(val, meta, record){
  3007. if(val != null && val != ''){
  3008. return val.split(',').length + ' 个';
  3009. } else {
  3010. return '无';
  3011. }
  3012. },
  3013. /**
  3014. * 对任务完成率不同阶段进行图片标识
  3015. */
  3016. percentdone: function(val, meta, record){
  3017. val == null || 0;
  3018. if(val < 30)
  3019. return '<img src="' + basePath + 'resource/images/renderer/remind2.png">'+'<span style="color:#436EEE;padding-left:2px">' + val + '</span>';
  3020. else if(val > 30 && val < 50)
  3021. return '<img src="' + basePath + 'resource/images/renderer/remind.png">'+'<span style="color:#5F9EA0;padding-left:2px">' + val + '</span>';
  3022. else if(val == 100){
  3023. return '<img src="' + basePath + 'resource/images/renderer/award1.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  3024. }else if(val > 80){
  3025. return '<img src="' + basePath + 'resource/images/renderer/award2.png">'+'<span style="color:green;padding-left:2px">' + val + '</span>';
  3026. }
  3027. else
  3028. return val;
  3029. },
  3030. /**
  3031. * SCM 请购转采购替代料
  3032. * */
  3033. ap_isrep: function(val, meta, record, x, y){
  3034. if(record.data.ad_ifrep==-1) {
  3035. meta.tdCls = "x-grid-cell-renderer-cl";
  3036. return '<img src="' + basePath + 'resource/images/taskdescription.png">' + val;
  3037. }
  3038. return val;
  3039. },
  3040. isDateModel_type: function(val){
  3041. if(val =='zhou'){
  3042. return '周';
  3043. } else if(val == 'yue'){
  3044. return '月';
  3045. } else {
  3046. return '未知';
  3047. }
  3048. },
  3049. string_substring: function(val, meta, record, x, y, store, view){
  3050. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  3051. if(!me || !me.args){
  3052. return val;
  3053. } else {
  3054. var i=me.args['string_substring'][field];
  3055. return val.substring(Number(i[0]),Number(i[1]));
  3056. }
  3057. },
  3058. /**
  3059. * @MA
  3060. */
  3061. logicDesc_type: function(val){
  3062. if (val == 1) {
  3063. return '主算法';
  3064. } else if(val == 0){
  3065. return '一般算法';
  3066. } else {
  3067. return '系统算法';
  3068. }
  3069. },
  3070. /**
  3071. * 通用方法
  3072. * 获取本地常用属性
  3073. * em_name,em_code,em_uu,en_uu...
  3074. * 以及获取本地时间
  3075. * @expression getLocal(em_code),getLocal(Y-m-d),getLocal(time)
  3076. */
  3077. getLocal: function(val, meta, record, x, y, store, view){
  3078. var grid = view.ownerCt,me = grid.RenderUtil,column = grid.columns[y],field = column.dataIndex;
  3079. if(!me || !me.args){
  3080. grid = grid.ownerCt, me = grid.RenderUtil;
  3081. if(!me || !me.args){
  3082. return val;
  3083. }
  3084. }
  3085. var arg = me.args.getLocal[field][0],v = val;
  3086. if(contains('Y-m-d H:i:s', arg)) {
  3087. v = Ext.Date.format(new Date(), arg);
  3088. } else if('time' == arg){
  3089. v = Ext.Date.format(new Date(), 'Y-m-d H:i:s');
  3090. } else if('date' == arg){
  3091. v = Ext.Date.format(new Date(), 'Y-m-d');
  3092. } else {
  3093. v = window[arg];
  3094. }
  3095. if(v && Ext.isEmpty(val)) {
  3096. val = v;
  3097. record.set(field, v);
  3098. }
  3099. return val;
  3100. },
  3101. /**
  3102. * @MA
  3103. * 逻辑顺序 0-before,1-after
  3104. */
  3105. logicturn: function(val){
  3106. switch (Number(val)){
  3107. case 0 :
  3108. val = 'before';break;
  3109. case 1 :
  3110. val = 'after';break;
  3111. }
  3112. return val;
  3113. },
  3114. /**
  3115. * @MA
  3116. * form配置界面,将从datadictonary得到的ddd_fieldtype转化为form能识别的fd_type
  3117. */
  3118. form_type: function(val, meta, record, x, y, store, view){
  3119. var grid = view.ownerCt,column = grid.columns[y],e,f, _v = val ? val.toLowerCase() : '', len = 20;
  3120. if(/^(varchar2)/.test(_v)) {
  3121. val = 'S';
  3122. len = Number(_v.substring(_v.indexOf('(') + 1, _v.indexOf(')')));
  3123. } else if (/^(int)/.test(_v)) {
  3124. val = 'N';
  3125. } else if (/^(number)/.test(_v)) {
  3126. val = 'N';
  3127. } else if (/^(float)/.test(_v)) {
  3128. val = 'N';
  3129. } else if (/^(smallint)/.test(_v)) {
  3130. val = 'N';
  3131. } else if ('date' == _v) {
  3132. val = 'D';
  3133. } else if ('timestamp' == _v) {
  3134. val = 'DT';
  3135. }
  3136. if (record.get('fd_type') != val) {
  3137. record.set('fd_type', val);
  3138. record.set('fd_fieldlength', len);
  3139. }
  3140. if ((e = (column.editor || column.filter)) != null && e.store) {
  3141. var s = null,dd = e.store.data;
  3142. s = Ext.Array.filter(dd, function(d, index){
  3143. return d.value == val;
  3144. });
  3145. if(s && s.length > 0) {
  3146. return s[0].display;
  3147. }
  3148. } else if ((f = column.field) != null) {
  3149. return f.rawValue;
  3150. }
  3151. return val;
  3152. },
  3153. /**
  3154. * @FA.VoucherStyle
  3155. */
  3156. fa_vdclass: function(val, meta, record, x, y, store, view) {
  3157. if(!Ext.isEmpty(val)) {
  3158. var count = 0;
  3159. store.each(function(d){
  3160. if(d.get('vd_class') == val) {
  3161. count++;
  3162. }
  3163. });
  3164. var v = record.get('vd_detno');
  3165. if(v <= 0 || v > count) {
  3166. record.set('vd_detno', count);
  3167. }
  3168. }
  3169. return val;
  3170. } ,
  3171. /**
  3172. * @FA.VoucherStyle
  3173. */
  3174. fa_custmonthcys_batch: function(val, meta, record, x, y, store, view) {
  3175. var cm_endamount = record.data['cm_endamount']; //应收金额
  3176. var cm_prepayend = record.data['cm_prepayend']; //预收金额
  3177. if(Ext.isNumber(Number(cm_endamount))&&Ext.isNumber(Number(cm_prepayend))){
  3178. if(cm_endamount == '' && cm_prepayend == ''){
  3179. return '';
  3180. }
  3181. return Number(cm_endamount) > Number(cm_prepayend) ? Ext.util.Format.number(cm_endamount, '0,000.00') :Ext.util.Format.number(cm_prepayend,'0,000.00') ;
  3182. } else {
  3183. return '';
  3184. }
  3185. } ,
  3186. /**
  3187. * @流程等待时间
  3188. */
  3189. WaitTime:function(val, meta, record){
  3190. if(record){
  3191. var launchTime=record.data.jp_launchTime;
  3192. return parseInt((new Date().getTime()-new Date(launchTime).getTime())/60000);
  3193. }
  3194. else return null;
  3195. },
  3196. /**
  3197. * @FA.Voucher
  3198. * VoucherCreate
  3199. * 打开凭证
  3200. */
  3201. openvoucher: function(val, meta, record) {
  3202. if(!Ext.isEmpty(val)) {
  3203. if(!window.__fn) {
  3204. var fn = function(vo_code) {
  3205. Ext.Ajax.request({
  3206. url: basePath + 'common/getFieldData.action',
  3207. params: {
  3208. caller: 'Voucher',
  3209. field: 'vo_id',
  3210. condition: 'vo_code=\'' + vo_code + '\''
  3211. },
  3212. callback: function(opt, s, r) {
  3213. if(s) {
  3214. var rs = Ext.decode(r.responseText);
  3215. if(rs.data != null && rs.data > 0) {
  3216. openUrl('jsps/fa/ars/voucher.jsp?formCondition=vo_idIS' + rs.data +
  3217. '&gridCondition=vd_voidIS' + rs.data);
  3218. }
  3219. }
  3220. }
  3221. });
  3222. };
  3223. window.__fn = fn;
  3224. }
  3225. val = '<a href="javascript:window.__fn(\'' + val + '\');">' + val + '</a>';
  3226. }
  3227. return val;
  3228. },
  3229. prod_disable : function(v, m, r) {
  3230. var s = r.get('pr_status');
  3231. m.style = '';
  3232. if('已删除' == s || '已禁用' == s) {
  3233. m.style = 'color:red;';
  3234. }
  3235. return v;
  3236. },
  3237. /**
  3238. * @PM
  3239. * 制造单批量转FQC前,判断根据物料大类,批号需要手工录入(国扬)
  3240. **/
  3241. turnfqc_requirebatch : function(v, m, r, x, y, store, view) {
  3242. var kinds = ['CWDM模块','PCBA板','PCB板','光开关','结构件','模拟光模块','模拟光器件','数字光模块','数字光器件','数字器件材料','无源半成品','无源器件材料'];
  3243. if(kinds.indexOf(v) > -1 && view.ownerCt.selModel.isSelected(r) && Ext.isEmpty(r.get('ma_contractcode'))) {
  3244. showError('需要填写批号,工单:' + r.get('ma_code'));
  3245. }
  3246. return v;
  3247. },
  3248. /**
  3249. * @Scm.Application
  3250. * 请购单差异天数计算(国扬)
  3251. **/
  3252. application_differdays : function(val, meta, record){
  3253. var v = record.get('ad_delivery');
  3254. if(v != null) {
  3255. return Math.round((v-Ext.getCmp('ap_date').getValue())/86400000)-(record.get('ad_leadtime'));
  3256. }
  3257. return 0;
  3258. },
  3259. /**
  3260. * @Pm.MakeScrap
  3261. * 报废单是否超备损数报废
  3262. **/
  3263. ifoverqtyScrap : function(val, meta, record){
  3264. var v1 = record.get('md_allscrapqty');
  3265. var v2 = record.get('mm_balanceqty');
  3266. var v;
  3267. if(v1>0 && v1>v2) {
  3268. v='是';
  3269. }else
  3270. v= '否';
  3271. return v;
  3272. },
  3273. /**
  3274. * @Scm。ProdInOut
  3275. * 生产退料单,是否超损耗退料
  3276. **/
  3277. ifoverqtyReturn : function(val, meta, record){
  3278. var v1 = record.get('pd_orderqty');
  3279. var v2 = record.get('mm_balanceqty');
  3280. var v;
  3281. if(v1>0 && v1>v2 && record.get('pd_description')=="制程不良") {
  3282. v='是';
  3283. }else
  3284. v= '否';
  3285. return v;
  3286. },
  3287. /**
  3288. * @Pm。
  3289. * 增加物料的关联信息查看render(鼠标停在某个物料上时,显示一个tip提示信息,
  3290. * 包含物料的MRP库存,不良品库存,采购待检数,PO在途数,请购在途数,工单未发料数,工单为完工数)
  3291. **/
  3292. ProductHref : function(val, meta, record,x,y,store, view){
  3293. var field = this.columns[y].dataIndex;
  3294. var me = this.RenderUtil;
  3295. var grid = view.ownerCt;
  3296. document.getElementById(view.el.id).addEventListener("mouseover", function(e){
  3297. callValue = e.target.innerHTML;
  3298. if(typeof(me.args.ProductHref) != undefined && me.args.ProductHref != null){//带有参数,分别指参数列
  3299. var rfield = me.args.ProductHref[field];
  3300. for(var i=0;i<rfield.length;i++){//当前所指的单元格名称等于参数
  3301. if(record.data[rfield[i]] == callValue){
  3302. code = callValue;
  3303. getData();
  3304. }
  3305. }
  3306. }else{//不带参数指的是该列
  3307. if(record.data[field] == callValue){
  3308. code = callValue;
  3309. getData();
  3310. }
  3311. }
  3312. });
  3313. function getData(){
  3314. if(!view.tip || (view.tip && view.tip.hidden)) {
  3315. if(view.tip && view.tip.hidden){
  3316. view.tip.destroy();
  3317. }
  3318. view.tip = Ext.create('Ext.tip.ToolTip', {
  3319. target: view.el,
  3320. delegate: view.itemSelector,
  3321. trackMouse: true,
  3322. renderTo: Ext.getBody(),
  3323. maxWidth :580,
  3324. hidden : false,
  3325. listeners: {
  3326. beforeshow: function updateTipBody(tip) {
  3327. if(callValue == code){
  3328. Ext.Ajax.request({
  3329. url: basePath + 'pm/product/getProductCount.action',
  3330. params: {
  3331. codes: code
  3332. },
  3333. callback: function (opt, s, r) {
  3334. if(s) {
  3335. var rs = Ext.decode(r.responseText);
  3336. if(rs.data) {
  3337. tip.down('grid').setTitle(code);
  3338. tip.down('grid').store.loadData(rs.data);
  3339. }
  3340. }
  3341. }
  3342. });
  3343. }else{//不显示tip
  3344. return false;
  3345. }
  3346. }
  3347. },
  3348. items: [{
  3349. xtype: 'grid',
  3350. width: 580,
  3351. columns: [{
  3352. text: 'MRP库存',
  3353. cls: 'x-grid-header-1',
  3354. dataIndex:'PO_MRPONHAND',
  3355. width: 80
  3356. },{
  3357. text: '不良品库存',
  3358. cls: 'x-grid-header-1',
  3359. dataIndex: 'PO_DEFECTONHAND',
  3360. width: 80
  3361. },{
  3362. text: '采购待检数',
  3363. cls: 'x-grid-header-1',
  3364. xtype: 'numbercolumn',
  3365. align: 'right',
  3366. dataIndex: 'RECONHAND',
  3367. width: 80
  3368. },{
  3369. text: 'PO在途数',
  3370. cls: 'x-grid-header-1',
  3371. xtype: 'numbercolumn',
  3372. align: 'right',
  3373. dataIndex: 'POQTY',
  3374. width: 80
  3375. },{
  3376. text: '请购在途数',
  3377. cls: 'x-grid-header-1',
  3378. xtype: 'numbercolumn',
  3379. align: 'right',
  3380. dataIndex: 'ARKQTY',
  3381. width: 80
  3382. },{
  3383. text: '工单未发料数',
  3384. cls: 'x-grid-header-1',
  3385. xtype: 'numbercolumn',
  3386. align: 'right',
  3387. dataIndex: 'MMQTY',
  3388. width: 80
  3389. },{
  3390. text: '工单未完工数',
  3391. cls: 'x-grid-header-1',
  3392. xtype: 'numbercolumn',
  3393. align: 'left',
  3394. dataIndex: 'MAQTY',
  3395. width: 100
  3396. }],
  3397. columnLines: true,
  3398. title: '物料分仓库存',
  3399. store: new Ext.data.Store({
  3400. fields: ['PO_MRPONHAND', 'PO_DEFECTONHAND', 'RECONHAND','POQTY','ARKQTY','MMQTY','MAQTY'],
  3401. data: [{}]
  3402. })
  3403. }]
  3404. });
  3405. }
  3406. }
  3407. var field = this.columns[y].dataIndex;
  3408. return record.data[field];
  3409. },
  3410. /**
  3411. * @Pm。
  3412. * 增加物料的关联信息查看render(鼠标停在某个物料上时,显示一个tip提示信息,
  3413. * 包含物料的仓库编号,仓库名称,库存),类似于erp.view.core.plugin.ProdOnhand,委外成套发料界面中的显示效果
  3414. * 类似配置方式 ProdOnhand:pd_prodcode,或者直接配置为ProdOnhand,如果没有添加字段则默认选取的字段就是该行字段名
  3415. **/
  3416. ProdOnhand : function(val, meta, record,x,y,store, view){
  3417. var field = this.columns[y].dataIndex;
  3418. var me = this.RenderUtil;
  3419. var grid = view.ownerCt;
  3420. var rfield = field;
  3421. if(me.args.ProdOnhand != null){
  3422. rfield = me.args.ProdOnhand[field][0];
  3423. }
  3424. var code = record.data[rfield];
  3425. if(code) {
  3426. if(!view.tip) {
  3427. view.tip = Ext.create('Ext.tip.ToolTip', {
  3428. target: view.el,
  3429. delegate: view.itemSelector,
  3430. trackMouse: true,
  3431. renderTo: Ext.getBody(),
  3432. maxWidth :580,
  3433. listeners: {
  3434. beforeshow: function updateTipBody(tip) {
  3435. var rowindex = tip.triggerElement.rowIndex;
  3436. var code = Ext.getCmp(grid.id).getStore().getAt(rowindex-1).get(rfield);
  3437. Ext.Ajax.request({
  3438. url : basePath + 'scm/product/getProductwh.action',
  3439. params : {
  3440. codes : "'"+code+"'"
  3441. },
  3442. callback: function (opt, s, r) {
  3443. if(s) {
  3444. var rs = Ext.decode(r.responseText);
  3445. if(rs.data) {
  3446. tip.update('');
  3447. tip.down('grid').setTitle(code);
  3448. tip.down('grid').show();
  3449. tip.down('grid').store.loadData(rs.data);
  3450. }else{
  3451. tip.down('grid').hide();
  3452. tip.update(code+'<br/> 库存数量为0');
  3453. }
  3454. }
  3455. }
  3456. });
  3457. }
  3458. },
  3459. items : [{
  3460. xtype : 'grid',
  3461. width : 300,
  3462. columns : [ {
  3463. text : '仓库编号',
  3464. cls : 'x-grid-header-1',
  3465. dataIndex : 'PW_WHCODE',
  3466. width : 80
  3467. }, {
  3468. text : '仓库名称',
  3469. cls : 'x-grid-header-1',
  3470. dataIndex : 'WH_DESCRIPTION',
  3471. width : 120
  3472. }, {
  3473. text : '库存',
  3474. cls : 'x-grid-header-1',
  3475. xtype : 'numbercolumn',
  3476. align : 'right',
  3477. dataIndex : 'PW_ONHAND',
  3478. width : 90
  3479. } ],
  3480. columnLines : true,
  3481. title : '物料分仓库存',
  3482. store : new Ext.data.Store({
  3483. fields : [ 'PW_WHCODE', 'WH_DESCRIPTION', 'PW_ONHAND' ],
  3484. data : [ {} ]
  3485. })
  3486. } ]
  3487. });
  3488. }
  3489. }
  3490. return record.data[field];
  3491. },
  3492. /**
  3493. * @SCM.Purchase.VerifyApplyChange
  3494. * 收料变更单新数量
  3495. */
  3496. scm_verify_change_qty: function(val, meta, record){
  3497. meta.style = "background:#C6E2FF;";
  3498. var pdq = record.data['pd_qty'], oldqty = record.data['vcd_oldqty'],
  3499. yqty = record.data['pd_yqty'];
  3500. if(pdq != null && pdq > 0) {
  3501. if(yqty + (val-oldqty) > pdq) {
  3502. val = pdq-yqty+oldqty;
  3503. showError('请不要超过采购数<' + pdq + '>!');
  3504. }
  3505. }
  3506. if(record.get('vcd_newqty') != val) {
  3507. record.set('vcd_newqty', val);
  3508. }
  3509. return val;
  3510. },
  3511. /**
  3512. * @PM ProdInOut!Partition!Deal
  3513. * 拆件批量入库 (入库数)
  3514. */
  3515. pm_io_thisqty: function(val, meta, record, x, y, store, view){
  3516. meta.tdCls = "x-grid-cell-renderer-bl";
  3517. var grid = view.ownerCt, me = grid.RenderUtil,column = grid.columns[y] ;
  3518. var gqty = record.data['mm_gqty'];
  3519. var yqty = record.data['mm_yqty'];
  3520. if(gqty != null && gqty > 0 ) {
  3521. var maxValue = gqty-yqty;
  3522. if(record.dirty){
  3523. var thisqty = val ;
  3524. if(column.editor || (column.getEditor && column.getEditor())) {//在允许编辑的情况下,修改值不能大于maxValue
  3525. if (thisqty > maxValue){
  3526. val = maxValue;
  3527. showError('请不要输入超过最大数量<' + maxValue + '>的值!');
  3528. }
  3529. }
  3530. }else{
  3531. val = maxValue;
  3532. }
  3533. if(record.data['mm_thisqty'] != val){
  3534. record.set('mm_thisqty', val);
  3535. }
  3536. return val;
  3537. }
  3538. },
  3539. /**
  3540. * @Fa
  3541. * 应付批量开票
  3542. * */
  3543. FA_THISVOQTY: function(val, meta, record, x, y, store, view){
  3544. var maxValue=record.get('pd_showqty')-record.get('pd_showinvoqty');
  3545. var grid = view.ownerCt,column = grid.columns[y],field = column.dataIndex;
  3546. if(maxValue>0 && val<0){
  3547. val=maxValue;
  3548. showError('开票数量不能小于0!');
  3549. record.set(field,val);
  3550. }
  3551. else if(maxValue<0 && val>0){
  3552. val=maxValue;
  3553. showError('开票数量不能大于0!');
  3554. record.set(field,val);
  3555. }
  3556. if(column.format)
  3557. val = Ext.util.Format.number(val, column.format);
  3558. else
  3559. val = val.toFixed(4);
  3560. return val;
  3561. },
  3562. FA_BILLOUTTHISVOQTY: function(val, meta, record, x, y, store, view){
  3563. var maxValue=record.get('abd_qty')-record.get('abd_yqty');
  3564. var grid = view.ownerCt,column = grid.columns[y],field = column.dataIndex;
  3565. if(maxValue>0 && val<0){
  3566. val=maxValue;
  3567. showError('开票数量不能小于0!');
  3568. record.set(field,val);
  3569. }
  3570. else if(maxValue<0 && val>0){
  3571. val=maxValue;
  3572. showError('开票数量不能大于0!');
  3573. record.set(field,val);
  3574. } else if(!val) {
  3575. val = maxValue;
  3576. record.set(field,val);
  3577. }
  3578. if(column.format)
  3579. val = Ext.util.Format.number(val, column.format);
  3580. else
  3581. val = val.toFixed(4);
  3582. return val;
  3583. },
  3584. /**
  3585. * @Fa
  3586. * 对账单转发票
  3587. * */
  3588. FA_CHECK_THISVOQTY: function(val, meta, record, x, y, store, view){
  3589. var maxValue=record.get('ad_qty')-record.get('ad_yqty');
  3590. var grid = view.ownerCt,column = grid.columns[y],field = column.dataIndex;
  3591. if(maxValue>0 && val<0){
  3592. val=maxValue;
  3593. showError('开票数量不能小于0!');
  3594. record.set(field,val);
  3595. } else if(maxValue<0 && val>0){
  3596. val=maxValue;
  3597. showError('开票数量不能大于0!');
  3598. record.set(field,val);
  3599. } else if(!val) {
  3600. val = maxValue;
  3601. record.set(field,val);
  3602. }
  3603. if(column.format)
  3604. val = Ext.util.Format.number(val, column.format);
  3605. else
  3606. val = val.toFixed(4);
  3607. return val;
  3608. },
  3609. BatchRemind: function(val, meta, record){
  3610. if(record.get('ba_validtime') && Number(record.get('ba_remain'))>0 && new Date()>record.get('ba_validtime'))
  3611. return '<span style="color:red;padding-left:2px">' + val + '</span>';
  3612. else return val;
  3613. },
  3614. SMTMonitor :function(val, meta, record, x, y, store, view){
  3615. var me = this;
  3616. if(Ext.isDefined(me.unitTime)){
  3617. if(Number(me.unitTime)*Number(record.get('msl_remainqty')) < Number(me.warningTime)*60){
  3618. me.getView().getRowClass = function(record, rowIndex, rowParams, store) {
  3619. return 'renderColor';
  3620. };
  3621. var el = Ext.get('audio-error').dom;
  3622. el.play();
  3623. }
  3624. }
  3625. return val;
  3626. },
  3627. /**
  3628. * 明细行附件上传下载
  3629. * */
  3630. detailAttach:function(val, meta, record, x, y, store, view){
  3631. if(record&&record.data["1detailAttach"]!=null&&record.data["1detailAttach"]!=""){
  3632. var attach=record.data["1detailAttach"];
  3633. var grid = view.ownerCt,column = grid.columns[y],field = column.dataIndex;
  3634. if(record.data[field] != attach){
  3635. record.set(field,attach);
  3636. }
  3637. return '<img src="'+basePath+'resource/images/renderer/attach.png">'+'<span style="color:green;padding-left:2px;">' + attach.split(";")[0] + '</span>'+'<a href="' + basePath + 'common/downloadbyId.action?id='+attach.split(";")[1]+'"><img src="' + basePath + 'resource/images/icon/download.png" ></a>';
  3638. }else if(record&&val!=null&&val!=""){
  3639. return '<img src="'+basePath+'resource/images/renderer/attach.png">'+'<span style="color:green;padding-left:2px;">' + val.split(";")[0] + '</span>'+'<a href="' + basePath + 'common/downloadbyId.action?id='+val.split(";")[1]+'"><img src="' + basePath + 'resource/images/icon/download.png" ></a>';
  3640. }else return val;
  3641. },
  3642. /**
  3643. * 明细行报表上传下载
  3644. * */
  3645. detailAttach1:function(val, meta, record, x, y, store, view){
  3646. var file_path = record.data["file_path"];
  3647. if(record&&record.data["1detailAttach"]){
  3648. var attach=record.data["1detailAttach"];
  3649. var grid = view.ownerCt,column = grid.columns[y],field = column.dataIndex;
  3650. if(record.data[field] != attach){
  3651. record.set(field,attach);
  3652. }
  3653. return '<img src="'+basePath+'resource/images/renderer/attach.png">'+'<span style="color:green;padding-left:2px;">' + attach.split(";")[0] + '</span>'+'<a href="' + basePath + 'common/download.action?path='+ file_path +'"><img src="' + basePath + 'resource/images/icon/download.png" ></a>';
  3654. }else if(record &&en_admin=="pdf"){
  3655. if(val!=null&&val!="" ){
  3656. return '<img src="'+basePath+'resource/images/renderer/attach.png">'+'<span style="color:green;padding-left:2px;">' + val.split(";")[0] + '</span>'+'<a href="' + basePath + 'common/download.action?path='+ file_path +'"><img src="' + basePath + 'resource/images/icon/download.png" ></a>';
  3657. }else if(!record.dirty && record.data["file_name"] !="" && record.data["file_name"]!=null){
  3658. return '<img src="'+basePath+'resource/images/renderer/attach.png">'+'<span style="color:green;padding-left:2px;">' + record.data["file_name"]+'.rpt'+ '</span>'+'<a href="' + basePath + 'common/download.action?path='+ file_path +'"><img src="' + basePath + 'resource/images/icon/download.png" ></a>';
  3659. }else if(record.data["id"] !="" && record.data["id"]!=null&&en_admin=="pdf"){//解决更新条件等字段时附件字段为空无法更新
  3660. var arr=file_path.split('/');var length=arr.length;
  3661. record.set('attach',arr[length-1]+";0");
  3662. return '<img src="'+basePath+'resource/images/renderer/attach.png">'+'<span style="color:green;padding-left:2px;">' + arr[length-1]+ '</span>'+'<a href="' + basePath + 'common/download.action?path='+ file_path +'"><img src="' + basePath + 'resource/images/icon/download.png" ></a>';
  3663. }
  3664. }else return val;
  3665. },
  3666. /**
  3667. *kpi考核结果 查看分数来源
  3668. * */
  3669. score_from:function(val,meta,record){
  3670. if(record.data.ktd_kiid!=0){
  3671. var ktd_kiid=record.data.ktd_kiid;
  3672. return "<input type='button' value='查看分数来源' name='"+ktd_kiid+"' style='color:gray;font-size:13px;cursor:pointer;height:25px;' onClick='scoreFrom(this.name)' />";
  3673. }
  3674. return '';
  3675. },
  3676. /**
  3677. * 培训资源链接
  3678. */
  3679. resource_link:function(val){
  3680. return '<a target="_blank" href="' + val +'">'+val+'</a>';
  3681. },
  3682. /**
  3683. * 培训计划—考试-特殊颜色
  3684. */
  3685. trainingPlan_exam:function(val,meta,record){
  3686. if(record&&record.data['ti_exam']==true){
  3687. meta.tdCls = "x-grid-cell-renderer-cl";
  3688. }
  3689. return val;
  3690. },
  3691. /**
  3692. * 明细行texttrigger
  3693. */
  3694. texttrigger:function(val, meta, record, x, y, store, view){
  3695. var grid = view.ownerCt,column = grid.columns[y];
  3696. meta.style="padding-right:0px!important";
  3697. if(val){
  3698. return '<span style="display:inline-block;padding-left:2px;width:80%; text-overflow: ellipsis; white-space:nowrap; overflow:hidden;">'+val+'</span>'+
  3699. '<span><img src="'+basePath+'resource/images/renderer/texttrigger.png" style="display: inline; float: right;" ' +
  3700. 'onClick="Ext.getCmp(\'grid\').showTrigger(' + '\''+val+'\'' +')"></span>';
  3701. }
  3702. return '';
  3703. },
  3704. /**
  3705. * CommonUse 列表链接
  3706. */
  3707. openCommonUse:function(val, m, record, x, y, store, view) {
  3708. var grid = view.ownerCt, me = grid.RenderUtil,column = grid.columns[y], url = record.get('cu_url');
  3709. if(url) {
  3710. var val = "<a href=\"javascript:openTable1("
  3711. + record.get['cu_id'] + ",null,\'" + val + "\',\'" + url.replace(/\'/g, '\\\'') + "\',null,null,null,null,true)\">" + val + "</a>";
  3712. return val;
  3713. }
  3714. return val;
  3715. },
  3716. /**
  3717. * @PM.MRP
  3718. * MRP 需求中的订单号根据不同来源[销售订单,销售预测]打开链接
  3719. */
  3720. openorder: function(val, meta, record) {
  3721. if(!Ext.isEmpty(val)) {
  3722. if(!window.__fn) {
  3723. var fn = function(code) {
  3724. Ext.Ajax.request({
  3725. url: basePath + 'common/getFieldData.action',
  3726. params: {
  3727. caller: 'SaleForecast',
  3728. field: 'sf_id',
  3729. condition: 'sf_code=\'' + code + '\''
  3730. },
  3731. callback: function(opt, s, r) {
  3732. if(s) {
  3733. var rs = Ext.decode(r.responseText);
  3734. if(rs.data != null && rs.data > 0) {
  3735. openUrl('jsps/scm/sale/saleForecast.jsp?whoami=SaleForecast&formCondition=sf_idIS' + rs.data +
  3736. '&gridCondition=sd_sfidIS' + rs.data);
  3737. }else{
  3738. openUrl('jsps/scm/sale/sale.jsp?whoami=Sale&formCondition=sa_codeIS' + code +
  3739. '&gridCondition=sd_codeIS'+code);
  3740. }
  3741. }
  3742. }
  3743. });
  3744. };
  3745. window.__fn = fn;
  3746. }
  3747. val = '<a href="javascript:window.__fn(\'' + val + '\');">' + val + '</a>';
  3748. }
  3749. return val;
  3750. },
  3751. /**
  3752. * @PM.GoodsUpDeal 批量上架
  3753. * 本次上架数量不允许超过建议上架数量,不允许小于0
  3754. */
  3755. pm_goodsup_thisqty: function(val, meta, record, x, y){
  3756. meta.tdCls = "x-grid-cell-renderer-bl";
  3757. var r=0;
  3758. //r为该序号总剩余未发料数
  3759. r = record.data['mdd_qty'];
  3760. if(record.dirty){//未被修改过,并且mdd_qty与计算值不等
  3761. if(val > r) {
  3762. showError("本次上架数不得超过" + r);
  3763. val = r;
  3764. record.set('mdd_upqty', val);
  3765. } else if(val < 0 || val == 0){
  3766. showError("本次上架数必须大于0");
  3767. if(val!=r){
  3768. val = r;
  3769. record.set('mdd_upqty', val);
  3770. }
  3771. }
  3772. }else if(val == 0 ){
  3773. if(val!=r){
  3774. val = r;
  3775. record.set('mdd_upqty', val);
  3776. }
  3777. }
  3778. return val;
  3779. }
  3780. });