Commit adb2386db04a5a304672adbc8a41f55c3812d9fc

Authored by yeqianyong
2 parents bd99f69f 5bb8337e

Merge branch 'master_after20' into master_cj_zq

@@ -49,6 +49,12 @@ public class GetContractStdProcessingLineBo extends BaseBo<ContractStdProcessing @@ -49,6 +49,12 @@ public class GetContractStdProcessingLineBo extends BaseBo<ContractStdProcessing
49 private String rawProductGrade; 49 private String rawProductGrade;
50 50
51 /** 51 /**
  52 + * 原材料牌号名称
  53 + */
  54 + @ApiModelProperty("原材料牌号")
  55 + private String rawProductGradeName;
  56 +
  57 + /**
52 * 行业 58 * 行业
53 */ 59 */
54 @ApiModelProperty("行业") 60 @ApiModelProperty("行业")
@@ -118,6 +118,8 @@ public class ContractDistributorStandardController extends DefaultBaseController @@ -118,6 +118,8 @@ public class ContractDistributorStandardController extends DefaultBaseController
118 public static final String APPLICABLE_STANDARD_DIC_CODE = "APPLICABLE_STANDARD"; // 执行标准 118 public static final String APPLICABLE_STANDARD_DIC_CODE = "APPLICABLE_STANDARD"; // 执行标准
119 public static final String AUDIT_STATUS_DIC_CODE = "AUDIT_STATUS"; // 审核状态 119 public static final String AUDIT_STATUS_DIC_CODE = "AUDIT_STATUS"; // 审核状态
120 public static final String RAW_TO_PROD_RATIO_DIC_CODE = "RAW_TO_PROD_RATIO"; // 原材料与产品数量比 120 public static final String RAW_TO_PROD_RATIO_DIC_CODE = "RAW_TO_PROD_RATIO"; // 原材料与产品数量比
  121 + public static final String RAW_MATERIAL = "RAW_MATERIAL"; // 原材料
  122 + public static final String RAW_MATERIAL_GRADE = "RAW_MATERIAL_GRADE"; // 原材料牌号
121 123
122 /** 124 /**
123 * 查询列表 125 * 查询列表
@@ -390,12 +392,18 @@ public class ContractDistributorStandardController extends DefaultBaseController @@ -390,12 +392,18 @@ public class ContractDistributorStandardController extends DefaultBaseController
390 List<GetContractStdProcessingLineBo> lineBoList = new ArrayList<>(contractStdProcessingLineList.size()); 392 List<GetContractStdProcessingLineBo> lineBoList = new ArrayList<>(contractStdProcessingLineList.size());
391 List<SysDataDicItem> rawToProdRatioDiciItemList = sysDataDicItemService.findByDicCode(RAW_TO_PROD_RATIO_DIC_CODE); 393 List<SysDataDicItem> rawToProdRatioDiciItemList = sysDataDicItemService.findByDicCode(RAW_TO_PROD_RATIO_DIC_CODE);
392 Map<String, String> rawToProdRatioCodeAndNameMap = rawToProdRatioDiciItemList.stream().collect(Collectors.toMap(SysDataDicItem::getCode, SysDataDicItem::getName)); 394 Map<String, String> rawToProdRatioCodeAndNameMap = rawToProdRatioDiciItemList.stream().collect(Collectors.toMap(SysDataDicItem::getCode, SysDataDicItem::getName));
  395 + List<SysDataDicItem> rawMaterialDiciItemList = sysDataDicItemService.findByDicCode(RAW_MATERIAL);
  396 + Map<String, String> rawMaterialCodeAndNameMap = rawMaterialDiciItemList.stream().collect(Collectors.toMap(SysDataDicItem::getCode, SysDataDicItem::getName));
  397 + List<SysDataDicItem> rawProductGradeDiciItemList = sysDataDicItemService.findByDicCode(RAW_MATERIAL_GRADE);
  398 + Map<String, String> rawProductGradeCodeAndNameMap = rawProductGradeDiciItemList.stream().collect(Collectors.toMap(SysDataDicItem::getCode, SysDataDicItem::getName));
393 contractStdProcessingLineList.forEach(contractStdProcessingLine -> { 399 contractStdProcessingLineList.forEach(contractStdProcessingLine -> {
394 GetContractStdProcessingLineBo contractStdProcessingLineBo = new GetContractStdProcessingLineBo(contractStdProcessingLine); 400 GetContractStdProcessingLineBo contractStdProcessingLineBo = new GetContractStdProcessingLineBo(contractStdProcessingLine);
395 - String rawProductName = productCodeAndNameMap.get(contractStdProcessingLineBo.getRawProductId()); 401 + String rawProductName = rawMaterialCodeAndNameMap.get(contractStdProcessingLineBo.getRawProductId());
  402 + String rawProductGradeName = rawProductGradeCodeAndNameMap.get(contractStdProcessingLineBo.getRawProductGrade());
396 String productName = productCodeAndNameMap.get(contractStdProcessingLineBo.getProductId()); 403 String productName = productCodeAndNameMap.get(contractStdProcessingLineBo.getProductId());
397 String materialProductRatioName = rawToProdRatioCodeAndNameMap.get(contractStdProcessingLineBo.getMaterialProductRatio()); 404 String materialProductRatioName = rawToProdRatioCodeAndNameMap.get(contractStdProcessingLineBo.getMaterialProductRatio());
398 contractStdProcessingLineBo.setRawProductName(rawProductName); 405 contractStdProcessingLineBo.setRawProductName(rawProductName);
  406 + contractStdProcessingLineBo.setRawProductGradeName(rawProductGradeName);
399 contractStdProcessingLineBo.setProductName(productName); 407 contractStdProcessingLineBo.setProductName(productName);
400 contractStdProcessingLineBo.setMaterialProductRatioName(materialProductRatioName); 408 contractStdProcessingLineBo.setMaterialProductRatioName(materialProductRatioName);
401 lineBoList.add(contractStdProcessingLineBo); 409 lineBoList.add(contractStdProcessingLineBo);
@@ -1144,7 +1152,7 @@ public class ContractDistributorStandardController extends DefaultBaseController @@ -1144,7 +1152,7 @@ public class ContractDistributorStandardController extends DefaultBaseController
1144 if (CollectionUtils.isNotEmpty(data.getContractStdProcessingLineList())) { 1152 if (CollectionUtils.isNotEmpty(data.getContractStdProcessingLineList())) {
1145 startRow++; 1153 startRow++;
1146 for (GetContractStdProcessingLineBo line : data.getContractStdProcessingLineList()) { 1154 for (GetContractStdProcessingLineBo line : data.getContractStdProcessingLineList()) {
1147 - setCellValue(sheet, startRow, 1, line.getRawProductName() + "、" + line.getRawProductGrade()); 1155 + setCellValue(sheet, startRow, 1, line.getRawProductName() + "、" + line.getRawProductGradeName());
1148 setCellValue(sheet, startRow, 4, line.getSupplyTime()); 1156 setCellValue(sheet, startRow, 4, line.getSupplyTime());
1149 if ("其它".equals(line.getMaterialProductRatioName())) { 1157 if ("其它".equals(line.getMaterialProductRatioName())) {
1150 setCellValue(sheet, startRow, 5, line.getMaterialProductRatioName() + "|" + line.getMaterialProductRatioRemarks()); 1158 setCellValue(sheet, startRow, 5, line.getMaterialProductRatioName() + "|" + line.getMaterialProductRatioRemarks());
@@ -62,7 +62,6 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram @@ -62,7 +62,6 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram
62 return getBaseMapper().query(vo); 62 return getBaseMapper().query(vo);
63 } 63 }
64 64
65 - @Cacheable(value = ContractFramework.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null")  
66 @Override 65 @Override
67 public ContractFramework findById(String id) { 66 public ContractFramework findById(String id) {
68 67
@@ -77,6 +76,19 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram @@ -77,6 +76,19 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram
77 if (ObjectUtil.isNull(data)) { 76 if (ObjectUtil.isNull(data)) {
78 throw new DefaultClientException("合同框架不存在!"); 77 throw new DefaultClientException("合同框架不存在!");
79 } 78 }
  79 + QueryContractFrameworkVo vo1 = new QueryContractFrameworkVo();
  80 + vo1.setCustomerId(vo.getCustomerId());
  81 + vo1.setCompany(vo.getCompany());
  82 + vo1.setMaterialTypeId(vo.getMaterialTypeId());
  83 + List<ContractFramework> query = this.query(vo1);
  84 + if (CollectionUtils.isNotEmpty(query)) {
  85 + // 过滤掉当前 ID 的记录,看是否还有其他记录
  86 + boolean hasOtherRecords = query.stream()
  87 + .anyMatch(item -> !item.getId().equals(vo.getId()));
  88 + if (hasOtherRecords) {
  89 + throw new DefaultClientException("已经存在相同的框架合同!");
  90 + }
  91 + }
80 92
81 LambdaUpdateWrapper<ContractFramework> updateWrapper = Wrappers.lambdaUpdate(ContractFramework.class) 93 LambdaUpdateWrapper<ContractFramework> updateWrapper = Wrappers.lambdaUpdate(ContractFramework.class)
82 .set(ContractFramework::getCode, vo.getCode()) 94 .set(ContractFramework::getCode, vo.getCode())
@@ -97,7 +109,14 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram @@ -97,7 +109,14 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram
97 @Transactional(rollbackFor = Exception.class) 109 @Transactional(rollbackFor = Exception.class)
98 @Override 110 @Override
99 public String create(CreateContractFrameworkVo vo) { 111 public String create(CreateContractFrameworkVo vo) {
100 - 112 + QueryContractFrameworkVo vo1 = new QueryContractFrameworkVo();
  113 + vo1.setCustomerId(vo.getCustomerId());
  114 + vo1.setCompany(vo.getCompany());
  115 + vo1.setMaterialTypeId(vo.getMaterialTypeId());
  116 + List<ContractFramework> query = this.query(vo1);
  117 + if (CollectionUtils.isNotEmpty(query)) {
  118 + throw new DefaultClientException("已经存在相同的框架合同!");
  119 + }
101 ContractFramework data = new ContractFramework(); 120 ContractFramework data = new ContractFramework();
102 data.setId(IdUtil.getId()); 121 data.setId(IdUtil.getId());
103 data.setCode(vo.getCode()); 122 data.setCode(vo.getCode());
@@ -44,6 +44,7 @@ import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; @@ -44,6 +44,7 @@ import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo;
44 import lombok.extern.slf4j.Slf4j; 44 import lombok.extern.slf4j.Slf4j;
45 import org.apache.commons.collections4.CollectionUtils; 45 import org.apache.commons.collections4.CollectionUtils;
46 import org.apache.commons.collections4.MapUtils; 46 import org.apache.commons.collections4.MapUtils;
  47 +import org.apache.commons.lang3.BooleanUtils;
47 import org.apache.commons.lang3.StringUtils; 48 import org.apache.commons.lang3.StringUtils;
48 import org.springframework.transaction.annotation.Transactional; 49 import org.springframework.transaction.annotation.Transactional;
49 import com.lframework.xingyun.sc.mappers.ShipmentsOrderInfoMapper; 50 import com.lframework.xingyun.sc.mappers.ShipmentsOrderInfoMapper;
@@ -471,7 +472,39 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr @@ -471,7 +472,39 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
471 return; 472 return;
472 } 473 }
473 List<String> orderIds = detailList.stream().map(ShipmentsPlanDetail::getOrderId).distinct().collect(Collectors.toList()); 474 List<String> orderIds = detailList.stream().map(ShipmentsPlanDetail::getOrderId).distinct().collect(Collectors.toList());
474 - purchaseOrderInfoService.updateStatus(orderIds, "DELIVERED"); 475 + // 获取订货单规格数据
  476 + List<PurchaseOrderLine> orderLineList = purchaseOrderLineService.listByOrderIds(orderIds, true);
  477 + if (CollectionUtils.isEmpty(orderLineList)) {
  478 + return;
  479 + }
  480 + // 按照订货单分组
  481 + Map<String, List<PurchaseOrderLine>> orderLineMap = new HashMap<>();
  482 + for (PurchaseOrderLine orderLine : orderLineList) {
  483 + String orderId = orderLine.getPurchaseOrderId();
  484 + List<PurchaseOrderLine> list = orderLineMap.computeIfAbsent(orderId, k -> new ArrayList<>());
  485 + list.add(orderLine);
  486 + }
  487 + List<String> needDeliveryOrderIds = new ArrayList<>();
  488 + for (String orderId : orderIds) {
  489 + List<PurchaseOrderLine> lineList = orderLineMap.get(orderId);
  490 + if (CollectionUtils.isEmpty(lineList)) {
  491 + log.info("========================== 订货单 {} 不存在规格数据!", orderId);
  492 + continue;
  493 + }
  494 + boolean needDelivery = true;
  495 + for (PurchaseOrderLine line : lineList) {
  496 + Boolean shipment = line.getShipment();
  497 + if (!BooleanUtils.isTrue(shipment)) {
  498 + needDelivery = false;
  499 + break;
  500 + }
  501 + }
  502 + if (needDelivery) {
  503 + needDeliveryOrderIds.add(orderId);
  504 + }
  505 + }
  506 +
  507 + purchaseOrderInfoService.updateStatus(needDeliveryOrderIds, "DELIVERED");
475 } 508 }
476 509
477 @Override 510 @Override
@@ -186,40 +186,49 @@ @@ -186,40 +186,49 @@
186 AND tb.standard_approved = #{vo.standardApproved} 186 AND tb.standard_approved = #{vo.standardApproved}
187 </if> 187 </if>
188 <if test="vo.workshopIdList != null and vo.workshopIdList.size() > 0"> 188 <if test="vo.workshopIdList != null and vo.workshopIdList.size() > 0">
189 - OR tb.workshop_id IN 189 + AND tb.workshop_id IN
190 <foreach collection="vo.workshopIdList" open="(" separator="," close=")" item="item"> 190 <foreach collection="vo.workshopIdList" open="(" separator="," close=")" item="item">
191 #{item} 191 #{item}
192 </foreach> 192 </foreach>
193 </if> 193 </if>
194 - <choose>  
195 - <when test="vo.contractIdList != null and vo.contractIdList.size() > 0">  
196 - AND (tb.id IN  
197 - <foreach collection="vo.contractIdList" open="(" separator="," close=")" item="item">  
198 - #{item}  
199 - </foreach>  
200 - <if test="vo.createById != null and vo.createById != ''">  
201 - OR tb.create_by_id = #{vo.createById}  
202 - </if>  
203 - <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">  
204 - OR tb.create_by_id IN  
205 - <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">  
206 - #{item}  
207 - </foreach>  
208 - </if>  
209 - )  
210 - </when>  
211 - <otherwise>  
212 - <if test="vo.createById != null and vo.createById != ''">  
213 - AND tb.create_by_id = #{vo.createById}  
214 - </if>  
215 - <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">  
216 - AND tb.create_by_id IN  
217 - <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">  
218 - #{item}  
219 - </foreach>  
220 - </if>  
221 - </otherwise>  
222 - </choose> 194 + <if test="vo.createById != null and vo.createById != ''">
  195 + AND tb.create_by_id = #{vo.createById}
  196 + </if>
  197 + <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">
  198 + AND tb.create_by_id IN
  199 + <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">
  200 + #{item}
  201 + </foreach>
  202 + </if>
  203 +<!-- <choose>-->
  204 +<!-- <when test="vo.contractIdList != null and vo.contractIdList.size() > 0">-->
  205 +<!-- AND (tb.id IN-->
  206 +<!-- <foreach collection="vo.contractIdList" open="(" separator="," close=")" item="item">-->
  207 +<!-- #{item}-->
  208 +<!-- </foreach>-->
  209 +<!-- <if test="vo.createById != null and vo.createById != ''">-->
  210 +<!-- OR tb.create_by_id = #{vo.createById}-->
  211 +<!-- </if>-->
  212 +<!-- <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">-->
  213 +<!-- OR tb.create_by_id IN-->
  214 +<!-- <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">-->
  215 +<!-- #{item}-->
  216 +<!-- </foreach>-->
  217 +<!-- </if>-->
  218 +<!-- )-->
  219 +<!-- </when>-->
  220 +<!-- <otherwise>-->
  221 +<!-- <if test="vo.createById != null and vo.createById != ''">-->
  222 +<!-- AND tb.create_by_id = #{vo.createById}-->
  223 +<!-- </if>-->
  224 +<!-- <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">-->
  225 +<!-- AND tb.create_by_id IN-->
  226 +<!-- <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">-->
  227 +<!-- #{item}-->
  228 +<!-- </foreach>-->
  229 +<!-- </if>-->
  230 +<!-- </otherwise>-->
  231 +<!-- </choose>-->
223 </where> 232 </where>
224 order by tb.create_time desc 233 order by tb.create_time desc
225 </select> 234 </select>