Ext.define('erp.view.scm.reserve.setBarcode.Form',{ extend: 'Ext.form.Panel', alias: 'widget.erpSetBarcodeFormPanel', requires: ['Ext.tip.QuickTipManager','erp.view.core.button.Save','erp.view.core.button.GenerateBarcode','erp.view.core.trigger.DbfindTrigger',''], id: 'setBarcodeform', region: 'north', frame : true, layout : 'column', title:'条形码维护', columnWidth:0.33, padding: '0 4 0 4', autoScroll : true, defaultType : 'textfield', labelSeparator : ':', buttonAlign : 'center', fieldDefaults : { fieldStyle : "background:#FFFAFA;color:#515151;", labelAlign : "left", blankText : $I18N.common.form.blankText, labelWidth: 80 }, FormUtil: Ext.create('erp.util.FormUtil'), isStatic: true, initComponent : function(){ Ext.tip.QuickTipManager.init(); var me = this; Ext.apply(me, { items : [{ id : 'bi_inoutno', name : 'bi_inoutno', fieldLabel : '出入库单号', readOnly : true, columnWidth : 0.20, fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue' }, { id : 'bi_pdno', name : 'bi_pdno', fieldLabel : '行号', columnWidth : 0.10, readOnly : true, labelWidth : 40, fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue' },{ xtype:'tool', type:'prev', id: 'prev', tooltip: '上一条', margin:'4 6 0 0', listeners:{ render: function(btn){ setTimeout(function(){ if(parent.Ext) { var form = Ext.getCmp('setBarcodeform'); var bi_pdid = Ext.getCmp("bi_pdid").value; var datalistStore = form.getCurrentStore(bi_pdid); Ext.each(datalistStore, function(){ if(this.selected == true){ if(this.prev == null){ btn.disable(true); } } }); } else { btn.disable(true); } },100); }, click: function(btn){ var form = Ext.getCmp('setBarcodeform'); var newId = 0; var idx = 0; var id = Ext.getCmp("bi_piid").value; var bi_pdid = Ext.getCmp("bi_pdid").value; var datalistStore = form.getCurrentStore(bi_pdid); Ext.each(datalistStore, function(s, index){ if(s.selected == true){ if(s.prev != null){ newId = this.prev; idx = index; } } }); var formCondition = "pd_id="+newId+" and pi_id='"+id+"'"; var gridCondition = "bi_pdid="+newId+" and bi_piid='"+id+"'"; window.location.href = basePath+'jsps/scm/reserve/setBarcode.jsp?_noc=1&whoami='+caller+'&formCondition='+formCondition+'&gridCondition='+gridCondition; } } },{ xtype:'tool', type: 'next', id: 'next', tooltip: '下一条', margin:'4 8 0 6', listeners:{ render: function(btn){ setTimeout(function(){ if(parent.Ext) { var form = Ext.getCmp('setBarcodeform'); var bi_pdid = Ext.getCmp("bi_pdid").value; var datalistStore = form.getCurrentStore(bi_pdid); Ext.each(datalistStore, function(){ if(this.selected == true){ if(this.next == null){ btn.disable(true); } } }); } else { btn.disable(true); } },100); }, click: function(btn){ var form = Ext.getCmp('setBarcodeform'); var bi_pdid = Ext.getCmp("bi_pdid").value; var datalistStore = form.getCurrentStore(bi_pdid); var idx = 0; var newId = 0; var id = Ext.getCmp("bi_piid").value; Ext.each(datalistStore, function(s, index){ if(s.selected == true){ if(s.next != null){ newId = s.next; idx = index; } } }); var formCondition = "pd_id="+newId+" and pi_id='"+id+"'"; var gridCondition = "bi_pdid="+newId+" and bi_piid='"+id+"'"; window.location.href = basePath+'jsps/scm/reserve/setBarcode.jsp?_noc=1&whoami='+caller+'&formCondition='+formCondition+'&gridCondition='+gridCondition; } } } ,{ id : 'pd_ordercode', name : 'pd_ordercode', fieldLabel : '采购单号', readOnly : true, hidden : true, hideLabel : true, logic:'ignore' }, { id : 'bi_prodcode', name : 'bi_prodcode', fieldLabel : '物料编号', columnWidth : 0.20, readOnly : true, fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue' }, { id : 'bi_prodid', name : 'bi_prodid', fieldLabel : '物料ID', readOnly : true, hidden : true, hideLabel : true }, { id : 'bi_pdid', name : 'bi_pdid', fieldLabel : '出入库单行号ID', readOnly : true, hidden : true, hideLabel : true }, { id : 'bi_piid', name : 'bi_piid', fieldLabel : '出入库单ID', readOnly : true, hidden : true, hideLabel : true },{ id : 'pr_detail', name : 'pr_detail', fieldLabel : '物料名称', readOnly : true, logic:'ignore', fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue', columnWidth : 0.20 }, { id : 'pr_unit', name : 'pr_unit', fieldLabel : '单位', readOnly : true, logic:'ignore', fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue', columnWidth : 0.15 }, { id : 'pd_qty', name : 'pd_qty', fieldLabel : '来料总数', readOnly : true, logic:'ignore', fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue', columnWidth : 0.15 }, { id : 'pr_tracekind', name : 'pr_tracekind', xtype : 'combobox', fieldLabel : '管控类型', readOnly : true, fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue', columnWidth : 0.20, store: Ext.create('Ext.data.Store', { fields: ['display', 'value'], data : [ {"display": '不管控', "value": '0'}, {"display": '单件管控', "value": '1'}, {"display": '批管控', "value": '2'} ] }), displayField: 'display', valueField: 'value', editable: false }, { id : 'pi_cardcode', name : 'pi_cardcode', fieldLabel : '供应商编号', readOnly : true, fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue', columnWidth : 0.20 }, { id : 'pi_title', name : 'pi_title', fieldLabel : '供应商名称', readOnly : true, logic:'ignore', fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue', columnWidth : 0.4 }, { xtype : 'textfield', id : 'pd_inqty', name : 'pd_inqty', fieldLabel : '批总量', fieldStyle : "background:rgb(224, 224, 255);", labelStyle:"color:red;", columnWidth : 0.20 }, { id : 'pd_outqty', name : 'pd_outqty', fieldLabel : '批总量', allowBlank:false, columnWidth : 0.20 },{ xtype : 'textfield', id : 'pk_qty', name : 'pk_qty', fieldLabel : '箱内总数', columnWidth : 0.20 },{ xtype : 'textfield', id : 'pr_zxbzs', name : 'pr_zxbzs', fieldLabel : '最小包数', columnWidth : 0.20, allowBlank:false, fieldStyle : "background:rgb(224, 224, 255);", labelStyle:"color:red;" },{ xtype : 'textareatrigger', id : 'bi_bzs', name : 'bi_bzs', fieldLabel : '来料包装数', columnWidth : 0.20 }, { xtype : 'textfield', id : 'bi_vendbarcode', name : 'bi_vendbarcode', fieldLabel : '供应商批号', columnWidth : 0.22 }, { xtype : 'datefield', id : 'bi_madedate', name : 'bi_madedate', fieldLabel : '生产日期', columnWidth : 0.20 }, { xtype : 'datefield', id : 'bi_validdate', name : 'bi_validdate', fieldLabel : '有效期', columnWidth : 0.20, labelWidth : 50 }, { id : 'pl_code', xtype : 'dbfindtrigger', name : 'bi_location', fieldLabel : '仓位', fieldStyle : "background:rgb(224, 224, 255);", labelStyle:"color:red;", columnWidth : 0.15, allowBlank:false, labelWidth : 50 }], dockedItems:[{ xtype: 'toolbar', dock: 'bottom', layout: { pack: 'center' //放置位置 }, defaults: { style: { marginLeft: '10px', marginBottom:'15px' } }, items:[{ id : 'batchGenBarcode', cls : 'x-btn-gray', text : '批量生成条码', style : 'margin-left:20px', formBind : true,// form.isValid() == false时,按钮disabled width:100 },/*{ cls: 'x-btn-gray', id: 'generateBarcodebtn', text: $I18N.common.button.erpGenerateBarcodeButton, formBind : true,// form.isValid() == false时,按钮disabled style: { marginLeft: '10px' }, width: 90 },*/{ id : 'batchGenBarOBcode', cls : 'x-btn-gray', text : '批量生成条码和箱号', style : 'margin-left:20px', formBind : true,// form.isValid() == false时,按钮disabled width:150 }/*,{ xtype:'erpGeneratePaCodeButton' }*/,{ xtype:'erpPrintAllButton' },{ xtype:'erpPrintAllPackageButton' },{ id : 'save', text : '保存', width : 60, iconCls : 'x-button-icon-save', cls : 'x-btn-gray' },{ xtype:'erpDeleteAllDetailsButton' },{ xtype:'erpCloseButton' }] }] }); formCondition = getUrlParam('formCondition');// 从url解析参数 formCondition = (formCondition == null) ? "" : formCondition.replace(/IS/g,"="); this.loadStore(this,formCondition); this.callParent(arguments); }, loadStore : function(form,param){ var me = this; Ext.Ajax.request({ url : basePath + "scm/reserve/getBarFormStore.action", params: { caller: caller, condition:param }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exceptionInfo != null){ showError(res.exceptionInfo);return; } if(res.data){ var d = Ext.decode(res.data); form.getForm().setValues(d); } } }); }, getCurrentStore: function(value){ var grid = parent.Ext.getCmp('grid'); var items = grid.store.data.items; var array = new Array(); var o = null; Ext.each(items, function(item, index){ o = new Object(); o.selected = false; if(index == 0){ o.prev = null; } else { o.prev = items[index-1].data["pd_id"]; } if(index == items.length - 1){ o.next = null; } else { o.next = items[index+1].data["pd_id"]; } var v = item.data["pd_id"]; o.value = v; if(v == value) o.selected = true; array.push(o); }); return array; } });