| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.scm.reserve.ProdInOut', {
- extend: 'Ext.app.Controller',
- requires: ['erp.util.FormUtil', 'erp.util.GridUtil', 'erp.util.BaseUtil'],
- views: [
- 'core.form.Panel', 'scm.reserve.ProdInOut', 'core.grid.Panel2', 'core.toolbar.Toolbar', 'core.form.MultiField', 'core.form.YnField', 'core.form.SpecialContainField',
- 'core.button.Save', 'core.button.Add', 'core.button.Submit', 'core.button.Print', 'core.button.PrintA4', 'core.button.Upload', 'core.button.ResAudit',
- 'core.button.Audit', 'core.button.Close', 'core.button.Delete', 'core.button.Update', 'core.button.DeleteDetail', 'core.button.ResSubmit',
- 'core.button.Banned', 'core.button.ResBanned', 'core.button.Post', 'core.button.ResPost', 'core.button.Query', 'core.button.GetPrice',
- 'core.button.RePrice', 'core.button.BussAccount', 'core.button.Export', 'core.form.FtFindField', 'core.form.ConDateField', 'core.button.UpdateWHCode',
- 'core.button.FeeShare', 'core.button.TurnDefectOut', 'core.button.Resetbatch', 'core.button.PrintwithPrice', 'core.button.tecai', 'core.button.GridWin',
- 'core.button.TurnExOut', 'core.trigger.DbfindTrigger', 'core.trigger.MultiDbfindTrigger', 'core.trigger.TextAreaTrigger', 'core.button.TurnProdinoutReturn',
- 'core.button.TurnProdinoutIn', 'core.button.UpdatePdprice', 'core.button.PrintNoPrice', 'core.button.PrintBKT', 'core.button.PrintPrice', 'core.form.FileField', 'core.button.TurnOutReturn',
- 'core.button.Split', 'core.button.TurnReturn', 'core.button.PrintBar', 'core.button.Printotherin', 'core.button.Printotherout', 'core.button.TurnProdOut', 'core.button.TurnYPOutReturn',
- 'core.button.TurnOtherIn', 'core.button.TurnOtherOut', 'core.button.TurnOtherPurcOut', 'core.button.TurnAppropriationOut', 'core.button.TurnCustReturnOut', 'core.button.TurnPurcOut',
- 'core.button.ClearSubpackage', 'core.button.Subpackage', 'core.grid.YnColumn', 'core.button.CatchBatch', 'core.button.Printnosale', 'core.button.PrintNoCustomer', 'core.button.PrintBZT', 'core.button.PrintInvoice',
- 'core.button.SetMMQTY', 'core.button.TurnSaleReturn', 'core.button.TurnRenewApply', 'core.button.TurnMrb', 'core.button.UpdateInfo', 'core.button.Barcode', 'core.button.UpdateRemark', 'core.button.ZxbzsBarcode',
- 'core.button.PrintAll', 'core.form.CheckBoxGroup', 'core.button.PrintByCondition', 'core.button.CreateBill', 'core.button.TurnGoodsOut', 'core.button.PrintMT', 'core.button.CatchBatchByOrder',
- 'core.button.CatchBatchByClient', 'core.button.CatchBatchByCust','core.button.TurnPaIn'
- ],
- init: function() {
- var me = this;
- var grid = Ext.getCmp('grid');
- me.FormUtil = Ext.create('erp.util.FormUtil');
- me.GridUtil = Ext.create('erp.util.GridUtil');
- me.BaseUtil = Ext.create('erp.util.BaseUtil');
- this.control({
- 'erpCreateBillButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_statuscode'),
- url = "";;
- if (status && status.value != 'POSTED') {
- btn.hide();
- }
- if (caller == 'ProdInOut!Sale' || caller == 'ProdInOut!SaleReturn') {
- me.BaseUtil.getSetting('sys', 'autoCreateArBill', function(bool) {
- if (!bool) {
- btn.hide();
- }
- });
- }
- if (caller == 'ProdInOut!PurcCheckin' || caller == 'ProdInOut!PurcCheckout' || caller == 'ProdInOut!OutesideCheckReturn' || caller == 'ProdInOut!OutsideCheckIn' || caller == 'ProdInOut!GoodsOut' || caller == 'ProdInOut!GoodsIn') {
- me.BaseUtil.getSetting('sys', 'autoCreateApBill', function(bool) {
- if (!bool) {
- btn.hide();
- }
- });
- }
- },
- click: function(btn) {
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/createBill.action',
- params: {
- caller: caller,
- id: Ext.getCmp('pi_id').value
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res) {
- if (res.exceptionInfo) {
- showMessage('提示', res.exceptionInfo);
- } else {
- if (res.log == null || res.log == '')
- showMessage('提示', '产生形式发票成功');
- }
- } else {
- showMessage('提示', '产生形式发票失败');
- }
- }
- });
- }
- },
- 'erpCatchBatchButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_statuscode');
- if (status && status.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/catchBatch.action',
- params: {
- caller: caller,
- id: Ext.getCmp('pi_id').value
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res) {
- if (res.exceptionInfo) {
- showMessage('提示', res.exceptionInfo);
- } else {
- if (res.log == null || res.log == '')
- showMessage('提示', '抓取成功');
- var grid=Ext.getCmp('grid');
- me.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: gridCondition
- });
- }
- } else {
- showMessage('提示', '抓取失败');
- }
- }
- });
- }
- },
- 'erpGridPanel2': {
- afterrender: function(grid) {
- grid.plugins[0].on('beforeedit', function(args) {
- if (args.field == "pd_inqty") {
- return me.isAllowUpdateQty(args.record);
- }
- if (caller == 'ProdInOut!SaleAppropriationOut' || 'ProdInOut!OtherOut' == caller) {
- if (args.field == "pd_ordercode") {
- return me.isAllowSale(args.record);
- }
- if (args.field == "pd_plancode") {
- return me.isAllowForeCast(args.record);
- }
- }
- });
- if (caller == 'ProdInOut!SaleReturn') {
- if (Ext.getCmp('pi_sourcecode') && Ext.getCmp('pi_sourcecode').value != "") {
- grid.readOnly = true;
- }
- }
- },
- itemclick: function(selModel, record) {
- var bool = me.hasSource(selModel.ownerCt);
- if (caller == 'ProdInOut!OtherIn' || caller == 'ProdInOut!OtherPurcIn') {
- if (record.data.pd_id > 0) {
- var btn = selModel.ownerCt.down('#erpEditSubpackageButton');
- if (btn && !btn.hidden)
- btn.setDisabled(false);
- }
- }
- if (caller == 'ProdInOut!Sale' || caller == 'ProdInOut!SaleReturn') {
- if (record.data.pd_id > 0) {
- var btn = Ext.getCmp('UpdateProdInoutrateButton');
- if (btn && !btn.hidden)
- btn && btn.setDisabled(false);
- }
- }
- if (caller == 'ProdInOut!PurcCheckout') {
- if (record.data.pd_id > 0 && Ext.getCmp('pi_statuscode').value != 'POSTED' && Ext.isEmpty(record.data.pd_ordercode)) {
- var btn = selModel.ownerCt.down('#erpGetPurcPrice');
- if (btn && !btn.hidden)
- btn.setDisabled(false);
- }
- }
- if (record.data.pd_id != 0 && record.data.pd_id != null && record.data.pd_id != '') {
- var btn = Ext.getCmp('updatebgxh');
- btn && btn.setDisabled(false);
- btn = Ext.getCmp('erpSaveOrdercodeButton');
- btn && btn.setDisabled(false);
- btn = Ext.getCmp('barcodebtn');
- btn && btn.setDisabled(false);
- btn = Ext.getCmp('erpUpdateDetailWHCode');
- btn && btn.setDisabled(false);
- btn = Ext.getCmp('erpUpdateBatchCode');
- btn && btn.setDisabled(false);
- btn = Ext.getCmp('splitdetail');
- btn && btn.setDisabled(false);
- if (Ext.getCmp('pi_statuscode').value != 'POSTED' && !Ext.isEmpty(record.data.pd_pocode)) {
- btn = Ext.getCmp('catchBatchByOrder');
- btn && btn.setDisabled(false);
- }
- }
- if (!bool)
- this.GridUtil.onGridItemClick(selModel, record);
- }
- },
- /**
- * 明细分拆
- */
- '#splitdetail': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode'), poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value == 'AUDITED') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var record=btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.SplitDetail(record);
- }
- },
- '#UpdateProdInoutrateButton': {
- click: function(btn) {
- var record = btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.updatepdscaleremark(record);
- }
- },
- /**
- * 更改报关型号
- */
- '#updatebgxh': {
- click: function(btn) {
- var record = btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.Updatebgxh(record);
- }
- },
- 'erpDeleteDetailButton': {
- afterrender: function(btn) {
- btn.ownerCt.add({
- xtype: 'erpBarcodeButton'
- });
- }
- },
- 'erpUpdateRemarkButton': {
- beforerender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode'),
- poststatus = Ext.getCmp('pi_statuscode');
- if (caller == 'ProdInOut!OtherIn') {
- if (status && status.value == 'COMMITED') {
- Ext.getCmp('pi_remark').setReadOnly(false);
- } else {
- btn.hide();
- }
- }
- if (caller == 'ProdInOut!PurcCheckin') {
- if (poststatus && poststatus.value == 'POSTED') {
- Ext.getCmp('pi_remark').setReadOnly(false);
- } else {
- btn.hide();
- }
- }
- if (caller == 'ProdInOut!PurcCheckout') {
- if (status && status.value == 'AUDITED') {
- Ext.getCmp('pi_remark').setReadOnly(false);
- } else {
- btn.hide();
- }
- }
- if (caller == 'ProdInOut!OutesideCheckReturn') {
- if (status && status.value == 'AUDITED') {
- Ext.getCmp('pi_remark').setReadOnly(false);
- } else {
- btn.hide();
- }
- }
- },
- click: function(btn) {
- var remark = Ext.getCmp('pi_remark').value;
- var id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url: basePath + 'scm/sale/updateProdInOutOtherInRemark.action',
- params: {
- id: id,
- remark: remark
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- showMessage('提示', '更新备注成功!');
- window.location.reload();
- }
- }
- });
- }
- },
- 'erpBarcodeButton': {
- click: function(btn) {
- var pdid = btn.ownerCt.ownerCt.ownerCt.items.items[1].selModel.selected.items[0].data["pd_id"];
- var id = Ext.getCmp("pi_id").value;
- var formCondition1 = "pd_idIS" + pdid + " and pi_idIS'" + id + "'";
- var gridCondition1 = "bi_pdidIS" + pdid + " and bi_piidIS'" + id + "'";
- var linkCaller = '';
- //获取出入库单DS_INOROUT字段判读是出库单还是入库单
- Ext.Ajax.request({
- url: basePath + '/pm/bom/getDescription.action',
- params: {
- tablename: "documentsetup",
- field: 'ds_inorout',
- condition: "ds_name='" + Ext.getCmp("pi_class").value + "'",
- caller: caller
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- var inOrOut = res.description;
- if (inOrOut == "IN" || inOrOut == "-OUT") {
- linkCaller = "ProdInOut!BarcodeIn";
- } else if (inOrOut == "-IN" || inOrOut == "OUT") {
- linkCaller = "ProdInOut!BarcodeOut";
- }
- var win = new Ext.window.Window({
- id: 'win',
- height: '90%',
- width: '95%',
- maximizable: true,
- buttonAlign: 'center',
- layout: 'anchor',
- items: [{
- tag: 'iframe',
- frame: true,
- anchor: '100% 100%',
- layout: 'fit',
- html: '<iframe id="iframe_' + linkCaller + '" src="' + basePath + 'jsps/scm/reserve/setBarcode.jsp?_noc=1&whoami=' + linkCaller + '&formCondition=' + formCondition1 + '&gridCondition=' + gridCondition1 + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
- }],
- listeners: {
- 'beforeclose': function(view, opt) {
- var postStatus = Ext.getCmp('pi_statuscode');
- if (postStatus && postStatus.value != 'POSTED') {
- var grid = Ext.getCmp("grid");
- me.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: gridCondition
- });
- }
- }
- }
- });
- win.show();
- }
- }
- });
- },
- afterrender: function(btn) {
- btn.setDisabled(true);
- }
- },
- '#erpEditSubpackageButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode');
- if (status && status.value != 'AUDITED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var record = btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.EditSubpackage(record);
- }
- },
- '#erpGetPurcPrice': {
- click: function(btn) {
- var record = btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.getPurcPrice(record);
- }
- },
- '#erpUpdateBatchCode': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode'),
- poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value == 'ENTERING') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var record = btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.updateBatchCode(record);
- }
- },
- '#erpSaveOrdercodeButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode'),
- poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value == 'ENTERING') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var record = btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.updateOrderCode(record);
- }
- },
- 'erpTurnProdinoutReturnButton': {
- click: function(btn) {
- var id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url: basePath + 'scm/sale/turnTurnProdinoutReturn.action',
- params: {
- id: id
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if (res.log)
- showMessage('提示', res.log);
- }
- }
- });
- }
- },
- 'erpSplitButton': {
- afterrender: function(btn) {
- var poststatus = Ext.getCmp('pi_statuscode');
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- warnMsg("确定拆分单据?", function(btn) {
- if (btn == 'yes') {
- var id = Ext.getCmp('pi_id').value;
- var piclass = Ext.getCmp('pi_class').value;
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/split.action',
- params: {
- id: id,
- caller: caller,
- cls: piclass
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exceptionInfo) {
- showError(res.exceptionInfo);
- } else {
- if (res.log)
- showMessage('提示', res.log);
- }
- }
- });
- }
- });
- }
- },
- 'erpGridWinButton': {
- afterrender: function(btn) {
- var id = Ext.getCmp('pi_id').value,
- piclass = Ext.getCmp('pi_class').value,
- cal;
- if (piclass == '采购验收单') {
- cal = 'ProdChargeDetail!CGYS';
- } else if (piclass == '采购验退单') {
- cal = 'ProdChargeDetail!CGYT';
- } else if (piclass == '出货单') {
- cal = 'ProdChargeDetail!XSCH';
- } else if (piclass == '销售退货单') {
- cal = 'ProdChargeDetail!XSTH';
- }
- btn.setConfig({
- text: '费用明细',
- caller: cal,
- condition: 'pd_piid=' + id,
- paramConfig: {
- pd_piid: id
- }
- });
- },
- beforesave: function(btn) {
- var f = btn.ownerCt.ownerCt,
- p = f.down('field[name=pi_statuscode]');
- if (p && 'POSTED' == p.getValue()) {
- Ext.Msg.alert("提示", "该单据已经过账,不能修改费用明细!");
- return false;
- }
- return true;
- }
- },
- 'field[name=pi_testcolumn1]': {
- beforerender: function(field) {
- field.labelWidth = 800;
- }
- },
- 'erpSaveButton': {
- click: function(btn) {
- var form = me.getForm(btn);
- if (Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == '') {
- me.BaseUtil.getRandomNumber(caller, 2, form.codeField); //自动添加编号
- }
- me.save(btn);
- }
- },
- 'erpPrintA4Button': {
- click: function(btn) {
- var reportName = '';
- var kind = Ext.getCmp('pi_class').value;
- if (kind == '拨出单') {
- reportName = "piolist_bc4"
- } else if (kind == '出货单') {
- reportName = "sendlist"
- } else if (kind == '生产退料单') {
- reportName = "PIOLISTM_BackA4"
- } else if (kind == '生产补料单') {
- reportName = "PIOLIST_blA4"
- } else if (kind == '生产领料单') {
- reportName = "PIOLISTMA4"
- } else if (kind == '其它出库单') {
- reportName = "piolist_outA4"
- } else if (kind == '其它入库单') {
- reportName = "piolist_inA4"
- } else if (kind == '报废单') {
- reportName = "piolist_bfA4"
- }
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpUpdatePdpriceButton': {
- click: function(btn) {
- var p = Ext.getCmp('pi_statuscode');
- if (p && 'POSTED' == p.getValue()) {
- Ext.Msg.alert("提示", "该单据已经过账,不能修改费用明细!");
- return;
- }
- var id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/updatepdPrice.action',
- params: {
- id: id
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- window.location.reload();
- if (!res.bool) {
- btn.hide();
- }
- }
- });
- }
- },
- 'erpDeleteButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp(me.getForm(btn).statuscodeField),
- poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value == 'DELETED') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- me.FormUtil.onDelete({
- pu_id: Number(Ext.getCmp('pi_id').value)
- });
- }
- },
- 'erpResetbatchButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_statuscode');
- if (status && status.value != 'UNPOST') {
- btn.hide();
- }
- },
- click: function(btn) {
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/resetBatchcode.action',
- params: {
- caller: caller,
- id: Ext.getCmp('pi_id').value
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exceptionInfo) {
- showError(res.exceptionInfo);
- return;
- } else if (res.success) {
- showMessage("提示", "批号重置成功!");
- window.location.reload();
- }
- }
- });
- }
- },
- 'erpUpdateButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if (status && status.value != 'ENTERING') {
- btn.hide();
- }
- status = Ext.getCmp('pi_statuscode');
- if (status && 'POSTED' == status.value) {
- btn.hide();
- }
- },
- click: {
- lock: 2000,
- fn: function(btn) {
- var grid = Ext.getCmp('grid'),
- items = grid.store.data.items,
- c = Ext.getCmp('pi_inoutno').value;
- var piclass = Ext.getCmp('pi_class').value,
- date = Ext.getCmp('pi_date').value;
- var bool = true;
- if (caller == 'ProdInOut!PurcCheckout') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['pd_acceptqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于采购单的验收数量');
- return false;
- }
- }
- });
- }
- if (caller == 'ProdInOut!OtherPurcIn') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (Ext.Date.format(item.data['pd_vendorreplydate'], 'Ymd') < Ext.Date.format(new Date(), 'Ymd')) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '还料日期小于系统当前日期');
- return false;
- }
- }
- });
- }
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- /*item.set('pd_inoutno', c);
- item.set('pd_piclass', piclass);*/
- item.data['pd_inoutno']=c;
- item.data['pd_piclass']=piclass;
- }
- if (caller == 'ProdInOut!OtherIn' || caller == 'ProdInOut!OtherPurcIn') {
- if (item.data['pd_unitpackage'] == null || item.data['pd_unitpackage'] == '' ||
- item.data['pd_unitpackage'] == '0' || item.data['pd_unitpackage'] == 0) {
- /*item.set('pd_unitpackage', item.data['pd_inqty']);*/
- item.data['pd_unitpackage']=item.data['pd_inqty'];
- }
- }
- });
- if (caller != 'ProdInOut!AppropriationOut' && caller != 'ProdInOut!AppropriationIn') {
- var whcode = Ext.getCmp('pi_whcode'),
- whname = Ext.getCmp('pi_whname');
- if (whcode && whname) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_whcode'])) {
- /*item.set('pd_whcode', whcode.value);
- item.set('pd_whname', whname.value);*/
- item.data['pd_whcode']=whcode.value;
- item.data['pd_whname']=whname.value;
- }
- }
- });
- }
- }
- if (caller == 'ProdInOut!SaleAppropriationOut' || 'ProdInOut!OtherOut' == caller) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_plancode'])) {
- if (item.data['pd_outqty'] > item.data['pd_sfdqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售预测单数量');
- return false;
- }
- }
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['sd_qty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售单数量');
- return false;
- }
- }
- });
- }
- if (caller == 'ProdInOut!SaleAppropriationOut' || 'ProdInOut!AppropriationOut' == caller) {
- var pi_purpose = Ext.getCmp('pi_purpose'),
- pi_purposename = Ext.getCmp('pi_purposename');
- var pi_whcode = Ext.getCmp('pi_whcode'),
- pi_whname = Ext.getCmp('pi_whname');
- if (pi_whcode && pi_whname) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_whcode'])) {
- /*item.set('pd_whcode', pi_whcode.value);
- item.set('pd_whname', pi_whname.value);*/
- item.data['pd_whcode']=pi_whcode.value;
- item.data['pd_whname']=pi_whname.value;
- }
- }
- });
- }
- if (pi_purpose && pi_purposename) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_inwhcode'])) {
- /*item.set('pd_inwhcode', pi_purpose.value);
- item.set('pd_inwhname', pi_purposename.value);*/
- item.data['pd_inwhcode']=pi_purpose.value;
- item.data['pd_inwhname']=pi_purposename.value;
- }
- }
- });
- }
- }
- // 拨入单、拨出单,默认第一行的仓库
- me.setDetailWarehouse(grid);
- if (caller == 'ProdInOut!Make!Return' || caller == 'ProdInOut!OutsideReturn' || caller == 'ProdInOut!Make!Useless') {
- var firstItem = grid.store.getAt(0);
- if (firstItem) {
- var desc = firstItem.get('pd_description'),
- dc = firstItem.get('pd_departmentcode'),
- dn = firstItem.get('pd_departmentname'),
- whcode = firstItem.get('pd_whcode'),
- whname = firstItem.get('pd_whname'),
- pd_textbox = firstItem.get('pd_textbox');
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_description'])) {
- /*item.set('pd_description', desc);*/
- item.data['pd_description']=desc;
- }
- if (Ext.isEmpty(item.data['pd_departmentcode'])) {
- /*item.set('pd_departmentcode', dc);
- item.set('pd_departmentname', dn);*/
- item.data['pd_departmentcode']=dc;
- item.data['pd_departmentname']=dn;
- }
- if (Ext.isEmpty(item.data['pd_whcode'])) {
- /*item.set('pd_whcode', whcode);
- item.set('pd_whname', whname);*/
- item.data['pd_whcode']=whcode;
- item.data['pd_whname']=whname;
- }
- if (caller == 'ProdInOut!Make!Useless') {
- if (Ext.isEmpty(item.data['pd_textbox'])) {
- /*item.set('pd_textbox', pd_textbox);*/
- item.data['pd_textbox']=pd_textbox;
- }
- }
- }
- });
- }
- }
- if (bool) {
- me.FormUtil.onUpdate(me);
- }
- }
- }
- },
- 'erpAddButton': {
- click: function() {
- me.FormUtil.onAdd('add' + caller, '新增出入库单', "jsps/scm/reserve/prodInOut.jsp?whoami=" + caller);
- }
- },
- 'erpCloseButton': {
- click: function(btn) {
- me.FormUtil.beforeClose(me);
- }
- },
- 'field[name=pi_currency]': {
- beforetrigger: function(field) {
- var t = field.up('form').down('field[name=pi_date]'),
- value = t.getValue();
- if (value) {
- field.findConfig = 'cm_yearmonth=' + Ext.Date.format(value, 'Ym');
- }
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp(me.getForm(btn).statuscodeField),
- poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value != 'ENTERING') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var grid = Ext.getCmp('grid');
- var items = grid.store.data.items;
- var bool = true;
- var date = Ext.getCmp('pi_date').value;
- if (caller == 'ProdInOut!OtherIn' || caller == 'ProdInOut!OtherOut') {
- var type = Ext.getCmp('pi_type').value;
- if (type == null || type == '') {
- showError("主表类型字段未填写,不能提交!");
- return;
- }
- }
- if (caller == 'ProdInOut!PurcCheckout') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['pd_acceptqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于采购单的验收数量');
- return;
- }
- }
- });
- }
- if (caller == 'ProdInOut!OtherPurcIn') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (Ext.Date.format(item.data['pd_vendorreplydate'], 'Ymd') < Ext.Date.format(new Date(), 'Ymd')) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '还料日期小于系统当前日期');
- return;
- }
- }
- });
- }
- /*Ext.each(items, function(item){
- if(item.data[grid.necessaryField] != null && item.data[grid.necessaryField] != ''){
- if(item.data['pd_outqty'] == null || item.data['pd_outqty'] == ''){
- bool = false;
- showError("明细第" + item.data['pd_pdno'] + "行出库数量未填写,不能提交");return;
- }
- }
- });*/
- if (caller == 'ProdInOut!SaleAppropriationOut' || 'ProdInOut!OtherOut' == caller) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_plancode'])) {
- if (item.data['pd_outqty'] > item.data['pd_sfdqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售预测单数量');
- return;
- }
- }
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['sd_qty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售单数量');
- return;
- }
- }
- });
- }
- if (caller == 'ProdInOut!AppropriationOut') {
- Ext.each(items, function(item) {
- if (item.data[grid.necessaryField] != null && item.data[grid.necessaryField] != '') {
- if (Ext.getCmp('pd_outqty') && item.data['pd_outqty'] == null || item.data['pd_outqty'] == '') {
- bool = false;
- showError("明细第" + item.data['pd_pdno'] + "行出库数量未填写,不能提交");
- return;
- }
- }
- });
- }
- if (bool) {
- me.FormUtil.onSubmit(Ext.getCmp('pi_id').value);
- }
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp(me.getForm(btn).statuscodeField),
- poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value != 'COMMITED') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- me.FormUtil.onResSubmit(Ext.getCmp('pi_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp(me.getForm(btn).statuscodeField),
- poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value != 'COMMITED') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: {
- lock: 2000,
- fn: function(btn) {
- var grid = Ext.getCmp('grid');
- var items = grid.store.data.items;
- var bool = true;
- if (caller == 'ProdInOut!OtherPurcIn') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (Ext.Date.format(item.data['pd_vendorreplydate'], 'Ymd') < Ext.Date.format(new Date(), 'Ymd')) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '还料日期小于系统当前日期');
- return;
- }
- }
- });
- }
- if (caller == 'ProdInOut!SaleAppropriationOut' || 'ProdInOut!OtherOut' == caller) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_plancode'])) {
- if (item.data['pd_outqty'] > item.data['pd_sfdqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售预测单数量');
- return;
- }
- }
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['sd_qty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售单数量');
- return;
- }
- }
- });
- }
- if (bool)
- me.FormUtil.onAudit(Ext.getCmp('pi_id').value);
- }
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp(me.getForm(btn).statuscodeField),
- postStatus = Ext.getCmp('pi_statuscode');
- if ((status && status.value != 'AUDITED') || (postStatus && postStatus.value == 'POSTED')) {
- btn.hide();
- }
- },
- click: {
- lock: 2000,
- fn: function(btn) {
- me.FormUtil.onResAudit(Ext.getCmp('pi_id').value);
- }
- }
- },
- 'erpPrintButton': {
- click: function(btn) {
- me.onPrint();
- }
- },
- 'erpPrintotherinButton': { // 返修机入仓单
- click: function(btn) {
- var reportName = "piolist_otherin";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintotheroutButton': { // 返修机出仓单
- click: function(btn) {
- var reportName = "piolist_otherout";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintwithPriceButton': { // 无价打印==erpPrintButton
- click: function(btn) {
- var reportName = "sendlist_yessale_yesprice";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintBKTButton': { // 打印补客退==erpPrintButton
- click: function(btn) {
- var reportName = "sendlist_bh";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintPriceButton': { // (有价)打印,和erpPrintwithPriceButton一样,某些客户需要默认为有效
- click: function(btn) {
- var reportName = "sendlist_yessale_yesprice";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintnosaleButton': { // 无PO打印
- click: function(btn) {
- var reportName = "sendlist_nosale";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintBZTButton': {
- click: function(btn) {
- var reportName = "sale_packing";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- me.FormUtil.onwindowsPrint(Ext.getCmp('pi_id').value, reportName, condition);
- }
- },
- 'erpPrintInvoiceButton': {
- click: function(btn) {
- var reportName = "sale_invoice";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintNoCustomerButton': { // 无客户打印
- click: function(btn) {
- var reportName = "sendlist_yessale_nocustomer";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintNoPriceButton': { // 无价打印==erpPrintButton
- click: function(btn) {
- me.onPrint();
- }
- },
- 'erpPostButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_statuscode');
- if (status && status.value != 'UNPOST') {
- btn.hide();
- }
- },
- click: {
- lock: 2000,
- fn: function(btn) {
- var grid = Ext.getCmp('grid'),
- items = grid.store.data.items,
- bool = true;
- var date = Ext.getCmp('pi_date').value;
- if (caller == 'ProdInOut!OtherIn' || caller == 'ProdInOut!OtherOut') {
- var type = Ext.getCmp('pi_type').value;
- if (type == null || type == '') {
- showError("主表类型字段未填写,不能提交!");
- return;
- }
- }
- if (caller == 'ProdInOut!PurcCheckout') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['pd_acceptqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于采购单的验收数量');
- return;
- }
- }
- });
- }
- if (caller == 'ProdInOut!OtherPurcIn') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (Ext.Date.format(item.data['pd_vendorreplydate'], 'Ymd') < Ext.Date.format(new Date(), 'Ymd')) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '还料日期小于系统当前日期');
- return;
- }
- }
- });
- }
- /*Ext.each(items, function(item){
- if(item.data[grid.necessaryField] != null && item.data[grid.necessaryField] != ''){
- if(item.data['pd_outqty'] == null || item.data['pd_outqty'] == ''){
- bool = false;
- showError("明细第" + item.data['pd_pdno'] + "行出库数量未填写,不能提交");return;
- }
- }
- });*/
- if (caller == 'ProdInOut!AppropriationOut') {
- Ext.each(items, function(item) {
- if (item.data[grid.necessaryField] != null && item.data[grid.necessaryField] != '') {
- if (Ext.getCmp('pd_outqty') && item.data['pd_outqty'] == null || item.data['pd_outqty'] == '') {
- bool = false;
- showError("明细第" + item.data['pd_pdno'] + "行出库数量未填写,不能提交");
- return;
- }
- }
- });
- }
- if (caller == 'ProdInOut!SaleAppropriationOut' || 'ProdInOut!OtherOut' == caller) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_plancode'])) {
- if (item.data['pd_outqty'] > item.data['pd_sfdqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售预测单数量');
- return;
- }
- }
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['sd_qty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售单数量');
- return;
- }
- }
- });
- }
- if (bool) {
- me.FormUtil.onPost(Ext.getCmp('pi_id').value);
- }
- }
- }
- },
- 'erptecaiButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_statuscode');
- if (caller != 'ProdInOut!DefectIn' || status.value != 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var pi_id = Ext.getCmp('pi_id').value;
- me.batchdeal('ProdIN!ToProdOtherOut!Deal', ' pd_piid=' + Ext.getCmp('pi_id').value + ' and nvl(pd_yqty,0) < nvl(pd_inqty,0) + nvl(pd_outqty,0)', 'scm/reserve/erptecai.action');
- //之前是判断单据状态 现在取消 需要根据明细数量来确定是否可以特采
- /*Ext.Ajax.request({
- url: basePath + 'scm/reserve/erptecai.action',
- params: {
- caller: caller,
- id: pi_id
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if(rs.log)
- showMessage('提示', rs.log);
- }
- }
- });*/
- }
- },
- 'erpResPostButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_statuscode');
- if (status && status.value != 'POSTED') {
- btn.hide();
- }
- },
- click: {
- lock: 2000,
- fn: function(btn) {
- me.FormUtil.onResPost(Ext.getCmp('pi_id').value);
- }
- }
- },
- 'erpTurnProdinoutIn': {
- afterrender: function(btn) {
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if (caller == 'ProdInOut!OtherOut' && status.value != 'AUDITED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/turnProdinoutIn.action',
- params: {
- id: id
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if (rs.log)
- showMessage('提示', rs.log);
- }
- }
- });
- }
- },
- 'erpSetMMQTYButton': {
- click: function(btn) {
- warnMsg("确认本次发料数为当前维护的实际可发数?", function(btn) {
- if (btn == 'yes') {
- me.FormUtil.setLoading(true); //loading...
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/SetMMQTY.action',
- params: {
- id: Ext.getCmp('pi_id').value,
- caller: caller
- },
- method: 'post',
- callback: function(opt, s, r) {
- me.FormUtil.setLoading(false);
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if (rs.log)
- showMessage('提示', rs.log);
- }
- window.location.reload();
- }
- });
- }
- });
- }
- },
- 'dbfindtrigger[name=pd_ordercode]': {
- focus: function(t) {
- t.setHideTrigger(false);
- t.setReadOnly(false);
- if (Ext.getCmp('pi_cardcode')) {
- var code = Ext.getCmp('pi_cardcode').value;
- if (code != null && code != '') {
- var obj = me.getCodeCondition();
- if (obj && obj.field) {
- t.dbBaseCondition = obj.field + "='" + code + "'";
- }
- }
- }
- if (caller == 'ProdInOut!OutReturn') { //借货归还单
- var code = Ext.getCmp('pi_cardcode').value;
- if (code != null && code != '') {
- if (t.dbBaseCondition == null || t.dbBaseCondition == '') {
- t.dbBaseCondition = "pi_cardcode='" + code + "'";
- } else {
- t.dbBaseCondition = t.dbBaseCondition + " and pi_cardcode='" + code + "'";
- }
- }
- }
- },
- aftertrigger: function(t) {
- if (Ext.getCmp('pi_cardcode')) {
- var obj = me.getCodeCondition();
- if (obj && obj.fields) {
- me.FormUtil.getFieldsValue(obj.tablename, obj.fields, obj.myfield + "='" + t.value + "'", obj.tFields);
- }
- }
- }
- },
- 'dbfindtrigger[name=pd_orderdetno]': {
- focus: function(t) {
- t.setHideTrigger(false);
- t.setReadOnly(false); //用disable()可以,但enable()无效
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var code = record.data['pd_ordercode'];
- if (code == null || code == '') {
- showError("请先选择关联单号!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- var field = me.getBaseCondition();
- if (field) {
- t.dbBaseCondition = field + "='" + code + "'";
- }
- }
- }
- },
- 'multidbfindtrigger[name=pd_orderdetno]': {
- focus: function(t) {
- t.setHideTrigger(false);
- t.setReadOnly(false); //用disable()可以,但enable()无效
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var code = record.data['pd_ordercode'];
- if (code == null || code == '') {
- showError("请先选择关联单号!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- var field = me.getBaseCondition();
- if (field) {
- t.dbBaseCondition = field + "='" + code + "'";
- }
- }
- }
- },
- 'dbfindtrigger[name=pd_batchcode1]': {
- afterrender: function(t) {
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var pr = record.data['pd_prodcode'],
- wh = record.data['pd_whcode'];
- if (pr == null || pr == '') {
- showError("请先选择料号!");
- return;
- }
- console.log(wh);
- if (wh == null || wh == '') {
- if (Ext.getCmp('pi_whcode')) {
- wh = Ext.getCmp('pi_whcode').value;
- if (wh == null || wh == '') {
- showError("请先选择仓库!");
- return;
- }
- }
- }
- t.dbBaseCondition = "ba_whcode='" + wh + "' AND ba_prodcode='" + pr + "'";
- }
- },
- 'dbfindtrigger[name=pd_batchcode]': {
- focus: function(t) {
- t.setHideTrigger(false);
- t.setReadOnly(false); //用disable()可以,但enable()无效
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var pr = record.data['pd_prodcode'];
- if (pr == null || pr == '') {
- showError("请先选择料号!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- var code = record.data['pd_whcode'];
- if (code == null || code == '') {
- if (Ext.getCmp('pi_whcode')) {
- code = Ext.getCmp('pi_whcode').value;
- if (code == null || code == '') {
- showError("请先选择仓库!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- t.dbBaseCondition = "ba_whcode='" + code + "' AND ba_prodcode='" + pr + "'";
- }
- } else {
- t.dbBaseCondition = "ba_prodcode='" + pr + "'";
- }
- } else {
- t.dbBaseCondition = "ba_whcode='" + code + "' AND ba_prodcode='" + pr + "'";
- }
- }
- }
- },
- 'multidbfindtrigger[name=pd_batchcode]': {
- focus: function(t) {
- t.setHideTrigger(false);
- t.setReadOnly(false); //用disable()可以,但enable()无效
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var pr = record.data['pd_prodcode'];
- if (pr == null || pr == '') {
- showError("请先选择料号!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- var code = record.data['pd_whcode'];
- if (code == null || code == '') {
- if (Ext.getCmp('pi_whcode')) {
- code = Ext.getCmp('pi_whcode').value;
- if (code == null || code == '') {
- showError("请先选择仓库!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- t.dbBaseCondition = "ba_whcode='" + code + "' AND ba_prodcode='" + pr + "'";
- }
- } else {
- t.dbBaseCondition = "ba_prodcode='" + pr + "'";
- }
- } else {
- t.dbBaseCondition = "ba_whcode='" + code + "' AND ba_prodcode='" + pr + "'";
- }
- }
- }
- },
- /*'field[name=pi_whcode]': {
- aftertrigger: function(f){
- if(f.value != null && f.value != ''){
- var grid = Ext.getCmp('grid');
- var whname = Ext.getCmp('pi_whname');
- Ext.Array.each(grid.store.data.items, function(item){
- if(item.data['pd_whcode'] == null || item.data['pd_whcode'] == ''){
- item.set('pd_whcode', f.value);
- item.set('pd_whname', whname.value);
- }
- });
- }
- }
- },
- 'field[name=pi_purpose]': {
- aftertrigger: function(f){
- if(f.value != null && f.value != ''){
- var grid = Ext.getCmp('grid');
- var posename = Ext.getCmp('pi_purposename');
- Ext.Array.each(grid.store.data.items, function(item){
- if(item.data['pd_inwhcode'] == null || item.data['pd_inwhcode'] == ''){
- item.set('pd_inwhcode', f.value);
- if(posename){
- item.set('pd_inwhname', posename.value);
- }
- }
- });
- }
- }
- },*/
- 'dbfindtrigger[name=pi_paymentcode]': {
- afterrender: function(trigger) {
- if (trigger.fieldConfig == 'PT') {
- trigger.dbKey = 'pi_cardcode';
- if (caller == 'ProdInOut!Sale' || caller == 'ProdInOut!SaleReturn' || caller == 'ProdInOut!SaleBorrow') {
- trigger.mappingKey = 'cu_code';
- trigger.dbMessage = '请先选客户编号!';
- }
- }
- }
- },
- 'dbfindtrigger[name=pi_address]': {
- afterrender: function(trigger) {
- if (trigger.fieldConfig == 'PT') {
- trigger.dbKey = 'pi_cardcode';
- if (caller == 'ProdInOut!Sale' || caller == 'ProdInOut!SaleReturn' || caller == 'ProdInOut!SaleBorrow') {
- trigger.mappingKey = 'cu_code';
- trigger.dbMessage = '请先选客户编号!';
- }
- }
- }
- },
- 'dbfindtrigger[name=pi_custcode2]': {
- afterrender: function(trigger) {
- trigger.dbKey = 'pi_cardcode';
- trigger.mappingKey = 'cu_code';
- trigger.dbMessage = '请先选客户编号!';
- }
- },
- 'dbfindtrigger[name=pi_invoiceremark]': {
- afterrender: function(trigger) {
- trigger.dbKey = 'pi_cardcode';
- trigger.mappingKey = 'cu_code';
- trigger.dbMessage = '请先选客户编号!';
- }
- },
- 'dbfindtrigger[name=pi_packingremark]': {
- afterrender: function(trigger) {
- trigger.dbKey = 'pi_cardcode';
- trigger.mappingKey = 'cu_code';
- trigger.dbMessage = '请先选客户编号!';
- }
- },
- /* 'dbfindtrigger[name=pi_receivecode]': {
- afterrender:function(trigger){
- if (caller == 'ProdInOut!Sale') {
- trigger.dbKey='pi_cardcode';
- trigger.mappingKey='cu_code';
- trigger.dbMessage='请先选客户编号!';
- }
- }
- },*/ //万利达收货客户可以随意改成其他客户
- 'erpGetPriceButton': {
- click: function() {
- }
- },
- //转其它出库单
- 'erpTurnOtherOutButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp("pi_statuscode");
- if (status && status.value != 'POSTED') {
- btn.hide();
- }
- },
- click: function(m) {
- me.batchdeal('ProdIN!ToProdOtherOut!Deal', ' pd_piid=' + Ext.getCmp('pi_id').value + ' and nvl(pd_yqty,0) < nvl(pd_inqty,0) + nvl(pd_outqty,0)', 'scm/reserve/turnDefectOut.action?type=ProdInOut!OtherOut');
- }
- },
- '#erpUpdateDetailWHCode': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode'),
- poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value == 'ENTERING') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var record = btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- this.UpdateDetailWHCode(record);
- }
- },
- //转出货单
- 'erpTurnProdOutButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp("pi_statuscode");
- if (status && status.value != 'POSTED') {
- btn.hide();
- }
- },
- click: function(m) {
- me.batchdeal('ProdIN!ToProdOut!Deal', ' pd_piid=' + Ext.getCmp('pi_id').value + ' and nvl(pd_yqty,0) < nvl(pd_inqty,0) + nvl(pd_outqty,0)', 'scm/reserve/turnDefectOut.action?type=ProdInOut!Sale');
- }
- },
- //转换货出库单
- 'erpTurnExOutButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp("pi_statuscode");
- if (status && status.value != 'POSTED') {
- btn.hide();
- }
- },
- click: function(m) {
- me.batchdeal('ProdInOut!ToExchangeOut!Deal', ' pd_piid=' + Ext.getCmp('pi_id').value + ' and nvl(pd_yqty,0) < nvl(pd_inqty,0) + nvl(pd_outqty,0)', 'scm/reserve/turnDefectOut.action?type=ProdInOut!ExchangeOut');
- }
- },
- //转借货归还单
- 'erpTurnOutReturnButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp("pi_statuscode");
- if (status && status.value != 'POSTED') {
- btn.hide();
- }
- },
- click: function(m) {
- me.batchdeal('ProdIN!ToProdOutReturn!Deal', ' pd_piid=' + Ext.getCmp('pi_id').value + ' and nvl(pd_yqty,0) < nvl(pd_inqty,0) + nvl(pd_outqty,0)', 'scm/reserve/turnDefectIn.action?type=ProdInOut!OutReturn');
- }
- },
- //转用品退仓单
- 'erpTurnGoodsOutButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp("pi_statuscode");
- if (status && status.value != 'POSTED') {
- btn.hide();
- }
- },
- click: function(m) {
- me.batchdeal('ProdIN!ToProdOutGoodsOut!Deal', ' pd_piid=' + Ext.getCmp('pi_id').value + ' and nvl(pd_yqty,0) < nvl(pd_inqty,0) + nvl(pd_outqty,0)', 'scm/reserve/turnDefectIn.action?type=ProdInOut!GoodsShutout');
- }
- },
- 'erpTurnMrbButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp("pi_statuscode");
- if (status && status.value != 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- me.batchdeal('ProdIO!ToMRB!Deal', 'pd_piid=' + Ext.getCmp('pi_id').value + ' AND nvl(pd_yqty,0)<nvl(pd_inqty,0) + nvl(pd_outqty,0)', 'scm/reserve/turnMRB.action');
- }
- },
- 'erpSubpackageButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode');
- if (status && status.value != 'AUDITED') {
- btn.hide();
- }
- },
- click: function(btn) {
- warnMsg("确定分装?", function(btn) {
- if (btn == 'yes') {
- me.FormUtil.setLoading(true); //loading...
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/Subpackage.action',
- params: {
- id: Ext.getCmp('pi_id').value
- },
- method: 'post',
- callback: function(opt, s, r) {
- me.FormUtil.setLoading(false);
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if (rs.log)
- showMessage('提示', rs.log);
- }
- }
- });
- }
- });
- }
- },
- 'erpClearSubpackageButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode');
- if (status && status.value != 'AUDITED') {
- btn.hide();
- }
- },
- click: function(btn) {
- warnMsg("确定清除分装?", function(btn) {
- if (btn == 'yes') {
- me.FormUtil.setLoading(true); //loading...
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/ClearSubpackage.action',
- params: {
- id: Ext.getCmp('pi_id').value
- },
- method: 'post',
- callback: function(opt, s, r) {
- me.FormUtil.setLoading(false);
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if (rs.log)
- showMessage('提示', rs.log);
- }
- }
- });
- }
- });
- }
- },
- 'erpPrintBarButton': {
- click: function(btn) {
- var reportName = "bar_53";
- var condition = '{ProdIODetailBar.pdb_inoutno}=' + "'" + Ext.getCmp('pi_inoutno').value + "'";
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpUpdateInfoButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('pi_invostatuscode'),
- poststatus = Ext.getCmp('pi_statuscode');
- if (status && status.value == 'ENTERING') {
- btn.hide();
- }
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var me = this,
- win = Ext.getCmp('borrowCargoType-win');
- if (!win) {
- var type = Ext.getCmp('pi_outtype'),
- remark = Ext.getCmp('pi_remark'),
- val1 = type ? type.value : '',
- val2 = remark ? remark.value : '';
- win = Ext.create('Ext.Window', {
- id: 'borrowCargoType-win',
- title: '更新借货出货单 ' + Ext.getCmp('pi_inoutno').value + ' 的借货类型',
- height: 200,
- width: 400,
- items: [{
- xtype: 'form',
- height: '100%',
- width: '100%',
- bodyStyle: 'background:#f1f2f5;',
- items: [{
- margin: '10 0 0 0',
- xtype: 'dbfindtrigger',
- fieldLabel: '借货类型',
- name: 'pi_outtype',
- allowBlank: false,
- value: val1
- }, {
- margin: '3 0 0 0',
- xtype: 'textfield',
- name: 'pi_remark',
- fieldLabel: '备注',
- value: val2
- }],
- closeAction: 'hide',
- buttonAlign: 'center',
- layout: {
- type: 'vbox',
- align: 'center'
- },
- buttons: [{
- text: $I18N.common.button.erpConfirmButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- var form = btn.ownerCt.ownerCt,
- a = form.down('dbfindtrigger[name=pi_outtype]'),
- b = form.down('textfield[name=pi_remark]');
- if (form.getForm().isDirty()) {
- me.updateInfo(Ext.getCmp('pi_id').value, a.value, b.value);
- }
- }
- }, {
- text: $I18N.common.button.erpCloseButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- btn.up('window').hide();
- }
- }]
- }]
- });
- }
- win.show();
- }
- },
- 'erpZxbzsBarcodeButton': { //按最小包装数生成条码
- afterrender: function(btn) {
- var poststatus = Ext.getCmp('pi_statuscode');
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- warnMsg("确定生成?", function(btn) {
- if (btn == 'yes') {
- me.FormUtil.setLoading(true); //loading...
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/GenerateBarcodeByZxbzs.action',
- params: {
- pi_id: Ext.getCmp('pi_id').value,
- pi_class: Ext.getCmp("pi_class").value,
- caller: caller
- },
- method: 'post',
- callback: function(opt, s, r) {
- me.FormUtil.setLoading(false);
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- Ext.MessageBox.alert('系统提示', '按最小包装数批量生成条码成功!');
- }
- }
- });
- }
- });
- }
- },
- 'erpPrintAllButton': {
- afterrender: function(btn) {
- btn.setText('打印全部条码');
- },
- click: function(btn) {
- var lps_barcaller = 'ProdIO!BarPrintAll';
- var win = new Ext.window.Window({
- id: 'win',
- maximizable: true,
- buttonAlign: 'center',
- layout: 'anchor',
- title: '打印模板选择',
- modal: true,
- items: [{
- tag: 'iframe',
- frame: true,
- anchor: '100% 100%',
- layout: 'fit',
- html: '<iframe id="iframe_' + caller + '" src="' + basePath + 'jsps/scm/reserve/selPrintTemplate.jsp?whoami=' + lps_barcaller + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
- }]
- });
- win.show();
- }
- },
- 'erpCatchBatchByOrderButton': {
- click: function(btn) {
- var grid = btn.ownerCt.ownerCt;
- var record = grid.getSelectionModel().getLastSelected();
- var id = Ext.getCmp("pi_id").value;
- //选择明细行按订单抓取批号
- Ext.Ajax.request({
- url: basePath + '/scm/reserve/catchBatchByOrder.action',
- params: {
- pd_id: record.data.pd_id,
- pd_piid: record.data.pd_piid,
- caller: caller
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exceptionInfo) {
- showError(res.exceptionInfo);
- } else if (res.success) {
- showMessage('提示', '按订单号抓取批次成功!', 1000);
- me.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: "pd_piid=" + id
- });
- }
- }
- });
- },
- afterrender: function(btn) {
- btn.setDisabled(true);
- }
- },
- 'erpCatchBatchByClientButton': {
- afterrender: function(btn) {
- var poststatus = Ext.getCmp('pi_statuscode');
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var grid = Ext.getCmp('grid');
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/catchBatchByClient.action',
- params: {
- type : 'ByClient',
- pi_id: Ext.getCmp('pi_id').value,
- caller: caller
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res) {
- if (res.exceptionInfo) {
- showMessage('提示', res.exceptionInfo);
- } else {
- if (res.log == null || res.log == ''){
- grid.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: gridCondition
- });
- showMessage('提示', '按委托方抓取成功');
- }
- }
- } else {
- showMessage('提示', '按委托方抓取失败');
- }
- }
- });
- }
- },
- 'erpCatchBatchByCustButton': {
- afterrender: function(btn) {
- var poststatus = Ext.getCmp('pi_statuscode');
- if (poststatus && poststatus.value == 'POSTED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var grid = Ext.getCmp('grid');
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/catchBatchByClient.action',
- params: {
- type : 'ByCust',
- pi_id: Ext.getCmp('pi_id').value,
- caller: caller
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res) {
- if (res.exceptionInfo) {
- showMessage('提示', res.exceptionInfo);
- } else {
- if (res.log == null || res.log == ''){
- grid.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: gridCondition
- });
- showMessage('提示', '按客户抓取成功');
- }
- }
- } else {
- showMessage('提示', '按客户抓取失败');
- }
- }
- });
- }
- },
- 'erpTurnPaInButton': {
- afterrender: function(btn) {
- var pi_invoicecode = Ext.getCmp('pi_invoicecode'), pi_packingcode = Ext.getCmp('pi_packingcode'),
- pi_invostatuscode = Ext.getCmp('pi_invoicecode'), pi_class = Ext.getCmp('pi_class').value;
- if(pi_class !='销售退货单' && pi_class !='出货单'){
- btn.hide();
- }
- if (pi_invoicecode && !Ext.isEmpty(pi_invoicecode.value)) {
- btn.hide();
- }
- if (pi_packingcode && !Ext.isEmpty(pi_packingcode.value)) {
- btn.hide();
- }
- if (pi_class =='销售退货单' && pi_invostatuscode.value !='AUDITED') {
- btn.hide();
- }
- },
- click: function(btn) {
- var grid = Ext.getCmp('grid');
- warnMsg("确定要生成发票箱单吗?", function(btn){
- if(btn == 'yes'){
- me.FormUtil.getActiveTab().setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/turnPackInvo.action',
- params: {
- id: Ext.getCmp('pi_id').value,
- caller: caller
- },
- method : 'post',
- callback : function(options,success,response){
- me.FormUtil.getActiveTab().setLoading(false);
- var localJson = new Ext.decode(response.responseText);
- if(localJson.exceptionInfo){
- showError(localJson.exceptionInfo);
- }
- if(localJson.success){
- showMessage("localJson", localJson.log);
- }
- }
- });
- }
- });
- }
- }
- });
- },
- getForm: function(btn) {
- return btn.ownerCt.ownerCt;
- },
- save: function(btn) {
- var me = this;
- var bool = true;
- var form = me.getForm(btn);
- if (Ext.getCmp('Fin_Code')) {
- Ext.getCmp('Fin_Code').setValue(Ext.getCmp(form.codeField).value); //流水号
- }
- var grid = Ext.getCmp('grid'),
- items = grid.store.data.items,
- c = Ext.getCmp('pi_inoutno').value;
- var piclass = Ext.getCmp('pi_class').value,
- date = Ext.getCmp('pi_date').value;
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- /* item.set('pd_inoutno', c);
- item.set('pd_piclass', piclass);*/
- item.data['pd_inoutno']=c;
- item.data['pd_piclass']=piclass;
- }
- });
- if (caller == 'ProdInOut!OtherPurcIn') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (Ext.Date.format(item.data['pd_vendorreplydate'], 'Ymd') < Ext.Date.format(new Date(), 'Ymd')) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '还料日期小于系统当前日期');
- return false;
- }
- }
- });
- }
- if (caller == 'ProdInOut!PurcCheckout') {
- Ext.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['pd_acceptqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于采购单的验收数量');
- return false;
- }
- }
- });
- }
- if (caller == 'ProdInOut!AppropriationOut') {
- var recorder = Ext.getCmp('pi_recordman');
- if (recorder) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_seller'])) {
- /*item.set('pd_seller', recorder.value);*/
- item.data['pd_seller']=recorder.value;
- }
- }
- });
- }
- }
- if (caller != 'ProdInOut!AppropriationOut' && caller != 'ProdInOut!AppropriationIn') {
- var whcode = Ext.getCmp('pi_whcode'),
- whname = Ext.getCmp('pi_whname');
- if (whcode && whname) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_whcode'])) {
- /* item.set('pd_whcode', whcode.value);
- item.set('pd_whname', whname.value);*/
- item.data['pd_whcode']=whcode.value;
- item.data['pd_whname']=whname.value;
- }
- if (caller == 'ProdInOut!OtherIn' || caller == 'ProdInOut!OtherPurcIn') {
- if (item.data['pd_unitpackage'] == null || item.data['pd_unitpackage'] == '' ||
- item.data['pd_unitpackage'] == '0' || item.data['pd_unitpackage'] == 0) {
- /*item.set('pd_unitpackage', item.data['pd_inqty']);*/
- item.data['pd_unitpackage']=item.data['pd_inqty'];
- }
- }
- }
- });
- }
- }
- if (caller == 'ProdInOut!SaleAppropriationOut' || 'ProdInOut!OtherOut' == caller) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_plancode'])) {
- if (item.data['pd_outqty'] > item.data['pd_sfdqty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售预测单数量');
- return false;
- }
- }
- if (!Ext.isEmpty(item.data['pd_ordercode'])) {
- if (item.data['pd_outqty'] > item.data['sd_qty']) {
- bool = false;
- showError('明细表第' + item.data['pd_pdno'] + '数量大于销售单数量');
- return false;
- }
- }
- });
- }
- if (caller == 'ProdInOut!SaleAppropriationOut' || 'ProdInOut!AppropriationOut' == caller) {
- var pi_purpose = Ext.getCmp('pi_purpose'),
- pi_purposename = Ext.getCmp('pi_purposename');
- var pi_whcode = Ext.getCmp('pi_whcode'),
- pi_whname = Ext.getCmp('pi_whname');
- if (pi_whcode && pi_whname) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_whcode'])) {
- /*item.set('pd_whcode', pi_whcode.value);
- item.set('pd_whname', pi_whname.value);*/
- item.data['pd_whcode']=pi_whcode.value;
- item.data['pd_whname']=pi_whname.value;
- }
- }
- });
- }
- if (pi_purpose && pi_purposename) {
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_inwhcode'])) {
- /*item.set('pd_inwhcode', pi_purpose.value);
- item.set('pd_inwhname', pi_purposename.value);*/
- item.data['pd_inwhcode']=pi_purpose.value;
- item.data['pd_inwhname']=pi_purposename.value;
- }
- }
- });
- }
- }
- // 拨入单、拨出单,默认第一行的仓库
- me.setDetailWarehouse(grid);
- if (caller == 'ProdInOut!Make!Return' || caller == 'ProdInOut!OutsideReturn' || caller == 'ProdInOut!Make!Useless') {
- var firstItem = grid.store.getAt(0);
- if (firstItem) {
- var desc = firstItem.get('pd_description'),
- dc = firstItem.get('pd_departmentcode'),
- dn = firstItem.get('pd_departmentname'),
- whcode = firstItem.get('pd_whcode'),
- whname = firstItem.get('pd_whname'),
- pd_textbox = firstItem.get('pd_textbox');
- Ext.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- if (Ext.isEmpty(item.data['pd_description'])) {
- /*item.set('pd_description', desc);*/
- item.data['pd_description']=desc;
-
- }
- if (Ext.isEmpty(item.data['pd_departmentcode'])) {
- /*item.set('pd_departmentcode', dc);
- item.set('pd_departmentname', dn);*/
- item.data['pd_departmentcode']=dc;
- item.data['pd_departmentname']=dn;
- }
- if (Ext.isEmpty(item.data['pd_whcode'])) {
- /* item.set('pd_whcode', whcode);
- item.set('pd_whname', whname);*/
- item.data['pd_whcode']=whcode;
- item.data['pd_whname']=whname
- }
- if (caller == 'ProdInOut!Make!Useless') {
- if (Ext.isEmpty(item.data['pd_textbox'])) {
- /*item.set('pd_textbox', pd_textbox);*/
- item.data['pd_textbox']=pd_textbox;
- }
- }
- }
- });
- }
- }
- if (bool)
- me.FormUtil.beforeSave(me);
- },
- setDetailWarehouse: function(grid) {
- var me = this;
- if ('ProdInOut!AppropriationIn' == caller || 'ProdInOut!AppropriationOut' == caller || 'ProdInOut!SaleAppropriationOut' == caller) {
- var firstItem = grid.store.getAt(0);
- if (firstItem) {
- var whcode = firstItem.get('pd_whcode'),
- whname = firstItem.get('pd_whname'),
- inwhcode = firstItem.get('pd_inwhcode'),
- inwhname = firstItem.get('pd_inwhname');
- grid.store.each(function() {
- if (!me.GridUtil.isBlank(grid, this.data)) {
- if (!Ext.isEmpty(this.get('pd_prodcode'))) {
- if (Ext.isEmpty(this.get('pd_whcode'))) {
- this.set('pd_whcode', whcode);
- this.set('pd_whname', whname);
- }
- if (Ext.isEmpty(this.get('pd_inwhcode'))) {
- this.set('pd_inwhcode', inwhcode);
- this.set('pd_inwhname', inwhname);
- }
- }
- }
- });
- }
- }
- },
- /**
- *修改明细仓库
- * */
- UpdateDetailWHCode: function(record) {
- var me = this;
- var win = Ext.create('Ext.window.Window', {
- width: 430,
- height: 250,
- closeAction: 'destroy',
- title: '<h1>修改仓库信息</h1>',
- layout: {
- type: 'vbox'
- },
- items: [{
- margin: '5 0 0 5',
- xtype: 'dbfindtrigger',
- fieldLabel: '仓库编号',
- name: 'whcode',
- value: record.data.pd_whcode,
- id: 'whcode'
- }, {
- margin: '5 0 0 5',
- xtype: 'textfield',
- fieldLabel: '仓库名称',
- name: 'whname',
- value: record.data.pd_whname,
- id: 'whname'
- }, {
- margin: '5 0 0 5',
- xtype: 'checkbox',
- fieldLabel: '是否修改所有明细',
- labelWidth: 120,
- name: 'isalldetail',
- id: 'isalldetail'
- }],
- buttonAlign: 'center',
- buttons: [{
- xtype: 'button',
- text: '保存',
- width: 60,
- iconCls: 'x-button-icon-save',
- handler: function(btn) {
- var w = btn.up('window');
- me.saveWhInfo(w);
- win.close();
- win.destroy();
- }
- }, {
- xtype: 'button',
- columnWidth: 0.1,
- text: '关闭',
- width: 60,
- iconCls: 'x-button-icon-close',
- margin: '0 0 0 10',
- handler: function(btn) {
- var win = btn.up('window');
- win.close();
- win.destroy();
- }
- }]
- });
- win.show();
- },
- saveWhInfo: function(w) {
- var whcode = w.down('field[name=whcode]').getValue();
- var isalldetail = w.down('field[name=isalldetail]').getValue();
- grid = Ext.getCmp('grid'),
- record = grid.getSelectionModel().getLastSelected();
- if (!whcode) {
- showError('请先设置仓库信息!');
- return;
- } else {
- var dd = {
- whcode: whcode,
- whname: w.down('field[name=whname]').getValue(),
- pd_id: record.data.pd_id,
- isalldetail: isalldetail
- };
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/updateWhCodeInfo.action',
- params: {
- data: unescape(Ext.JSON.encode(dd)),
- caller: caller
- },
- method: 'post',
- callback: function(opt, s, res) {
- var r = new Ext.decode(res.responseText);
- if (r.success) {
- grid.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: gridCondition
- });
- showMessage('提示', '更新成功!', 1000);
- } else if (r.exceptionInfo) {
- showError(r.exceptionInfo);
- } else {
- saveFailure();
- }
- }
- });
- }
- },
- /**
- * pd_orderdetno的限制条件
- */
- getBaseCondition: function() {
- var field = null;
- switch (caller) {
- case 'ProdInOut!PurcCheckin': //采购验收单
- field = "pd_code";
- break;
- case 'ProdInOut!PurcCheckout': //采购验退单
- field = "pd_code";
- break;
- case 'ProdInOut!Sale': //出货单
- field = "sd_code";
- break;
- case 'ProdInOut!Make!Return': //生产退料单
- field = "mm_code";
- break;
- case 'ProdInOut!Make!Give': //生产补料单
- field = "mm_code";
- break;
- case 'ProdInOut!Picking': //生产领料单
- field = "mm_code";
- break;
- case 'ProdInOut!Make!Consume': //生产耗料单
- field = "mm_code";
- break;
- case 'ProdInOut!Make!Useless': //生产报废单
- field = "mm_code";
- break;
- case 'ProdInOut!SaleAppropriationOut': //销售拨出单
- field = "sd_code";
- break;
- case 'ProdInOut!SaleReturn': //销售退货单
- field = "sd_code";
- break;
- case 'ProdInOut!OtherOut': //其它出库单
- field = "sd_code";
- break;
- case 'ProdInOut!OutsidePicking': //委外领料单
- field = "ma_code";
- break;
- case 'ProdInOut!OutsideReturn': //委外退料单
- field = "mm_code";
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- field = "pd_code";
- break;
- case 'ProdInOut!DefectOut': //不良品入库单
- field = "pd_code";
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- field = "mm_code";
- break;
- case 'ProdInOut!OSMake!Give': //委外补料单
- field = "mm_code";
- break;
- case 'ProdInOut!SampleSale': //样品出货单
- field = "sd_code";
- break;
- case 'ProdInOut!SampleMake!Give': //工程补料单
- field = "mm_code";
- break;
- case 'ProdInOut!SamplePicking': //工程领料单
- field = "mm_code";
- break;
- case 'ProdInOut!PurcCheckin!PLM': //研发采购验收单
- field = "pd_code";
- break;
- case 'ProdInOut!PurcCheckout!PLM': //研发采购验退单
- field = "pd_code";
- break;
- case 'ProdInOut!PartitionStockIn': //拆件入库单
- field = "mm_code";
- break;
- }
- return field;
- },
- /**
- * pd_ordercode的限制条件
- */
- updatepdscaleremark: function(record) {
- var win = Ext.create('Ext.Window', {
- id: 'win',
- title: '发货比例信息维护',
- height: 300,
- width: 400,
- items: [{
- margin: '3 0 0 0',
- id: 'pd_scaleremark',
- xtype: 'textfield',
- fieldLabel: '比例备注',
- name: 'pd_scaleremark',
- value: record.data.pd_scaleremark
- }],
- closeAction: 'hide',
- buttonAlign: 'center',
- layout: {
- type: 'vbox',
- align: 'center'
- },
- buttons: [{
- text: '保存信息',
- cls: 'x-btn-blue',
- handler: function(btn) {
- var id = record.data.pd_id;
- Ext.Ajax.request({
- url: basePath + 'scm/sale/updatepdscaleremark.action',
- params: {
- id: id,
- field: 'pd_id',
- data: Ext.getCmp('pd_scaleremark').value
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showMessage('提示', rs.exceptionInfo.replace('AFTERSUCCESS', ''));
- } else {
- saveSuccess(function() {
- window.location.reload();
- });
- }
- }
- });
- }
- }, {
- text: '保存全部',
- cls: 'x-btn-blue',
- handler: function(btn) {
- var id = record.data.pd_piid;
- Ext.Ajax.request({
- url: basePath + 'scm/sale/updatepdscaleremark.action',
- params: {
- id: id,
- field: 'pd_piid',
- data: Ext.getCmp('pd_scaleremark').value
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showMessage('提示', rs.exceptionInfo.replace('AFTERSUCCESS', ''));
- } else {
- saveSuccess(function() {
- window.location.reload();
- });
- }
- }
- });
- }
- }, {
- text: $I18N.common.button.erpCloseButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- btn.ownerCt.ownerCt.hide();
- }
- }]
- });
- win.show();
- },
- getCodeCondition: function() {
- var field = null;
- var fields = '';
- var tablename = '';
- var myfield = '';
- var tFields = '';
- switch (caller) {
- case 'ProdInOut!PurcCheckin': //采购验收单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_paymentcode,pi_transport,pi_paydate,pi_receivecode,pi_receivename';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_paymentscode,pu_transport,pu_suredate,pu_receivecode,pu_receivename';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!PurcCheckout': //采购验退单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_paymentcode,pi_transport,pi_paydate,pi_receivecode,pi_receivename';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_paymentscode,pu_transport,pu_suredate,pu_receivecode,pu_receivename';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!Sale': //出货单
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_paymentcode,pi_transport,pi_sellercode,pi_belongs,pi_receivecode,pi_receivename,pi_transport';
- fields = 'sa_custid,sa_custcode,sa_custname,sa_currency,sa_rate,sa_payments,sa_paymentscode,sa_transport,sa_sellercode,sa_seller,sa_shcustcode,sa_shcustname,sa_transport';
- tablename = 'Sale';
- myfield = 'sa_code';
- field = "sa_custcode";
- break;
- case 'ProdInOut!AppropriationIn': //拨入单
- tFields = 'pi_cardcode,pi_title';
- fields = 'ma_custcode,ma_custname';
- tablename = 'Make';
- myfield = 'ma_code';
- field = "ma_custcode";
- break;
- case 'ProdInOut!SaleAppropriationOut': //销售拨出单
- tFields = 'pi_cardid,pi_cardcode,pi_title';
- fields = 'sa_custid,sa_custcode,sa_custname';
- tablename = 'Sale';
- myfield = 'sa_code';
- field = "sa_custcode";
- break;
- case 'ProdInOut!SaleReturn': //销售退货单
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_paymentcode,pi_payment,pi_transport,pi_sellercode,pi_belongs,pi_receivecode,pi_receivename,pi_transport';
- fields = 'sa_custid,sa_custcode,sa_custname,sa_currency,sa_rate,sa_paymentscode,sa_payments,sa_transport,sa_sellercode,sa_seller,sa_shcustcode,sa_shcustname,sa_transport';
- tablename = 'Sale';
- myfield = 'sa_code';
- field = "sa_custcode";
- break;
- case 'ProdInOut!AppropriationOut': //拨出单
- tFields = 'pi_cardcode,pi_title';
- fields = 'ma_custcode,ma_custname';
- tablename = 'Make';
- myfield = 'ma_code';
- field = "ma_custcode";
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!DefectOut': //不良品出库单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!OutsidePicking': //委外领料单
- field = "ma_vendcode";
- tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
- fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
- tablename = 'Make';
- myfield = 'ma_code';
- break;
- case 'ProdInOut!OutsideReturn': //委外退料单
- field = "ma_vendcode";
- tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
- fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
- tablename = 'Make';
- myfield = 'ma_code';
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- field = "ma_vendcode";
- tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
- fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
- tablename = 'Make';
- myfield = 'ma_code';
- break;
- case 'ProdInOut!OutesideCheckReturn': //委外验退单
- field = "ma_vendcode";
- tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname,pi_currency,pi_rate';
- fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname,ma_currency,ma_rate';
- tablename = 'Make';
- myfield = 'ma_code';
- break;
- case 'ProdInOut!OutReturn': //借货归还单
- tFields = 'pi_sellercode,pi_belongs,pi_cop,pi_shr,pi_expresscode,pi_emcode,pi_emname,pi_address';
- fields = 'pi_emcode,pi_emname,pi_cop,pi_shr,pi_expresscode,pi_emcode,pi_emname,pi_address';
- tablename = 'ProdInOut';
- myfield = 'pi_inoutno';
- break;
- case 'ProdInOut!PurcCheckin!PLM': //研发采购验收单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate,pi_receivecode,pi_receivename';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate,pu_receivecode,pu_receivename';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!PurcCheckout!PLM': //研发采购验退单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate,pi_receivecode,pi_receivename';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate,pu_receivecode,pu_receivename';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!ExchangeOut': //换货出库单
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_sellercode,pi_belongs,pi_receivecode,pi_receivename,pi_transport';
- fields = 'sa_custid,sa_custcode,sa_custname,sa_currency,sa_rate,sa_payments,sa_transport,sa_sellercode,sa_seller,sa_shcustcode,sa_shcustname,sa_transport';
- tablename = 'Sale';
- myfield = 'sa_code';
- field = "sa_custcode";
- break;
- case 'ProdInOut!GoodsOut': //用品验退单
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_payment,pi_receivecode,pi_receivename,pi_paymentcode';
- fields = 've_id,ve_code,ve_name,ve_payment,ve_apvendcode,ve_apvendname,ve_paymentcode';
- tablename = 'Vendor left join Oapurchase on op_vecode=ve_code';
- myfield = 'op_code';
- field = "op_vecode";
- break;
- }
- var obj = new Object();
- obj.field = field;
- obj.fields = fields;
- obj.tFields = tFields;
- obj.tablename = tablename;
- obj.myfield = myfield;
- return obj;
- },
- /**
- * 有来源不能新增明细
- */
- hasSource: function(grid) {
- var bool = false,
- field = null;
- switch (caller) {
- // case 'ProdInOut!Sale'://出货单
- // field = 'pd_snid';
- // break;
- case 'ProdInOut!PurcCheckin': //采购验收单
- field = 'pd_qcid';
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- field = 'pd_qcid';
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- field = 'pd_qcid';
- break;
- }
- if (field != null) {
- var s = null;
- grid.store.each(function(item) {
- s = item.get(field);
- if (s != null && s != '' && s > 0) {
- bool = true;
- return;
- }
- });
- }
- return bool;
- },
- isAllowUpdateQty: function(record) {
- var bool = true;
- switch (caller) {
- case 'ProdInOut!PurcCheckin': //采购验收单
- if (record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- if (record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- if (record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!Make!In': //完工入库单
- if (record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- }
- return bool;
- },
- onPrint: function() {
- var me = this,
- whichKind = Ext.getCmp('pi_class').value;
- var reportName = '';
- if (whichKind == "出货单") {
- reportName = "sendlist_yessale";
- } else if (whichKind == "无订单出货单") {
- reportName = "sendlist_nosale";
- } else if (whichKind == "不良品入库单") {
- //console.log("fds");
- reportName = "pio_notokin";
- } else if (whichKind == "不良品出库单") {
- reportName = "pio_notokout";
- } else if (whichKind == "其它采购入库单") {
- reportName = "piolist_opin";
- } else if (whichKind == "其它采购出库单") {
- reportName = "piolist_opout";
- } else if (whichKind == "拨入单") {
- reportName = "piolist_br";
- } else if (whichKind == "拨出单") {
- reportName = "piolist_bc";
- } else if (whichKind == "其它入库单") {
- reportName = "piolist_in";
- } else if (whichKind == "其它出库单") {
- reportName = "piolist_out";
- } else if (whichKind == "报废单") {
- reportName = "piolist_bf";
- } else if (whichKind == "换货入库单") {
- reportName = "pio_changein";
- } else if (whichKind == "换货出库单") {
- reportName = "pio_changeout";
- } else if (whichKind == "销售退货单") {
- reportName = "retulist";
- } else if (whichKind == "采购验收单") {
- reportName = "acclist";
- } else if (whichKind == "采购验退单") {
- reportName = "piolist_yt";
- } else if (whichKind == "销售拨入单") {
- reportName = "piolist";
- } else if (whichKind == "销售拨出单") {
- reportName = "piolist_salebc";
- } else if (whichKind == "生产领料单") {
- reportName = "PIOLISTM";
- } else if (whichKind == "生产退料单") {
- reportName = "PIOLISTM_Back";
- } else if (whichKind == "完工入库单") {
- reportName = "finish";
- } else if (whichKind == "结余退料单") {
- reportName = "PIOLISTM_JY";
- } else if (whichKind == "拆件入库单") {
- reportName = "chaijian";
- } else if (whichKind == "生产补料单") {
- reportName = "PIOLIST_bl";
- } else if (whichKind == "生产耗料单") {
- reportName = "PIOLISTM_HL";
- } else if (whichKind == "委外领料单") {
- reportName = "Expiolist";
- } else if (whichKind == "委外退料单") {
- reportName = "PIOLIST_wwtl";
- } else if (whichKind == "委外验收单") {
- reportName = "EXPLIST_ys";
- } else if (whichKind == "委外验退单") {
- reportName = "EXPLIST_yt";
- } else if (whichKind == "生产报废单") {
- reportName = "MakeScrap";
- } else if (whichKind == "无订单退货单") {
- reportName = "retulist_nosale";
- } else if (whichKind == "委外补料单") {
- reportName = "Expiolist";
- } else if (whichKind == "盘盈调整单") {
- reportName = "piolist_tz";
- } else if (whichKind == "盘亏调整单") {
- reportName = "piolist_tz";
- } else if (whichKind == "辅料入库单") {
- reportName = "piolist_flr";
- } else if (whichKind == "辅料出库单") {
- reportName = "piolist_flc";
- } else if (whichKind == "研发领料单") {
- reportName = "piolist_yfll";
- } else if (whichKind == "研发退料单") {
- reportName = "piolist_yftl";
- } else if (whichKind == "借货出货单") {
- reportName = "sendlist_jh";
- } else if (whichKind == "借货归还单") {
- reportName = "sendlist_jhgh";
- } else if (whichKind == "用品验收单") {
- reportName = "piolist_ypys";
- } else if (whichKind == "用品验退单") {
- reportName = "piolist_ypyt";
- } else if (whichKind == "用品领用单") {
- reportName = "piolist_yply";
- } else if (whichKind == "用品借用单") {
- reportName = "piolist_ypjy";
- } else if (whichKind == "用品归还单") {
- reportName = "piolist_ypgh";
- } else if (whichKind == "用品退仓单") {
- reportName = "piolist_ypgh";
- }
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint2(id, reportName, condition, function() {
- if (whichKind == '生产退料单' || whichKind == '拆件入库单' || whichKind == '拆件完工入库单')
- window.location.reload();
- });
- },
- /**
- *编辑分装明细
- **/
- EditSubpackage: function(record) {
- var width = Ext.isIE ? screen.width * 0.7 * 0.9 : '80%',
- height = Ext.isIE ? screen.height * 0.75 : '100%';
- var pd_id = record.get('pd_id');
- Ext.create('Ext.Window', {
- width: width,
- height: height,
- autoShow: true,
- layout: 'anchor',
- items: [{
- tag: 'iframe',
- frame: true,
- anchor: '100% 100%',
- layout: 'fit',
- html: '<iframe id="iframe_dbfind" src="' + basePath + 'jsps/scm/reserve/prodIODetail.jsp?formCondition=pd_id=' +
- pd_id + '&gridCondition=pdb_pdid=' + pd_id + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
- }]
- });
- },
- loadOnHandQty: function(grid, id) {
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/loadOnHandQty.action',
- params: {
- caller: caller,
- id: id
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showMessage('提示', rs.exceptionInfo.replace('AFTERSUCCESS', ''));
- } else {
- var data = [];
- if (!rs.data || rs.data.length == 2) {
- grid.GridUtil.add10EmptyData(grid.detno, data);
- grid.GridUtil.add10EmptyData(grid.detno, data);
- } else {
- data = Ext.decode(rs.data.replace(/,}/g, '}').replace(/,]/g, ']'));
- }
- grid.store.loadData(data);
- }
- }
- });
- },
- Updatebgxh: function(record) {
- var win = this.bgxhwindow;
- if (!win) {
- win = this.getBgxhWindow();
- }
- win.show();
- },
- getBgxhWindow: function() {
- var me = this;
- return Ext.create('Ext.window.Window', {
- width: 330,
- height: 180,
- closeAction: 'hide',
- cls: 'custom-blue',
- title: '<h1>更改报关型号</h1>',
- layout: {
- type: 'vbox'
- },
- items: [{
- margin: '5 0 0 5',
- xtype: 'textfield',
- fieldLabel: '报关型号',
- name: 'pd_bgxh',
- id: 'pd_bgxh'
- }, {
- margin: '5 0 0 5',
- xtype: 'fieldcontainer',
- fieldLabel: '全部更新',
- combineErrors: false,
- defaults: {
- hideLabel: true
- },
- layout: {
- type: 'column',
- defaultMargins: {
- top: 0,
- right: 5,
- bottom: 0,
- left: 0
- }
- },
- items: [{
- xtype: 'checkbox',
- columnidth: 0.4,
- fieldLabel: '全部更新',
- name: 'allupdate',
- id: 'allupdate'
- }, {
- xtype: 'displayfield',
- fieldStyle: 'color:red',
- columnidth: 0.6,
- value: ' *更改当前所有明细'
- }]
- }],
- buttonAlign: 'center',
- buttons: [{
- xtype: 'button',
- text: '保存',
- width: 60,
- iconCls: 'x-button-icon-save',
- handler: function(btn) {
- var w = btn.up('window');
- me.saveBgxh(w);
- w.hide();
- }
- }, {
- xtype: 'button',
- columnWidth: 0.1,
- text: '关闭',
- width: 60,
- iconCls: 'x-button-icon-close',
- margin: '0 0 0 10',
- handler: function(btn) {
- btn.up('window').hide();
- }
- }]
- });
- },
- saveBgxh: function(w) {
- var pd_bgxh = w.down('field[name=pd_bgxh]').getValue(),
- grid = Ext.getCmp('grid'),
- record = grid.getSelectionModel().getLastSelected();
- if (!pd_bgxh) {
- showError('请先设置报关型号.');
- return;
- } else {
- var allupdate = w.down('field[name=allupdate]').getValue();
- var dd = {
- pd_id: record.data.pd_id,
- pd_piid: record.data.pd_piid,
- pd_bgxh: pd_bgxh ? pd_bgxh : null,
- allupdate: allupdate ? 1 : 0,
- caller: caller
- };
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/updatebgxh.action',
- params: {
- _noc: 1,
- data: unescape(Ext.JSON.encode(dd))
- },
- method: 'post',
- callback: function(opt, s, res) {
- var r = new Ext.decode(res.responseText);
- if (r.success) {
- grid.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: 'pd_piid=' + record.data.pd_piid
- });
- showMessage('提示', '更新成功!', 1000);
- } else if (r.exceptionInfo) {
- showError(r.exceptionInfo);
- } else {
- saveFailure();
- }
- }
- });
- }
- },
- getPurcPrice: function(record) {
- warnMsg("确定要获取采购单价吗?", function(btn) {
- if (btn == 'yes') {
- var pdid = record.data.pd_id,
- prod = record.data.pd_prodcode,
- piid = record.data.pd_piid,
- vend = Ext.getCmp('pi_cardcode').value,
- curr = Ext.getCmp('pi_currency').value,
- grid = Ext.getCmp('grid');
- if (Ext.isEmpty(vend)) {
- showError('请先选择供应商!');
- return;
- }
- if (Ext.isEmpty(curr)) {
- showError('请先选择币别!');
- return;
- }
- if (Ext.isEmpty(prod)) {
- showError('请先选择物料!');
- return;
- }
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/getPrice.action',
- params: {
- pdid: pdid,
- piid: piid,
- caller: caller
- },
- method: 'post',
- callback: function(opt, s, res) {
- var r = new Ext.decode(res.responseText);
- if (r.success) {
- grid.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: 'pd_piid=' + piid
- });
- showMessage('提示', '更新成功!', 1000);
- } else if (r.exceptionInfo) {
- showError(r.exceptionInfo);
- } else {
- saveFailure();
- }
- }
- });
- }
- });
- },
- updateOrderCode: function(record) {
- var win = this.orderwindow;
- if (!win) {
- win = this.getOrderWindow(record);
- }
- win.show();
- },
- getOrderWindow: function(record) {
- var me = this;
- return Ext.create('Ext.window.Window', {
- width: 330,
- height: 250,
- closeAction: 'hide',
- cls: 'custom-blue',
- title: '<h1>更改关联单号</h1>',
- layout: {
- type: 'vbox'
- },
- items: [{
- margin: '5 0 0 5',
- xtype: 'dbfindtrigger',
- fieldLabel: '关联单号',
- value: record.data.pd_ordercode,
- name: 'pd_ordercode',
- id: 'pd_ordercode'
- }, {
- margin: '5 0 0 5',
- xtype: 'textfield',
- fieldLabel: '关联序号',
- value: record.data.pd_orderdetno,
- name: 'pd_orderdetno',
- id: 'pd_orderdetno',
- readOnly: true
- }, {
- margin: '5 0 0 5',
- xtype: 'textfield',
- fieldLabel: '物料编号',
- value: record.data.pd_prodcode,
- name: 'pd_prodcode',
- id: 'pd_prodcode',
- readOnly: true
- }, {
- margin: '5 0 0 5',
- xtype: 'textfield',
- fieldLabel: '采购单价',
- value: record.data.pd_orderprice,
- name: 'pd_orderprice',
- id: 'pd_orderprice'
- }, {
- margin: '5 0 0 5',
- xtype: 'textfield',
- fieldLabel: '税率%',
- value: record.data.pd_taxrate,
- name: 'pd_taxrate',
- id: 'pd_taxrate'
- }],
- buttonAlign: 'center',
- buttons: [{
- xtype: 'button',
- text: '保存',
- width: 60,
- iconCls: 'x-button-icon-save',
- handler: function(btn) {
- var w = btn.up('window');
- me.saveOrder(w);
- w.hide();
- }
- }, {
- xtype: 'button',
- columnWidth: 0.1,
- text: '关闭',
- width: 60,
- iconCls: 'x-button-icon-close',
- margin: '0 0 0 10',
- handler: function(btn) {
- btn.up('window').hide();
- }
- }]
- });
- },
- saveOrder: function(w) {
- var pd_ordercode = w.down('field[name=pd_ordercode]').getValue(),
- pd_orderdetno = w.down('field[name=pd_orderdetno]').getValue(),
- pd_prodcode = w.down('field[name=pd_prodcode]').getValue(),
- pd_orderprice = w.down('field[name=pd_orderprice]').getValue(),
- pd_taxrate = w.down('field[name=pd_taxrate]').getValue(),
- grid = Ext.getCmp('grid'),
- record = grid.getSelectionModel().getLastSelected();
- if (!pd_ordercode) {
- showError('请先选择关联单号!');
- return;
- } else {
- var dd = {
- pd_id: record.data.pd_id,
- pd_piid: record.data.pd_piid,
- pd_ordercode: pd_ordercode ? pd_ordercode : null,
- pd_orderdetno: pd_orderdetno ? pd_orderdetno : 0,
- pd_prodcode: pd_prodcode,
- pd_orderprice: pd_orderprice ? pd_orderprice : 0,
- pd_taxrate: pd_taxrate ? pd_taxrate : 0,
- caller: caller
- };
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/updateOrderCode.action',
- params: {
- _noc: 1,
- data: unescape(Ext.JSON.encode(dd))
- },
- method: 'post',
- callback: function(opt, s, res) {
- var r = new Ext.decode(res.responseText);
- if (r.success) {
- grid.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: 'pd_piid=' + record.data.pd_piid
- });
- showMessage('提示', '更新成功!', 1000);
- } else if (r.exceptionInfo) {
- showError(r.exceptionInfo);
- } else {
- saveFailure();
- }
- }
- });
- }
- },
- updateBatchCode: function(record) {
- var me = this;
- var win = Ext.create('Ext.window.Window', {
- width: 430,
- height: 250,
- closeAction: 'destroy',
- title: '<h1>修改批号信息</h1>',
- layout: {
- type: 'vbox'
- },
- items: [{
- margin: '5 0 0 5',
- xtype: 'dbfindtrigger',
- fieldLabel: '批号',
- value: record.data.pd_batchcode,
- name: 'pd_batchcode1',
- id: 'pd_batchcode1'
- }, {
- margin: '5 0 0 5',
- xtype: 'textfield',
- fieldLabel: '批号ID',
- value: record.data.pd_batchid,
- name: 'pd_batchid',
- id: 'pd_batchid',
- readOnly: true
- }],
- buttonAlign: 'center',
- buttons: [{
- xtype: 'button',
- text: '保存',
- width: 60,
- iconCls: 'x-button-icon-save',
- handler: function(btn) {
- var w = btn.up('window');
- me.saveBatch(w);
- w.hide();
- }
- }, {
- xtype: 'button',
- columnWidth: 0.1,
- text: '关闭',
- width: 60,
- iconCls: 'x-button-icon-close',
- margin: '0 0 0 10',
- handler: function(btn) {
- btn.up('window').hide();
- }
- }]
- });
- win.show();
- },
- saveBatch: function(w) {
- var pd_batchcode = w.down('field[name=pd_batchcode1]').getValue(),
- pd_batchid = w.down('field[name=pd_batchid]').getValue(),
- grid = Ext.getCmp('grid'),
- record = grid.getSelectionModel().getLastSelected();
- if (!pd_batchcode) {
- showError('请先选择批号!');
- return;
- } else {
- var dd = {
- pd_id: record.data.pd_id,
- pd_piid: record.data.pd_piid,
- pd_batchcode: pd_batchcode ? pd_batchcode : null,
- pd_batchid: pd_batchid ? pd_batchid : 0,
- caller: caller
- };
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/updateBatchCode.action',
- params: {
- _noc: 1,
- data: unescape(Ext.JSON.encode(dd))
- },
- method: 'post',
- callback: function(opt, s, res) {
- var r = new Ext.decode(res.responseText);
- if (r.success) {
- grid.GridUtil.loadNewStore(grid, {
- caller: caller,
- condition: 'pd_piid=' + record.data.pd_piid
- });
- showMessage('提示', '更新成功!', 1000);
- } else if (r.exceptionInfo) {
- showError(r.exceptionInfo);
- } else {
- saveFailure();
- }
- }
- });
- }
- },
- batchdeal: function(nCaller, condition, url) {
- var win = new Ext.window.Window({
- id: 'win',
- height: "100%",
- width: "80%",
- maximizable: true,
- buttonAlign: 'center',
- layout: 'anchor',
- items: [{
- tag: 'iframe',
- frame: true,
- anchor: '100% 100%',
- layout: 'fit',
- html: '<iframe id="iframe_' + caller + '" src="' + basePath + 'jsps/common/editorColumn.jsp?caller=' + nCaller +
- "&condition=" + condition + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
- }],
- buttons: [{
- name: 'confirm',
- text: $I18N.common.button.erpConfirmButton,
- iconCls: 'x-button-icon-confirm',
- cls: 'x-btn-gray',
- listeners: {
- buffer: 500,
- click: function(btn) {
- var grid = Ext.getCmp('win').items.items[0].body.dom.getElementsByTagName('iframe')[0].contentWindow.Ext.getCmp("editorColumnGridPanel");
- btn.setDisabled(true);
- grid.updateAction(url);
- }
- }
- }, {
- text: $I18N.common.button.erpCloseButton,
- iconCls: 'x-button-icon-close',
- cls: 'x-btn-gray',
- handler: function() {
- Ext.getCmp('win').close();
- }
- }]
- });
- win.show();
- },
- updateInfo: function(id, val1, val2) {
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/updateBorrowCargoType.action',
- params: {
- id: id,
- type: val1,
- remark: val2
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- Ext.Msg.alert("提示", "更新成功!");
- window.location.reload();
- }
- }
- });
- },
- isAllowSale: function(record) {
- var bool = true;
- if (!Ext.isEmpty(record.get('pd_plancode'))) bool = false;
- return bool;
- },
- isAllowForeCast: function(record) {
- var bool = true;
- if (!Ext.isEmpty(record.get('pd_ordercode'))) bool = false;
- return bool;
- },
- /**
- *明细拆分
- * */
- SplitDetail:function(record){
- var width = Ext.isIE ? screen.width * 0.7 * 0.9 : '80%',
- height = Ext.isIE ? screen.height * 0.75 : '100%';
- var pd_id = record.get('pd_id');
- Ext.create('Ext.Window', {
- width: width,
- height: height,
- autoShow: true,
- layout: 'anchor',
- items: [{
- tag: 'iframe',
- frame: true,
- anchor: '100% 100%',
- layout: 'fit',
- html: '<iframe id="iframe_dbfind" src="' + basePath + 'jsps/scm/reserve/splitProdIODetail.jsp?formCondition=pd_id=' +
- pd_id + '&gridCondition=pd_id=' + pd_id + '&whoami=' +caller+ '-Detail&_noc=1" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
- }]
- });
- }
- });
|