Commit 1d7c3c18d4192678c0541d54421df28cdd4e1b69

Authored by 房远帅
1 parent 65754a68

楚江ERP:发货计划中延期一天自动加入后日预发

@@ -135,6 +135,25 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP @@ -135,6 +135,25 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
135 OpLogUtil.setExtra(vo); 135 OpLogUtil.setExtra(vo);
136 } 136 }
137 137
  138 + @OpLog(type = OtherOpLogType.class, name = "修改发货计划明细,ID:{}", params = {"#id"})
  139 + @Transactional(rollbackFor = Exception.class)
  140 + @Override
  141 + public void updateShipmentDate(String id, LocalDate shipmentDate) {
  142 +
  143 + ShipmentsPlanDetail data = getBaseMapper().selectById(id);
  144 + if (ObjectUtil.isNull(data)) {
  145 + throw new DefaultClientException("发货计划明细不存在!");
  146 + }
  147 +
  148 + LambdaUpdateWrapper<ShipmentsPlanDetail> updateWrapper = Wrappers.lambdaUpdate(ShipmentsPlanDetail.class)
  149 + .set(ShipmentsPlanDetail::getShipmentsDate, shipmentDate)
  150 + .eq(ShipmentsPlanDetail::getId, id);
  151 + getBaseMapper().update(updateWrapper);
  152 +
  153 + OpLogUtil.setVariable("id", data.getId());
  154 + OpLogUtil.setExtra(id);
  155 + }
  156 +
138 /** 157 /**
139 * 获取可以发货的列表数据 158 * 获取可以发货的列表数据
140 * 159 *
@@ -163,13 +163,16 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen @@ -163,13 +163,16 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen
163 for (CreateDelayedShipmentDetailVo createDelayedShipmentDetailVo : delayedShipmentDetailList) { 163 for (CreateDelayedShipmentDetailVo createDelayedShipmentDetailVo : delayedShipmentDetailList) {
164 createDelayedShipmentDetailVo.setDelayedShipmentId(data.getId()); 164 createDelayedShipmentDetailVo.setDelayedShipmentId(data.getId());
165 id = delayedShipmentDetailService.create(createDelayedShipmentDetailVo); 165 id = delayedShipmentDetailService.create(createDelayedShipmentDetailVo);
166 - ids.add(createDelayedShipmentDetailVo.getShipmentsPlanDetailId());  
167 LocalDate deliveryDate = createDelayedShipmentDetailVo.getDeliveryDate(); 166 LocalDate deliveryDate = createDelayedShipmentDetailVo.getDeliveryDate();
168 applyShipmentDate = createDelayedShipmentDetailVo.getApplyShipmentDate(); 167 applyShipmentDate = createDelayedShipmentDetailVo.getApplyShipmentDate();
169 if (deliveryDate != null && applyShipmentDate != null) { 168 if (deliveryDate != null && applyShipmentDate != null) {
170 long daysBetween = Math.abs(ChronoUnit.DAYS.between(deliveryDate, applyShipmentDate)); 169 long daysBetween = Math.abs(ChronoUnit.DAYS.between(deliveryDate, applyShipmentDate));
171 if (daysBetween > 1) { 170 if (daysBetween > 1) {
  171 + ids.add(createDelayedShipmentDetailVo.getShipmentsPlanDetailId());
172 delayedExceedOneDay = true; 172 delayedExceedOneDay = true;
  173 + } else {
  174 + //延期等于1天的自动加入后日预发
  175 + shipmentsPlanDetailService.updateShipmentDate(createDelayedShipmentDetailVo.getShipmentsPlanDetailId(), applyShipmentDate);
173 } 176 }
174 } 177 }
175 } 178 }
@@ -7,6 +7,8 @@ import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanDetailVo; @@ -7,6 +7,8 @@ import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanDetailVo;
7 import com.lframework.xingyun.sc.entity.ShipmentsPlanDetail; 7 import com.lframework.xingyun.sc.entity.ShipmentsPlanDetail;
8 import com.lframework.starter.web.core.service.BaseMpService; 8 import com.lframework.starter.web.core.service.BaseMpService;
9 import com.lframework.starter.web.core.components.resp.PageResult; 9 import com.lframework.starter.web.core.components.resp.PageResult;
  10 +
  11 +import java.time.LocalDate;
10 import java.util.List; 12 import java.util.List;
11 13
12 /** 14 /**
@@ -46,6 +48,13 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD @@ -46,6 +48,13 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD
46 void create(CreateShipmentsPlanDetailVo vo); 48 void create(CreateShipmentsPlanDetailVo vo);
47 49
48 /** 50 /**
  51 + * 更新发货日期
  52 + *
  53 + * @param shipmentDate 发货日期
  54 + */
  55 + void updateShipmentDate(String id, LocalDate shipmentDate);
  56 +
  57 + /**
49 * 修改 58 * 修改
50 * 59 *
51 * @param vo 数据实体 60 * @param vo 数据实体