|
|
@@ -17,6 +17,8 @@ import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
|
|
|
import okhttp3.*;
|
|
|
import org.springblade.client.entity.Message;
|
|
|
import org.springblade.client.feign.IMessageClient;
|
|
|
+import org.springblade.common.enums.CommonEnum;
|
|
|
+import org.springblade.common.enums.NumberEnum;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.jackson.JsonUtil;
|
|
|
@@ -26,6 +28,7 @@ import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.pay.tonglianPayment.entity.Parameters;
|
|
|
import org.springblade.pay.tonglianPayment.fegin.ITongLianPaymentClient;
|
|
|
import org.springblade.salesPart.entity.*;
|
|
|
+import org.springblade.salesPart.enums.FinalMap;
|
|
|
import org.springblade.salesPart.enums.OrderTypeEnum;
|
|
|
import org.springblade.salesPart.excel.PjShipStockDetails;
|
|
|
import org.springblade.salesPart.excel.ShipItemImportCodeExcel;
|
|
|
@@ -126,7 +129,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
@Override
|
|
|
public PjShip getMessageById(PjShip ship) {
|
|
|
PjShip detail = baseMapper.selectById(ship.getId());
|
|
|
-
|
|
|
+ if (NumberEnum.ONE.number.equals(detail.getIsDeleted())) {
|
|
|
+ throw new NullPointerException("该单据已被删除,请返回列表刷新后重试!");
|
|
|
+ }
|
|
|
//明细
|
|
|
LambdaQueryWrapper<PjShipItems> itemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
itemsLambdaQueryWrapper.eq(PjShipItems::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -187,12 +192,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R saveShipMessage(PjShip ship) {
|
|
|
- if(!org.springframework.util.ObjectUtils.isEmpty(ship.getId())) {
|
|
|
- PjShip srcShip = baseMapper.selectById(ship.getId());
|
|
|
- if (ObjectUtils.isNotNull(srcShip) && !Objects.equals(ship.getVersion(), srcShip.getVersion())) {
|
|
|
- return R.fail(601, "数据已被其他用户更新,请等待刷新后重试");
|
|
|
- }
|
|
|
- }
|
|
|
//获得所属公司
|
|
|
R<Dept> dept = sysClient.getDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
if (ObjectUtil.isNotEmpty(dept)) {
|
|
|
@@ -226,15 +225,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setCreateUser(AuthUtil.getUserId());
|
|
|
ship.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
ship.setTenantId(AuthUtil.getTenantId());
|
|
|
+ ship.setVersion(1);
|
|
|
baseMapper.insert(ship);
|
|
|
} else {
|
|
|
- PjShip shipVersion = baseMapper.selectById(ship.getId());
|
|
|
- if (shipVersion != null && !shipVersion.getVersion().equals(ship.getVersion())) {
|
|
|
- throw new RuntimeException("数据已被修改,请返回列表重新操作!");
|
|
|
- }
|
|
|
ship.setVersion(ship.getVersion() + 1);
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
|
+ ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
|
|
|
baseMapper.updateById(ship);
|
|
|
}
|
|
|
|
|
|
@@ -930,6 +927,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
order.setLogisticsCorpId(ship.getLogisticsCorpId());
|
|
|
order.setLogisticsCorpName(ship.getLogisticsCorpName());
|
|
|
order.setExpressNo(ship.getExpressNo());
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
System.err.println("=============出库完成-" + order.getOrdNo() + "==============");
|
|
|
if (goodsNum.compareTo(sendNum) == 0) {//数量等于发货数量修改销售订单状态
|
|
|
System.err.println("=============数量等于发货数量-" + order.getOrdNo() + "==============");
|
|
|
@@ -1190,6 +1188,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ items.setVersion(items.getVersion() + 1);
|
|
|
orderMapper.updateById(items);
|
|
|
}
|
|
|
}
|
|
|
@@ -1245,10 +1244,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setStatusName(OrderTypeEnum.TOBESHIPPEDOUT.getType());
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
|
- PjShip shipVersion = baseMapper.selectById(ship.getId());
|
|
|
+ ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
|
|
|
+/* PjShip shipVersion = baseMapper.selectById(ship.getId());
|
|
|
if (shipVersion != null && !shipVersion.getVersion().equals(ship.getVersion())) {
|
|
|
throw new RuntimeException("数据已被修改,请返回列表重新操作!");
|
|
|
- }
|
|
|
+ }*/
|
|
|
baseMapper.updateById(ship);
|
|
|
PjOrder order = orderMapper.selectById(ship.getOrdId());
|
|
|
// 保存订单明细
|
|
|
@@ -1418,6 +1418,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
order.setDeliveryBusinesDate(null);
|
|
|
order.setStatus(OrderTypeEnum.XSDFH.getType());
|
|
|
order.setXcxStatus(OrderTypeEnum.XSDFH.getType());
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
orderMapper.updateById(order);
|
|
|
} else {
|
|
|
throw new RuntimeException("数据异常请联系管理员");
|
|
|
@@ -1425,7 +1426,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
|
|
|
if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
|
|
|
BigDecimal sendNumFinancing = itemsList.stream().map(PjShipItems::getSendNumFinancing).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- if (new BigDecimal("0.00").compareTo(sendNumFinancing) != 0) {
|
|
|
+ if (FinalMap.ZERO_POINT_ZERO.compareTo(sendNumFinancing) != 0) {
|
|
|
List<ShipItemsRecord> recordList = shipItemsRecordService.list(new LambdaQueryWrapper<ShipItemsRecord>()
|
|
|
.eq(ShipItemsRecord::getIsDeleted, 0)
|
|
|
.eq(ShipItemsRecord::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -1830,12 +1831,14 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setCreateUser(AuthUtil.getUserId());
|
|
|
ship.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
ship.setTenantId(AuthUtil.getTenantId());
|
|
|
+ ship.setVersion(1);
|
|
|
baseMapper.insert(ship);
|
|
|
} else {
|
|
|
ship.setVersion(ship.getVersion() + 1);
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
|
ship.setStorageName(storageDescMapper.selectById(ship.getStorageId()).getCname());
|
|
|
+ ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
|
|
|
baseMapper.updateById(ship);
|
|
|
}
|
|
|
BigDecimal number = new BigDecimal("0.00");
|
|
|
@@ -2066,6 +2069,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
//修改任务发货数量
|
|
|
PjShip rwShip = baseMapper.selectById(ship.getTaskId());
|
|
|
if (ObjectUtils.isNotNull(rwShip)) {
|
|
|
+ ship.setVersion(Objects.isNull(rwShip.getVersion()) ? 1 : rwShip.getVersion() + 1);
|
|
|
if (ObjectUtils.isNotNull(rwShip.getSendTotalNum())) {
|
|
|
rwShip.setSendTotalNum(rwShip.getSendTotalNum().add(number));
|
|
|
} else {
|
|
|
@@ -2097,9 +2101,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
BigDecimal goodsTotalShipAmount = orderItemsList.stream().map(PjOrderItems::getGoodsTotalShipAmount).filter(Objects::nonNull)
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
if (ObjectUtil.isNotEmpty(order)) {
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
order.setGoodsTotalShipNum(sendNum);
|
|
|
order.setGoodsTotalShipAmount(goodsTotalShipAmount);
|
|
|
- if (goodsNum.compareTo(sendNum) == 0) {//数量等于发货数量修改销售订单状态
|
|
|
+ if (goodsNum.compareTo(sendNum) == 0) {
|
|
|
+ //数量等于发货数量修改销售订单状态
|
|
|
order.setStatus(OrderTypeEnum.RECEIVEDGOODS.getType());
|
|
|
order.setXcxStatus(OrderTypeEnum.RECEIVEDGOODS.getType());
|
|
|
order.setDeliveryBusinesDate(new Date());
|
|
|
@@ -2507,10 +2513,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R revokeWarehousing(PjShip ship) {
|
|
|
- PjShip shipVersion = baseMapper.selectById(ship.getId());
|
|
|
+/* PjShip shipVersion = baseMapper.selectById(ship.getId());
|
|
|
if (shipVersion != null && !shipVersion.getVersion().equals(ship.getVersion())) {
|
|
|
throw new RuntimeException("数据已被修改,请返回列表重新操作!");
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 保存订单明细
|
|
|
BigDecimal number = new BigDecimal("0.00");
|
|
|
List<PjShipItems> shipItemsList = new ArrayList<>();
|
|
|
@@ -2687,10 +2693,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
saveHistory(ship.getId(), OrderTypeEnum.TREATWAREHOUSING.getType());
|
|
|
|
|
|
ship.setStatusName(OrderTypeEnum.TREATWAREHOUSING.getType());
|
|
|
+ ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
|
|
|
baseMapper.updateById(ship);
|
|
|
//修改任务发货数量
|
|
|
PjShip rwShip = baseMapper.selectById(ship.getTaskId());
|
|
|
if (ObjectUtils.isNotNull(rwShip)) {
|
|
|
+ rwShip.setVersion(Objects.isNull(rwShip.getVersion()) ? 1 : rwShip.getVersion() + 1);
|
|
|
rwShip.setSendTotalNum(rwShip.getSendTotalNum().subtract(number));
|
|
|
if (rwShip.getSendTotalNum().compareTo(rwShip.getGoodsTotalNum()) == 0) {
|
|
|
rwShip.setStatusName("已完成");
|
|
|
@@ -2724,6 +2732,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
order.setGoodsTotalShipNum(sendNum);
|
|
|
order.setGoodsTotalShipAmount(goodsTotalShipAmount);
|
|
|
}
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
order.setStatus(OrderTypeEnum.GOODSRECEIVED.getType());
|
|
|
order.setXcxStatus(OrderTypeEnum.GOODSRECEIVED.getType());
|
|
|
order.setDeliveryBusinesDate(null);
|
|
|
@@ -3665,11 +3674,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setCreateUser(AuthUtil.getUserId());
|
|
|
ship.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
ship.setTenantId(AuthUtil.getTenantId());
|
|
|
+ ship.setVersion(1);
|
|
|
baseMapper.insert(ship);
|
|
|
} else {
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
|
ship.setStorageName(storageDescMapper.selectById(ship.getStorageId()).getCname());
|
|
|
+ ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
|
|
|
baseMapper.updateById(ship);
|
|
|
}
|
|
|
// 保存订单明细
|
|
|
@@ -3838,6 +3849,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
//修改任务发货数量
|
|
|
PjShip rwShip = baseMapper.selectById(ship.getTaskId());
|
|
|
if (ObjectUtils.isNotNull(rwShip)) {
|
|
|
+ rwShip.setVersion(Objects.isNull(rwShip.getVersion()) ? 1 : rwShip.getVersion() + 1);
|
|
|
if (ObjectUtils.isNotNull(rwShip.getSendTotalNum())) {
|
|
|
rwShip.setSendTotalNum(rwShip.getSendTotalNum().add(number));
|
|
|
} else {
|
|
|
@@ -3861,11 +3873,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
BigDecimal amount = pjOrderItemsList.stream().map(PjOrderItems::getSubTotalMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
PjOrder order = orderMapper.selectById(ship.getOrdId());
|
|
|
if (ObjectUtil.isNotEmpty(order)) {
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
order.setShipType(ship.getShipType());
|
|
|
order.setLogisticsCorpId(ship.getLogisticsCorpId());
|
|
|
order.setLogisticsCorpName(ship.getLogisticsCorpName());
|
|
|
order.setExpressNo(ship.getExpressNo());
|
|
|
- if (goodsNum.compareTo(sendNum) == 0) {//数量等于发货数量修改销售订单状态
|
|
|
+ if (goodsNum.compareTo(sendNum) == 0) {
|
|
|
+ // 数量等于发货数量修改销售订单状态
|
|
|
order.setStatus("已完成");
|
|
|
order.setXcxStatus("已完成");
|
|
|
order.setDeliveryBusinesDate(new Date());
|
|
|
@@ -3951,6 +3965,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setStatusName(OrderTypeEnum.TOBESHIPPEDOUT.getType());
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
|
+ ship.setVersion(ship.getVersion() + 1);
|
|
|
baseMapper.updateById(ship);
|
|
|
|
|
|
// 保存订单明细
|
|
|
@@ -4090,6 +4105,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
PjShip rwShip = baseMapper.selectById(ship.getTaskId());
|
|
|
if (ObjectUtils.isNotNull(rwShip)) {
|
|
|
rwShip.setSendTotalNum(rwShip.getSendTotalNum().subtract(number));
|
|
|
+ rwShip.setVersion(ObjectUtils.isNull(rwShip.getVersion()) ? 1 : rwShip.getVersion() + 1);
|
|
|
if (rwShip.getSendTotalNum().compareTo(rwShip.getGoodsTotalNum()) == 0) {
|
|
|
rwShip.setStatusName("已完成");
|
|
|
} else {
|
|
|
@@ -4102,6 +4118,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
PjOrder order = orderMapper.selectById(ship.getOrdId());
|
|
|
if (ObjectUtil.isNotEmpty(order)) {
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
order.setStatus("待出库");
|
|
|
order.setXcxStatus("待出库");
|
|
|
order.setDeliveryBusinesDate(null);
|
|
|
@@ -4373,11 +4390,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setCreateUser(AuthUtil.getUserId());
|
|
|
ship.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
ship.setTenantId(AuthUtil.getTenantId());
|
|
|
+ ship.setVersion(1);
|
|
|
baseMapper.insert(ship);
|
|
|
} else {
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
|
ship.setStorageName(storageDescMapper.selectById(ship.getStorageId()).getCname());
|
|
|
+ ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
|
|
|
baseMapper.updateById(ship);
|
|
|
}
|
|
|
BigDecimal number = new BigDecimal("0.00");
|
|
|
@@ -4588,6 +4607,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
//修改任务发货数量
|
|
|
PjShip rwShip = baseMapper.selectById(ship.getTaskId());
|
|
|
if (ObjectUtils.isNotNull(rwShip)) {
|
|
|
+ rwShip.setVersion(Objects.isNull(rwShip.getVersion()) ? 1 : rwShip.getVersion() + 1);
|
|
|
if (ObjectUtils.isNotNull(rwShip.getSendTotalNum())) {
|
|
|
rwShip.setSendTotalNum(rwShip.getSendTotalNum().add(number));
|
|
|
} else {
|
|
|
@@ -4614,7 +4634,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
BigDecimal sendNum = itemsList.stream().map(PjOrderItems::getSendNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
PjOrder order = orderMapper.selectById(ship.getOrdId());
|
|
|
if (ObjectUtil.isNotEmpty(order)) {
|
|
|
- if (goodsNum.compareTo(sendNum) == 0) {//数量等于发货数量修改销售订单状态
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
+ if (goodsNum.compareTo(sendNum) == 0) {
|
|
|
+ // 数量等于发货数量修改销售订单状态
|
|
|
order.setStatus("已完成");
|
|
|
order.setXcxStatus("已完成");
|
|
|
order.setDeliveryBusinesDate(new Date());
|
|
|
@@ -4905,7 +4927,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
//生成出库工单历史记录
|
|
|
saveHistory(ship.getId(), OrderTypeEnum.TREATWAREHOUSING.getType());
|
|
|
-
|
|
|
+ ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
|
|
|
ship.setStatusName(OrderTypeEnum.TREATWAREHOUSING.getType());
|
|
|
baseMapper.updateById(ship);
|
|
|
//修改任务发货数量
|
|
|
@@ -4917,12 +4939,14 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
} else {
|
|
|
rwShip.setStatusName("未完成");
|
|
|
}
|
|
|
+ rwShip.setVersion(Objects.isNull(rwShip) ? 1 : rwShip.getVersion() + 1);
|
|
|
rwShip.setUpdateUser(AuthUtil.getUserId());
|
|
|
rwShip.setUpdateTime(new Date());
|
|
|
baseMapper.updateById(rwShip);
|
|
|
}
|
|
|
PjOrder order = orderMapper.selectById(ship.getOrdId());
|
|
|
if (ObjectUtil.isNotEmpty(order)) {
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
order.setStatus("待入库");
|
|
|
order.setXcxStatus("待入库");
|
|
|
order.setDeliveryBusinesDate(null);
|
|
|
@@ -5247,10 +5271,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setCreateUser(AuthUtil.getUserId());
|
|
|
ship.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
ship.setTenantId(AuthUtil.getTenantId());
|
|
|
+ ship.setVersion(1);
|
|
|
baseMapper.insert(ship);
|
|
|
} else {
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
|
+ ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
|
|
|
baseMapper.updateById(ship);
|
|
|
}
|
|
|
|