| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.pm.make.Rework', {
- extend: 'Ext.app.Controller',
- FormUtil: Ext.create('erp.util.FormUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- GridUtil: Ext.create('erp.util.GridUtil'),
- views:[
- 'pm.make.Rework','core.form.Panel','core.grid.Panel2','core.toolbar.Toolbar','core.button.SNRange',
- 'core.button.Add','core.button.Save','core.button.Close','core.button.StepCollection',
- 'core.button.Submit','core.button.ResSubmit','core.button.Audit','core.button.ResAudit',
- 'core.button.Update','core.button.Delete','core.form.YnField','core.button.OnlineMake','core.button.Modify',
- 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.button.OpenMake','core.button.DecomSetting'
- ],
- init:function(){
- var me = this;
- this.control({
- 'erpGridPanel2': {
- reconfigure: function(grid){
- Ext.defer(function(){
- grid.readOnly = true;
- }, 500);
- },
- itemclick: this.onGridItemClick
- },
- 'erpSaveButton': {
- click: function(btn){
- var form = me.getForm(btn);
- if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
- me.BaseUtil.getRandomNumber();//自动添加编号
- }
- this.FormUtil.beforeSave(this);
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- this.FormUtil.beforeClose(this);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('addMakeBase', '新增单据', 'jsps/pm/make/rework.jsp?whoami=' + caller);
- }
- },
- 'erpUpdateButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpDeleteButton': {
- click: function(btn){
- me.FormUtil.onDelete(Ext.getCmp('re_id').value);
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('re_statuscode');
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onSubmit(Ext.getCmp('re_id').value);
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('re_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResSubmit(Ext.getCmp('re_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('re_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onAudit(Ext.getCmp('re_id').value);
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('re_statuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResAudit(Ext.getCmp('re_id').value);
- }
- },
- 'erpOnlineMakeButton' :{
- afterrender: function(btn){
- var status = Ext.getCmp('re_statuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.onlineMake(Ext.getCmp('re_id').value);
- }
- },
- 'erpOpenMakeButton' :{
- afterrender: function(btn){
- var status = Ext.getCmp('re_statuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.openMake(Ext.getCmp('re_id').value);
- }
- },
- 'erpDecomSettingButton':{
- /*afterrender: function(btn){
- var grid = Ext.getCmp('grid');
- var bool = true;
- var s = grid.getStore().data.items;//获取store里面的数据
- console.log(s.length);
- for(var i=0;i<s.length;i++){//将grid里面各行的数据获取并拼成jsonGridData
- var data = s[i].data;
- }
- Ext.Array.each(grid.getStore().data.items,function(item){
- if(item.data['rd_detno'] != null && item.data['rd_detno'] != '' ){
- bool = false;
- }
- });
- if(bool){
- btn.setDisabled(true);
- }
- },*/
- click: function(btn){
- var id = Ext.getCmp('re_id').value;
- var caller = 'DecomSetting';
- var grid = Ext.getCmp('grid');
- var items = grid.getStore().data.items;//获取store里面的数据
- var bool = false;
- Ext.Array.each(items,function(item){
- if(item.data['rd_sncode'] != null && item.data['rd_sncode'] != '' ){
- bool = true;
- }
- });
- if(!bool){
- showError("不存在序列号");return;
- }
- var dbwin = new Ext.window.Window({
- id : 'dcswin',
- title: '拆解部件设定',
- height: "100%",
- width: "90%",
- maximizable : true,
- buttonAlign : 'center',
- layout : 'anchor',
- items: [],
- listeners:{
- beforeclose: function(){
- window.location.reload();
- }
- }
- });
- dbwin.add({
- tag : 'iframe',
- frame : true,
- anchor : '100% 100%',
- layout : 'fit',
- html : '<iframe id="iframe_Updatebomlevel" src="'+basePath+'jsps/pm/make/decomSetting.jsp?whoami='+caller+'&formCondition=re_idIS'+id+'&gridCondition=rd_reidIS'+id+'" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
- });
- dbwin.show();
- }
- },
- 'erpSNRangeButton':{
- afterrender: function(btn){
- var status = Ext.getCmp('re_statuscode');
- if(status && status.value == 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- var id = Ext.getCmp('re_id').value;
- var dbwin = new Ext.window.Window({
- id : 'dbwin',
- title: '序列号范围',
- height: "100%",
- width: "80%",
- maximizable : true,
- buttonAlign : 'center',
- layout : 'anchor',
- items: [],
- listeners:{
- beforeclose: function(){
- window.location.reload();
- }
- }
- });
- dbwin.add({
- tag : 'iframe',
- frame : true,
- anchor : '100% 100%',
- layout : 'fit',
- html : '<iframe id="iframe_Updatebomlevel" src="'+basePath+'jsps/pm/make/snRange.jsp?whoami=SNRange&formCondition=re_idIS'+id+'&gridCondition=rd_reidIS'+id+'" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
- });
- dbwin.show();
- }
- },
- 'dbfindtrigger[name=re_craftcode]': {
- beforetrigger: function(field) {
- var t = field.up('form').down('field[name=re_prodcode]'),
- value = t.getValue();
- if(value) {
- field.findConfig = "cr_prodcode='" + value + "'";
- }
- }
- }
- });
- },
- onGridItemClick: function(selModel, record){//grid行选择
- this.GridUtil.onGridItemClick(selModel, record);
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- },
- onlineMake: function(id){
- var mm = this;
- mm.FormUtil.setLoading(true);
- Ext.Ajax.request({
- url : basePath + "pm/make/onlinemake.action",
- params: {
- id : id,
- caller : caller
- },
- method : 'post',
- callback : function(options,success,response){
- mm.FormUtil.setLoading(false);
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo != null){
- showError(res.exceptionInfo);return;
- }else{
- Ext.Msg.alert("提示","在线返工成功!",function(){
- window.location.reload();
- });
- }
- }
- });
- },
- openMake: function(id){
- var mm = this;
- mm.FormUtil.setLoading(true);
- Ext.Ajax.request({
- url : basePath + "pm/make/openmake.action",
- params: {
- id : id,
- caller : caller
- },
- method : 'post',
- callback : function(options,success,response){
- mm.FormUtil.setLoading(false);
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo != null){
- showError(res.exceptionInfo);return;
- }else if(res.log){
- showMessage("提示", res.log);
- Ext.Msg.alert("提示","开返工单成功!");
- }
- }
- });
- }
-
- });
|