Showing
1 changed file
with
110 additions
and
5 deletions
| @@ -8,6 +8,7 @@ import com.lframework.starter.bpm.dto.FlowTaskDto; | @@ -8,6 +8,7 @@ import com.lframework.starter.bpm.dto.FlowTaskDto; | ||
| 8 | import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; | 8 | import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; |
| 9 | import com.lframework.starter.bpm.service.FlowInstanceWrapperService; | 9 | import com.lframework.starter.bpm.service.FlowInstanceWrapperService; |
| 10 | import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; | 10 | import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; |
| 11 | +import com.lframework.starter.common.utils.CollectionUtil; | ||
| 11 | import com.lframework.starter.common.utils.StringUtil; | 12 | import com.lframework.starter.common.utils.StringUtil; |
| 12 | import com.lframework.starter.mq.core.service.MqProducerService; | 13 | import com.lframework.starter.mq.core.service.MqProducerService; |
| 13 | import com.lframework.starter.web.core.components.security.SecurityUtil; | 14 | import com.lframework.starter.web.core.components.security.SecurityUtil; |
| @@ -51,18 +52,21 @@ import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorS | @@ -51,18 +52,21 @@ import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorS | ||
| 51 | import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractStdProcessingLineVo; | 52 | import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractStdProcessingLineVo; |
| 52 | import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderInfoVo; | 53 | import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderInfoVo; |
| 53 | import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; | 54 | import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; |
| 55 | +import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; | ||
| 54 | import lombok.extern.slf4j.Slf4j; | 56 | import lombok.extern.slf4j.Slf4j; |
| 55 | import org.apache.commons.collections4.CollectionUtils; | 57 | import org.apache.commons.collections4.CollectionUtils; |
| 56 | import org.apache.commons.lang3.StringUtils; | 58 | import org.apache.commons.lang3.StringUtils; |
| 57 | import org.springframework.beans.factory.annotation.Autowired; | 59 | import org.springframework.beans.factory.annotation.Autowired; |
| 58 | import org.springframework.cache.annotation.CacheEvict; | 60 | import org.springframework.cache.annotation.CacheEvict; |
| 59 | import org.springframework.cache.annotation.Cacheable; | 61 | import org.springframework.cache.annotation.Cacheable; |
| 62 | +import org.springframework.security.core.parameters.P; | ||
| 60 | import org.springframework.stereotype.Service; | 63 | import org.springframework.stereotype.Service; |
| 61 | import org.springframework.transaction.annotation.Transactional; | 64 | import org.springframework.transaction.annotation.Transactional; |
| 62 | 65 | ||
| 63 | import javax.annotation.Resource; | 66 | import javax.annotation.Resource; |
| 64 | import java.io.Serializable; | 67 | import java.io.Serializable; |
| 65 | import java.math.BigDecimal; | 68 | import java.math.BigDecimal; |
| 69 | +import java.math.RoundingMode; | ||
| 66 | import java.time.LocalDate; | 70 | import java.time.LocalDate; |
| 67 | import java.time.LocalDateTime; | 71 | import java.time.LocalDateTime; |
| 68 | import java.util.*; | 72 | import java.util.*; |
| @@ -1315,6 +1319,110 @@ public class ContractDistributorStandardServiceImpl extends | @@ -1315,6 +1319,110 @@ public class ContractDistributorStandardServiceImpl extends | ||
| 1315 | if (ObjectUtil.isNull(vo)) { | 1319 | if (ObjectUtil.isNull(vo)) { |
| 1316 | throw new DefaultClientException("订货单表不存在!"); | 1320 | throw new DefaultClientException("订货单表不存在!"); |
| 1317 | } | 1321 | } |
| 1322 | + | ||
| 1323 | + //合计不含税金额 | ||
| 1324 | + BigDecimal totalAmountExcludingTax = BigDecimal.ZERO; | ||
| 1325 | + //合计总金额 | ||
| 1326 | + BigDecimal totalAmountIncludingTax = BigDecimal.ZERO; | ||
| 1327 | + //更新物料信息 | ||
| 1328 | + QueryPurchaseOrderLineVo vo1 = new QueryPurchaseOrderLineVo(); | ||
| 1329 | + vo1.setPurchaseOrderId(orderId); | ||
| 1330 | + List<PurchaseOrderLine> purchaseOrderLineList = purchaseOrderLineService.query(vo1); | ||
| 1331 | + if (CollectionUtil.isNotEmpty(purchaseOrderLineList)) { | ||
| 1332 | + for (PurchaseOrderLine line : purchaseOrderLineList) { | ||
| 1333 | + if ("PROCESS_STD_AGMT".equals(vo.getContractType())) { | ||
| 1334 | + //加工合同 | ||
| 1335 | + UpdateContractStdProcessingLineVo vo2 = new UpdateContractStdProcessingLineVo(); | ||
| 1336 | + ContractStdProcessingLine data = contractStdProcessingLineService.findById(line.getContractDistributorLineId()); | ||
| 1337 | + if (ObjectUtil.isNull(data)) { | ||
| 1338 | + continue; | ||
| 1339 | + } | ||
| 1340 | + vo2.setId(line.getContractDistributorLineId()); | ||
| 1341 | + vo2.setContractId(vo.getContractId()); | ||
| 1342 | + vo2.setRawProductId(data.getRawProductId()); | ||
| 1343 | + vo2.setRawProductGrade(data.getRawProductGrade()); | ||
| 1344 | + vo2.setIndustry(line.getIndustry()); | ||
| 1345 | + vo2.setQuality(line.getQuality()); | ||
| 1346 | + vo2.setLossRate(data.getLossRate()); | ||
| 1347 | + vo2.setSupplyTime(data.getSupplyTime()); | ||
| 1348 | + vo2.setMaterialProductRatio(data.getMaterialProductRatio()); | ||
| 1349 | + vo2.setMaterialProductRatioRemarks(data.getMaterialProductRatioRemarks()); | ||
| 1350 | + vo2.setProductId(data.getProductId()); | ||
| 1351 | + vo2.setProductGrade(line.getBrand()); | ||
| 1352 | + vo2.setProductStatus(line.getStatus()); | ||
| 1353 | + vo2.setProductQuantity(line.getQuantity()); | ||
| 1354 | + vo2.setThickness(line.getThickness()); | ||
| 1355 | + vo2.setThicknessTolNeg(line.getThicknessTolNeg()); | ||
| 1356 | + vo2.setThicknessTolPos(line.getThicknessTolPos()); | ||
| 1357 | + vo2.setWidth(line.getWidth()); | ||
| 1358 | + vo2.setWidthTolPos(line.getWidthTolPos()); | ||
| 1359 | + vo2.setWidthTolNeg(line.getWidthTolNeg()); | ||
| 1360 | + vo2.setLength(line.getLength()); | ||
| 1361 | + vo2.setLengthTolPos(line.getLengthTolPos()); | ||
| 1362 | + vo2.setLengthTolNeg(line.getLengthTolNeg()); | ||
| 1363 | + vo2.setUnitPrice(line.getSalesPrice()); | ||
| 1364 | + if (line.getQuantity() != null && line.getSalesPrice() != null) { | ||
| 1365 | + //总金额 | ||
| 1366 | + BigDecimal result = line.getQuantity().multiply(line.getSalesPrice()).setScale(2, RoundingMode.HALF_UP); | ||
| 1367 | + vo2.setTotalAmount(result); | ||
| 1368 | + totalAmountIncludingTax.add(result); | ||
| 1369 | + //不含税金额 | ||
| 1370 | + BigDecimal divisor = new BigDecimal("1.13"); | ||
| 1371 | + BigDecimal finalResult = result.divide(divisor, 2, RoundingMode.HALF_UP); | ||
| 1372 | + vo2.setAmountExcludingTax(finalResult); | ||
| 1373 | + totalAmountExcludingTax.add(finalResult); | ||
| 1374 | + } | ||
| 1375 | + vo2.setDeliveryDate(line.getDeliveryDate()); | ||
| 1376 | + vo2.setShowOrder(data.getShowOrder()); | ||
| 1377 | + vo2.setItemId(data.getItemId()); | ||
| 1378 | + vo2.setSampleOrder(line.getSampleOrder()); | ||
| 1379 | + vo2.setMaterialCode(data.getMaterialCode()); | ||
| 1380 | + contractStdProcessingLineService.update(vo2); | ||
| 1381 | + } else { | ||
| 1382 | + UpdateContractDistributorLineVo vo2 = new UpdateContractDistributorLineVo(); | ||
| 1383 | + ContractDistributorLine data = contractDistributorLineService.findById(line.getContractDistributorLineId()); | ||
| 1384 | + if (ObjectUtil.isNull(data)) { | ||
| 1385 | + continue; | ||
| 1386 | + } | ||
| 1387 | + vo2.setId(line.getContractDistributorLineId()); | ||
| 1388 | + vo2.setContractId(vo.getContractId()); | ||
| 1389 | + vo2.setIndustry(line.getIndustry()); | ||
| 1390 | + vo2.setQuality(line.getQuality()); | ||
| 1391 | + vo2.setBrand(line.getBrand()); | ||
| 1392 | + vo2.setThickness(line.getThickness()); | ||
| 1393 | + vo2.setThicknessTolNeg(line.getThicknessTolNeg()); | ||
| 1394 | + vo2.setThicknessTolPos(line.getThicknessTolPos()); | ||
| 1395 | + vo2.setWidth(line.getWidth()); | ||
| 1396 | + vo2.setWidthTolPos(line.getWidthTolPos()); | ||
| 1397 | + vo2.setWidthTolNeg(line.getWidthTolNeg()); | ||
| 1398 | + vo2.setLength(line.getLength()); | ||
| 1399 | + vo2.setLengthTolPos(line.getLengthTolPos()); | ||
| 1400 | + vo2.setLengthTolNeg(line.getLengthTolNeg()); | ||
| 1401 | + vo2.setStatus(line.getStatus()); | ||
| 1402 | + vo2.setQuantity(line.getQuantity()); | ||
| 1403 | + vo2.setUnitPrice(line.getSalesPrice()); | ||
| 1404 | + if (line.getQuantity() != null && line.getSalesPrice() != null) { | ||
| 1405 | + //总金额 | ||
| 1406 | + BigDecimal result = line.getQuantity().multiply(line.getSalesPrice()).setScale(2, RoundingMode.HALF_UP); | ||
| 1407 | + vo2.setTotalAmount(result); | ||
| 1408 | + totalAmountIncludingTax.add(result); | ||
| 1409 | + //不含税金额 | ||
| 1410 | + BigDecimal divisor = new BigDecimal("1.13"); | ||
| 1411 | + BigDecimal finalResult = result.divide(divisor, 2, RoundingMode.HALF_UP); | ||
| 1412 | + vo2.setAmountExcludingTax(finalResult); | ||
| 1413 | + totalAmountExcludingTax.add(finalResult); | ||
| 1414 | + } | ||
| 1415 | + vo2.setDeliveryDate(line.getDeliveryDate()); | ||
| 1416 | + vo2.setShowOrder(data.getShowOrder()); | ||
| 1417 | + vo2.setProductId(data.getProductId()); | ||
| 1418 | + vo2.setItemId(data.getItemId()); | ||
| 1419 | + vo2.setSampleOrder(line.getSampleOrder()); | ||
| 1420 | + vo2.setMaterialCode(data.getMaterialCode()); | ||
| 1421 | + contractDistributorLineService.update(vo2); | ||
| 1422 | + } | ||
| 1423 | + } | ||
| 1424 | + } | ||
| 1425 | + | ||
| 1318 | //更新基本信息 | 1426 | //更新基本信息 |
| 1319 | LambdaUpdateWrapper<ContractDistributorStandard> updateWrapper = Wrappers.lambdaUpdate(ContractDistributorStandard.class) | 1427 | LambdaUpdateWrapper<ContractDistributorStandard> updateWrapper = Wrappers.lambdaUpdate(ContractDistributorStandard.class) |
| 1320 | .set(ContractDistributorStandard::getSupplier, vo.getSupplyUnit()) | 1428 | .set(ContractDistributorStandard::getSupplier, vo.getSupplyUnit()) |
| @@ -1336,16 +1444,13 @@ public class ContractDistributorStandardServiceImpl extends | @@ -1336,16 +1444,13 @@ public class ContractDistributorStandardServiceImpl extends | ||
| 1336 | .set(ContractDistributorStandard::getPackaging, vo.getPackaging()) | 1444 | .set(ContractDistributorStandard::getPackaging, vo.getPackaging()) |
| 1337 | .set(ContractDistributorStandard::getRemarks, vo.getRemarks()) | 1445 | .set(ContractDistributorStandard::getRemarks, vo.getRemarks()) |
| 1338 | //合计不含税金额 | 1446 | //合计不含税金额 |
| 1339 | -// .set(ContractDistributorStandard::getTotalAmountExcludingTax, ) | 1447 | + .set(ContractDistributorStandard::getTotalAmountExcludingTax, totalAmountExcludingTax) |
| 1340 | //合计总金额 | 1448 | //合计总金额 |
| 1341 | -// .set(ContractDistributorStandard::getTotalAmountIncludingTax, ) | 1449 | + .set(ContractDistributorStandard::getTotalAmountIncludingTax, totalAmountIncludingTax) |
| 1342 | .set(ContractDistributorStandard::getTotalQuantity, vo.getTotalQuantity()) | 1450 | .set(ContractDistributorStandard::getTotalQuantity, vo.getTotalQuantity()) |
| 1343 | .eq(ContractDistributorStandard::getId, vo.getContractId()); | 1451 | .eq(ContractDistributorStandard::getId, vo.getContractId()); |
| 1344 | 1452 | ||
| 1345 | getBaseMapper().update(updateWrapper); | 1453 | getBaseMapper().update(updateWrapper); |
| 1346 | - | ||
| 1347 | - //更新物料信息 | ||
| 1348 | - | ||
| 1349 | } | 1454 | } |
| 1350 | 1455 | ||
| 1351 | @CacheEvict(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") | 1456 | @CacheEvict(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") |