Showing
6 changed files
with
49 additions
and
14 deletions
| @@ -132,13 +132,13 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | @@ -132,13 +132,13 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | ||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | /** | 134 | /** |
| 135 | - * 修改 | 135 | + * 填写实际发货日期 |
| 136 | */ | 136 | */ |
| 137 | - @ApiOperation("修改") | 137 | + @ApiOperation("填写实际发货日期") |
| 138 | @HasPermission({"shipping-plan-manage:invoice:modify"}) | 138 | @HasPermission({"shipping-plan-manage:invoice:modify"}) |
| 139 | @PutMapping | 139 | @PutMapping |
| 140 | public InvokeResult<Void> update(@Valid UpdateShipmentsOrderInfoVo vo) { | 140 | public InvokeResult<Void> update(@Valid UpdateShipmentsOrderInfoVo vo) { |
| 141 | - shipmentsOrderInfoService.update(vo); | 141 | + shipmentsOrderInfoService.updateShipmentDate(vo); |
| 142 | return InvokeResultBuilder.success(); | 142 | return InvokeResultBuilder.success(); |
| 143 | } | 143 | } |
| 144 | 144 |
| @@ -1259,7 +1259,12 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge | @@ -1259,7 +1259,12 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge | ||
| 1259 | data.setRegion(region); | 1259 | data.setRegion(region); |
| 1260 | } | 1260 | } |
| 1261 | data.setCustomerId(shipmentsOrderInfo.getCustomerId()); | 1261 | data.setCustomerId(shipmentsOrderInfo.getCustomerId()); |
| 1262 | - data.setShipmentDate(shipmentsOrderInfo.getShipmentsDate()); | 1262 | + // 发货日期处理 |
| 1263 | + LocalDate shipmentsDate = shipmentsOrderInfo.getShipmentsDate(); | ||
| 1264 | + if (BooleanUtils.isFalse(shipmentsOrderInfo.getOnTimeShipment())) { | ||
| 1265 | + shipmentsDate = shipmentsOrderInfo.getNewShipmentDate(); | ||
| 1266 | + } | ||
| 1267 | + data.setShipmentDate(shipmentsDate); | ||
| 1263 | 1268 | ||
| 1264 | String contractType = null; | 1269 | String contractType = null; |
| 1265 | List<String> supplyUnitList = new ArrayList<>(); | 1270 | List<String> supplyUnitList = new ArrayList<>(); |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| @@ -287,8 +287,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -287,8 +287,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 287 | @OpLog(type = OtherOpLogType.class, name = "修改发货单,ID:{}", params = {"#id"}) | 287 | @OpLog(type = OtherOpLogType.class, name = "修改发货单,ID:{}", params = {"#id"}) |
| 288 | @Transactional(rollbackFor = Exception.class) | 288 | @Transactional(rollbackFor = Exception.class) |
| 289 | @Override | 289 | @Override |
| 290 | - public void update(UpdateShipmentsOrderInfoVo vo) { | ||
| 291 | - ShipmentsOrderInfo data = getBaseMapper().selectById(vo.getId()); | 290 | + public void updateShipmentDate(UpdateShipmentsOrderInfoVo vo) { |
| 291 | + ShipmentsOrderInfo data = findById(vo.getId()); | ||
| 292 | if (ObjectUtil.isNull(data)) { | 292 | if (ObjectUtil.isNull(data)) { |
| 293 | throw new DefaultClientException("发货单不存在!"); | 293 | throw new DefaultClientException("发货单不存在!"); |
| 294 | } | 294 | } |
| @@ -297,9 +297,34 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -297,9 +297,34 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 297 | .eq(ShipmentsOrderInfo::getId, vo.getId()); | 297 | .eq(ShipmentsOrderInfo::getId, vo.getId()); |
| 298 | 298 | ||
| 299 | getBaseMapper().update(updateWrapper); | 299 | getBaseMapper().update(updateWrapper); |
| 300 | - | ||
| 301 | - OpLogUtil.setVariable("id", data.getId()); | ||
| 302 | - OpLogUtil.setExtra(vo); | 300 | + // 判断当前日期是否大于等于发货日期 |
| 301 | + LocalDate now = LocalDate.now(); | ||
| 302 | + LocalDate newShipmentDate = vo.getNewShipmentDate(); | ||
| 303 | + if (!now.isBefore(newShipmentDate)) { | ||
| 304 | + List<ShipmentsPlanDetail> detailList = data.getDetailList(); | ||
| 305 | + if (CollectionUtils.isEmpty(detailList)) { | ||
| 306 | + throw new DefaultClientException("发货明细不存在!"); | ||
| 307 | + } | ||
| 308 | + List<String> orderIds = new ArrayList<>(); | ||
| 309 | + List<String> orderSpecIds = new ArrayList<>(); | ||
| 310 | + List<String> detailIds = new ArrayList<>(); | ||
| 311 | + for (ShipmentsPlanDetail detail : detailList) { | ||
| 312 | + String orderId = detail.getOrderId(); | ||
| 313 | + String orderSpecId = detail.getOrderSpecId(); | ||
| 314 | + String detailId = detail.getId(); | ||
| 315 | + if (!orderIds.contains(orderId)) { | ||
| 316 | + orderIds.add(orderId); | ||
| 317 | + } | ||
| 318 | + if (!orderSpecIds.contains(orderSpecId)) { | ||
| 319 | + orderSpecIds.add(orderSpecId); | ||
| 320 | + } | ||
| 321 | + if (!detailIds.contains(detailId)) { | ||
| 322 | + detailIds.add(detailId); | ||
| 323 | + } | ||
| 324 | + } | ||
| 325 | + List<PurchaseOrderInfo> orderInfoList = purchaseOrderInfoService.listByIds(orderIds); | ||
| 326 | + this.handleData(data, orderInfoList, orderSpecIds, detailIds); | ||
| 327 | + } | ||
| 303 | } | 328 | } |
| 304 | 329 | ||
| 305 | @OpLog(type = OtherOpLogType.class, name = "删除发货单,ID:{}", params = {"#id"}) | 330 | @OpLog(type = OtherOpLogType.class, name = "删除发货单,ID:{}", params = {"#id"}) |
| @@ -310,7 +310,9 @@ public class ShipmentDetailStatisticsServiceImpl extends BaseMpServiceImpl<Shipm | @@ -310,7 +310,9 @@ public class ShipmentDetailStatisticsServiceImpl extends BaseMpServiceImpl<Shipm | ||
| 310 | iterator.remove(); | 310 | iterator.remove(); |
| 311 | } | 311 | } |
| 312 | } | 312 | } |
| 313 | - getBaseMapper().batchAdd(needStatisticsDataList); | 313 | + if (CollectionUtils.isNotEmpty(needStatisticsDataList)) { |
| 314 | + getBaseMapper().batchAdd(needStatisticsDataList); | ||
| 315 | + } | ||
| 314 | } | 316 | } |
| 315 | 317 | ||
| 316 | @Override | 318 | @Override |
| @@ -52,7 +52,7 @@ public interface ShipmentsOrderInfoService extends BaseMpService<ShipmentsOrderI | @@ -52,7 +52,7 @@ public interface ShipmentsOrderInfoService extends BaseMpService<ShipmentsOrderI | ||
| 52 | * | 52 | * |
| 53 | * @param vo 数据实体 | 53 | * @param vo 数据实体 |
| 54 | */ | 54 | */ |
| 55 | - void update(UpdateShipmentsOrderInfoVo vo); | 55 | + void updateShipmentDate(UpdateShipmentsOrderInfoVo vo); |
| 56 | 56 | ||
| 57 | /** | 57 | /** |
| 58 | * 根据ID删除 | 58 | * 根据ID删除 |
| @@ -149,9 +149,12 @@ | @@ -149,9 +149,12 @@ | ||
| 149 | o.settlement_terms, | 149 | o.settlement_terms, |
| 150 | o.supply_unit as supplier, | 150 | o.supply_unit as supplier, |
| 151 | o.workshop_id, | 151 | o.workshop_id, |
| 152 | - o.delivery_method, | ||
| 153 | so.code as shipment_order_no, | 152 | so.code as shipment_order_no, |
| 154 | - so.shipments_date as shipment_date, | 153 | + case |
| 154 | + when so.on_time_shipment = true then so.shipments_date | ||
| 155 | + when so.on_time_shipment = false then so.new_shipment_date | ||
| 156 | + else so.shipments_date | ||
| 157 | + end as shipment_date, | ||
| 155 | sc.id as contract_id, | 158 | sc.id as contract_id, |
| 156 | sc.type as contract_type, | 159 | sc.type as contract_type, |
| 157 | sc.packaging_requirements, | 160 | sc.packaging_requirements, |
| @@ -164,7 +167,7 @@ | @@ -164,7 +167,7 @@ | ||
| 164 | left join tbl_contract_distributor_standard sc on o.contract_id = sc.id | 167 | left join tbl_contract_distributor_standard sc on o.contract_id = sc.id |
| 165 | left join tbl_contract_std_processing_line cl on sc.id = cl.contract_id | 168 | left join tbl_contract_std_processing_line cl on sc.id = cl.contract_id |
| 166 | <where> | 169 | <where> |
| 167 | - and sd.del_flag = false | 170 | + and sd.del_flag = false and so.status != 'DRAFT' |
| 168 | <if test="vo.ids != null and vo.ids.size() > 0"> | 171 | <if test="vo.ids != null and vo.ids.size() > 0"> |
| 169 | and sd.id in | 172 | and sd.id in |
| 170 | <foreach collection="vo.ids" open="(" separator="," close=")" item="item"> | 173 | <foreach collection="vo.ids" open="(" separator="," close=")" item="item"> |