Pārlūkot izejas kodu

客户送样申请,多次送样功能优化,列表及详情页调整内容。

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@8917 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
dongbw 9 gadi atpakaļ
vecāks
revīzija
f1657ca74a

+ 4 - 7
src/main/java/com/uas/platform/b2b/controller/SaleSampleController.java

@@ -32,10 +32,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  * 卖家获取对应的客户打样申请单
@@ -233,13 +230,13 @@ public class SaleSampleController {
 	 */
 	@RequestMapping(value = "/{id}/send", method = RequestMethod.GET)
 	@ResponseBody
-	public PurchaseProofingSend getProofingSends(@PathVariable("id") Long id) {
+	public List<PurchaseProofingSend> getProofingSends(@PathVariable("id") Long id) {
 		List<PurchaseProofingSend> sends = purchaseProofingService.findSendsByItemId(id);
 		logger.log("客户打样申请", "获取打样申请的送样信息,送样单明细id:" + id);
 		if (sends.size() > 0) {
-			return sends.get(0);
+			return sends;
 		} else {
-			return null;
+			return Collections.emptyList();
 		}
 	}
 

+ 5 - 0
src/main/java/com/uas/platform/b2b/service/impl/PurchaseProofingServiceImpl.java

@@ -287,6 +287,11 @@ public class PurchaseProofingServiceImpl implements PurchaseProofingService {
 					return null;
 			}
 		}
+		if (null != proofingItem.getSendQty()) { // proofingItem中的sendQty用来判断是否完成送样
+			proofingItem.setSendQty(proofingSend.getSendQty() + proofingItem.getSendQty());
+		} else {
+			proofingItem.setSendQty(proofingSend.getSendQty());
+		}
 		proofingItem.setStatus((short) Status.SEND.value());
 		proofingSend.setProofingItem(proofingItem);
 		proofingSend = purchaseProofingSendDao.save(proofingSend);

+ 10 - 0
src/main/webapp/resources/css/index.css

@@ -158,11 +158,21 @@ a.none:hover {
 	white-space: nowrap;
 }
 
+.text-trans.todo {
+	color: #56a022;
+	border-color: #56a022;
+}
+
 .text-trans.success {
 	color: #ffb433;
 	border-color: #ffb433;
 }
 
+.text-trans.half {
+	color: #55b6ff;
+	border-color: #55b6ff;
+}
+
 .text-trans.error {
 	color: #d44950;
 	border-color: #d44950;

+ 12 - 9
src/main/webapp/resources/js/index/app.js

@@ -5781,15 +5781,15 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		var loadData = function() {
 			PurcSample.get({id: $stateParams.id}, function(data){
 				$scope.sample = data;
-				if(!$scope.sample.send){
+				if(!$scope.sample.sends){
 					$scope.sample.getSendInfo = '加载中...';
 					PurcSample.getSend({id: $stateParams.id}, function(sendData){
 						if(sendData) {
 							$scope.sample.getSendInfo = null;
-							$scope.sample.send = sendData;
+							$scope.sample.sends = sendData;
 						} else {
 							$scope.sample.getSendInfo = '无送样信息';
-							$scope.sample.send = '无送样信息';
+							$scope.sample.sends = '无送样信息';
 						}
 					}, function(response){
 						$scope.sample.getSendInfo = '加载失败!';
@@ -5928,15 +5928,15 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		};
 		
 		$scope.getSend = function(proofing){
-			if( !proofing.send) {
+			if( !proofing.sends) {
 				proofing.getSendInfo = '加载中...';
 				PurcSample.getSend({id: proofing.id}, function(data){
 					if(data) {
 						proofing.getSendInfo = null;
-						proofing.send = data;
+						proofing.sends = data;
 					} else {
 						proofing.getSendInfo = '无送样信息';
-						proofing.send = '无送样信息';
+						proofing.sends = '无送样信息';
 					}
 				}, function(response){
 					proofing.getSendInfo = '加载失败!';
@@ -5952,10 +5952,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 	}]);
 	
 	app.controller('SampleSendCtrl', ['$scope', '$modalInstance', 'sampleItem', 'PurcSample', '$upload', 'toaster', function($scope, $modalInstance, sampleItem, PurcSample, $upload, toaster){
-        if( !sampleItem.send) {
+        if( !sampleItem.sends) {
             PurcSample.getSend({id: sampleItem.id}, function(data){
                 if(data) {
-                    sampleItem.send = data; // 获取送样信息
+                    sampleItem.sends = data; // 获取送样信息
+                    angular.forEach(data, function(send) {
+                        sampleItem.sendQty = send.sendQty + (sampleItem.sendQty || 0);
+                    });
                 }
             }, function(response){
             });
@@ -5967,7 +5970,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		$scope.ok = function (form) {
 			$scope.loading = true;
 			// 多次送样时,由于ng-model是sendQty,所以需要加上送样历史中的数量
-            $scope.sampleItem.sampleSend.sendQty = $scope.sampleItem.sampleSend.sendQty + ($scope.sampleItem.send.sendQty || 0);
+            $scope.sampleItem.sampleSend.sendQty = $scope.sampleItem.sampleSend.sendQty + ($scope.sampleItem.sendQty || 0);
             $scope.sampleItem.sendQty = $scope.sampleItem.sampleSend.sendQty; // 判断是否需要多次送样
 			var files = form.attachFile.$viewValue, file = files && files.length > 0 ? files[0] : null;
 			$upload.upload({

+ 2 - 1
src/main/webapp/resources/js/index/services/Purc.js

@@ -491,7 +491,8 @@ define([ 'ngResource'], function() {
 				method: 'GET',
 				params: {
 					id: 'id'
-				}
+				},
+                isArray: true
 			},
 			getTodo: {
 				params: {

+ 15 - 12
src/main/webapp/resources/tpl/index/sale/sample.html

@@ -323,7 +323,7 @@
 			</td>
 			<td class="text-center">
 				<div ng-show="sample.proofing.isCharge == '是'" class="text-num">
-					<span ng-bind="::currency(sample.currency)"></span>
+					<span ng-bind="sample.currency"></span>
 					<span ng-bind="::sample.price | number:6"></span>
 				</div>
 				<div ng-show="sample.proofing.isCharge == '是'" class="text-muted">
@@ -341,26 +341,26 @@
 					<div class="dropdown-menu pane" style="width: 270px;">
 						<div class="pane-body">
 							<span ng-if="sample.getSendInfo" ng-bind="sample.getSendInfo"></span>
-							<ul ng-if="sample.send" class="list-unstyled list-menu">
+							<ul ng-if="sample.sends" ng-repeat="send in sample.sends | orderBy : '-date'" class="list-unstyled list-menu">
 								<li>
 									<div class="row row-sm">
-										<div class="col-xs-7" ng-bind="::sample.send.date | date: 'yyyy-MM-dd HH:mm'"></div>
-										<div class="col-xs-5" ng-bind="::sample.send.recorder"></div>
+										<div class="col-xs-7" ng-bind="send.date | date: 'yyyy-MM-dd HH:mm'"></div>
+										<div class="col-xs-5" ng-bind="send.recorder"></div>
 									</div>
 									<div>
-										送样单号:<span ng-bind="::sample.send.code"></span>
+										送样单号:<span ng-bind="send.code"></span>
 									</div>
 									<div>
-										送样数量:<span class="text-num" ng-bind="::sample.send.sendQty"></span>
+										送样数量:<span class="text-num" ng-bind="send.sendQty"></span>
 									</div>
 									<div>
-										采购单价:<span class="text-num" ng-bind="::sample.send.puprice | number:6"></span>
+										采购单价:<span class="text-num" ng-bind="send.puprice | number:6"></span>
 									</div>
 									<div class="row row-sm">
-										<div class="col-xs-6" ng-if="sample.send.minQty">最小包装量:<span ng-bind="::sample.send.minQty"></span></div>
-										<div class="col-xs-6" ng-if="sample.send.minBuyQty">最小订购量:<span ng-bind="::sample.send.minBuyQty"></span></div>
+										<div class="col-xs-6" ng-if="send.minQty">最小包装量:<span ng-bind="send.minQty"></span></div>
+										<div class="col-xs-6" ng-if="send.minBuyQty">最小订购量:<span ng-bind="send.minBuyQty"></span></div>
 									</div>
-									<div class="row row-sm" ng-if="sample.send.attachs.length > 0">
+									<div class="row row-sm" ng-if="send.attachs.length > 0">
 										<div class="col-xs-3">附件:</div>
 										<div class="col-xs-9">
 											<div ng-repeat="attach in sample.send.attachs"><a href="file/{{attach.id}}" class="file">{{attach.name}}</a></div>
@@ -380,10 +380,13 @@
 						送样
 					</a>
 				</div>
-				<div ng-if="sample.status == 400" class="block">
+				<div ng-if="sample.status == 400 && !(sample.qty > (sample.sendQty || 0))" class="block">
 					<span class="text-trans success">已送样</span>
 				</div>
-				<div ng-if="sample.status == 400 && sample.qty > sample.sendQty" style="margin-top: 40px;">
+				<div ng-if="sample.status == 400 && sample.qty > (sample.sendQty || 0)" class="block">
+					<span class="text-trans half">部分送样</span>
+				</div>
+				<div ng-if="sample.status == 400 && sample.qty > (sample.sendQty || 0)" style="margin-top: 40px;">
 					<a ng-click="openSend($index, sample)" class="text-muted" title="送样">
 						送样
 					</a>

+ 90 - 55
src/main/webapp/resources/tpl/index/sale/sample_detail.html

@@ -1,3 +1,11 @@
+<style>
+	.text-trans {
+		top: -25px;
+		right: 50px;
+		font-size: 35px;
+		font-family: Microsoft Yahei Regular;
+	}
+</style>
 <div class="pane base-info"  id="order-detail-list">
 	<div class="pub-com_head">
 		<span>客户打样申请单</span>
@@ -7,6 +15,18 @@
 	<div class="pane-body">
 		<div class="title-div" style="border-bottom: 1px dashed #327ebe;">
 			<span class="f14">单据信息</span>&nbsp;
+			<div ng-if="sample.status == 401" class="block">
+				<span class="text-trans todo">待送样</span>
+			</div>
+			<div ng-if="sample.status == 400 && !(sample.qty > (sample.sendQty || 0))" class="block">
+				<span class="text-trans success">已送样</span>
+			</div>
+			<div ng-if="sample.status == 400 && sample.qty > (sample.sendQty || 0)" class="block">
+				<span class="text-trans success">部分送样</span>
+			</div>
+			<div ng-if="sample.status == 315" class="block">
+				<span class="text-trans text-light">已作废</span>
+			</div>
 		</div>
 		<div class="row row-sm item">
 			<div class="col-xs-3">
@@ -23,11 +43,35 @@
 			</div>
 		</div>
 		<div class="row row-sm item">
+			<div class="col-xs-3">
+				<span class="title">需求数</span>
+				<div class="content" title="{{sample.qty}}" ng-bind="::sample.qty"></div>
+			</div>
+			<div class="col-xs-3">
+				<span class="title">单价</span>
+				<div ng-show="sample.proofing.isCharge != '是'"
+					 class="label label-default">不收费</div>
+				<div ng-show="sample.proofing.isCharge == '是'" class="text-num">
+					<span ng-bind="sample.currency"></span> <span
+						ng-bind="sample.price | number:6"></span>
+				</div>
+			</div>
+			<div ng-show="sample.proofing.isCharge == '是'" class="col-xs-3">
+				<span class="title">税率</span>
+				<span class="content" ng-bind="sample.taxrate || 0"></span>%
+			</div>
+		</div>
+		<div class="row row-sm item">
+			<div class="col-xs-3">
+				<span class="title">交货日期</span>
+				<div class="content"
+					 ng-bind="::sample.proofing.delivery | date: 'yyyy-MM-dd'"></div>
+			</div>
 			<div class="col-xs-3">
 				<span class="title">送样申请人</span>
 				<div class="content" ng-bind="::sample.proofing.user.userName"></div>
 			</div>
-			<div class="col-xs-9">
+			<div class="col-xs-6">
 				<span class="title">备注</span>
 				<div class="content" ng-bind="::sample.proofing.remark"></div>
 				<div class="content" ng-show="!sample.proofing.remark">无</div>
@@ -63,86 +107,77 @@
 				<div class="content" ng-show="!sample.proofing.envrequiry">无</div>
 			</div>
 		</div>
-		<div class="title-div" style="border-bottom: 1px dashed #327ebe;">
-			<span class="f14">送样信息</span>&nbsp;
-		</div>
-		<div class="block">
+		<div class="block" ng-show="sample.status != 401">
 			<table class="block table table-default table-striped table-hover">
 				<thead>
 					<tr class="header">
-						<th >样品</th>
-						<th width="100">单价</th>
-						<th>需求数</th>
-						<th width="120">交货日期</th>
-						<th width="110">送样人</th>
-						<th width="140">附加信息</th>
-						<th width="100" ng-show="sample.status == 401">操作</th>
-						<th width="100" ng-show="sample.status == 400">状态</th>
+						<th width="120">单号</th>
+						<th width="100">送样时间</th>
+						<th width="70">采购单价</th>
+						<th width="70">送样数量</th>
+						<th width="40">交货周期</th>
+						<th width="90">送样人</th>
+						<th width="140">其他信息</th>
 					</tr>
 				</thead>
 				<tbody>
-					<tr>
+					<tr ng-repeat="send in sample.sends | orderBy : '-date'">
 						<td>
-							<div>
-								<span>送样单号:<span class="text-num">{{::sample.send.code}}</span></span>
-							</div>
-							<div>
-								<span>送样时间:<span class="text-num">{{::sample.send.date | date: 'yyyy-MM-dd HH:mm'}}</span></span>
-							</div>
+							<span class="text-num">{{send.code}}</span>
 						</td>
 						<td class="text-center">
-							<div ng-show="sample.proofing.isCharge != '是'"
-								class="label label-default">不收费</div>
-							<div ng-show="sample.proofing.isCharge == '是'" class="text-num">
-								<span ng-bind="::currency(sample.currency)"></span> <span
-									ng-bind="::sample.price | number:6"></span>
+							<span class="text-num">{{send.date | date: 'yyyy-MM-dd HH:mm'}}</span>
+						</td>
+						<td class="text-center">
+							<div>
+								<span class="text-num">{{send.puprice}}</span>
 							</div>
-							<div ng-show="sample.proofing.isCharge == '是'" class="text-muted">
-								税率:<span class="text-num" ng-bind="::sample.taxrate || 0"></span>%
+							<div ng-if="send.currency">
+								<span class="text-num">{{send.currency}}</span>
 							</div>
 						</td>
 						<td class="text-center">
-							<div class="text-num" title="{{sample.qty}}" ng-bind="::sample.qty"></div>
+							<span class="text-num">{{send.sendQty}}</span>
 						</td>
 						<td class="text-center">
-							<div class="text-num"
-								ng-bind="::sample.proofing.delivery | date: 'yyyy-MM-dd'"></div>
+							<span class="text-num">{{send.delivery}}</span>
 						</td>
-						<td >
-							<div ng-bind="::sample.send.recorder" style=" text-align:center"></div>
+						<td class="text-center">
+							<span class="text-num">{{send.recorder}}</span>
 						</td>
 						<td>
-							<div ng-if="sample.send.minQty">最小包装量:<span ng-bind="::sample.send.minQty"></span></div>
-							<div ng-if="sample.send.minBuyQty">最小订购量:<span ng-bind="::sample.send.minBuyQty"></span></div>
-							<div class="row row-sm" ng-if="sample.send.attachs.length > 0">
+							<div ng-if="send.minQty">最小包装量:<span ng-bind="send.minQty"></span></div>
+							<div ng-if="send.minBuyQty">最小订购量:<span ng-bind="send.minBuyQty"></span></div>
+							<div ng-if="send.vendSpec">生产厂型号:<span ng-bind="send.vendSpec"></span></div>
+							<div ng-if="send.brand">品牌:<span ng-bind="send.brand"></span></div>
+							<div ng-if="send.weight">单重:<span ng-bind="send.weight"></span></div>
+							<div ng-if="send.material">材料:<span ng-bind="send.material"></span></div>
+							<div ng-if="send.materialQuality">材质:<span ng-bind="send.materialQuality"></span></div>
+							<div ng-if="send.adress">产地:<span ng-bind="send.minBuyQty"></span></div>
+							<div ng-if="send.addressMark">产地标识:<span ng-bind="send.addressMark"></span></div>
+							<div ng-if="send.ratio">口水料比例:<span ng-bind="send.ratio"></span>%</div>
+							<div class="row row-sm" ng-if="send.attachs.length > 0">
 								<div class="col-xs-3">附件:</div>
 								<div class="col-xs-9">
-									<div ng-repeat="attach in sample.send.attachs"><a href="file/{{attach.id}}" class="file">{{attach.name}}</a></div>
+									<div ng-repeat="attach in send.attachs"><a href="file/{{attach.id}}" class="file">{{attach.name}}</a></div>
 								</div>
 							</div>
 						</td>
-						<td class="text-center">
-							<div ng-show="sample.status == 401">
-								<a ng-click="openSend($index, sample)" class="text-muted" title="送样">
-									<i class="fa fa-paper-plane fa-lg fa-fw"></i><br>
-									送样
-								</a>
-							</div>
-							<div ng-if="sample.status == 400" class="block">
-								<span class="text-trans success">已送样</span>
-							</div>
-							<div ng-if="sample.status == 400 && sample.qty > sample.sendQty" style="margin-top: 40px;" >
-								<a ng-click="openSend($index, sample)" class="text-muted" title="送样">
-									送样
-								</a>
-							</div>
-							<div ng-if="sample.status == 315" class="block">
-								<span class="text-trans text-light">已作废</span>
-							</div>
-						</td>
 					</tr>
 				</tbody>
 			</table>
 		</div>
+		<div class="text-center" ng-show="sample.status == 401">
+			<a ng-click="openSend($index, sample)" class="text-muted" title="送样">
+				<i class="fa fa-paper-plane fa-lg fa-fw"></i><br>
+				还未送样,点击立即送样
+			</a>
+		</div>
+		<div class="text-center" ng-show="sample.status == 400 && sample.qty > (sample.sendQty || 0)">
+			<a ng-click="openSend($index, sample)" class="text-muted" title="送样">
+				<i class="fa fa-paper-plane fa-lg fa-fw"></i><br>
+				未满足需求数,点击立即送样
+			</a>
+		</div>
 	</div>
 </div>

+ 3 - 3
src/main/webapp/resources/tpl/index/sale/sample_send.html

@@ -80,7 +80,7 @@
 		<div class="row">
 			<label class="col-md-2 col-sm-2 col">单位:</label>
 			<div class="col-md-4 col-sm-4 col">
-				<input ng-model=""
+				<input ng-model="sampleItem.sampleSend.unit"
 					   class="form-control input-sm" type="text">
 			</div>
 			<label class="col-md-2 col-sm-2 col">品牌:</label>
@@ -123,7 +123,7 @@
 		<div class="row">
 			<label class="col-md-2 col-sm-2 col">币别:</label>
 			<div class="col-md-4 col-sm-4 col">
-				<select class="form-control" ng-model="sampleItem.currency" ng-init="sampleItem.currency = 'RMB'">
+				<select class="form-control" ng-model="sampleItem.currency" ng-init="sampleItem.currency">
 					<option value="RMB">RMB</option>
 					<option value="USD">USD</option>
 					<option value="HKD">HKD</option>
@@ -138,7 +138,7 @@
 		<div class="row">
 			<label class="col-md-2 col-sm-2 col">税率:</label>
 			<div class="col-md-4 col-sm-4 col input-group">
-				<input class="form-control input-sm" type="text" ng-model="sampleItem.taxrate" ng-pattern="/^\d{1,2}$/">
+				<input class="form-control input-sm" type="text" ng-model="sampleItem.taxrate" ng-init="sampleItem.taxrate" ng-pattern="/^\d{1,2}$/">
 				<span style="width: 30px;" class="input-group-addon">%</span>
 			</div>
 			<label class="col-md-2 col-sm-2 col">产地:</label>