Browse Source

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@463 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d

administrator 11 years ago
parent
commit
33d810c55c

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

@@ -35,7 +35,7 @@ public class SaleInquiryController {
 	/**
 	 * 作为卖家,收到的采购询价
 	 * 
-	 * @param json
+	 * @param params
 	 * @return
 	 */
 	@RequestMapping(method = RequestMethod.GET)
@@ -73,7 +73,7 @@ public class SaleInquiryController {
 	 * 作为卖家,给询价单报价
 	 * 
 	 * @param json
-	 * @param orderItemId
+	 * @param inquiryItemId
 	 * @return
 	 */
 	@RequestMapping(value = "/items/{inquiryItemId}/reply", method = RequestMethod.POST)
@@ -87,10 +87,10 @@ public class SaleInquiryController {
 	 * 作为卖家,保存更新询价单
 	 * 
 	 * @param json
-	 * @param orderItemId
+	 * @param inquiryItemId
 	 * @return
 	 */
-	@RequestMapping(value = "/items/{inquiryItemId}/save", method = RequestMethod.POST)
+	@RequestMapping(value = "/items/{inquiryItemId}", method = RequestMethod.POST)
 	public ResponseEntity<String> saveOrderItem(@RequestBody String json, @PathVariable("inquiryItemId") Long inquiryItemId) {
 		PurchaseInquiryItem item = FlexJsonUtils.fromJson(json, PurchaseInquiryItem.class);
 		purchaseInquiryService.save(item);

+ 48 - 0
src/main/java/com/uas/platform/b2b/controller/SaleNoticeController.java

@@ -1,7 +1,23 @@
 package com.uas.platform.b2b.controller;
 
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.uas.platform.b2b.model.PurchaseNotice;
+import com.uas.platform.b2b.model.SaleSend;
+import com.uas.platform.b2b.service.PurchaseNoticeService;
+import com.uas.platform.b2b.support.SystemSession;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
 
 /**
  * 卖家对送货提醒的操作
@@ -13,4 +29,36 @@ import org.springframework.web.bind.annotation.RequestMapping;
 @RequestMapping("/sale/notice")
 public class SaleNoticeController {
 
+	@Autowired
+	private PurchaseNoticeService purchaseNoticeService;
+
+	/**
+	 * 作为卖家,收到的送货提醒
+	 * 
+	 * @param params
+	 * @return
+	 */
+	@RequestMapping(method = RequestMethod.GET)
+	@ResponseBody
+	public Page<PurchaseNotice> getReceivedPurchaseNotices(PageParams params) {
+		PageInfo info = new PageInfo(params);
+		// 我作为卖家,把我的企业ID作为供应商ID传入
+		info.filter("vendUU", SystemSession.getUser().getEnterprise().getUu());
+		return purchaseNoticeService.findAllByPageInfo(info);
+	}
+
+	/**
+	 * 作为卖家,针对送货提醒发货
+	 * 
+	 * @param noticeId
+	 * @param json
+	 * @return
+	 */
+	@RequestMapping(value = "/{noticeId}", method = RequestMethod.POST)
+	public ResponseEntity<String> send(@PathVariable("noticeId") Long noticeId,@RequestBody String json) {
+		SaleSend send = FlexJsonUtils.fromJson(json, SaleSend.class);
+		purchaseNoticeService.send(noticeId, send);
+		return new ResponseEntity<String>(HttpStatus.OK);
+	}
+
 }

+ 10 - 0
src/main/java/com/uas/platform/b2b/erp/model/AcceptNotify.java

@@ -16,6 +16,7 @@ import com.uas.platform.b2b.support.SystemSession;
  */
 public class AcceptNotify {
 
+	private Long b2b_ss_id;
 	private long an_venduu;
 	private String an_currency;
 	private Float an_rate;
@@ -24,6 +25,14 @@ public class AcceptNotify {
 	private String an_remark;
 	private List<AcceptNotifyDetail> details;
 
+	public Long getB2b_ss_id() {
+		return b2b_ss_id;
+	}
+
+	public void setB2b_ss_id(Long b2b_ss_id) {
+		this.b2b_ss_id = b2b_ss_id;
+	}
+
 	public long getAn_venduu() {
 		return an_venduu;
 	}
@@ -90,6 +99,7 @@ public class AcceptNotify {
 	 * @param send
 	 */
 	public AcceptNotify(SaleSend send) {
+		this.b2b_ss_id = send.getId();
 		this.an_buyeruu = send.getCustUserUU();
 		this.an_currency = send.getCurrency();
 		this.an_payment = send.getPayments();

+ 1 - 0
src/main/java/com/uas/platform/b2b/erp/model/PurchaseNotify.java

@@ -119,6 +119,7 @@ public class PurchaseNotify {
 		orderItem.setNumber(pn_orderdetno);
 		orderItem.setOrder(order);
 		notice.setOrderItem(orderItem);
+		notice.setStatus((short) Status.NOT_REPLY.value());
 		notice.setSendStatus((short) Status.NOT_UPLOAD.value());
 		return notice;
 	}

+ 14 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseNotice.java

@@ -82,6 +82,12 @@ public class PurchaseNotice implements Serializable {
 	@Column(name = "pn_remark")
 	private String remark;
 
+	/**
+	 * 处理状态(已回复、未回复),全部发货后改为已回复
+	 */
+	@Column(name = "pn_status")
+	private Short status;
+
 	/**
 	 * 客户采购单明细
 	 */
@@ -214,6 +220,14 @@ public class PurchaseNotice implements Serializable {
 		this.endStatus = endStatus;
 	}
 
+	public Short getStatus() {
+		return status;
+	}
+
+	public void setStatus(Short status) {
+		this.status = status;
+	}
+
 	public Long getOrderItemId() {
 		return orderItemId;
 	}

+ 0 - 3
src/main/java/com/uas/platform/b2b/model/PurchaseOrderItem.java

@@ -11,8 +11,6 @@ import javax.persistence.ManyToOne;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
 
-import org.codehaus.jackson.annotate.JsonIgnore;
-
 /**
  * 平台里面,以供应商的角度来查看采购订单明细
  * 
@@ -153,7 +151,6 @@ public class PurchaseOrderItem {
 		this.number = number;
 	}
 
-	@JsonIgnore
 	public PurchaseOrder getOrder() {
 		return order;
 	}

+ 10 - 0
src/main/java/com/uas/platform/b2b/service/PurchaseNoticeService.java

@@ -44,6 +44,16 @@ public interface PurchaseNoticeService {
 	 */
 	public PurchaseNotice findById(Long id);
 
+	/**
+	 * 针对送货提醒,填写数量单个发货
+	 * 
+	 * @param noticeId
+	 *            送货提醒ID
+	 * @param send
+	 *            本次发货
+	 */
+	public void send(Long noticeId, SaleSend send);
+
 	/**
 	 * 单个发货
 	 * 

+ 34 - 0
src/main/java/com/uas/platform/b2b/service/impl/PurchaseNoticeServiceImpl.java

@@ -167,4 +167,38 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
 		}
 	}
 
+	@Override
+	public void send(Long noticeId, SaleSend send) {
+		PurchaseNotice notice = purchaseNoticeDao.findOne(noticeId);
+		if (notice != null) {
+			double thisQty = 0;
+			for (SaleSendItem item : send.getSendItems())
+				thisQty += item.getQty();
+			double endQty = (notice.getEndQty() == null ? 0.0 : notice.getEndQty()) + thisQty;
+			if (endQty > notice.getQty())
+				throw new IllegalArgumentException("累计发货数量将超出本次送货提醒的需求数!");
+			PurchaseOrder order = notice.getOrderItem().getOrder();
+			send.setCurrency(order.getCurrency());
+			send.setBackStatus((short) Status.NOT_UPLOAD.value());
+			send.setSendStatus((short) Status.NOT_UPLOAD.value());
+			send.setCustUU(notice.getEnUU());
+			send.setCustUserUU(order.getUserUU());
+			send.setEnUU(SystemSession.getUser().getEnterprise().getUu());
+			send.setPayments(order.getPayments());
+			send.setRate(order.getRate());
+			short number = 0;
+			for (SaleSendItem item : send.getSendItems()) {
+				item.setNoticeId(noticeId);
+				item.setNotice(notice);
+				item.setNumber(++number);
+				item.setPrice(notice.getOrderItem().getPrice());
+				item.setSend(send);
+			}
+			saleSendItemDao.save(send.getSendItems());
+			notice.setEndQty(endQty);
+			notice.setStatus((short) (endQty == notice.getQty() ? Status.REPLIED.value() : Status.NOT_REPLY.value()));
+			purchaseNoticeDao.save(notice);
+		}
+	}
+
 }

+ 1 - 23
src/main/webapp/resources/css/index.css

@@ -134,19 +134,15 @@ a {
 	top: 0;
 	left: 100%;
 	margin-top: 0;
-	margin-left: -1px;
 	-webkit-border-radius: 0 6px 6px 6px;
 	-moz-border-radius: 0 6px 6px 6px;
 	border-radius: 0 6px 6px 6px;
-	left: 100%;
 }
 
 .dropdown-submenu:hover>.dropdown-toggle {
 	position: relative;
 	background-color: #ffffff;
-	border: 1px solid #ccc;
-	border-right: 0;
-	border-left: 0;
+	border-color: transparent;
 	z-index: 1001;
 }
 
@@ -166,24 +162,6 @@ a {
 	border-radius: 5px 5px 5px 0;
 }
 
-.dropdown-submenu>a:after {
-	display: block;
-	content: " ";
-	float: right;
-	width: 0;
-	height: 0;
-	border-color: transparent;
-	border-style: solid;
-	border-width: 5px 0 5px 5px;
-	border-left-color: #cccccc;
-	margin-top: 5px;
-	margin-right: -10px;
-}
-
-.dropdown-submenu:hover>a:after {
-	border-left-color: #ffffff;
-}
-
 .dropdown-submenu.pull-left {
 	float: none;
 }

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

@@ -483,8 +483,20 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
 			}
 		});
 		
-		$scope.onReplyClick = function() {
-			
+		$scope.onReplyClick = function(notice) {
+			if(!notice.send || !notice.send.qty || notice.send.qty > notice.qty - (notice.endQty || 0)) {
+				toaster.pop('warning', '警告', '数量填写错误!');
+			} else if(!notice.send.code) {
+				toaster.pop('warning', '警告', '请填写发货单号!');
+			} else {
+				var send = {code: notice.send.code, sendItems: [{qty: notice.send.qty}]};
+				PurcNotice.save({id: notice.id}, send, function(){
+					toaster.pop('info', '提示', '送货成功');
+					$scope.tableParams.reload();
+				}, function(response){
+					toaster.pop('error', '失败', response);
+				});
+			}
 		};
 	});
 	/**

+ 92 - 34
src/main/webapp/resources/tpl/index/sale/notice.html

@@ -57,6 +57,12 @@
 	padding: 0 5px;
 }
 
+.order-table .order-hd .dropdown-toggle {
+	line-height: 40px;
+	display: block;
+	padding: 0 10px;
+}
+
 .order-table>tbody {
 	border: 1px solid transparent;
 }
@@ -96,21 +102,43 @@
 	border-radius: 3px;
 }
 
-.input-group-xs .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn:not
-	 (:first-child ),.input-group-btn:last-child>.btn {
-	border-top-left-radius: 0;
-	border-bottom-left-radius: 0;
+.order-snapshot .title {
+	border-top: 1px dashed #ddd;
+}
+
+.order-snapshot .dl-horizontal dt {
+	width: 60px;
+	text-align: left;
+	font-weight: normal;
+	color: #999;
+	padding: 4px 0;
 }
 
-@media ( min-width : 768px) {
-	.form-horizontal .form-group-xs .control-label {
-		padding-top: 5px;
-	}
+.order-snapshot .dl-horizontal dd {
+	margin-left: 80px;
+	padding: 4px 0;
+}
+/*arrow*/
+.order-send {
+	position: relative;
+}
+
+.order-send.arrow-border:before,.arrow-border:after {
+	content: '';
+	position: absolute;
+	top: 20px;
+	width: 0;
+	height: 0;
+	border: 7px solid transparent;
 }
 
-.input-trigger .dropdown-menu tr>td>.btn {
-	border-radius: 0;
-	border: none;
+.order-send.arrow-border.arrow-bottom-right:before {
+	content: '';
+	position: absolute;
+	left: -13px;
+	border-bottom-color: #fff;
+	border-right-color: #fff;
+	margin-top: -10px;
 }
 </style>
 <div ng-controller="SaleNoticeCtrl" class="block">
@@ -127,7 +155,8 @@
 						class="tm-h">6</em></a></li>
 				<li><a ui-sref="sale.change"><span>变更中</span><em
 						class="tm-h">2</em></a></li>
-				<li class="active"><a ui-sref="sale.notice"><span>待发货</span><em class="tm-h">0</em></a></li>
+				<li class="active"><a ui-sref="sale.notice"><span>待发货</span><em
+						class="tm-h">0</em></a></li>
 				<li><a href="#"><span>退货中</span><em class="tm-h">0</em></a></li>
 			</ul>
 		</div>
@@ -136,10 +165,10 @@
 		<thead>
 			<tr class="header">
 				<th>商品</th>
-				<th width="90">数量</th>
+				<th width="120">备注</th>
+				<th width="240">数量</th>
 				<th width="90">价格</th>
 				<th width="90">交货日期</th>
-				<th width="120">备注</th>
 				<th width="60">操作</th>
 			</tr>
 			<tr class="sep-row">
@@ -164,15 +193,35 @@
 					<div class="order-main">
 						<span> <input type="checkbox" class="selector"
 							ng-model="notice.$selected">
-						</span> <span class="text-num text-bold"
-							title="{{notice.date}}"
+						</span> <span class="text-num text-bold" title="{{notice.date}}"
 							ng-bind="notice.date | date:'yyyy-MM-dd'"></span>
 					</div>
 				</td>
 				<td colspan="2"><a href="#"
 					ng-bind="notice.orderItem.order.enterprise.enName"></a></td>
-				<td class="text-right" colspan="2" class="order-sum">
-					PO:<a class="text-num text-bold" ng-bind="notice.orderItem.order.code" href="#"></a> 第{{notice.orderItem.number}}行
+				<td class="text-right dropdown" colspan="2" class="order-sum">
+					<a class="dropdown-toggle" href="javascript:void(0);"> <span
+						class="text-num text-bold" ng-bind="notice.orderItem.order.code"></span>
+						第{{notice.orderItem.number}}行
+				</a>
+					<div class="dropdown-menu order-snapshot"
+						style="padding: 10px 15px">
+						<div class="text-center text-bold title">订单快照</div>
+						<dl class="dl-horizontal">
+							<dt>日期</dt>
+							<dd>{{notice.orderItem.order.date | date : 'yyyy-MM-dd'}}</dd>
+							<dt>采购员</dt>
+							<dd>{{notice.orderItem.order.user.userName}}</dd>
+							<dt>付款条件</dt>
+							<dd>{{notice.orderItem.order.payments}}</dd>
+							<dt>付款币种</dt>
+							<dd>{{notice.orderItem.order.currency}}</dd>
+							<dt>交货地址</dt>
+							<dd>{{notice.orderItem.order.shipAddress}}</dd>
+							<dt>备注</dt>
+							<dd>{{notice.orderItem.order.remark}}</dd>
+						</dl>
+					</div>
 				</td>
 				<td class="text-center">
 					<div class="operates">
@@ -192,29 +241,38 @@
 					<div class="text-muted" title="{{notice.orderItem.product.spec}}"
 						ng-bind="notice.orderItem.product.spec"></div>
 				</td>
-				<td>
+				<td class="text-center">
+					<div ng-show="!notice.$editing">{{notice.remark}}</div>
+					<div ng-show="notice.$editing">
+						<input type="text" class="form-control input-xs" ng-model="notice.send.code" placeholder="送货单号">
+					</div>
+				</td>
+				<td class="br-l">
 					<div ng-show="!notice.$editing">
 						<ul>
-							<li>订单数:{{notice.orderItem.qty}}</li>
-							<li>本次需求:{{notice.qty}}</li>
-							<li>已发货:{{notice.endQty}}</li>
-							<li>剩余未货:{{notice.qty-(notice.endQty || 0)}}</li>
+							<li>本次需求:{{notice.qty}}<span class="text-muted pull-right">[订单数:{{notice.orderItem.qty}}]</span></li>
+							<li class="dropdown dropdown-submenu">剩余未发:<span
+								class="text-num text-inverse"
+								ng-bind="notice.qty-(notice.endQty || 0)"></span> <a
+								href="javascript:void(0);" class="dropdown-toggle pull-right"><span
+									ng-class="{'text-muted' : notice.endQty == null || notice.endQty == 0,'text-default': notice.endQty > 0}">[已发货:{{notice.endQty}}]</span></a>
+								<div
+									class="dropdown-menu order-send arrow-border arrow-bottom-right"
+									style="padding: 10px 15px">
+									<span class="text-muted">还未发货</span>
+								</div>
+							</li>
 						</ul>
 					</div>
-					<div style="margin: 0 auto" ng-show="notice.$editing" ng-init="notice.send.qty=notice.qty-(notice.endQty || 0)">
+					<div style="margin: 0 auto" ng-show="notice.$editing"
+						ng-init="notice.send.qty=notice.qty-(notice.endQty || 0)">
 						<input type="text" class="form-control input-xs"
-										ng-model="notice.send.qty" placeholder="数量">
+							ng-model="notice.send.qty" placeholder="数量">
 					</div>
 				</td>
-				<td class="text-center br-l">
-					{{notice.orderItem.price}}
-				</td>
-				<td class="text-center br-l">
-					{{notice.delivery | date : 'yyyy-MM-dd'}}
-				</td>
-				<td class="text-center br-l">
-					{{notice.remark}}
-				</td>
+				<td class="text-center br-l">{{notice.orderItem.price}}</td>
+				<td class="text-center br-l">{{notice.delivery | date :
+					'yyyy-MM-dd'}}</td>
 				<td class="text-center br-l">
 					<div ng-show="!notice.$editing">
 						<a ng-click="notice.$editing=!notice.$editing">发 货</a>