Browse Source

更新新增采购单无法下单的bug;增加单价小数位限制

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@7397 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 years ago
parent
commit
165bdd3643

+ 13 - 8
src/main/java/com/uas/platform/b2b/service/impl/BaseInfoServiceImpl.java

@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.ui.ModelMap;
 
+import com.alibaba.fastjson.JSON;
 import com.uas.account.entity.RequsetStatus;
 import com.uas.account.support.Page;
 import com.uas.account.util.AccountUtils;
@@ -112,15 +113,18 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 					Product product = new Product();
 
 					// 商品名称
-					if (row.getCell(0) != null) {
+					if (row.getCell(0) == null) {
+						infos.add("第" + r + 1 + "行商品名称为空");
+					} else {
+						System.out.println(row.getCell(0));
 						row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
 						product.setTitle(row.getCell(0).getStringCellValue().trim());
-					} else {
-						infos.add("第" + r + 1 + "行商品名称为空");
 					}
 
 					// 型号
-					if (row.getCell(1) != null) {
+					if (row.getCell(1) == null) {
+						infos.add("第" + r + 1 + "行编号为空");
+					} else {
 						row.getCell(1).setCellType(Cell.CELL_TYPE_STRING);
 						String code = row.getCell(1).getStringCellValue().trim();
 						List<Product> prods = productDao
@@ -130,8 +134,6 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 						} else {
 							alters.add(code);
 						}
-					} else {
-						infos.add("第" + r + 1 + "行编号为空");
 					}
 
 					// 规格
@@ -175,6 +177,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 						modelMap.put("success", total - alters.size());
 						products.add(product);
 					}
+					System.out.println(JSON.toJSON(products));
 				}
 			}
 			if (!CollectionUtils.isEmpty(products)) {
@@ -284,13 +287,14 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 		purcOrder.setCurrency("RMB");
 		purcOrder.setType("平台采购");
 		purcOrder.setAuditor(SystemSession.getUser().getUserName());
-		purcOrder.setShipAddress(SystemSession.getUser().getEnterprise().getEnAddress());
+		purcOrder.setShipAddress(neworder.getShipaddress());
 		purcOrder.setReceiveName(neworder.getCust().getEnName());
 		purcOrder.setReceiveCode(String.valueOf(neworder.getCust().getUu()));
 		purcOrder.setEnName(neworder.getCust().getEnName());
 		purcOrder.setCurrency(neworder.getCurrency());
 		purcOrder.setPayments(neworder.getPayments());
 		purcOrder.setRemark(neworder.getRemark());
+		purcOrder.setShipAddress(neworder.getShipaddress());
 		short i = 1;
 		if (!CollectionUtils.isEmpty(neworder.getOrderItems())) {
 			for (OrderItems orderitem : neworder.getOrderItems()) {
@@ -457,6 +461,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 
 	@Override
 	public ModelMap addtoCart(NewPurcOrder neworder) {
+		System.out.println("cart--> " + JSON.toJSONString(neworder));
 		ModelMap map = new ModelMap();
 		Cart cart = new Cart();
 		Set<CartDetail> cartDetails = new HashSet<CartDetail>();
@@ -472,7 +477,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 		cart.setVendUserUU(neworder.getCustUserUU());
 		cart.setVendUU(neworder.getCust().getUu());
 		cart.setCurrency("RMB");
-		cart.setShipAddress(SystemSession.getUser().getEnterprise().getEnAddress());
+		cart.setShipAddress(neworder.getShipaddress());
 		cart.setReceiveName(neworder.getCust().getEnName());
 		cart.setReceiveCode(String.valueOf(neworder.getCust().getUu()));
 		cart.setEnName(neworder.getCust().getEnName());

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/impl/CartServiceImpl.java

@@ -84,7 +84,7 @@ public class CartServiceImpl implements CartService {
 		purcOrder.setCurrency("RMB");
 		purcOrder.setType("平台采购");
 		purcOrder.setAuditor(SystemSession.getUser().getUserName());
-		purcOrder.setShipAddress(SystemSession.getUser().getEnterprise().getEnAddress());
+		purcOrder.setShipAddress(cart.getShipAddress());
 		purcOrder.setReceiveName(cart.getReceiveName());
 		purcOrder.setReceiveCode(String.valueOf(cart.getReceiveCode()));
 		purcOrder.setEnName(cart.getEnName());

+ 10 - 3
src/main/java/com/uas/platform/b2b/temporary/model/NewPurcOrder.java

@@ -19,6 +19,7 @@ public class NewPurcOrder {
 	private String currency;
 	private String payments;
 	private String remark;
+	private String shipaddress;
 
 	public String getCode() {
 		return code;
@@ -84,13 +85,19 @@ public class NewPurcOrder {
 		this.remark = remark;
 	}
 
+	public String getShipaddress() {
+		return shipaddress;
+	}
+
+	public void setShipaddress(String shipaddress) {
+		this.shipaddress = shipaddress;
+	}
+
 	@Override
 	public String toString() {
 		return "NewPurcOrder [code=" + code + ", date=" + date + ", orderItems=" + orderItems + ", cust=" + cust
 				+ ", custUserUU=" + custUserUU + ", currency=" + currency + ", payments=" + payments + ", remark="
-				+ remark + "]";
+				+ remark + ", shipaddress=" + shipaddress + "]";
 	}
 
-
-
 }

+ 4 - 2
src/main/webapp/resources/js/index/app.js

@@ -8011,6 +8011,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 				price: null,
 				remark: null, 
 				delivery: null,
+				id: null
 				};
 //		$scope.order.orderItems.push(item);
 		if($rootScope.prodId) {
@@ -8019,6 +8020,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 				item.title = data.title;
 				item.spec = data.spec;
 				item.unit = data.unit;
+				item.ubit = data.id;
 				$scope.order.orderItems.push(item);
 			}, function(response) {
 				
@@ -8067,7 +8069,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		
 		// 选择
   		$scope.check = function(data) {
-  			$scope.order.orderItems.push({code: data.code, title: data.title, spec: data.spec, unit: data.unit, qty: null, price: null, remark: null, delivery: null});
+  			$scope.order.orderItems.push({code: data.code, title: data.title, spec: data.spec, unit: data.unit, qty: null, price: null, remark: null, delivery: null, id: data.id});
   		};
   		
   		// 搜索框回车
@@ -8743,7 +8745,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 				if(data.success) {
 					toaster.pop('success', '提示', data.success);
 					$timeout(function() {
-						window.location.hash = '#/purc/cartdetail/'+data.id;
+						window.location.hash = '#/purc/order/'+data.id;
 					},500);
 				}
 				if(data.error) {

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/newProdInfo.html

@@ -175,7 +175,7 @@
 				<label for="file" class="col-sm-2 control-label">附件</label>
 				<div class="col-sm-4">
 					<div class="">
-						<input ng-file-select accept="image/*,application/pdf,*.pdf" ng-model="myFiles" type="file" 
+						<input ng-file-select  ng-model="myFiles" type="file" 
 			      		ng-multiple="false" class="form-control" id="enImage" name="enImage" placeholder="图片或PDF文件">
 				      	<div class="well margin-b-0" >
 				      		<div ng-show="previewShow">

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/productDetail.html

@@ -232,7 +232,7 @@
 						<!-- <a href="file/{{prodInfo.attach.id}}" class="file" target="_blank">{{prodInfo.attach.name}}</a> -->
 						<a ng-click="showImg()">{{prodInfo.attach.name}}</a>
 					</div>
-					<input ng-file-select accept="image/*,application/pdf,*.pdf" ng-model="myFiles" type="file" 
+					<input ng-file-select ng-model="myFiles" type="file" 
 		      		ng-multiple="false" class="form-control" id="enImage" name="enImage" placeholder="图片或PDF文件" ng-disabled="!prodInfo.$editing">
 			      	<div class="well margin-b-0" >
 			      		<div ng-show="previewShow">

+ 3 - 3
src/main/webapp/resources/tpl/index/purc/addOrder.html

@@ -215,7 +215,7 @@
 					<label for="customer" class="col-sm-2 text-right"><span class="text-inverse text-bold">* </span>收货地址:</label>
 					<div class="col-sm-4">
 						<div id="">
-							<input ng-model="order.payments" type="text" class="form-control"  
+							<input ng-model="order.shipaddress" type="text" class="form-control"  
 								placeholder="请填收货地址" style="cursor: pointer;" ng-required="true">
 						</div>
 					</div>
@@ -257,11 +257,11 @@
 							<td>
 								<div class="col-sm-10">
 									<input ng-model="item.price" type="text" class="form-control input-dbfind" id="product" 
-											placeholder="单价" style="cursor: pointer;" required="true" ng-pattern="/[1-9]\d*(\.\d*[1-9])?/">
+											placeholder="单价(最多6位小数)" style="cursor: pointer;" required="true" ng-pattern="/^[0-9]+(\.[0-9]{1,6})?$/">
 								</div>
 								<div class="col-sm-10">
 									<input ng-model="item.qty" type="text" class="form-control input-dbfind" id="product" 
-											placeholder="数量" style="cursor: pointer;" required="true" ng-pattern="/^[1-9]d*$/">
+											placeholder="数量" style="cursor: pointer;" required="true" ng-pattern="/^\+?[1-9][0-9]*$/">
 								</div>
 							</td>
 							<td class="text-center">