Commit 528c150982f85aab5652ff8f822e25c8f0065697

Authored by 房远帅
1 parent 36833415

1:锁规合同编码+_01;2:库存合同新增筛选条件“锁价状态”;3:未锁规合同新增筛选条件“锁规状态”

... ... @@ -1418,8 +1418,11 @@ public class ContractDistributorStandardServiceImpl extends
1418 1418
1419 1419 // 判断锁规是否完成(锁规数量等于合同数量)
1420 1420 boolean checkPriceSpecLocked = allChildTotalQuantity.compareTo(data.getTotalQuantity()) == 0;
  1421 + int lockBatchNo = childContractList.size() + 1;
  1422 + String lockContractCode = buildSpecificationLockContractCode(data.getCode(), data.getType(), lockBatchNo);
1421 1423
1422 1424 data.setId(IdUtil.getUUID());
  1425 + data.setCode(lockContractCode);
1423 1426 data.setTotalQuantity(vo.getTotalQuantity());
1424 1427 data.setTotalAmountCapital(vo.getTotalAmountCapital());
1425 1428 data.setTotalAmountExcludingTax(vo.getTotalAmountExcludingTax());
... ... @@ -1479,6 +1482,19 @@ public class ContractDistributorStandardServiceImpl extends
1479 1482 // createPurchaseOrderInfo(data, "PRODUCTION");
1480 1483 }
1481 1484
  1485 + private String buildSpecificationLockContractCode(String contractCode, String contractType, int lockBatchNo) {
  1486 + if (!isOpenSpecContract(contractType) || StringUtils.isBlank(contractCode)) {
  1487 + return contractCode;
  1488 + }
  1489 +
  1490 + String normalizedCode = contractCode.replaceFirst("_[0-9]{2}$", "");
  1491 + return normalizedCode + "_" + String.format("%02d", lockBatchNo);
  1492 + }
  1493 +
  1494 + private boolean isOpenSpecContract(String contractType) {
  1495 + return "DRAFT_DIST_AGMT".equals(contractType) || "INTL_OPEN_SPEC_AGMT".equals(contractType);
  1496 + }
  1497 +
1482 1498 public List<String> getNoContractSigned(List<String> buyerList) {
1483 1499 return getBaseMapper().getNoContractSigned(buyerList);
1484 1500 }
... ...
... ... @@ -95,5 +95,11 @@ public class QueryContractDistributorStandardVo extends PageVo implements BaseVo
95 95 @ApiModelProperty("生产厂ID集合")
96 96 private List<String> workshopIdList;
97 97
  98 + @ApiModelProperty("锁规状态:UNLOCKED-未锁规,PARTIAL-部分锁规,LOCKED-已锁规")
  99 + private String specLockStatus;
  100 +
  101 + @ApiModelProperty("锁价状态:UNLOCKED-未锁价,LOCKED-已锁价")
  102 + private String lockedPriceStatus;
  103 +
98 104 }
99 105
... ...
... ... @@ -195,6 +195,41 @@
195 195 #{item}
196 196 </foreach>
197 197 </if>
  198 + <if test="vo.specLockStatus != null and vo.specLockStatus != ''">
  199 + AND tb.type IN ('DRAFT_DIST_AGMT', 'INTL_OPEN_SPEC_AGMT')
  200 + <choose>
  201 + <when test="vo.specLockStatus == 'UNLOCKED'">
  202 + AND (tb.price_spec_locked = 0 OR tb.price_spec_locked IS NULL)
  203 + AND NOT EXISTS (
  204 + SELECT 1
  205 + FROM tbl_contract_distributor_standard child
  206 + WHERE child.parent_id = tb.id
  207 + )
  208 + </when>
  209 + <when test="vo.specLockStatus == 'PARTIAL'">
  210 + AND (tb.price_spec_locked = 0 OR tb.price_spec_locked IS NULL)
  211 + AND EXISTS (
  212 + SELECT 1
  213 + FROM tbl_contract_distributor_standard child
  214 + WHERE child.parent_id = tb.id
  215 + )
  216 + </when>
  217 + <when test="vo.specLockStatus == 'LOCKED'">
  218 + AND tb.price_spec_locked = 1
  219 + </when>
  220 + </choose>
  221 + </if>
  222 + <if test="vo.lockedPriceStatus != null and vo.lockedPriceStatus != ''">
  223 + AND tb.type IN ('DIST_STOCK_CONTRACT', 'INTL_INVENTORY_AGMT')
  224 + <choose>
  225 + <when test="vo.lockedPriceStatus == 'LOCKED'">
  226 + AND tb.price_spec_locked = 1
  227 + </when>
  228 + <when test="vo.lockedPriceStatus == 'UNLOCKED'">
  229 + AND (tb.price_spec_locked = 0 OR tb.price_spec_locked IS NULL)
  230 + </when>
  231 + </choose>
  232 + </if>
198 233 <if test="vo.createById != null and vo.createById != ''">
199 234 AND tb.create_by_id = #{vo.createById}
200 235 </if>
... ...