Bladeren bron

Merge branch 'test'

yzc 2 jaren geleden
bovenliggende
commit
cae8e2e782

+ 1 - 1
hx-common/src/main/java/com/fjhx/common/enums/CodingRuleEnum.java

@@ -18,7 +18,7 @@ public enum CodingRuleEnum {
 
     /**
      * 外销合同
-     */
+     */ 
     CONTRACT("contract", "外销合同", Arrays.asList(
             getDefaultRule(RuleTypeEnum.CUSTOMIZE, "SC-"),
             getDefaultRule(RuleTypeEnum.DATE_FORMAT, "yyyyMM-"),

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/po/Contract.java

@@ -289,6 +289,11 @@ public class Contract extends BasePo {
     private String profitClearingRemark;
 
     /**
+     * 是否变更  0:未变更  1已变更
+     */
+    private String isChange;
+
+    /**
      * 原合同id
      */
     private Long oldContractId;

+ 1 - 4
hx-sale/src/main/java/com/fjhx/sale/flow/ContractUpdateFlow.java

@@ -116,11 +116,8 @@ public class ContractUpdateFlow extends FlowDelegate {
             throw new ServiceException("原合同不存在");
         }
         oldContract.setStatus(FlowStatusEnum.UPDATE.getKey());
+        oldContract.setIsChange("1");
         contractService.updateById(oldContract);
-
-        // TODO 已认领数据清空,但需要保留原认领记录
-
-
     }
 
 }

+ 22 - 0
hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlow.java

@@ -17,9 +17,12 @@ import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.entity.purchase.po.PurchaseDetail;
 import com.fjhx.purchase.entity.purchase.po.PurchaseOtherFee;
 import com.fjhx.purchase.entity.purchase.vo.PurchaseVo;
+import com.fjhx.purchase.entity.subscribe.enums.SubscribeDetailStatusEnum;
+import com.fjhx.purchase.entity.subscribe.po.SubscribeDetail;
 import com.fjhx.purchase.service.purchase.PurchaseDetailService;
 import com.fjhx.purchase.service.purchase.PurchaseOtherFeeService;
 import com.fjhx.purchase.service.purchase.PurchaseService;
+import com.fjhx.purchase.service.subscribe.SubscribeDetailService;
 import com.fjhx.sale.entity.contract.po.ContractProduct;
 import com.fjhx.sale.entity.sample.po.SampleProduct;
 import com.fjhx.sale.service.contract.ContractProductService;
@@ -58,6 +61,8 @@ public class PurchaseFlow extends FlowDelegate {
     private CodingRuleService codingRuleService;
     @Autowired
     private PurchaseOtherFeeService purchaseOtherFeeService;
+    @Autowired
+    private SubscribeDetailService subscribeDetailService;
 
     @Override
     public String getFlowKey() {
@@ -86,6 +91,23 @@ public class PurchaseFlow extends FlowDelegate {
                 s.setPurchaseId(purchase.getId());
             }
             purchaseDetailService.saveBatch(purchaseDetailList);
+            //修改申购明细的采购状态
+            for (PurchaseDetail purchaseDetail : purchaseDetailList) {
+                //计算已经采购的数量
+                List<PurchaseDetail> purchaseDetails = purchaseDetailService.list(q -> q
+                        .eq(PurchaseDetail::getSubscribeDetailId, purchaseDetail.getSubscribeDetailId())
+                );
+                BigDecimal pdCount = purchaseDetails.stream().map(PurchaseDetail::getCount).reduce(BigDecimal.ZERO, BigDecimal::add);
+                SubscribeDetail subscribeDetail = subscribeDetailService.getById(purchaseDetail.getSubscribeDetailId());
+                if (pdCount.compareTo(subscribeDetail.getCount()) >= 0) {
+                    //修改为已采购
+                    subscribeDetail.setStatus(SubscribeDetailStatusEnum.PURCHASED.getKey());
+                } else {
+                    //修改为部分采购
+                    subscribeDetail.setStatus(SubscribeDetailStatusEnum.LITT_PAID_AMOUNT.getKey());
+                }
+                subscribeDetailService.updateById(subscribeDetail);
+            }
         }
         //保存其他费用信息
         List<PurchaseOtherFee> otherFeeList = purchase.getOtherFeeList();

+ 2 - 0
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -148,10 +148,12 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
         IWrapper<Contract> wrapper = getWrapper();
         wrapper.orderByDesc("t1", Contract::getCreateTime);
+        wrapper.eq("t1", Contract::getIsChange,"0");//列表只展示未变更得数据
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum.DRAFT.getKey(), FlowStatusEnum.CANCELLATION.getKey() - 1);
         if (StringUtils.isNotEmpty(dto.getStatus())) {
             wrapper.eq("t1", Contract::getStatus, dto.getStatus());
         }
+
         if (StringUtils.isNotEmpty(dto.getSellCorporationId())) {
             wrapper.eq("t1", Contract::getSellCorporationId, dto.getSellCorporationId());
         }

+ 9 - 1
hx-sale/src/main/java/com/fjhx/sale/service/pack/impl/PackShipmentServiceImpl.java

@@ -5,11 +5,13 @@ import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.sale.entity.documents.po.Documents;
 import com.fjhx.sale.entity.pack.dto.PackShipmentDto;
 import com.fjhx.sale.entity.pack.dto.PackShipmentSelectDto;
 import com.fjhx.sale.entity.pack.po.PackShipment;
 import com.fjhx.sale.entity.pack.vo.PackShipmentVo;
 import com.fjhx.sale.mapper.pack.PackShipmentMapper;
+import com.fjhx.sale.service.documents.DocumentsService;
 import com.fjhx.sale.service.pack.PackDetailGoodsService;
 import com.fjhx.sale.service.pack.PackDetailProductService;
 import com.fjhx.sale.service.pack.PackShipmentService;
@@ -39,6 +41,9 @@ public class PackShipmentServiceImpl extends ServiceImpl<PackShipmentMapper, Pac
     @Autowired
     private PackDetailProductService packDetailProductService;
 
+    @Autowired
+    private DocumentsService documentsService;
+
     @Override
     public Page<PackShipmentVo> getPage(PackShipmentSelectDto dto) {
         IWrapper<PackShipment> wrapper = getWrapper();
@@ -77,9 +82,12 @@ public class PackShipmentServiceImpl extends ServiceImpl<PackShipmentMapper, Pac
      */
     @Override
     public List<PackShipmentVo> getList(PackShipmentSelectDto dto) {
+        List<Long> packShipmentIds = documentsService.listObject(Documents::getPackShipmentId, q -> q.orderByAsc(Documents::getContractId));
         //查询出货绑定主合同列表详情
         List<PackShipmentVo> packShipments = baseMapper.getList(Wrappers.query()
-                .like(ObjectUtil.isNotEmpty(dto.getKeyword())," c.code",dto.getKeyword()));
+                .like(ObjectUtil.isNotEmpty(dto.getKeyword()), "c.code", dto.getKeyword())
+                .notIn(ObjectUtil.isNotEmpty(packShipmentIds), "ps.id", packShipmentIds)
+        );
         return packShipments;
     }