Browse Source

代采更新计算方法

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9446 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 years ago
parent
commit
6ea6e2fb15

+ 14 - 0
src/main/java/com/uas/platform/b2b/controller/ProductController.java

@@ -143,6 +143,20 @@ public class ProductController {
 		return searchService.searchProductsCheckIds(keyword, pageParams);
 	}
 
+	/**
+	 * 所有的物料信息(不做查询)
+	 * 
+	 * @param params
+	 * @param keyword
+	 * @return
+	 */
+	@RequestMapping(value = "/info/newest", method = RequestMethod.GET)
+	@ResponseBody
+	public SPage<Product> getProductInfo(PageParams params, String keyword) {
+		PageInfo pageInfo = new PageInfo(params);
+		return productService.findProductInfoByPageInfo(pageInfo, keyword);
+	}
+
 	/**
 	 * 开启物料销售
 	 * 

+ 11 - 0
src/main/java/com/uas/platform/b2b/service/ProductService.java

@@ -10,6 +10,7 @@ import com.uas.platform.b2b.model.Product;
 import com.uas.platform.b2b.model.ProductMatchResult;
 import com.uas.platform.b2b.temporary.model.UpdateByBatchParameter;
 import com.uas.platform.core.model.PageInfo;
+import com.uas.search.b2b.model.SPage;
 
 public interface ProductService {
 
@@ -160,4 +161,14 @@ public interface ProductService {
 	 * @return
 	 */
 	public ModelMap matchsize(String type);
+
+	/**
+	 * 分页查找客户物料(全部)
+	 * 
+	 * @param pageInfo
+	 * @param keyword
+	 *            查找关键词
+	 * @return
+	 */
+	public SPage<Product> findProductInfoByPageInfo(PageInfo pageInfo, String keyword);
 }

+ 39 - 7
src/main/webapp/resources/js/index/app.js

@@ -12848,9 +12848,14 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 						}
 					}
 				})
+				$scope.deOrder.totalamount = 0;
+				$scope.deOrder.usdpayment = 0;
+				$scope.deOrder.orderamount = 0;
+				$scope.deOrder.totalpayament = 0;
 				angular.forEach($scope.deOrder.deputyOrderItems, function(item) {
 					$scope.deOrder.totalamount += item.amount * item.unitprice;
 					$scope.deOrder.usdpayment += item.amount * item.unitprice;
+					$scope.deOrder.totalpayament += item.amount * item.unitprice;
 					$scope.deOrder.orderamount += item.amount * item.purcprice;
 				});
 				
@@ -12891,11 +12896,19 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		
 		//计算采购单价
 		$scope.checkPrice = function(rate) {
+			$scope.deOrder.totalamount = 0;
+			$scope.deOrder.usdpayment = 0;
+			$scope.deOrder.orderamount = 0;
+			$scope.deOrder.totalpayament = 0;
 			if(rate == null) {
 				toaster.pop('info', '提示', '请先填入税率');
 			} else {
 				angular.forEach($scope.deOrder.deputyOrderItems, function(item) {
 					item.purcprice = item.unitprice * (1 + rate/100);
+					$scope.deOrder.totalamount += item.amount * item.unitprice;
+					$scope.deOrder.usdpayment += item.amount * item.unitprice;
+					$scope.deOrder.totalpayament += item.amount * item.unitprice;
+					$scope.deOrder.orderamount += item.amount * item.purcprice;
 				});
 			}
 		}
@@ -12903,10 +12916,14 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		$scope.save = function() {
 			$scope.deOrder.entrystatus = '保存';
 			$scope.deOrder.totalamount = 0;
+			$scope.deOrder.usdpayment = 0;
+			$scope.deOrder.orderamount = 0;
 			$scope.deOrder.totalpayament = 0;
 			angular.forEach($scope.deOrder.deputyOrderItems, function(item) {
 				$scope.deOrder.totalamount += item.amount * item.unitprice;
+				$scope.deOrder.usdpayment += item.amount * item.unitprice;
 				$scope.deOrder.totalpayament += item.amount * item.unitprice;
+				$scope.deOrder.orderamount += item.amount * item.purcprice;
 			});
 			if($scope.deOrder.deputyOrderItems[0].prodcode == null) {
 				toaster.pop('info', '提示', '您还未填写任何商品信息');
@@ -12928,11 +12945,15 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		// 提交
 		$scope.submit = function() {
 			$scope.deOrder.entrystatus = '已提交';
-			$scope.deOrder.totalpayament = 0;
 			$scope.deOrder.totalamount = 0;
+			$scope.deOrder.usdpayment = 0;
+			$scope.deOrder.orderamount = 0;
+			$scope.deOrder.totalpayament = 0;
 			angular.forEach($scope.deOrder.deputyOrderItems, function(item) {
 				$scope.deOrder.totalamount += item.amount * item.unitprice;
+				$scope.deOrder.usdpayment += item.amount * item.unitprice;
 				$scope.deOrder.totalpayament += item.amount * item.unitprice;
+				$scope.deOrder.orderamount += item.amount * item.purcprice;
 			});
 			if($scope.deOrder.deputyOrderItems[0].prodcode == null) {
 				toaster.pop('info', '提示', '您还未填写任何商品信息');
@@ -13145,8 +13166,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				angular.forEach($scope.deOrder.deputyOrderItems, function(item) {
 					$scope.deOrder.totalamount += item.amount * item.unitprice;
 					$scope.deOrder.usdpayment += item.amount * item.unitprice;
-					$scope.deOrder.orderamount += item.amount * item.unitprice * (1 + $scope.rate.rate/100);
 					$scope.deOrder.totalpayament += item.amount * item.unitprice;
+					$scope.deOrder.orderamount += item.amount * item.purcprice;
 				});
 			}, function(response) {
 				toaster.pop('error', '提示', response.data);
@@ -13197,7 +13218,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 					$scope.deOrder.totalamount += item.amount * item.unitprice;
 					$scope.deOrder.usdpayment += item.amount * item.unitprice;
 					$scope.deOrder.totalpayament += item.amount * item.unitprice;
-					$scope.deOrder.orderamount += item.amount * item.unitprice * (1 + $scope.rate.rate/100);
+					$scope.deOrder.orderamount += item.amount * item.purcprice;
 				});
 				
 			}, function(){
@@ -13234,11 +13255,19 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		
 		//计算采购单价
 		$scope.checkPrice = function(rate) {
+			$scope.deOrder.totalamount = 0;
+			$scope.deOrder.usdpayment = 0;
+			$scope.deOrder.orderamount = 0;
+			$scope.deOrder.totalpayament = 0;
 			if(rate == null) {
 				toaster.pop('info', '提示', '请先填入税率');
 			} else {
 				angular.forEach($scope.deOrder.deputyOrderItems, function(item) {
 					item.purcprice = item.unitprice * (1 + rate/100);
+					$scope.deOrder.totalamount += item.amount * item.unitprice;
+					$scope.deOrder.usdpayment += item.amount * item.unitprice;
+					$scope.deOrder.totalpayament += item.amount * item.unitprice;
+					$scope.deOrder.orderamount += item.amount * item.purcprice;
 				});
 			}
 		}
@@ -13254,7 +13283,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				$scope.deOrder.totalamount += item.amount * item.unitprice;
 				$scope.deOrder.usdpayment += item.amount * item.unitprice;
 				$scope.deOrder.totalpayament += item.amount * item.unitprice;
-				$scope.deOrder.orderamount += item.amount * item.unitprice * (1 + $scope.rate.rate/100);
+				$scope.deOrder.orderamount += item.amount * item.purcprice;
 			});
 			if($scope.deOrder.deputyOrderItems[0].prodcode == null) {
 				toaster.pop('info', '提示', '您还未填写任何商品信息');
@@ -13284,7 +13313,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				$scope.deOrder.totalamount += item.amount * item.unitprice;
 				$scope.deOrder.usdpayment += item.amount * item.unitprice;
 				$scope.deOrder.totalpayament += item.amount * item.unitprice;
-				$scope.deOrder.orderamount += item.amount * item.unitprice * (1 + $scope.rate.rate/100);
+				$scope.deOrder.orderamount += item.amount * item.purcprice;
 			});
 			DeputyOrder.saveDeOrder({deOrder: $scope.deOrder}, {}, function(data) {
 				if(data.id) {
@@ -15915,13 +15944,16 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			}
 		};
 		var getService = function() {
-			return ProductAll;
+//			return ProductAll;
+			return Products.getAllNewest;
 		};
 		
 		$scope.tableParams = new ngTableParams({
 			page : 1, 
 			count : 20,
 			sorting: {
+				standard: 'desc',
+				id: 'desc',
             }
 		}, {
 			total : 0, 
@@ -15931,7 +15963,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				var pageParams = params.url();
 				pageParams.keyword = $scope.keyword;
 				pageParams.searchFilter = $scope.searchFilter;
-				getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
+				getService().call(null, BaseService.parseParams(pageParams), function(page){
 					$scope.loading = false;
 					if(page) {
 						params.total(page.totalElement);

+ 4 - 0
src/main/webapp/resources/js/index/services/Product.js

@@ -89,6 +89,10 @@ define([ 'ngResource'], function() {
 			matchsize: {
 				url: 'product/matchsize/:type',
 				method: 'GET'
+			},
+			getAllNewest: {
+				url: 'product/info/newest',
+				method: 'GET',
 			}
 		});
 	}]).factory('PurcProduct', ['$resource', function($resource) {