Commit f8773fa23a47cadbd9df7f3cec081bd52e1c6114

Authored by 房远帅
2 parents 4fb0c499 93e325a2

Merge branch 'master_after0416' into master_after0225

@@ -303,6 +303,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -303,6 +303,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
303 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) 303 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
304 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { 304 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
305 purchaseOrderInfoService.updateStatus(businessId, "PASS"); 305 purchaseOrderInfoService.updateStatus(businessId, "PASS");
  306 + //审核通过,需要同步修改合同相关内容(变更,不需要这个逻辑)
  307 +// contractDistributorStandardService.orderUpdateContract(businessId);
306 //审核通过,物料行存在试样订单的需要对当前订单拆分 308 //审核通过,物料行存在试样订单的需要对当前订单拆分
307 packPurchaseOrderInfo(businessId); 309 packPurchaseOrderInfo(businessId);
308 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) 310 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)
@@ -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.*;
@@ -1307,6 +1311,148 @@ public class ContractDistributorStandardServiceImpl extends @@ -1307,6 +1311,148 @@ public class ContractDistributorStandardServiceImpl extends
1307 }); 1311 });
1308 } 1312 }
1309 1313
  1314 + @OpLog(type = OtherOpLogType.class, name = "订单修改合同,ID:{}", params = {"#id"})
  1315 + @Transactional(rollbackFor = Exception.class)
  1316 + @Override
  1317 + public void orderUpdateContract(String orderId) {
  1318 + PurchaseOrderInfo vo = purchaseOrderInfoService.findById(orderId);
  1319 + if (ObjectUtil.isNull(vo)) {
  1320 + throw new DefaultClientException("订货单表不存在!");
  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 +
  1426 + //更新基本信息
  1427 + LambdaUpdateWrapper<ContractDistributorStandard> updateWrapper = Wrappers.lambdaUpdate(ContractDistributorStandard.class)
  1428 + .set(ContractDistributorStandard::getSupplier, vo.getSupplyUnit())
  1429 + .set(ContractDistributorStandard::getBuyer, vo.getOrderingUnit())
  1430 + .set(vo.getDeptId() != null, ContractDistributorStandard::getDeptId, vo.getDeptId())
  1431 + .set(vo.getRegion() != null, ContractDistributorStandard::getRegion, vo.getRegion())
  1432 + .set(vo.getStockUpCompanyId() != null, ContractDistributorStandard::getStockUpCompanyId, vo.getStockUpCompanyId())
  1433 + .set(ContractDistributorStandard::getOrderDate, vo.getOrderDate())
  1434 + .set(ContractDistributorStandard::getWorkshopId, vo.getWorkshopId())
  1435 + .set(ContractDistributorStandard::getPaymentTerms, vo.getSettlementTerms())
  1436 + .set(ContractDistributorStandard::getExecutionStandard, vo.getExecutionStandard())
  1437 + .set(ContractDistributorStandard::getExecutionStandardRemarks, vo.getExecutionStandardRemarks())
  1438 + .set(ContractDistributorStandard::getTransportMode, vo.getDeliveryMethod())
  1439 + .set(ContractDistributorStandard::getPieceWeightHead, vo.getPieceWeightHeader())
  1440 + .set(ContractDistributorStandard::getSurface, vo.getSurface())
  1441 + .set(ContractDistributorStandard::getTolerance, vo.getTolerance())
  1442 + .set(ContractDistributorStandard::getPerformance, vo.getPerformance())
  1443 + .set(ContractDistributorStandard::getComponent, vo.getElement())
  1444 + .set(ContractDistributorStandard::getPackaging, vo.getPackaging())
  1445 + .set(ContractDistributorStandard::getRemarks, vo.getRemarks())
  1446 + //合计不含税金额
  1447 + .set(ContractDistributorStandard::getTotalAmountExcludingTax, totalAmountExcludingTax)
  1448 + //合计总金额
  1449 + .set(ContractDistributorStandard::getTotalAmountIncludingTax, totalAmountIncludingTax)
  1450 + .set(ContractDistributorStandard::getTotalQuantity, vo.getTotalQuantity())
  1451 + .eq(ContractDistributorStandard::getId, vo.getContractId());
  1452 +
  1453 + getBaseMapper().update(updateWrapper);
  1454 + }
  1455 +
1310 @CacheEvict(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") 1456 @CacheEvict(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
1311 @Override 1457 @Override
1312 public void cleanCacheByKey(Serializable key) { 1458 public void cleanCacheByKey(Serializable key) {
@@ -421,7 +421,9 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde @@ -421,7 +421,9 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
421 .set(PurchaseOrderInfo::getOrderNo, StringUtil.isBlank(vo.getOrderNo()) ? null : vo.getOrderNo()) 421 .set(PurchaseOrderInfo::getOrderNo, StringUtil.isBlank(vo.getOrderNo()) ? null : vo.getOrderNo())
422 .set(PurchaseOrderInfo::getSupplyUnit, StringUtil.isBlank(vo.getSupplyUnit()) ? null : vo.getSupplyUnit()) 422 .set(PurchaseOrderInfo::getSupplyUnit, StringUtil.isBlank(vo.getSupplyUnit()) ? null : vo.getSupplyUnit())
423 .set(PurchaseOrderInfo::getOrderingUnit, StringUtil.isBlank(vo.getOrderingUnit()) ? null : vo.getOrderingUnit()) 423 .set(PurchaseOrderInfo::getOrderingUnit, StringUtil.isBlank(vo.getOrderingUnit()) ? null : vo.getOrderingUnit())
  424 + .set(PurchaseOrderInfo::getStockUpCompanyId, StringUtil.isBlank(vo.getStockUpCompanyId()) ? null : vo.getStockUpCompanyId())
424 .set(PurchaseOrderInfo::getOrderDate, vo.getOrderDate() == null ? null : vo.getOrderDate()) 425 .set(PurchaseOrderInfo::getOrderDate, vo.getOrderDate() == null ? null : vo.getOrderDate())
  426 + .set(PurchaseOrderInfo::getRegion, StringUtil.isBlank(vo.getRegion()) ? null : vo.getRegion())
425 .set(PurchaseOrderInfo::getSettlementTerms, StringUtil.isBlank(vo.getSettlementTerms()) ? null : vo.getSettlementTerms()) 427 .set(PurchaseOrderInfo::getSettlementTerms, StringUtil.isBlank(vo.getSettlementTerms()) ? null : vo.getSettlementTerms())
426 .set(PurchaseOrderInfo::getDeliveryMethod, StringUtil.isBlank(vo.getDeliveryMethod()) ? null : vo.getDeliveryMethod()) 428 .set(PurchaseOrderInfo::getDeliveryMethod, StringUtil.isBlank(vo.getDeliveryMethod()) ? null : vo.getDeliveryMethod())
427 .set(PurchaseOrderInfo::getPriceListNo, StringUtil.isBlank(vo.getPriceListNo()) ? null : vo.getPriceListNo()) 429 .set(PurchaseOrderInfo::getPriceListNo, StringUtil.isBlank(vo.getPriceListNo()) ? null : vo.getPriceListNo())
@@ -125,4 +125,9 @@ public interface ContractDistributorStandardService extends BaseMpService<Contra @@ -125,4 +125,9 @@ public interface ContractDistributorStandardService extends BaseMpService<Contra
125 * 合同规范补充提醒 125 * 合同规范补充提醒
126 */ 126 */
127 void supplementContractSpecReminder(); 127 void supplementContractSpecReminder();
  128 +
  129 + /**
  130 + * 订单变动后同步修改合同相关信息
  131 + */
  132 + void orderUpdateContract(String orderId);
128 } 133 }
@@ -51,6 +51,12 @@ public class UpdatePurchaseOrderInfoVo implements BaseVo, Serializable { @@ -51,6 +51,12 @@ public class UpdatePurchaseOrderInfoVo implements BaseVo, Serializable {
51 private String orderingUnitName; 51 private String orderingUnitName;
52 52
53 /** 53 /**
  54 + * 备货单位ID
  55 + */
  56 + @ApiModelProperty("备货单位ID")
  57 + private String stockUpCompanyId;
  58 +
  59 + /**
54 * 订货日期 60 * 订货日期
55 */ 61 */
56 @ApiModelProperty("订货日期") 62 @ApiModelProperty("订货日期")
@@ -185,6 +191,12 @@ public class UpdatePurchaseOrderInfoVo implements BaseVo, Serializable { @@ -185,6 +191,12 @@ public class UpdatePurchaseOrderInfoVo implements BaseVo, Serializable {
185 private String workshopId; 191 private String workshopId;
186 192
187 /** 193 /**
  194 + * 区域
  195 + */
  196 + @ApiModelProperty("区域")
  197 + private String region;
  198 +
  199 + /**
188 * 客户资信Id 200 * 客户资信Id
189 */ 201 */
190 @ApiModelProperty("客户资信Id") 202 @ApiModelProperty("客户资信Id")