Browse Source

修改app.js,修改条码维护功能

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1828 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
aof 10 years ago
parent
commit
0a942cb461
1 changed files with 35 additions and 25 deletions
  1. 35 25
      src/main/webapp/resources/js/index/app.js

+ 35 - 25
src/main/webapp/resources/js/index/app.js

@@ -2046,11 +2046,16 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		
 	}]);
 	
+	/**
+	 * 发货单(包括发货条码维护)
+	 */
 	app.controller('SaleSendDetailCtrl', ['$scope', '$stateParams', 'SaleSend', 'toaster', 'ReportService', function($scope, $stateParams, SaleSend, toaster, ReportService){
 		var loading = true;
+		$scope.checkBarCode = [];
+		$scope.checkBoxCode = [];
 		var vm = $scope.vm = {};
 		vm.editBar = false;
-		vm.boxCode = false;
+		vm.showBarCode = false;
 		$scope.barCode = function() {
 			vm.editBar = !vm.editBar;
 		}
@@ -2059,18 +2064,18 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		};
 		$scope.checkbars = {
 				checked : false
-			};
+		};
 		// 点击勾选barCode全部的复选框
-		$scope.checkBarAll = function(data){
-			angular.forEach(data, function(item) {
-				item.checkBarCode = $scope.checkbars.checked;
+		$scope.checkBarAll = function(){
+			angular.forEach($scope.checkBarCode, function(item,key) {
+				$scope.checkBarCode[key] = $scope.checkbars.checked;
 			});
 		};
 		//点击barCode单选
-		$scope.checkBarOne = function(data) {
+		$scope.checkBarOne = function() {
 			var result = true;
-			angular.forEach(data, function(item) {
-				if(item.checkBarCode != true){
+			angular.forEach($scope.checkBarCode, function(item) {
+				if(item != true){
 					result = false;
 					return;
 				}
@@ -2078,16 +2083,16 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 			$scope.checkbars.checked = result;
 		}
 		// 点击boxCode全部的复选框
-		$scope.checkBoxAll = function(data){
-			angular.forEach(data, function(item) {
-				item.checkOutBoxCode = $scope.checkboxes.checked;
+		$scope.checkBoxAll = function(){
+			angular.forEach($scope.checkBoxCode, function(item,key) {
+				$scope.checkBoxCode[key] = $scope.checkboxes.checked;
 			});
 		};
 		//点击boxCode单选
-		$scope.checkBoxOne = function(data) {
+		$scope.checkBoxOne = function() {
 			var result = true;
-			angular.forEach(data, function(item) {
-				if(item.checkOutBoxCode != true){
+			angular.forEach($scope.checkBoxCode, function(item) {
+				if(item != true){
 					result = false;
 					return;
 				}
@@ -2095,28 +2100,28 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 			$scope.checkboxes.checked = result;
 		}
 		$scope.generateBarCode = function() {
-			console.log("生成条码");
+			
 		}
 		$scope.printBarCode = function() {
-			console.log("打印条码");
+			
 		}
 		$scope.printOutBoxCode = function() {
-			console.log("打印外箱号");
+			
 		}
 		$scope.showBarCode = function() {
-			console.log("查看条码");
+			vm.showBarCode = !vm.showBarCode;
 		}
 		/**
 		 * 更新外箱号
 		 */
-	   $scope.updateOutBox = function(item,$index) {
-		   if($scope.oldoutBoxQty[$index] == item.outBoxQty) {
-	    		toaster.pop('info', '提示', '未修改数据!');
+	   $scope.updateOutBox = function(item,number) {
+		   if($scope.oldoutBoxQty[number-1] == item.outBoxQty) {
 	    	}else {
 	    		 if(item.outBoxQty > 0) {
 	  			   if(!(item.outBoxQty % item.packageQty)) {
 	  				   SaleSend.update({id:item.id},item,function(){
 	  			    		toaster.pop('success', '提示','保存成功!');
+	  			    		loadData();
 	  		    		}, function(response){
 	  						$scope.loading = false;
 	  						toaster.pop('error', '回复失败', response.data);
@@ -2134,9 +2139,8 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		 * 更新最小包数
 		 * @TODO
 		 */
-	    $scope.updatePackage = function(item, $index) {
-	    	if(item.packageQty == $scope.oldpackageQty[$index]) {
-	    		toaster.pop('info', '提示', '未修改数据!');
+	    $scope.updatePackage = function(item, number) {
+	    	if(item.packageQty == $scope.oldpackageQty[number-1]) {
 	    	}else {
 	    		if(item.orderItem.product.minPack != 0) {
 		    		if(item.packageQty > 0) {
@@ -2183,11 +2187,18 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		var loadData = function() {
 			SaleSend.get({id: $stateParams.id}, function(data){
 				$scope.order = data;
+				var orderCount = $scope.order.sendItems.length;
 				$scope.oldpackageQty = [];
 				$scope.oldoutBoxQty = [];
 				var sum = 0;
 				vm.oldpackageQty = [];
 				angular.forEach(data.sendItems, function(value, key){
+						if($scope.checkBarCode.length <  orderCount) {
+							$scope.checkBarCode.push(false);
+						}
+						if($scope.checkBoxCode.length <  orderCount) {
+							$scope.checkBoxCode.push(false);
+						}
 					//给个初值
 					if(!value.packageQty) {
 						value.packageQty = value.orderItem.product.minPack;
@@ -3937,7 +3948,6 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		};
 		
 		$scope.print = function(order) {
-			console.log(order.id);
 			MakeOrder.printCount({id: order.id},{});//增加打印此次
 			ReportService.print(order.enUU, 'make', '{make_orders.ma_id}=' + order.id, ' 委外订单-' + order.code);
 		};