|
|
@@ -520,7 +520,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
for (OrderItems orderItems : list) {
|
|
|
if (ObjectUtils.isNull(orderItems.getPurchaseRebatePrice()) || orderItems.getPurchaseRebatePrice().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
purchaseRebatePrice = purchaseRebatePrice.add(new BigDecimal("0.00"));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
purchaseRebatePrice = purchaseRebatePrice.add((orderItems.getPurchaseAmount().subtract(orderItems.getPurchaseRebatePrice())).multiply(orderItems.getOrderQuantity()));
|
|
|
}
|
|
|
}
|
|
|
@@ -1228,12 +1228,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
oneStock.setSurplusRouteQuantity(surplusRouteQuantity.subtract(orderQuantity));
|
|
|
// 增加锁定库存
|
|
|
oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0").add(orderQuantity) : lockingQuantity.add(orderQuantity));
|
|
|
+ oneStock.setVersion(oneStock.getVersion());
|
|
|
stockGoods.add(oneStock);
|
|
|
}
|
|
|
// 更新库存
|
|
|
- boolean goods = stockGoodsClient.updateStockList(stockGoods);
|
|
|
- if (!goods) {
|
|
|
- throw new SecurityException("锁定库存失败: " + salesOrder.getOrderNo() + "更新失败");
|
|
|
+ R goods = stockGoodsClient.updateStockList(stockGoods);
|
|
|
+ if (!goods.isSuccess()) {
|
|
|
+// throw new SecurityException("锁定库存失败: " + salesOrder.getOrderNo() + "更新失败");
|
|
|
+ throw new SecurityException(goods.getMsg());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1676,9 +1678,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
// 减少锁定库存
|
|
|
oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0") : lockingQuantity.subtract(orderQuantity));
|
|
|
// 更新库存
|
|
|
- boolean r = stockGoodsClient.updateStock(oneStock);
|
|
|
- if (!r) {
|
|
|
- throw new SecurityException("驳回失败: 更新库存失败");
|
|
|
+ R res = stockGoodsClient.updateStock(oneStock);
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+// throw new SecurityException("驳回失败: 更新库存失败");
|
|
|
+ throw new SecurityException(res.getMsg());
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -1747,9 +1750,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
// 减少锁定库存
|
|
|
oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0") : lockingQuantity.subtract(orderQuantity));
|
|
|
// 更新库存
|
|
|
- boolean r = stockGoodsClient.updateStock(oneStock);
|
|
|
- if (!r) {
|
|
|
- throw new SecurityException("撤销失败: " + oneStock.getCode() + "更新库存失败");
|
|
|
+ R res = stockGoodsClient.updateStock(oneStock);
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+// throw new SecurityException("撤销失败: " + oneStock.getCode() + "更新库存失败");
|
|
|
+ throw new SecurityException(res.getMsg());
|
|
|
}
|
|
|
|
|
|
});
|
|
|
@@ -1972,12 +1976,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
oneStock.setSurplusRouteQuantity(surplusRouteQuantity.add(orderQuantity));
|
|
|
// 减少锁定库存
|
|
|
oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0") : lockingQuantity.subtract(orderQuantity));
|
|
|
+ oneStock.setVersion(oneStock.getVersion());
|
|
|
stockGoods.add(oneStock);
|
|
|
}
|
|
|
// 更新库存
|
|
|
- boolean r = stockGoodsClient.updateStockList(stockGoods);
|
|
|
- if (!r) {
|
|
|
- throw new SecurityException("撤销失败:" + order.getOrderNo() + "更新库存失败");
|
|
|
+ R r = stockGoodsClient.updateStockList(stockGoods);
|
|
|
+ if (!r.isSuccess()) {
|
|
|
+// throw new SecurityException("撤销失败:" + order.getOrderNo() + "更新库存失败");
|
|
|
+ throw new SecurityException(r.getMsg());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2074,7 +2080,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
data.setSurplusRouteQuantity(data.getSurplusRouteQuantity().subtract(item.getOrderQuantity()));
|
|
|
// 结余金额
|
|
|
data.setBalanceAmount(data.getInAmount().subtract(data.getOutAmount()));
|
|
|
- stockGoodsClient.updateStock(data);
|
|
|
+ R res = stockGoodsClient.updateStock(data);
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
// 更改明细状态
|
|
|
item.setConfirmStatus(3);
|
|
|
item.setUpdateTime(new Date());
|
|
|
@@ -2106,7 +2115,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
data.setSurplusRouteQuantity(data.getSurplusRouteQuantity().add(item.getOrderQuantity()));
|
|
|
// 结余金额
|
|
|
data.setBalanceAmount(data.getInAmount().subtract(data.getOutAmount()));
|
|
|
- stockGoodsClient.updateStock(data);
|
|
|
+ R res = stockGoodsClient.updateStock(data);
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
// 更改明细状态
|
|
|
item.setConfirmStatus(0);
|
|
|
item.setUpdateTime(new Date());
|
|
|
@@ -2788,7 +2800,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
} else {
|
|
|
StockGoods stockGoods = new StockGoods();
|
|
|
if ("CG".equals(order.getBillType())) {
|
|
|
@@ -2920,7 +2935,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
selectOrder.setOrderItemsList(orderItemsList);
|
|
|
@@ -3376,7 +3394,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
StockGoods stockGoods = new StockGoods();
|
|
|
@@ -3585,7 +3606,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
StockGoods stockGoods = new StockGoods();
|
|
|
@@ -4036,7 +4060,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
StockGoods stockGoods = new StockGoods();
|
|
|
@@ -4981,7 +5008,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
}
|
|
|
orderItems.setId(null);
|
|
|
orderItems.setPid(orderNew.getId());
|
|
|
@@ -5081,7 +5111,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
StockGoods stockGoods = new StockGoods();
|
|
|
@@ -5624,7 +5657,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
if (ObjectUtils.isNotNull(orderItemsList) && orderItemsList.size() > 0) {
|
|
|
List<Long> pidList = new ArrayList<>();
|
|
|
for (OrderItems orderItems : orderItemsList) {
|
|
|
- orderItemsMapper.updateById(orderItems);
|
|
|
if (1 == order.getPurchaseStatusType()) {//排产中
|
|
|
if (ObjectUtils.isNotEmpty(orderItems.getDetailType())) {
|
|
|
if (OrderTypeEnum.PARTSTYPE.getType().equals(orderItems.getDetailType())) {
|
|
|
@@ -5685,9 +5717,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
for (String arr : arrs) {
|
|
|
Order selectOrder = baseMapper.selectById(Long.parseLong(arr));
|
|
|
if (ObjectUtils.isNotNull(selectOrder)) {
|
|
|
- selectOrder.setUpdateTime(new Date());
|
|
|
+ /*selectOrder.setUpdateTime(new Date());
|
|
|
selectOrder.setUpdateUser(AuthUtil.getUserId());
|
|
|
- selectOrder.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ selectOrder.setUpdateUserName(AuthUtil.getUserName());*/
|
|
|
|
|
|
//循环发送消息
|
|
|
Message sendMessage = new Message();
|
|
|
@@ -5706,19 +5738,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
sendMessage.setToUserName(selectOrder.getCreateUserName());
|
|
|
if (1 == order.getPurchaseStatusType()) {
|
|
|
sendMessage.setMessageBody("您的销售订单" + selectOrder.getSysNo() + "正在排产中,请查看");
|
|
|
- selectOrder.setProductionScheduling("排产中");
|
|
|
+ /*selectOrder.setProductionScheduling("排产中");
|
|
|
selectOrder.setOrderStatus("排产中");
|
|
|
- selectOrder.setProductionSchedulingDate(order.getProductionSchedulingDate());
|
|
|
+ selectOrder.setProductionSchedulingDate(order.getProductionSchedulingDate());*/
|
|
|
} else if (2 == order.getPurchaseStatusType()) {
|
|
|
sendMessage.setMessageBody("您的销售订单" + selectOrder.getSysNo() + "已预计货好,请查看");
|
|
|
- selectOrder.setProductionScheduling("预计货好");
|
|
|
+ /*selectOrder.setProductionScheduling("预计货好");
|
|
|
selectOrder.setOrderStatus("预计货好");
|
|
|
- selectOrder.setProductionSchedulingDate(order.getEstimateGoodGoodsDate());
|
|
|
+ selectOrder.setProductionSchedulingDate(order.getEstimateGoodGoodsDate());*/
|
|
|
} else if (3 == order.getPurchaseStatusType()) {
|
|
|
sendMessage.setMessageBody("您的销售订单" + selectOrder.getSysNo() + "已采购完成,请查看");
|
|
|
- selectOrder.setProductionScheduling("货备齐");
|
|
|
+ /* selectOrder.setProductionScheduling("货备齐");
|
|
|
selectOrder.setOrderStatus("货备齐");
|
|
|
- selectOrder.setProductionSchedulingDate(new Date());
|
|
|
+ selectOrder.setProductionSchedulingDate(new Date());*/
|
|
|
deliveryClient.updateBySrcId(selectOrder.getId(), "FH", selectOrder.getTradeType());
|
|
|
}
|
|
|
R save = messageClient.save(sendMessage);
|
|
|
@@ -5742,7 +5774,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
throw new SecurityException("发送消息失败");
|
|
|
}
|
|
|
}
|
|
|
- baseMapper.updateById(selectOrder);
|
|
|
+// baseMapper.updateById(selectOrder);
|
|
|
}
|
|
|
}
|
|
|
return R.data(detail);
|
|
|
@@ -6353,7 +6385,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
}
|
|
|
orderItems.setPid(order.getId());
|
|
|
orderItems.setUpdateTime(new Date());
|
|
|
@@ -6598,7 +6633,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
|
|
|
r.getData().setBalanceQuantity(balanceQuantity);
|
|
|
r.getData().setBalanceAmount(balanceAmount);
|
|
|
- stockGoodsClient.updateStock(r.getData());
|
|
|
+ R res = stockGoodsClient.updateStock(r.getData());
|
|
|
+ if (!res.isSuccess()) {
|
|
|
+ throw new RuntimeException(res.getMsg());
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
StockGoods stockGoods = new StockGoods();
|
|
|
@@ -7392,7 +7430,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//给角色为财务的人发送消息
|
|
|
R<String> clientDeptIds = sysClient.getRoleIds(SecureUtil.getTenantId(), "财务");
|
|
|
if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
|
|
|
- R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()),null,null);
|
|
|
+ R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()), null, null);
|
|
|
if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
|
|
|
for (User datum : userList.getData()) {
|
|
|
//循环发送消息
|
|
|
@@ -7574,7 +7612,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//给角色为财务的人发送消息
|
|
|
R<String> clientDeptIds = sysClient.getRoleIds(SecureUtil.getTenantId(), "财务");
|
|
|
if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
|
|
|
- R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()),null,null);
|
|
|
+ R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()), null, null);
|
|
|
if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
|
|
|
for (User datum : userList.getData()) {
|
|
|
//循环发送消息
|