| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807 |
- 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.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.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.TurnOtherIn', 'core.button.TurnOtherOut', 'core.button.TurnOtherPurcOut','core.button.TurnAppropriationOut','core.button.TurnCustReturnOut',
- 'core.button.ClearSubpackage','core.button.Subpackage','core.grid.YnColumn','core.button.CatchBatch','core.button.Printnosale','core.button.PrintNoCustomer',
- 'core.button.SetMMQTY','core.button.TurnSaleReturn','core.button.TurnMrb','core.button.Barcode','core.button.TurnReturnMake','core.button.SendData'
- ],
- 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({
- 'erpTurnReturnMakeButton':{//销售退货转返修工单
- 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.batchdeal('ProdInOut!SaleReturn', 'pd_piid=' + Ext.getCmp('pi_id').value,'scm/purchase/turnReturnMake.action');
- }
- },
- '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: {
- 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!SaleReturn'){
- if(Ext.getCmp('pi_sourcecode')&&Ext.getCmp('pi_sourcecode').value!=""){
- grid.readOnly = true;
- }
- }
- },
- // reconfigure: function(grid) {
- // var f = Ext.getCmp('pi_id');
- // if(caller == 'ProdInOut!OtherOut'){
- // if (f && !Ext.isEmpty(f.value)) {
- // me.loadOnHandQty(grid, f.value);
- // }
- // }
- // },
- 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(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('barcodebtn');
- btn && btn.setDisabled(false);
- }
- if(!bool)
- this.GridUtil.onGridItemClick(selModel, record);
- }
- },
- /**
- * 更改报关型号
- */
- '#updatebgxh': {
- click: function(btn) {
- var record=btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.Updatebgxh(record);
- }
- },
- 'erpBarcodeButton':{
- click: function(btn){
- var pdid=btn.ownerCt.ownerCt.ownerCt.items.items[1].selModel.selected.items[0].data["pd_id"];
- var id = Ext.getCmp("pi_id").value;
- var formCondition1="pd_idIS"+pdid+" and pi_idIS'"+id+"'";
- var gridCondition1="bi_pdidIS"+pdid+" and bi_piidIS'"+id+"'";
- var linkCaller ='';
- //获取出入库单DS_INOROUT字段判读是出库单还是入库单
- Ext.Ajax.request({
- url : basePath + '/pm/bom/getDescription.action',
- params: {
- tablename:"documentsetup" ,
- field:'ds_inorout',
- condition:"ds_name='"+Ext.getCmp("pi_class").value+"'",
- caller:caller
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- var inOrOut = res.description ;
- if(inOrOut == "IN" || inOrOut == "-OUT"){
- linkCaller = "ProdInOut!BarcodeIn";
- }else if(inOrOut == "-IN" || inOrOut == "OUT"){
- linkCaller = "ProdInOut!BarcodeOut";
- }
- var win = new Ext.window.Window({
- id : 'win',
- height : '90%',
- width : '95%',
- maximizable : true,
- buttonAlign : 'center',
- layout : 'anchor',
- items : [ {
- tag : 'iframe',
- frame : true,
- anchor : '100% 100%',
- layout : 'fit',
- html : '<iframe id="iframe_'+linkCaller+'" src="'+basePath+'jsps/scm/reserve/setBarcode.jsp?_noc=1&whoami='+linkCaller+'&formCondition='+formCondition1+'&gridCondition='+gridCondition1+'" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
- }],
- listeners:{
- 'beforeclose':function(view ,opt){
- var postStatus = Ext.getCmp('pi_statuscode');
- if(postStatus && postStatus.value != 'POSTED'){
- var grid = Ext.getCmp("grid");
- me.GridUtil.loadNewStore(grid,{
- caller:caller,
- condition:gridCondition
- });
- }
- }
- }
- });
- win.show();
- }
- }
- });
- },
- afterrender:function(btn) {
- btn.setDisabled(true);
- }
- },
- 'erpDeleteDetailButton': {
- afterrender: function(btn){
- btn.ownerCt.add({
- xtype: 'erpBarcodeButton'
- });
- if(caller=='ProdInOut!Sale'){
- btn.ownerCt.add({
- xtype:'button',
- text:'比例信息维护',
- width:120,
- iconCls: 'x-button-icon-check',
- cls: 'x-btn-gray',
- id:'UpdateProdInoutrateButton',
- style: {
- marginLeft: '10px'
- },
- handler:function(){
- var record=btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.updatepdscaleremark(record);
- }
- });
- }
- }
- },
- '#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);
- }
- },
- '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);
- }
- }
- });
- }
- },
- 'erpTurnReturnButton':{
- beforerender:function(btn){
- btn.setText('转借货归还单');
- },
- 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(){
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/turnOutReturn.action',
- params: {
- id: Ext.getCmp('pi_id').value,
- caller:caller
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo){
- showError(res.exceptionInfo);return;
- }
- if(res.log)
- showMessage('提示', res.log);
- }
- });
- }
- },
- 'erpSplitButton':{
- 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;
- btn.setConfig({
- text: '费用明细',
- caller: 'ProdChargeDetail!CGYS',
- 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;
- }
- /*aftersave:function(){
- //验收单ID
- 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();
- }
- }
- });
- }*/
- //yaozx@13-12-04
- /*aftersave:function(btn){
- var items = Ext.getCmp('grid').store.data.items;
- var totalcount,parentCount;
- var rate,pd_prcie;
- Ext.Array.each(items, function(item){
- rate = item.data['pd_rate']==0?1:item.data['pd_rate'];
- totalcount = Number(totalcount) + rate*item.data['pd_amount'];
- });
- var parentItems = parent.Ext.getCmp('grid').store.data.items;
- Ext.Array.each(parentItems, function(item){
- parentCount = Number(parentCount)+item.data['pd_inqty']*item.data['pd_orderprice']*(1+item.data['pd_taxrate']/100);
- });
- rate = parent.Ext.getCmp('pi_rate').value==0?1:Ext.getCmp('pi_rate').value;
- parentCount = Number(parentCount)*rate;
- if(Number(parentCount)>0&&Number(parentCount)>0){
- Ext.Array.each(parentItems, function(item){
- pd_prcie = item.data['pd_orderprice']*(1+item.data['pd_taxrate']/100)+Number(parentCount)/item.data['pd_inqty']*totalcount;
- item.set('pd_prcie', pd_prcie );
- });
- }
- }*/
- },
- '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 reportName = "piolist_bc4";
- 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);
- if(status && status.value == 'DELETED'){
- 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();
- }/*else{
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/checkresetBatchcode.action',
- params: {
- caller: caller
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(!res.bool){
- btn.hide();
- }
- }
- });
- }*/
- },
- click: function(btn){
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/resetBatchcode.action',
- params: {
- 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){
- Ext.Msg.alert("提示","批号重置成功!");
- }
- }
- });
- }
-
- },
- '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;
- 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);
- }
- }
- });
- }
- }
-
- // 拨入单、拨出单,默认第一行的仓库
- me.setDetailWarehouse(grid);
- if(caller == 'ProdInOut!Make!Return') {
- 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');
- 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);
- }
- }
- });
- }
- }
- 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);
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- var grid = Ext.getCmp('grid');
- var items = grid.store.data.items;
- var bool = true;
- if(caller=='ProdInOut!OtherIn'||caller=='ProdInOut!OtherOut'){
- var type = Ext.getCmp('pi_type').value;
- if(type==null||type==''){
- showError("主表类型字段未填写,不能提交!");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(bool){
- me.FormUtil.onSubmit(Ext.getCmp('pi_id').value);
- }
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'COMMITED'){
- 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);
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- 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);
- }
- },
- 'erpBannedButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onBanned(Ext.getCmp('pi_id').value);
- }
- },
- 'erpResBannedButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'BANNED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResBanned(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);
- }
- },
- '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);
- }
- },
- '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){
- 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;
- 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 + "'";
- }
- }
- }
- },
- 'dbfindtrigger[name=pd_whcode]':{
- aftertrigger: function(t){
- if(caller=='ProdInOut!AppropriationOut'||caller=='ProdInOut!Sale'||caller=='ProdInOut!AppropriationIn'){
- var inwhcode=t.value;
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var prodcode=record.data['pd_prodcode'];
- if(prodcode&&inwhcode){
- var obj = {tablename:'productWH',fields:'pw_onhand'};
- me.FormUtil.getFieldsValue(obj.tablename, obj.fields,"pw_whcode='"+inwhcode+"' AND pw_prodcode='"+prodcode+"'" , "pd_inqty",record);
- }
- }
- }
- },
- '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_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_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(){
-
- }
- },
- '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)<pd_inqty+pd_outqty','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);
- }
- },
- /**
- * 发送出货单数据
- */
- 'erpSendDataButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('pi_statuscode');
- if(status && status.value == 'POSTED' && (caller == 'ProdInOut!Sale')){
- btn.show();
- }
- },
- click: function(btn) {
- var pi_id = Ext.getCmp('pi_id').value;
- var pi_class = Ext.getCmp('pi_class').value;
- Ext.getBody().mask("waiting...");
- if (caller == 'ProdInOut!Sale') {
- Ext.Ajax.request({
- url: basePath + "scm/reserve/inOutPut/syncToSqlServer.action",
- params: {
- id: pi_id,
- caller: caller
- },
- method: 'post',
- callback: function (options, success, response) {
- Ext.getBody().unmask();
- var res = new Ext.decode(response.responseText);
- if (res.success) {
- showMessage("提示","发送完成");
- }else{
- showError(res.exceptionInfo||"发送失败");
- return;
- }
- }
- });
- }
- }
- }
- });
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- },
- save: function(btn){
- var me = this;
- 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;
- 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!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']);
- }
- }
- }
- });
- }
- }
- // 拨入单、拨出单,默认第一行的仓库
- me.setDetailWarehouse(grid);
- if(caller == 'ProdInOut!Make!Return') {
- 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');
- 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);
- }
- }
- });
- }
- }
- me.FormUtil.beforeSave(me);
- },
- setDetailWarehouse : function(grid) {
- var me = this;
- if('ProdInOut!AppropriationIn' == caller || 'ProdInOut!AppropriationOut' == 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_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);
- }
- }
- });
- }
- }
- },
- /**
- * 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_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': //采购验退单
- 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!Sale': //出货单
- 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!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_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!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;
- }
- var obj = new Object();
- obj.field = field;
- obj.fields = fields;
- obj.tFields = tFields;
- obj.tablename = tablename;
- obj.myfield = myfield;
- return obj;
- },
- /**
- * 有来源不能新增明细
- */
- hasSource: function(grid) {
- var bool = false,field = null;
- switch(caller) {
- // case 'ProdInOut!Sale'://出货单
- // field = 'pd_snid';
- // break;
- case 'ProdInOut!PurcCheckin': //采购验收单
- field = 'pd_qcid';
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- field = 'pd_qcid';
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- field = 'pd_qcid';
- break;
- }
- if(field != null) {
- var s = null;
- grid.store.each(function(item){
- s = item.get(field);
- if(s != null && s != '' && s > 0) {
- bool = true;return;
- }
- });
- }
- return bool;
- },
- isAllowUpdateQty: function(record) {
- var bool = true;
- switch(caller) {
- case 'ProdInOut!PurcCheckin': //采购验收单
- if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!Make!In': //完工入库单
- if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- }
- return bool;
- },
- onPrint : function() {
- var me = this, whichKind = Ext.getCmp('pi_class').value;
- var reportName = '';
- if(whichKind=="出货单"){
- reportName="sendlist_yessale";
- }else if(whichKind=="无订单出货单"){
- reportName="sendlist_nosale";
- }
- else if(whichKind=="不良品入库单"){
- //console.log("fds");
- reportName="pio_notokin";
- }else if(whichKind=="不良品出库单"){
- reportName="pio_notokout";
- }else if(whichKind=="其它采购入库单"){
- reportName="piolist_opin";
- }else if(whichKind=="其它采购出库单"){
- reportName="piolist_opout";
- }else if(whichKind=="拨入单"){
- reportName="piolist_br";
- }else if(whichKind=="拨出单"){
- reportName="piolist_bc";
- }else if(whichKind=="其它入库单"){
- reportName="piolist_in";
- }else if(whichKind=="其它出库单"){
- reportName="piolist_out";
- }else if(whichKind=="报废单"){
- reportName="piolist_bf";
- }else if(whichKind=="换货入库单"){
- reportName="pio_changein";
- }else if(whichKind=="换货出库单"){
- reportName="pio_changeout";
- }else if(whichKind=="销售退货单"){
- reportName="retulist";
- }else if(whichKind=="采购验收单"){
- reportName="acclist";
- }else if(whichKind=="采购验退单"){
- reportName="piolist_yt";
- }else if(whichKind=="销售拨入单"){
- reportName="piolist";
- }else if(whichKind=="销售拨出单"){
- reportName="piolist_salebc";
- }else if(whichKind=="生产领料单"){
- reportName="PIOLISTM";
- }else if(whichKind=="生产退料单"){
- reportName="PIOLISTM_Back";
- }else if(whichKind=="完工入库单"){
- reportName="finish";
- }else if(whichKind=="结余退料单"){
- reportName="PIOLISTM_JY";
- }else if(whichKind=="拆件入库单"){
- reportName="chaijian";
- }else if(whichKind=="生产补料单"){
- reportName="PIOLIST_bl";
- }else if(whichKind=="生产耗料单"){
- reportName="PIOLISTM_HL";
- }else if(whichKind=="委外领料单"){
- reportName="Expiolist";
- }else if(whichKind=="委外退料单"){
- reportName="PIOLIST_wwtl";
- }else if(whichKind=="委外验收单"){
- reportName="EXPLIST_ys";
- }else if(whichKind=="委外验退单"){
- reportName="EXPLIST_yt";
- }else if(whichKind=="生产报废单"){
- reportName="MakeScrap";
- }else if(whichKind=="无订单退货单"){
- reportName="retulist_nosale";
- }else if(whichKind=="委外补料单"){
- reportName="Expiolist";
- }else if(whichKind=="盘盈调整单"){
- reportName="piolist_tz";
- }else if(whichKind=="盘亏调整单"){
- reportName="piolist_tz";
- }else if(whichKind=="辅料入库单"){
- reportName="piolist_flr";
- }else if(whichKind=="辅料出库单"){
- reportName="piolist_flc";
- }else if(whichKind=="研发领料单"){
- reportName="piolist_yfll";
- }else if(whichKind=="研发退料单"){
- reportName="piolist_yftl";
- }else if(whichKind=="借货出货单"){
- reportName="sendlist_jh";
- }else if(whichKind=="借货归还单"){
- reportName="sendlist_jhgh";
- }
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- },
- /**
- *编辑分装明细
- **/
- 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){
- showMessage('提示', '更新成功!', 1000);
- } else if(r.exceptionInfo){
- showError(r.exceptionInfo);
- } else{
- saveFailure();
- }
- }
- });
- }
- },
- batchdeal: function(nCaller, condition, url){
- console.log('url: '+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);
- win.close();
- //window.location.reload();
- }
- }
- }, {
- text : $I18N.common.button.erpCloseButton,
- iconCls: 'x-button-icon-close',
- cls: 'x-btn-gray',
- handler : function(){
- Ext.getCmp('win').close();
- }
- }]
- });
- win.show();
- }
- });
|