|
|
@@ -83,9 +83,6 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
|
|
@Autowired
|
|
|
private PrintLogDao printLogDao;
|
|
|
|
|
|
- @Autowired
|
|
|
- private PagingReleaseDao pagingReleaseDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private PurcOrderInfoItemDao purcOrderInfoItemDao;
|
|
|
|
|
|
@@ -107,9 +104,6 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
|
|
@Autowired
|
|
|
private ProductUsersService productUsersService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ProductDao productDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ProductTempDao productTempDao;
|
|
|
|
|
|
@@ -310,18 +304,15 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
|
|
Double replyQty = item.getReplyQty();
|
|
|
replyQty = replyQty == null ? 0 : replyQty;
|
|
|
item.setReplyQty(replyQty + reply.getQty());
|
|
|
- /*if (item.getReplyQty() > item.getQty()) {
|
|
|
- if (isB2b) {
|
|
|
- throw new IllegalOperatorException("回复的数量合计超过了订单数量");
|
|
|
- } else {
|
|
|
- return null;
|
|
|
- }
|
|
|
- }*/
|
|
|
- if (item.getReplyQty() < 0)
|
|
|
+ if (item.getReplyQty() < 0) {
|
|
|
throw new IllegalOperatorException("回复的数量合计不能为负数");
|
|
|
+ }
|
|
|
reply.setOrderItem(item);
|
|
|
reply = purchaseOrderReplyDao.save(reply);
|
|
|
- purchaseOrderItemDao.updateByReply(reply.getDelivery(), reply.getRemark(), item.getId());
|
|
|
+ if (item.getReplyQty() >= item.getQty()) {
|
|
|
+ item.setStatus((short) Status.REPLIED.value());
|
|
|
+ }
|
|
|
+ purchaseOrderItemDao.updateByReply(reply.getDelivery(), reply.getRemark(), item.getId(), item.getStatus());
|
|
|
PurchaseOrder order = item.getOrder();
|
|
|
// 订单主记录状态
|
|
|
order = updateOrderStatus(order.getId());
|
|
|
@@ -348,17 +339,20 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
|
|
private PurchaseOrder updateOrderStatus(long orderId) {
|
|
|
int notReply = purchaseOrderItemDao.getCountByStatus(orderId, (short) Status.NOT_REPLY.value());
|
|
|
PurchaseOrder order = purchaseOrderDao.findOne(orderId);
|
|
|
- if (order.getDisplay() == 1)
|
|
|
- order.setDisplay(Constant.NO);// 设置查看状态为已查看
|
|
|
+ if (order.getDisplay() == 1) {
|
|
|
+ order.setDisplay(Constant.NO);// 设置查看状态为已查看
|
|
|
+ }
|
|
|
order.setStatus((short) (notReply > 0 ? Status.NOT_REPLY.value() : Status.REPLIED.value()));
|
|
|
- if (purchaseOrderItemDao.getCountByReply(orderId) > 0)
|
|
|
- order.setReply(Constant.YES);
|
|
|
- else
|
|
|
- order.setReply(Constant.NO);
|
|
|
- if (purchaseOrderItemDao.getCountByEnd(orderId, Constant.YES) > 0)
|
|
|
- order.setEnd(Constant.YES);
|
|
|
- else
|
|
|
- order.setEnd(Constant.NO);// 反结案之后
|
|
|
+ if (purchaseOrderItemDao.getCountByReply(orderId) > 0) {
|
|
|
+ order.setReply(Constant.YES);
|
|
|
+ } else {
|
|
|
+ order.setReply(Constant.NO);
|
|
|
+ }
|
|
|
+ if (purchaseOrderItemDao.getCountByEnd(orderId, Constant.YES) > 0) {
|
|
|
+ order.setEnd(Constant.YES);
|
|
|
+ } else {
|
|
|
+ order.setEnd(Constant.NO);// 反结案之后
|
|
|
+ }
|
|
|
order = purchaseOrderDao.save(order);
|
|
|
return order;
|
|
|
}
|