| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073 |
- 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'
- ],
- 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('提示', '抓取成功');
- 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 + 'common/getFieldData.action',
- params: {
- caller: "documentsetup",
- field: 'ds_inorout',
- condition: "ds_name='" + Ext.getCmp("pi_class").value + "'"
- },
- method: 'post',
- callback: function(options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- var inOrOut = res.data;
- 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: 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;
- }
- }
- });
- }
- 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.Array.each(items, function(item) {
- if (!Ext.isEmpty(item.data['pd_prodcode'])) {
- item.set('pd_inoutno', c);
- item.set('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']);
- }
- }
- });
- 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);
- }
- }
- });
- }
- }
- 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!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);
- }
- }
- });
- }
- 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);
- }
- }
- });
- }
- }
- // 拨入单、拨出单,默认第一行的仓库
- 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);
- }
- if (Ext.isEmpty(item.data['pd_departmentcode'])) {
- item.set('pd_departmentcode', dc);
- item.set('pd_departmentname', dn);
- }
- if (Ext.isEmpty(item.data['pd_whcode'])) {
- item.set('pd_whcode', whcode);
- item.set('pd_whname', whname);
- }
- if (caller == 'ProdInOut!Make!Useless') {
- if (Ext.isEmpty(item.data['pd_textbox'])) {
- item.set('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: 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: 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();
- }
- },
- buffer: 1000,
- click: 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: 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;
- }
- 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('提示', '按客户抓取失败');
- }
- }
- });
- }
- }
- });
- },
- 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);
- }
- });
- 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!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!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);
- }
- }
- });
- }
- }
- 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);
- }
- 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']);
- }
- }
- }
- });
- }
- }
- 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!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);
- }
- }
- });
- }
- 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);
- }
- }
- });
- }
- }
- // 拨入单、拨出单,默认第一行的仓库
- 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);
- }
- if (Ext.isEmpty(item.data['pd_departmentcode'])) {
- item.set('pd_departmentcode', dc);
- item.set('pd_departmentname', dn);
- }
- if (Ext.isEmpty(item.data['pd_whcode'])) {
- item.set('pd_whcode', whcode);
- item.set('pd_whname', whname);
- }
- if (caller == 'ProdInOut!Make!Useless') {
- if (Ext.isEmpty(item.data['pd_textbox'])) {
- item.set('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 == "不良品入库单") {
- 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>'
- }]
- });
- }
- });
|