|
@@ -51,6 +51,7 @@ import com.sd.business.service.price.PriceBillingStandardDetailService;
|
|
|
import com.sd.business.service.price.PriceBillingStandardService;
|
|
|
import com.sd.business.service.sku.SkuSpecService;
|
|
|
import com.sd.business.service.statement.StatementOfAccountService;
|
|
|
+import com.sd.business.util.CodeEnum;
|
|
|
import com.sd.framework.util.Assert;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -253,7 +254,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
public void add(OrderInfoDto orderDto) {
|
|
|
List<OrderSkuDto> orderSkuList = orderDto.getOrderSkuList();
|
|
|
// 自建订单判断库存
|
|
|
- if (ObjectUtil.equals(orderDto.getType(), 1)) {
|
|
|
+ if (ObjectUtil.equals(orderDto.getType(), 1) && ObjectUtil.notEqual(orderDto.getStatus(), OrderStatusEnum.DRAFT.getKey())) {
|
|
|
this.checkSkuInventory(orderSkuList);
|
|
|
}
|
|
|
|
|
@@ -314,7 +315,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
public void edit(OrderInfoDto orderDto) {
|
|
|
List<OrderSkuDto> orderSkuList = orderDto.getOrderSkuList();
|
|
|
// 自建订单判断库存
|
|
|
- if (ObjectUtil.equals(orderDto.getType(), 1)) {
|
|
|
+ if (ObjectUtil.equals(orderDto.getType(), 1)
|
|
|
+ && ObjectUtil.notEqual(orderDto.getStatus(), OrderStatusEnum.DRAFT.getKey())
|
|
|
+ && ObjectUtil.notEqual(orderDto.getStatus(), OrderStatusEnum.COMPLETION_PRODUCTION.getKey())) {
|
|
|
this.checkSkuInventory(orderSkuList);
|
|
|
}
|
|
|
|
|
@@ -713,6 +716,28 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String getOrderDeliveryCode() {
|
|
|
+ return CodeEnum.SH_CODE.getCode();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveOrderDeliveryCode(OrderInfoDto dto) {
|
|
|
+ OrderInfo orderInfo = this.getById(dto.getId());
|
|
|
+ if (orderInfo == null) {
|
|
|
+ throw new ServiceException("未找到订单");
|
|
|
+ }
|
|
|
+ if (StrUtil.isBlank(dto.getDeliveryCode())) {
|
|
|
+ throw new ServiceException("送货单号不能为空");
|
|
|
+ }
|
|
|
+ OrderInfo one = this.getOne(q -> q.eq(OrderInfo::getDeliveryCode, dto.getDeliveryCode()));
|
|
|
+ if (one != null) {
|
|
|
+ throw new ServiceException("送货单号重复,请重新生成!");
|
|
|
+ }
|
|
|
+ this.update(q -> q.set(OrderInfo::getDeliveryCode, dto.getDeliveryCode())
|
|
|
+ .eq(BaseIdPo::getId, dto.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 删除订单以及订单关联数据
|
|
|
*/
|