huangzt před 5 roky
rodič
revize
f91bbe1ddc
1 změnil soubory, kde provedl 36 přidání a 9 odebrání
  1. 36 9
      WebContent/app/controller/pm/mes/SMTAoi.js

+ 36 - 9
WebContent/app/controller/pm/mes/SMTAoi.js

@@ -48,6 +48,7 @@ Ext.define('erp.controller.pm.mes.SMTAoi', {
     				var items = grid.store.data.items;
     				var start = record.get('sd_startdate');
     				var end = record.get('sd_enddate');
+    				var code =  record.get('sd_workordercode');
     				//前一行
     				var row = record.index-1;
     				if(row >= 0){
@@ -55,26 +56,37 @@ Ext.define('erp.controller.pm.mes.SMTAoi', {
 	    				var s_sd1 = s_sd.split(':');
 	    				var s_ed = items[row].data['sd_enddate'];
 	    				var s_ed1 = s_ed.split(':');
-	    				if((start == "" || start == null) && (end == "" || end == null) && 
-	    				s_sd != "" && s_sd != null && s_ed != "" && s_ed != null){
+	    				if((start == "" || start == null) && (end == "" || end == null)
+	    				&& s_sd != "" && s_sd != null && s_ed != "" && s_ed != null){
     						//前一行开始时间
     						if(s_sd1[0]==22){
-    							record.set('sd_startdate',parseInt(s_sd1[0])+1+':00');
+    							record.set('sd_startdate','23:00');
 								record.set('sd_enddate','0:00');
     						}else if(s_sd1[0]==23){
     							record.set('sd_startdate','0:00');
-								record.set('sd_enddate',parseInt(s_ed1[0])+1+':00');
+								record.set('sd_enddate','1:00');
     						}else{
     							record.set('sd_startdate',parseInt(s_sd1[0])+1+':00');
-								record.set('sd_enddate',parseInt(s_ed1[0])+1+':00');
+								record.set('sd_enddate',parseInt(s_sd1[0])+2+':00');
     						}
+    						//record.set('isselect',true);
+	    				}
+	    				var s_wc = items[row].data['sd_workordercode'];
+	    				if(s_wc != "" && s_wc != null &&(code == "" || code == null)){
+	    					record.set('sd_workordercode',s_wc);
 	    				}
     				}else{
-    					//获取当前时间	或Ext.Date.format(new Date(),"H:00"
-    					record.set('sd_startdate',new Date().getHours()+":00");
-						record.set('sd_enddate',new Date().getHours()+1+":00");
+    					var a_row = record.index+1;
+    					var s_sd = items[a_row].data['sd_startdate'];
+    					var s_ed = items[a_row].data['sd_enddate'];
+    					if((s_sd == null || s_sd == "") && (s_ed == null || s_ed == "")){
+    						//获取当前时间	或Ext.Date.format(new Date(),"H:00"
+    						record.set('sd_startdate',new Date().getHours()+":00");
+							record.set('sd_enddate',new Date().getHours()+1+":00");
+    					}
     				}
     			},
+    			itemdblclick:this.dblClick,
     			itemclick: this.onGridItemClick
             },
     		'erpSaveButton': {
@@ -91,6 +103,7 @@ Ext.define('erp.controller.pm.mes.SMTAoi', {
                 	if(!isture2){
                 		return false;
                 	}
+                	var isture3 = me.checkBitNumber();
                  	var form = me.getForm(btn), codeField = Ext.getCmp(form.codeField);
  					if(codeField.value == null || codeField.value == ''){
  						me.BaseUtil.getRandomNumber(caller);//自动添加编号
@@ -124,6 +137,7 @@ Ext.define('erp.controller.pm.mes.SMTAoi', {
                 	if(!isture2){
                 		return false;
                 	}
+                	var isture3 = me.checkBitNumber();
                 	this.FormUtil.onUpdate(this);
                 }
             },
@@ -259,8 +273,18 @@ Ext.define('erp.controller.pm.mes.SMTAoi', {
 			return true;
 		}
     },
-    onGridItemClick: function(selModel, record) { 
+    checkBitNumber:function(f){
     	var grid = Ext.getCmp('grid');
+		var items = grid.store.data.items;
+		Ext.each(items, function(item,index){
+			var bitnumber = item.get('sd_bitnumber');
+			if(bitnumber){
+				item.set("sd_bitnumber",bitnumber.toUpperCase());
+			}
+		});
+	},
+	dblClick:function(selModel, record){
+		var grid = Ext.getCmp('grid');
 		var items = grid.store.data.items;
 		var row = record.index-1;
 		if(row >= 0){
@@ -269,8 +293,11 @@ Ext.define('erp.controller.pm.mes.SMTAoi', {
 			if(s_sd != "" && s_sd != null && s_ed != "" && s_ed != null){
     			record.set('sd_startdate',s_sd);
 				record.set('sd_enddate',s_ed);
+				//record.set('isselect',false);
     		}
 		}
+	},
+    onGridItemClick: function(selModel, record) { 
         this.GridUtil.onGridItemClick(selModel, record);
     }
 });