Преглед изворни кода

1:批量上架的逻辑的调整。

yujia пре 8 година
родитељ
комит
c8e3c78f3d

+ 30 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -139,6 +139,18 @@ public class ReleaseProductByBatch implements Serializable {
 	@Column(name = "rel_minpackage")
 	private Double minPackage;
 
+	/**
+	 * 是否可拆卖
+	 */
+	@Column(name = "rel_breakup")
+	private Boolean breakUp;
+
+	/**
+	 * 是否
+	 */
+	@Column(name = "rel_breakupstr")
+	private String breakUpStr;
+
 	/**
 	 * 包装:托盘、管装、卷带
 	 */
@@ -1098,4 +1110,22 @@ public class ReleaseProductByBatch implements Serializable {
 		this.deliveryHKMaxTime = deliveryHKMaxTime;
 		return this;
 	}
+
+	public Boolean getBreakUp() {
+		return breakUp;
+	}
+
+	public ReleaseProductByBatch setBreakUp(Boolean breakUp) {
+		this.breakUp = breakUp;
+		return this;
+	}
+
+	public String getBreakUpStr() {
+		return breakUpStr;
+	}
+
+	public ReleaseProductByBatch setBreakUpStr(String breakUpStr) {
+		this.breakUpStr = breakUpStr;
+		return this;
+	}
 }

+ 31 - 21
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -13,6 +13,7 @@ import com.uas.platform.b2c.prod.commodity.model.GoodsQtyPrice;
 import com.uas.platform.b2c.prod.commodity.model.ReleaseProductByBatch;
 import com.uas.platform.b2c.prod.commodity.service.GoodsService;
 import com.uas.platform.b2c.prod.commodity.service.ReleaseProductByBatchService;
+import com.uas.platform.b2c.prod.commodity.type.ReleaseConstant;
 import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
 import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.b2c.prod.store.model.StoreStatus;
@@ -88,7 +89,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		Pattern chineseAndEnglishPattern = Pattern.compile(RegexConstant.chineseAndEnglish);
 		Sheet sheet = workbook.getSheetAt(0);
 		int colNum = sheet.getRow(0).getPhysicalNumberOfCells();
-		if(colNum != 25) {
+		if(colNum != 26) {
 			throw new IllegalOperatorException("您上传的信息列信息不正确,请与模板的列做比较");
 		}
 		int rowNum = sheet.getLastRowNum();
@@ -250,8 +251,17 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 						releaseProductByBatch.addErrmsg("10:最小包装量不可以为空且只能是数字");
 					}
 
+					// 可拆卖
+					Object breakUpCellValue = readWorkBookCell(row.getCell(10), Cell.CELL_TYPE_STRING, r, 10);
+					releaseProductByBatch.setBreakUpStr(String.valueOf(breakUpCellValue));
+					if (!StringUtils.isEmpty(breakUpCellValue)&&(ReleaseConstant.YES.equals(breakUpCellValue.toString()))) {
+						releaseProductByBatch.setBreakUp(Boolean.TRUE);
+					}else {
+						releaseProductByBatch.setBreakUp(Boolean.FALSE);
+					}
+
 					// 最小包单价(人民币)
-					Object rmbPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(10), Cell.CELL_TYPE_STRING, r, 10);
+					Object rmbPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(11), Cell.CELL_TYPE_STRING, r, 11);
 					if ((rmbPriceMinPackQtyCellValue != null)&&(isNumber(rmbPriceMinPackQtyCellValue.toString()))) {
 						Double rmbPrice = Double.valueOf(rmbPriceMinPackQtyCellValue.toString());
 						rmbPrice = fractionNumCeil(rmbPrice, 6);
@@ -259,7 +269,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					}
 
 					// 最小包单价(美元)
-					Object usdPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(11), Cell.CELL_TYPE_STRING, r, 11);
+					Object usdPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(12), Cell.CELL_TYPE_STRING, r, 12);
 					if ((usdPriceMinPackQtyCellValue != null)&&(isNumber(usdPriceMinPackQtyCellValue.toString()))) {
 						Double usdPrice = Double.valueOf(usdPriceMinPackQtyCellValue.toString());
 						usdPrice = fractionNumCeil(usdPrice, 6);
@@ -270,7 +280,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					Double rmbMinPackPrice = releaseProductByBatch.getRmbMinPackPrice();
 					Double usdMinPackPrice = releaseProductByBatch.getUsdMinPackPrice();
 					if (rmbMinPackPrice == null && usdMinPackPrice == null) {
-						releaseProductByBatch.addErrmsg("10-11:最小包单价至少填一种价格");
+						releaseProductByBatch.addErrmsg("12-13:最小包单价至少填一种价格");
 					} else if (rmbMinPackPrice != null && usdMinPackPrice == null) {
 						releaseProductByBatch.setCurrency("RMB");
 						releaseProductByBatch.setRmbTaxRate(0.17d);
@@ -284,9 +294,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					}
 					
 					// 生产日期
-					Object produceDateCellValue = readWorkBookCell(row.getCell(12), Cell.CELL_TYPE_STRING, r, 12);
+					Object produceDateCellValue = readWorkBookCell(row.getCell(13), Cell.CELL_TYPE_STRING, r, 13);
 					if (produceDateCellValue == null) {
-						releaseProductByBatch.addErrmsg("13:产品生产日期不可以为空");
+						releaseProductByBatch.addErrmsg("14:产品生产日期不可以为空");
 					} else {
 						releaseProductByBatch.setProductDate(String.valueOf(produceDateCellValue));
 					}
@@ -314,7 +324,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 					// 大陆交期
 					if(releaseProductByBatch.getCurrency() != null && releaseProductByBatch.getCurrency().contains("RMB")) {
-						Object deliveryCellValue = readWorkBookCell(row.getCell(13), Cell.CELL_TYPE_STRING, r, 13);
+						Object deliveryCellValue = readWorkBookCell(row.getCell(14), Cell.CELL_TYPE_STRING, r, 14);
 						if (!StringUtils.isEmpty(deliveryCellValue)) {
 							Short[] delivers = splitDeliveryString(deliveryCellValue.toString());
 							if (!ArrayUtils.isEmpty(delivers)&&(delivers[0] !=null)&&(delivers[1] !=null)) {
@@ -322,11 +332,11 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 								releaseProductByBatch.setDeliveryDemMaxTime(delivers[1]);
 								Boolean aBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryDemMaxTime(), (short) 0, (short) 9);
 								if(!aBoolean) {
-									releaseProductByBatch.addErrmsg("14:大陆交期的不在(0,9]天");
+									releaseProductByBatch.addErrmsg("15:大陆交期的不在(0,9]天");
 								}
 								Boolean bBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryDemMinTime(), (short) 0, (short) 9);
 								if(!bBoolean) {
-									releaseProductByBatch.addErrmsg("14:大陆交期的不在(0,9]天");
+									releaseProductByBatch.addErrmsg("15:大陆交期的不在(0,9]天");
 								}
 							}
 						}
@@ -334,7 +344,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 					// 香港交期
 					if(releaseProductByBatch.getCurrency() != null && releaseProductByBatch.getCurrency().contains("USD")) {
-						Object deliveryhkCellValue = readWorkBookCell(row.getCell(14), Cell.CELL_TYPE_STRING, r, 14);
+						Object deliveryhkCellValue = readWorkBookCell(row.getCell(15), Cell.CELL_TYPE_STRING, r, 15);
 						if (!StringUtils.isEmpty(deliveryhkCellValue)) {
 							Short[] deliverys = splitDeliveryString(deliveryhkCellValue.toString());
 							if (!ArrayUtils.isEmpty(deliverys)&&(deliverys[0] !=null)&&(deliverys[1] !=null)) {
@@ -343,11 +353,11 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 								Boolean aBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryHKMinTime(), (short) 0, (short) 9);
 								if(!aBoolean) {
-									releaseProductByBatch.addErrmsg("15:香港交期的不在(0,9]天");
+									releaseProductByBatch.addErrmsg("16:香港交期的不在(0,9]天");
 								}
 								Boolean bBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryHKMaxTime(), (short) 0, (short) 9);
 								if(!bBoolean) {
-									releaseProductByBatch.addErrmsg("15:香港交期的不在(0,9]天");
+									releaseProductByBatch.addErrmsg("16:香港交期的不在(0,9]天");
 								}
 							}
 						}
@@ -355,19 +365,19 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 					if("RMB-USD".equals(releaseProductByBatch.getCurrency())) {
 						if(releaseProductByBatch.getDeliveryDemMaxTime() == null ||  releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币和美金,所以香港和大陆的交期都需要填写,且格式必须是5~5");
+							releaseProductByBatch.addErrmsg("15-16:您上架的币别是人民币和美金,所以香港和大陆的交期都需要填写,且格式必须是5~5");
 						}
 					}else if("RMB".equals(releaseProductByBatch.getCurrency())) {
 						if(releaseProductByBatch.getDeliveryDemMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币,所以大陆交期需要填写,且格式必须是5~5");
+							releaseProductByBatch.addErrmsg("15-16:您上架的币别是人民币,所以大陆交期需要填写,且格式必须是5~5");
 						}
 					}else if("USD".equals(releaseProductByBatch.getCurrency())) {
 						if(releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("14-15:您上架的币别是美金,所以香港交期需要填写,且格式必须是5~5");
+							releaseProductByBatch.addErrmsg("15-16:您上架的币别是美金,所以香港交期需要填写,且格式必须是5~5");
 						}
 					}else {
 						if(releaseProductByBatch.getDeliveryDemMaxTime() == null && releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("14-15:您必须要填写一个类型的交期,且格式必须是5~5");
+							releaseProductByBatch.addErrmsg("15-16:您必须要填写一个类型的交期,且格式必须是5~5");
 						}
 					}
 
@@ -376,8 +386,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					Double[] priceMaxMinPrice = {Double.MAX_VALUE, Double.MIN_VALUE, Double.MAX_VALUE, Double.MIN_VALUE}; //最小人民币价格,最大人民币价格,最小美金价格,最大美金价格
 					for (int i = 0; i < 3; i++) {
 						// 起始量必须等于最小起定量
-						readSectionPrice(row.getCell(15 + 3 * i), row.getCell(16 + 3 * i), row.getCell(17 + 3 * i),
-								prices, releaseProductByBatch, r, (15 + 3 * i), priceMaxMinPrice);
+						readSectionPrice(row.getCell(16 + 3 * i), row.getCell(17 + 3 * i), row.getCell(18 + 3 * i),
+								prices, releaseProductByBatch, r, (16 + 3 * i), priceMaxMinPrice);
 					}
 					if (!CollectionUtils.isEmpty(prices)) {
 						double start = -1;
@@ -386,7 +396,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 							if(j == 0) {
 								int val = price.getStart().compareTo(releaseProductByBatch.getMinBuyQty());
 								if(val != 0) {
-									releaseProductByBatch.addErrmsg("16:第一个分段数量的起始值与最小起订量不相等");
+									releaseProductByBatch.addErrmsg("17:第一个分段数量的起始值与最小起订量不相等");
 								}
 							}
 
@@ -394,7 +404,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 							if (start < price.getStart()) {
 								start = price.getStart();
 							} else {
-								releaseProductByBatch.addErrmsg("16:分段数量起始值存在后一个分段的开始值小于前一个分段的开始值");
+								releaseProductByBatch.addErrmsg("17:分段数量起始值存在后一个分段的开始值小于前一个分段的开始值");
 							}
 
 							if (j < prices.size() - 1) {
@@ -440,7 +450,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					}
 
 					// 备注
-					Object remarkCellValue = readWorkBookCell(row.getCell(23), Cell.CELL_TYPE_STRING, r, 23);
+					Object remarkCellValue = readWorkBookCell(row.getCell(25), Cell.CELL_TYPE_STRING, r, 25);
 					if (!StringUtils.isEmpty(remarkCellValue)) {
 						String remark = remarkCellValue.toString();
 						releaseProductByBatch.setRemark(remark);

+ 13 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/type/ReleaseConstant.java

@@ -0,0 +1,13 @@
+package com.uas.platform.b2c.prod.commodity.type;
+
+/**
+ * 批量上架可拆卖的常量
+ *
+ * @author yuj 2017-09-07 15:59
+ */
+public class ReleaseConstant {
+
+    public static final String YES= "是";
+
+    public static final String NO = "否";
+}

BIN
src/main/resources/jxls-tpl/trade/releaseByBatch.xls


+ 1 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_onSaleCtrl.js

@@ -463,7 +463,7 @@ define([ 'app/app' ], function(app) {
                     $scope.changeMinBuyQty(commodity);
                 }
             }
-        }
+        };
 
         /**
          * 修改commodity的系列的dirty属性 为true;

+ 3 - 2
src/main/webapp/resources/view/vendor/forstore/vendor_upload.html

@@ -316,8 +316,8 @@
                                         <div>
                                             <span class="label-commodity">交期:</span>
                                             <span>
-                                                    <span ng-if="batchCommodity.mindeliveryDemTime" ng-bind="'大陆:' + batchCommodity.mindeliveryDemTime + '-' + batchCommodity.maxdeliveryDemTime"></span><br/>
-                                                    <span ng-if="batchCommodity.mindeliveryHKTime" ng-bind="'香港:' + batchCommodity.mindeliveryHKTime + '-' + batchCommodity.maxdeliveryHKTime"></span>
+                                                    <span ng-if="batchCommodity.deliveryDemMaxTime" ng-bind="'大陆:' + batchCommodity.deliveryDemMinTime + '-' + batchCommodity.deliveryDemMaxTime"></span><br/>
+                                                    <span ng-if="batchCommodity.deliveryHKMinTime" ng-bind="'香港:' + batchCommodity.deliveryHKMinTime + '-' + batchCommodity.deliveryHKMaxTime"></span>
                                                 </span>
                                         </div>
                                     </td>
@@ -334,6 +334,7 @@
                                                 </span>
                                         </div>
                                         <div>样品:&nbsp;<span ng-bind="batchCommodity.sampleqty | number"></span></div>
+                                        <div>可拆卖:&nbsp;<span ng-bind="batchCommodity.breakUp ? '是' : '否'"></span></div>
                                     </td>
                                     <td>
                                         <div class="fragment-price" ng-repeat="price in batchCommodity.prices">