Procházet zdrojové kódy

销售合同-采购-申购功能修改

yzc před 1 rokem
rodič
revize
00857351e8

+ 1 - 1
hx-item/src/main/java/com/fjhx/item/controller/product/ProductBomInfoController.java

@@ -50,7 +50,7 @@ public class ProductBomInfoController {
         //赋值物料信息
         List<ProductBomDetail> list = productBomDetailService.list(q -> q.eq(ProductBomDetail::getProductId, dto.getId()));
         List<ProductBomDetailVo> productBomDetailVos = BeanUtil.copyToList(list, ProductBomDetailVo.class);
-        productInfoService.attributeAssign(productBomDetailVos, ProductBomDetail::getProductId, (item, material) -> {
+        productInfoService.attributeAssign(productBomDetailVos, ProductBomDetail::getMaterialId, (item, material) -> {
             item.setMaterialName(material.getName());
             item.setMaterialCode(material.getCustomCode());
         });

+ 5 - 11
hx-purchase/src/main/java/com/fjhx/purchase/service/subscribe/impl/SubscribeDetailServiceImpl.java

@@ -84,7 +84,7 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
         wrapper.like("t2", Subscribe::getCode, dto.getKeyword());
         // 状态
         if (ObjectUtil.isNotEmpty(dto.getStatus())) {
-            wrapper.in("t1", SubscribeDetail::getStatus, Arrays.asList(dto.getStatus().split(",")));
+            wrapper.in("t2", SubscribeDetail::getStatus, Arrays.asList(dto.getStatus().split(",")));
         }
 
         // 如果类型存在带入类型查询
@@ -94,19 +94,13 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
             return new Page<>();
         }
         List<Long> productIds = productList.stream().map(ProductInfoVo::getId).collect(Collectors.toList());
-        wrapper.in("t1", SubscribeDetail::getProductId, productIds);
-
-        // 维多利亚扩展根据到货仓库id过滤
-        wrapper.eq("json_unquote(t2.victoriatourist_json -> '$.receiptWarehouseId')", dto.getReceiptWarehouseId());
-        if (ObjectUtil.isNotEmpty(dto.getDeptId())) {
-            wrapper.eq("json_unquote(pi.victoriatourist_json -> '$.deptId')", dto.getDeptId().toString());
-        }
+        wrapper.in("t2", SubscribeDetail::getProductId, productIds);
 
         // 待采购过滤掉指定状态 例如不要 99 作废
         if (StrUtil.isNotBlank(dto.getNeStatus())) {
-            wrapper.notIn("t1", SubscribeDetail::getStatus, dto.getNeStatus().split(","));
+            wrapper.notIn("t2", SubscribeDetail::getStatus, dto.getNeStatus().split(","));
         }
-        wrapper.orderByDesc("t1", SubscribeDetail::getCreateTime);
+        wrapper.orderByDesc("t2", SubscribeDetail::getCreateTime);
 
         Page<SubscribeDetailVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<SubscribeDetailVo> list = page.getRecords();
@@ -119,7 +113,7 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
         for (SubscribeDetailVo s : list) {
             Map<Long, ProductInfoVo> productMap = productList.stream().collect(Collectors.toMap(ProductInfoVo::getId, Function.identity()));
             ProductInfoVo productInfo = productMap.get(s.getProductId());
-            s.setProductCode(productInfo.getCode());
+            s.setProductCode(productInfo.getCustomCode());
             s.setProductName(productInfo.getName());
             s.setProductType(productInfo.getType());
             s.setProductCategory(productInfo.getClassifyName());

+ 30 - 14
hx-purchase/src/main/resources/mapper/subscribe/SubscribeDetailMapper.xml

@@ -2,20 +2,36 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.purchase.mapper.subscribe.SubscribeDetailMapper">
     <select id="getPage" resultType="com.fjhx.purchase.entity.subscribe.vo.SubscribeDetailVo">
-        SELECT t1.*,
-               t2.`code`                AS subscribeCode,
-               t2.subcribe_content      AS subscribeContent,
-               t2.subcribe_time         AS subcribeTime,
-               t2.subcribe_name         AS subcribeName,
-               t2.id                    AS subcribeId,
-               t2.required_arrival_time AS requiredArrivalTime,
-               t2.put_warehouse_id      AS putWarehouseId,
-               t2.victoriatourist_json,
-               t2.flow_id,
-               t2.corporation_id        AS corporationId
-        FROM subscribe_detail t1
-                 LEFT JOIN subscribe t2 ON t1.subscribe_id = t2.id
-                 left JOIN product_info pi on t1.product_id = pi.id
+        SELECT *
+        FROM ((SELECT t1.*,
+                      t2.`code`                AS subscribeCode,
+                      t2.subcribe_content      AS subscribeContent,
+                      t2.subcribe_time         AS subcribeTime,
+                      t2.subcribe_name         AS subcribeName,
+                      t2.id                    AS subcribeId,
+                      t2.required_arrival_time AS requiredArrivalTime,
+                      t2.put_warehouse_id      AS putWarehouseId,
+                      t2.flow_id,
+                      t2.corporation_id        AS corporationId
+               FROM subscribe_detail t1
+                        LEFT JOIN subscribe t2 ON t1.subscribe_id = t2.id
+                   AND t1.data_type = 0
+               WHERE t1.data_type = 0)
+              UNION ALL
+              (SELECT t1.*,
+                      t2.`code`      AS subscribeCode,
+                      null           AS subscribeContent,
+                      t1.create_time AS subcribeTime,
+                      null           AS subcribeName,
+                      t2.id          AS subcribeId,
+                      null           AS requiredArrivalTime,
+                      null           AS putWarehouseId,
+                      t2.flow_id,
+                      null           AS corporationId
+               FROM subscribe_detail t1
+                        LEFT JOIN contract t2 ON t1.contract_id = t2.id
+               WHERE t1.data_type = 1)) t2
+                 LEFT JOIN product_info pi ON t2.product_id = pi.id
             ${ew.customSqlSegment}
     </select>
 

+ 49 - 46
hx-sale/src/main/java/com/fjhx/sale/flow/ContractFlow.java

@@ -231,7 +231,7 @@ public class ContractFlow extends FlowDelegate {
         //获取产品列表
         Map<Long, ProductInfo> productInfoMap = productInfoService.mapKEntity(ProductInfo::getId, q -> q.in(ProductInfo::getId, productIds));
         //获取物料信息
-        Map<Long, List<ProductBomDetail>> productBomMap = productBomDetailService.mapKGroup(ProductBomDetail::getProductId, q -> q.eq(ProductBomDetail::getProductId, productIds));
+        Map<Long, List<ProductBomDetail>> productBomMap = productBomDetailService.mapKGroup(ProductBomDetail::getProductId, q -> q.in(ProductBomDetail::getProductId, productIds));
 
         //待采购列表
         List<SubscribeDetail> subscribeDetailList = new ArrayList<>();
@@ -247,53 +247,56 @@ public class ContractFlow extends FlowDelegate {
             rawMaterial.setMaterialId(productInfo.getRawMaterialId());
             rawMaterial.setProductId(productId);
             rawMaterial.setQuantity(BigDecimal.ONE);
+            productBomDetails.add(rawMaterial);
+
+            if (ObjectUtil.isNotEmpty(productBomDetails)) {
+                List<Long> materialIds = productBomDetails.stream().map(ProductBomDetail::getMaterialId).collect(Collectors.toList());
+                Map<Long, ProductInfo> materialMap = productInfoService.mapKEntity(ProductInfo::getId, q -> q.in(ProductInfo::getId, materialIds));
+
+                //遍历物料列表
+                for (ProductBomDetail productBomDetail : productBomDetails) {
+                    Long materialId = productBomDetail.getMaterialId();
+                    ProductInfo materialInfo = materialMap.get(materialId);
+
+                    BigDecimal multiply = productBomDetail.getQuantity().multiply(contractProduct.getQuantity());
+
+                    //获取产品安全库存
+                    BigDecimal stockThreshold = materialInfo.getStockThreshold();
+                    //获取可用库存
+                    BigDecimal availableQuantity = materialInfo.getAvailableQuantity();
+                    //计数需要采购的数量(需采购量 = 安全库存 - (可用库存 - 合同量)若 需采购量<0,则按0算不采购)
+                    BigDecimal subtract = availableQuantity.subtract(multiply);
+                    BigDecimal requiredQuantity = stockThreshold.subtract(subtract);
+
+                    //计算可用库存
+                    if (requiredQuantity.compareTo(BigDecimal.ZERO) < 0) {
+                        //需要采购的数量<0 可用库存 = 可用库存 - 合同量
+                        InOutBo inOutBo = new InOutBo();
+                        inOutBo.setProductId(materialId);
+                        inOutBo.setQuantity(multiply);
+                        productInfoService.editAvailableQuantity(Arrays.asList(inOutBo), InOutType.OUT, contractProduct.getId(), ProductAvailableRecordType.SALE_PASS);
+                    } else {
+                        //需要采购的数量>=0 可用库存 = 安全库存
+                        InOutBo inOutBo = new InOutBo();
+                        inOutBo.setProductId(materialId);
+                        inOutBo.setQuantity(stockThreshold);
+                        productInfoService.editAvailableQuantity(Arrays.asList(inOutBo), InOutType.EQ, contractProduct.getId(), ProductAvailableRecordType.SALE_PASS);
+                    }
+
+                    //需要采购的数量大于0生成待采购数据
+                    if (requiredQuantity.compareTo(BigDecimal.ZERO) > 0) {
+                        SubscribeDetail subscribeDetail = new SubscribeDetail();
+                        subscribeDetail.setProductId(contractProduct.getProductId());
+                        subscribeDetail.setCount(requiredQuantity);
+                        subscribeDetail.setStatus(15);//待采购
+                        subscribeDetail.setContractId(contract.getId());
+                        subscribeDetail.setContractDetailId(contractProduct.getId());
+                        subscribeDetail.setDataType(1);
+
+                        subscribeDetailList.add(subscribeDetail);
+                    }
 
-            List<Long> materialIds = productBomDetails.stream().map(ProductBomDetail::getMaterialId).collect(Collectors.toList());
-            Map<Long, ProductInfo> materialMap = productInfoService.mapKEntity(ProductInfo::getId, q -> q.in(ProductInfo::getId, materialIds));
-
-            //遍历物料列表
-            for (ProductBomDetail productBomDetail : productBomDetails) {
-                Long materialId = productBomDetail.getMaterialId();
-                ProductInfo materialInfo = materialMap.get(materialId);
-
-                BigDecimal multiply = productBomDetail.getQuantity().multiply(contractProduct.getQuantity());
-
-                //获取产品安全库存
-                BigDecimal stockThreshold = materialInfo.getStockThreshold();
-                //获取可用库存
-                BigDecimal availableQuantity = materialInfo.getAvailableQuantity();
-                //计数需要采购的数量(需采购量 = 安全库存 - (可用库存 - 合同量)若 需采购量<0,则按0算不采购)
-                BigDecimal subtract = availableQuantity.subtract(contractProduct.getQuantity());
-                BigDecimal requiredQuantity = stockThreshold.subtract(subtract);
-
-                //计算可用库存
-                if (requiredQuantity.compareTo(BigDecimal.ZERO) >= 0) {
-                    //需要采购的数量>=0 可用库存 = 可用库存 - 合同量
-                    InOutBo inOutBo = new InOutBo();
-                    inOutBo.setProductId(materialId);
-                    inOutBo.setQuantity(multiply);
-                    productInfoService.editAvailableQuantity(Arrays.asList(inOutBo), InOutType.OUT, contractProduct.getId(), ProductAvailableRecordType.SALE_PASS);
-                } else {
-                    //需要采购的数量<0 可用库存 = 安全库存
-                    InOutBo inOutBo = new InOutBo();
-                    inOutBo.setProductId(materialId);
-                    inOutBo.setQuantity(stockThreshold);
-                    productInfoService.editAvailableQuantity(Arrays.asList(inOutBo), InOutType.EQ, contractProduct.getId(), ProductAvailableRecordType.SALE_PASS);
                 }
-
-                //需要采购的数量大于0生成待采购数据
-                if (requiredQuantity.compareTo(BigDecimal.ZERO) > 0) {
-                    SubscribeDetail subscribeDetail = new SubscribeDetail();
-                    subscribeDetail.setProductId(contractProduct.getProductId());
-                    subscribeDetail.setCount(requiredQuantity);
-                    subscribeDetail.setStatus(15);//待采购
-                    subscribeDetail.setContractId(contract.getId());
-                    subscribeDetail.setContractDetailId(contractProduct.getId());
-                    subscribeDetail.setDataType(1);
-
-                    subscribeDetailList.add(subscribeDetail);
-                }
-
             }
         }
 

+ 35 - 12
hx-sale/src/main/java/com/fjhx/sale/flow/EhsdPurchaseFlow.java

@@ -29,13 +29,17 @@ import com.fjhx.sale.entity.purchase.po.EhsdPurchaseProduct;
 import com.fjhx.sale.entity.purchase.po.EhsdPurchaseProject;
 import com.fjhx.sale.entity.sample.po.Sample;
 import com.fjhx.sale.entity.sample.po.SampleProduct;
-import com.fjhx.sale.service.contract.ContractProductService;
 import com.fjhx.sale.service.contract.ContractService;
 import com.fjhx.sale.service.purchase.EhsdPurchaseProductService;
 import com.fjhx.sale.service.purchase.EhsdPurchaseProjectService;
 import com.fjhx.sale.service.purchase.EhsdPurchaseService;
 import com.fjhx.sale.service.sample.SampleProductService;
 import com.fjhx.sale.service.sample.SampleService;
+import com.fjhx.wms.entity.stock.emums.StockWaitType;
+import com.fjhx.wms.entity.stock.po.StockWait;
+import com.fjhx.wms.entity.stock.po.StockWaitDetails;
+import com.fjhx.wms.service.stock.StockWaitDetailsService;
+import com.fjhx.wms.service.stock.StockWaitService;
 import com.ruoyi.common.annotation.LogicIgnore;
 import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.exception.ServiceException;
@@ -68,16 +72,6 @@ public class EhsdPurchaseFlow extends FlowDelegate {
 
     @Autowired
     private EhsdPurchaseProjectService purchaseProjectService;
-
-//    @Autowired
-//    private EhsdPurchaseArrivalService purchaseArrivalService;
-//
-//    @Autowired
-//    private EhsdPurchaseProductMountingsService purchaseProductMountingsService;
-
-    @Autowired
-    private ContractProductService contractProductService;
-
     @Autowired
     private SampleProductService sampleProductService;
 
@@ -91,10 +85,14 @@ public class EhsdPurchaseFlow extends FlowDelegate {
     private SampleService sampleService;
     @Autowired
     private ProductInfoService productInfoService;
+    @Autowired
+    private StockWaitService stockWaitService;
+    @Autowired
+    private StockWaitDetailsService stockWaitDetailsService;
 
     @Override
     public String getFlowKey() {
-        return "ehsd_purchase_flow";
+        return "purchase_flow";
     }
 
     /**
@@ -290,6 +288,31 @@ public class EhsdPurchaseFlow extends FlowDelegate {
             }
         }
         productInfoService.editAvailableQuantity(inOutBoList, InOutType.IN, businessId, ProductAvailableRecordType.PURCHASE_PASS);
+
+
+        //采购审批通过 生成待入库数据
+        StockWait stockWait = new StockWait();
+        stockWait.setType(1);
+        stockWait.setBusinessType(StockWaitType.PURCHASE_ARRIVAL_IN.getDetailType());
+        stockWait.setBusinessId(purchase.getId());
+        stockWait.setBusinessCode(purchase.getCode());
+        stockWait.setStatus(0);
+        stockWait.setPurchaseId(purchase.getId());
+        stockWaitService.save(stockWait);
+        List<StockWaitDetails> stockWaitDetailsList = new ArrayList<>();
+        for (EhsdPurchaseProduct purchaseProduct : purchaseProductList) {
+            StockWaitDetails stockWaitDetails = new StockWaitDetails();
+            stockWaitDetails.setStockWaitId(stockWait.getId());
+            stockWaitDetails.setBusinessDetailsId(purchaseProduct.getId());
+            stockWaitDetails.setPurchaseDetailId(purchaseProduct.getId());
+
+            stockWaitDetails.setProductId(purchaseProduct.getProductId());
+            stockWaitDetails.setQuantity(purchaseProduct.getQuantity());
+            stockWaitDetails.setStatus(0);
+
+            stockWaitDetailsList.add(stockWaitDetails);
+        }
+        stockWaitDetailsService.saveBatch(stockWaitDetailsList);
     }
 
     /**

+ 34 - 35
hx-sale/src/main/java/com/fjhx/sale/flow/EhsdPurchaseUpdateFlow.java

@@ -12,13 +12,11 @@ import com.fjhx.flow.enums.FlowStatusEnum;
 import com.fjhx.item.enums.ProductAvailableRecordType;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.purchase.entity.purchase.enums.PurchaseDataResourceEnum;
-import com.fjhx.sale.entity.contract.po.ContractProduct;
 import com.fjhx.sale.entity.purchase.dto.EhsdPurchaseDto;
 import com.fjhx.sale.entity.purchase.po.EhsdPurchase;
 import com.fjhx.sale.entity.purchase.po.EhsdPurchaseArrival;
 import com.fjhx.sale.entity.purchase.po.EhsdPurchaseProduct;
 import com.fjhx.sale.entity.purchase.po.EhsdPurchaseProject;
-import com.fjhx.sale.entity.sample.po.SampleProduct;
 import com.fjhx.sale.service.contract.ContractProductService;
 import com.fjhx.sale.service.purchase.EhsdPurchaseArrivalService;
 import com.fjhx.sale.service.purchase.EhsdPurchaseProductService;
@@ -65,7 +63,7 @@ public class EhsdPurchaseUpdateFlow extends FlowDelegate {
 
     @Override
     public String getFlowKey() {
-        return "ehsd_purchase_update_flow";
+        return "purchase_update_flow";
     }
 
     /**
@@ -137,7 +135,7 @@ public class EhsdPurchaseUpdateFlow extends FlowDelegate {
     public void relaunch(Long flowId, Long businessId, FlowStatusEnum flowStatus, JSONObject submitData) {
         //删除采购合同
         EhsdPurchaseDto purchase = submitData.toJavaObject(EhsdPurchaseDto.class);
-        if(ObjectUtils.isEmpty(purchase)){
+        if (ObjectUtils.isEmpty(purchase)) {
             throw new ServiceException("采购数据不能为空");
         }
         purchase.setFlowId(flowId);
@@ -203,28 +201,29 @@ public class EhsdPurchaseUpdateFlow extends FlowDelegate {
         oldEhsdPurchase.setStatus(FlowStatusEnum1.UPDATE.getKey());
         ehsdPurchaseService.updateById(oldEhsdPurchase);
 
-        //回滚旧合同的已采购数量
-        List<EhsdPurchaseProduct> oldPurchaseProductList = ehsdPurchaseProductService.list(q -> q.eq(EhsdPurchaseProduct::getPurchaseId, purchase.getOldPurchaseId()));
-        for (EhsdPurchaseProduct ehsdPurchaseProduct : oldPurchaseProductList) {
-            if (ObjectUtils.isNotEmpty(ehsdPurchaseProduct.getDataResourceId()) && ehsdPurchaseProduct.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey()) {//如果采购的是外销合同
-                ContractProduct contractProduct = contractProductService.getById(ehsdPurchaseProduct.getDataResourceId());
-                //回滚变更前待采购数量
-                contractProduct.setExpendQuantity(contractProduct.getExpendQuantity().add(ehsdPurchaseProduct.getQuantity()));
-                contractProductService.updateById(contractProduct);
-            }
-            if (ObjectUtils.isNotEmpty(ehsdPurchaseProduct.getDataResourceId()) && ehsdPurchaseProduct.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_2.getKey()) {//如果采购的是样品单
-                SampleProduct sampleProduct = sampleProductService.getById(ehsdPurchaseProduct.getDataResourceId());
-                //回滚变更前待采购数量
-                sampleProduct.setExpendQuantity(sampleProduct.getExpendQuantity().add(ehsdPurchaseProduct.getQuantity()));
-                sampleProductService.updateById(sampleProduct);
-            }
-        }
+//        //回滚旧合同的已采购数量
+//        List<EhsdPurchaseProduct> oldPurchaseProductList = ehsdPurchaseProductService.list(q -> q.eq(EhsdPurchaseProduct::getPurchaseId, purchase.getOldPurchaseId()));
+//        for (EhsdPurchaseProduct ehsdPurchaseProduct : oldPurchaseProductList) {
+//            if (ObjectUtils.isNotEmpty(ehsdPurchaseProduct.getDataResourceId()) && ehsdPurchaseProduct.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey()) {//如果采购的是外销合同
+//                ContractProduct contractProduct = contractProductService.getById(ehsdPurchaseProduct.getDataResourceId());
+//                //回滚变更前待采购数量
+//                contractProduct.setExpendQuantity(contractProduct.getExpendQuantity().add(ehsdPurchaseProduct.getQuantity()));
+//                contractProductService.updateById(contractProduct);
+//            }
+//            if (ObjectUtils.isNotEmpty(ehsdPurchaseProduct.getDataResourceId()) && ehsdPurchaseProduct.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_2.getKey()) {//如果采购的是样品单
+//                SampleProduct sampleProduct = sampleProductService.getById(ehsdPurchaseProduct.getDataResourceId());
+//                //回滚变更前待采购数量
+//                sampleProduct.setExpendQuantity(sampleProduct.getExpendQuantity().add(ehsdPurchaseProduct.getQuantity()));
+//                sampleProductService.updateById(sampleProduct);
+//            }
+//        }
 
         //---------------------------------------
 
         //修改可用库存
         //回滚旧合同数据
         List<InOutBo> oldInOutBoList = new ArrayList<>();
+        List<EhsdPurchaseProduct> oldPurchaseProductList = ehsdPurchaseProductService.list(q -> q.eq(EhsdPurchaseProduct::getPurchaseId, purchase.getOldPurchaseId()));
         for (EhsdPurchaseProduct purchaseProduct : oldPurchaseProductList) {
             //如果数据来源是申购 操作可用库存(可用库存 = 当前可用库存 - 采购明细数量)
             if (Objects.equals(purchaseProduct.getDataResource(), PurchaseDataResourceEnum.DATA_RESOURCE_0)) {
@@ -265,11 +264,11 @@ public class EhsdPurchaseUpdateFlow extends FlowDelegate {
         ehsdPurchaseService.updatePurchaseId(businessId, tempId, SecurityUtils.getUserId(), null);
         ehsdPurchaseProductService.update(q -> q.eq(EhsdPurchaseProduct::getPurchaseId, businessId).set(EhsdPurchaseProduct::getPurchaseId, tempId));
         ehsdPurchaseProjectService.update(q -> q.eq(EhsdPurchaseProject::getPurchaseId, businessId).set(EhsdPurchaseProject::getPurchaseId, tempId));
-        ehsdPurchaseArrivalService.update(q -> q.eq(EhsdPurchaseArrival::getPurchaseId, businessId).set(EhsdPurchaseArrival::getPurchaseId, tempId));
+//        ehsdPurchaseArrivalService.update(q -> q.eq(EhsdPurchaseArrival::getPurchaseId, businessId).set(EhsdPurchaseArrival::getPurchaseId, tempId));
 
 
         //将旧合同的id改为新合同id
-        ehsdPurchaseService.updatePurchaseId(oldPurchaseId,businessId,SecurityUtils.getUserId(),null);
+        ehsdPurchaseService.updatePurchaseId(oldPurchaseId, businessId, SecurityUtils.getUserId(), null);
         ehsdPurchaseProductService.update(q -> q
                 .eq(EhsdPurchaseProduct::getPurchaseId, oldPurchaseId)
                 .set(EhsdPurchaseProduct::getPurchaseId, businessId)
@@ -282,14 +281,14 @@ public class EhsdPurchaseUpdateFlow extends FlowDelegate {
                 .set(BasePo::getUpdateTime, new Date())
                 .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
         );
-        ehsdPurchaseArrivalService.update(q -> q
-                .eq(EhsdPurchaseArrival::getPurchaseId, oldPurchaseId)
-                .set(EhsdPurchaseArrival::getPurchaseId, businessId)
-                .set(BasePo::getUpdateTime, new Date())
-                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-        );
+//        ehsdPurchaseArrivalService.update(q -> q
+//                .eq(EhsdPurchaseArrival::getPurchaseId, oldPurchaseId)
+//                .set(EhsdPurchaseArrival::getPurchaseId, businessId)
+//                .set(BasePo::getUpdateTime, new Date())
+//                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+//        );
         //将新合同id改为旧合同id
-        ehsdPurchaseService.updatePurchaseId(tempId,oldPurchaseId,SecurityUtils.getUserId(),businessId);
+        ehsdPurchaseService.updatePurchaseId(tempId, oldPurchaseId, SecurityUtils.getUserId(), businessId);
         ehsdPurchaseProductService.update(q -> q
                 .eq(EhsdPurchaseProduct::getPurchaseId, tempId)
                 .set(EhsdPurchaseProduct::getPurchaseId, oldPurchaseId)
@@ -302,12 +301,12 @@ public class EhsdPurchaseUpdateFlow extends FlowDelegate {
                 .set(BasePo::getUpdateTime, new Date())
                 .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
         );
-        ehsdPurchaseArrivalService.update(q -> q
-                .eq(EhsdPurchaseArrival::getPurchaseId, tempId)
-                .set(EhsdPurchaseArrival::getPurchaseId, oldPurchaseId)
-                .set(BasePo::getUpdateTime, new Date())
-                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-        );
+//        ehsdPurchaseArrivalService.update(q -> q
+//                .eq(EhsdPurchaseArrival::getPurchaseId, tempId)
+//                .set(EhsdPurchaseArrival::getPurchaseId, oldPurchaseId)
+//                .set(BasePo::getUpdateTime, new Date())
+//                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+//        );
     }
 
 }

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

@@ -1,201 +1,201 @@
-package com.fjhx.sale.flow;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.dynamic.datasource.annotation.DSTransactional;
-import com.fjhx.common.service.coding.CodingRuleService;
-import com.fjhx.flow.core.FlowDelegate;
-import com.fjhx.flow.enums.FlowStatusEnum;
-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.service.contract.ContractProductService;
-import com.fjhx.sale.service.sample.SampleProductService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-/**
- * EHSD采购流程
- *
- * @Author:caozj
- * @DATE:2023/4/3 17:38
- */
-@Component
-public class PurchaseFlow extends FlowDelegate {
-
-    @Autowired
-    private PurchaseService purchaseService;
-
-    @Autowired
-    private SampleProductService sampleProductService;
-
-    @Autowired
-    private PurchaseDetailService purchaseDetailService;
-
-    @Autowired
-    private ContractProductService contractProductService;
-
-    @Autowired
-    private CodingRuleService codingRuleService;
-
-    @Autowired
-    private PurchaseOtherFeeService purchaseOtherFeeService;
-    @Autowired
-    private SubscribeDetailService subscribeDetailService;
-    @Autowired
-    private EhsdPurchaseFlow ehsdPurchaseFlow;
-
-    @Override
-    public String getFlowKey() {
-        return "purchase_flow";
-    }
-
-    /**
-     * 发起流程
-     *
-     * @param flowId     流程ID
-     * @param submitData 采购数据
-     * @return
-     */
-    @Override
-    public Long start(Long flowId, JSONObject submitData) {
-//        DynamicDataSourceContextHolder.push(SourceConstant.PURCHASE);
-//        PurchaseVo purchase = submitData.toJavaObject(PurchaseVo.class);
-////        purchase.setCode(CodeEnum.PURCHASE.getCode());
-//        purchase.setCode(codingRuleService.createCode(CodingRuleEnum.PURCHASE.getKey(), null));
-//        purchase.setPurchaseStatus(PurchaseStatusEnum.UNDER_REVIEW.getKey());
-//        purchase.setFlowId(flowId);
-//        purchaseService.save(purchase);
-//        List<PurchaseDetail> purchaseDetailList = purchase.getPurchaseDetailList();
-//        if (CollectionUtils.isNotEmpty(purchaseDetailList)) {
-//            for (PurchaseDetail s : purchaseDetailList) {
-//                s.setPurchaseId(purchase.getId());
-//            }
-//            purchaseDetailService.saveBatch(purchaseDetailList);
-//            //修改申购明细的采购状态
-//            for (PurchaseDetail purchaseDetail : purchaseDetailList) {
-//                //如果来源是申购
-//                if (ObjectUtils.isEmpty(purchaseDetail.getDataResource())) {
-//                    //计算已经采购的数量
-//                    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();
-//        if (ObjectUtils.isNotEmpty(otherFeeList)) {
-//            otherFeeList.forEach(item -> item.setPurchaseId(purchase.getId()));
-//            purchaseOtherFeeService.saveBatch(otherFeeList);
-//        }
-//        DynamicDataSourceContextHolder.poll();
-//        return purchase.getId();
-        return ehsdPurchaseFlow.start(flowId, submitData);
-    }
-
-    /**
-     * 结束流程
-     *
-     * @param flowId     流程ID
-     * @param businessId 业务ID
-     * @param submitData 数据
-     */
-    @Override
-    @DSTransactional
-    public void end(Long flowId, Long businessId, JSONObject submitData) {
-//        //通过业务ID查询采购数据
-//        Purchase purchase = purchaseService.getById(businessId);
-//        if (ObjectUtils.isEmpty(purchase)) {
-//            throw new ServiceException("采购单不存在");
-//        }
-//        //查询采购产品
-//        List<PurchaseDetail> purchaseDetailList = purchaseDetailService.list(Wrappers.<PurchaseDetail>query().lambda().eq(PurchaseDetail::getPurchaseId, businessId));
-//        List<ContractProduct> upContractProduct = new ArrayList<>();
-//        List<SampleProduct> upSampleProduct = new ArrayList<>();
-//        for (PurchaseDetail p : purchaseDetailList) {
-//            if (ObjectUtils.isNotEmpty(p.getDataResourceId()) &&
-//                    p.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey()) {//如果采购的是外销合同
-//                ContractProduct contractProduct = contractProductService.getById(p.getDataResourceId());
-//                BigDecimal expendQuantity = contractProduct.getExpendQuantity().subtract(p.getCount());
-//                if (expendQuantity.compareTo(BigDecimal.ZERO) < 0) {
-//                    //外销合同-交接单采购 如果采购数量大于大于合同数量 将待处理数量改为0
-//                    expendQuantity = BigDecimal.ZERO;
-//                }
-//                contractProduct.setExpendQuantity(expendQuantity);
-//                upContractProduct.add(contractProduct);
-//            }
-//            if (ObjectUtils.isNotEmpty(p.getDataResourceId()) &&
-//                    p.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_2.getKey()) {//如果采购的是样品单
-//                SampleProduct sampleProduct = sampleProductService.getById(p.getDataResourceId());
-//                BigDecimal expendQuantity = sampleProduct.getExpendQuantity().subtract(p.getCount());
-//                if (expendQuantity.compareTo(BigDecimal.ZERO) < 1) {//小于0不让继续执行
-////                    throw new ServiceException("采购数量不得大于合同剩余采购数量");
-//                    expendQuantity = BigDecimal.ZERO;
-//                }
-//                sampleProduct.setExpendQuantity(expendQuantity);
-//                upSampleProduct.add(sampleProduct);
-//            }
-//        }
-//        if (CollectionUtils.isNotEmpty(upContractProduct)) {//扣减销售合同数量
-//            contractProductService.updateBatchById(upContractProduct);
-//        }
-//        if (CollectionUtils.isNotEmpty(upSampleProduct)) {//扣减样品单数量
-//            sampleProductService.updateBatchById(upSampleProduct);
-//        }
-//        //修改采购状态为审批通过
-//        purchase.setPurchaseStatus(PurchaseStatusEnum.PASS.getKey());
-//        purchase.setApprovedDate(new Date());
-//        purchaseService.updateById(purchase);
-//        //修改采购明细为待采购
-//        PurchaseDetail detail = new PurchaseDetail();
-//        detail.setStatus(PurchaseDetailStatusEnum.PASS.getKey());
-//        purchaseDetailService.update(detail, Wrappers.<PurchaseDetail>query()
-//                .lambda().eq(PurchaseDetail::getPurchaseId, purchase.getId()));
-        ehsdPurchaseFlow.end(flowId, businessId, submitData);
-    }
-
+//package com.fjhx.sale.flow;
+//
+//import com.alibaba.fastjson.JSONObject;
+//import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+//import com.fjhx.common.service.coding.CodingRuleService;
+//import com.fjhx.flow.core.FlowDelegate;
+//import com.fjhx.flow.enums.FlowStatusEnum;
+//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.service.contract.ContractProductService;
+//import com.fjhx.sale.service.sample.SampleProductService;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * EHSD采购流程
+// *
+// * @Author:caozj
+// * @DATE:2023/4/3 17:38
+// */
+//@Component
+//public class PurchaseFlow extends FlowDelegate {
+//
+//    @Autowired
+//    private PurchaseService purchaseService;
+//
+//    @Autowired
+//    private SampleProductService sampleProductService;
+//
+//    @Autowired
+//    private PurchaseDetailService purchaseDetailService;
+//
+//    @Autowired
+//    private ContractProductService contractProductService;
+//
+//    @Autowired
+//    private CodingRuleService codingRuleService;
+//
+//    @Autowired
+//    private PurchaseOtherFeeService purchaseOtherFeeService;
+//    @Autowired
+//    private SubscribeDetailService subscribeDetailService;
+//    @Autowired
+//    private EhsdPurchaseFlow ehsdPurchaseFlow;
+//
+//    @Override
+//    public String getFlowKey() {
+//        return "purchase_flow";
+//    }
+//
 //    /**
-//     * 驳回方法
+//     * 发起流程
+//     *
+//     * @param flowId     流程ID
+//     * @param submitData 采购数据
+//     * @return
 //     */
-//    public void reject() {
-//        if (HandleTypeEnum.REJECT.equals(FlowThreadLocalUtil.getHandleTypeEnum())) {
-//            purchaseService.update(q -> q
-//                    .eq(Purchase::getId, FlowThreadLocalUtil.getBusinessId())
-//                    .set(Purchase::getPurchaseStatus, 20)
-//                    .set(Purchase::getUpdateTime, new Date())
-//                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-//            );
-//        }
+//    @Override
+//    public Long start(Long flowId, JSONObject submitData) {
+////        DynamicDataSourceContextHolder.push(SourceConstant.PURCHASE);
+////        PurchaseVo purchase = submitData.toJavaObject(PurchaseVo.class);
+//////        purchase.setCode(CodeEnum.PURCHASE.getCode());
+////        purchase.setCode(codingRuleService.createCode(CodingRuleEnum.PURCHASE.getKey(), null));
+////        purchase.setPurchaseStatus(PurchaseStatusEnum.UNDER_REVIEW.getKey());
+////        purchase.setFlowId(flowId);
+////        purchaseService.save(purchase);
+////        List<PurchaseDetail> purchaseDetailList = purchase.getPurchaseDetailList();
+////        if (CollectionUtils.isNotEmpty(purchaseDetailList)) {
+////            for (PurchaseDetail s : purchaseDetailList) {
+////                s.setPurchaseId(purchase.getId());
+////            }
+////            purchaseDetailService.saveBatch(purchaseDetailList);
+////            //修改申购明细的采购状态
+////            for (PurchaseDetail purchaseDetail : purchaseDetailList) {
+////                //如果来源是申购
+////                if (ObjectUtils.isEmpty(purchaseDetail.getDataResource())) {
+////                    //计算已经采购的数量
+////                    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();
+////        if (ObjectUtils.isNotEmpty(otherFeeList)) {
+////            otherFeeList.forEach(item -> item.setPurchaseId(purchase.getId()));
+////            purchaseOtherFeeService.saveBatch(otherFeeList);
+////        }
+////        DynamicDataSourceContextHolder.poll();
+////        return purchase.getId();
+//        return ehsdPurchaseFlow.start(flowId, submitData);
+//    }
+//
+//    /**
+//     * 结束流程
+//     *
+//     * @param flowId     流程ID
+//     * @param businessId 业务ID
+//     * @param submitData 数据
+//     */
+//    @Override
+//    @DSTransactional
+//    public void end(Long flowId, Long businessId, JSONObject submitData) {
+////        //通过业务ID查询采购数据
+////        Purchase purchase = purchaseService.getById(businessId);
+////        if (ObjectUtils.isEmpty(purchase)) {
+////            throw new ServiceException("采购单不存在");
+////        }
+////        //查询采购产品
+////        List<PurchaseDetail> purchaseDetailList = purchaseDetailService.list(Wrappers.<PurchaseDetail>query().lambda().eq(PurchaseDetail::getPurchaseId, businessId));
+////        List<ContractProduct> upContractProduct = new ArrayList<>();
+////        List<SampleProduct> upSampleProduct = new ArrayList<>();
+////        for (PurchaseDetail p : purchaseDetailList) {
+////            if (ObjectUtils.isNotEmpty(p.getDataResourceId()) &&
+////                    p.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey()) {//如果采购的是外销合同
+////                ContractProduct contractProduct = contractProductService.getById(p.getDataResourceId());
+////                BigDecimal expendQuantity = contractProduct.getExpendQuantity().subtract(p.getCount());
+////                if (expendQuantity.compareTo(BigDecimal.ZERO) < 0) {
+////                    //外销合同-交接单采购 如果采购数量大于大于合同数量 将待处理数量改为0
+////                    expendQuantity = BigDecimal.ZERO;
+////                }
+////                contractProduct.setExpendQuantity(expendQuantity);
+////                upContractProduct.add(contractProduct);
+////            }
+////            if (ObjectUtils.isNotEmpty(p.getDataResourceId()) &&
+////                    p.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_2.getKey()) {//如果采购的是样品单
+////                SampleProduct sampleProduct = sampleProductService.getById(p.getDataResourceId());
+////                BigDecimal expendQuantity = sampleProduct.getExpendQuantity().subtract(p.getCount());
+////                if (expendQuantity.compareTo(BigDecimal.ZERO) < 1) {//小于0不让继续执行
+//////                    throw new ServiceException("采购数量不得大于合同剩余采购数量");
+////                    expendQuantity = BigDecimal.ZERO;
+////                }
+////                sampleProduct.setExpendQuantity(expendQuantity);
+////                upSampleProduct.add(sampleProduct);
+////            }
+////        }
+////        if (CollectionUtils.isNotEmpty(upContractProduct)) {//扣减销售合同数量
+////            contractProductService.updateBatchById(upContractProduct);
+////        }
+////        if (CollectionUtils.isNotEmpty(upSampleProduct)) {//扣减样品单数量
+////            sampleProductService.updateBatchById(upSampleProduct);
+////        }
+////        //修改采购状态为审批通过
+////        purchase.setPurchaseStatus(PurchaseStatusEnum.PASS.getKey());
+////        purchase.setApprovedDate(new Date());
+////        purchaseService.updateById(purchase);
+////        //修改采购明细为待采购
+////        PurchaseDetail detail = new PurchaseDetail();
+////        detail.setStatus(PurchaseDetailStatusEnum.PASS.getKey());
+////        purchaseDetailService.update(detail, Wrappers.<PurchaseDetail>query()
+////                .lambda().eq(PurchaseDetail::getPurchaseId, purchase.getId()));
+//        ehsdPurchaseFlow.end(flowId, businessId, submitData);
+//    }
+//
+////    /**
+////     * 驳回方法
+////     */
+////    public void reject() {
+////        if (HandleTypeEnum.REJECT.equals(FlowThreadLocalUtil.getHandleTypeEnum())) {
+////            purchaseService.update(q -> q
+////                    .eq(Purchase::getId, FlowThreadLocalUtil.getBusinessId())
+////                    .set(Purchase::getPurchaseStatus, 20)
+////                    .set(Purchase::getUpdateTime, new Date())
+////                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+////            );
+////        }
+////    }
+//
+//
+//    @Override
+//    public void relaunch(Long flowId, Long businessId, FlowStatusEnum flowStatus, JSONObject submitData) {
+//        super.relaunch(flowId, businessId, flowStatus, submitData);
+//        ehsdPurchaseFlow.relaunch(flowId, businessId, flowStatus, submitData);
+//    }
+//
+//    @Override
+//    public void reject(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
+//        super.reject(flowId, businessId, flowStatus);
+//        ehsdPurchaseFlow.reject(flowId, businessId, flowStatus);
+//    }
+//
+//    @Override
+//    public void cancellation(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
+//        super.cancellation(flowId, businessId, flowStatus);
+//        ehsdPurchaseFlow.cancellation(flowId, businessId, flowStatus);
 //    }
-
-
-    @Override
-    public void relaunch(Long flowId, Long businessId, FlowStatusEnum flowStatus, JSONObject submitData) {
-        super.relaunch(flowId, businessId, flowStatus, submitData);
-        ehsdPurchaseFlow.relaunch(flowId, businessId, flowStatus, submitData);
-    }
-
-    @Override
-    public void reject(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
-        super.reject(flowId, businessId, flowStatus);
-        ehsdPurchaseFlow.reject(flowId, businessId, flowStatus);
-    }
-
-    @Override
-    public void cancellation(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
-        super.cancellation(flowId, businessId, flowStatus);
-        ehsdPurchaseFlow.cancellation(flowId, businessId, flowStatus);
-    }
-}
+//}

+ 3 - 22
hx-wms/src/main/java/com/fjhx/wms/entity/stock/po/StockWait.java

@@ -1,11 +1,7 @@
 package com.fjhx.wms.entity.stock.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -42,29 +38,14 @@ public class StockWait extends BasePo {
      */
     private String businessCode;
 
-//    /**
-//     * 商品id
-//     */
-//    private Long productId;
-//
-//    /**
-//     * 数量
-//     */
-//    private BigDecimal quantity;
-//
-//    /**
-//     * 已入库数量
-//     */
-//    private BigDecimal receiptQuantity;
-
     /**
      * 入库状态 0待入库 1部分入库 2入库完成
      */
     private Integer status;
 
     /**
-     * 维多利亚扩展
+     * 采购id
      */
-    private String victoriatouristJson;
+    private Long purchaseId;
 
 }

+ 5 - 5
hx-wms/src/main/java/com/fjhx/wms/entity/stock/po/StockWaitDetails.java

@@ -41,11 +41,6 @@ public class StockWaitDetails extends BasePo {
     private BigDecimal receiptQuantity;
 
     /**
-     * 维多利亚扩展
-     */
-    private String victoriatouristJson;
-
-    /**
      * 业务明细id
      */
     private Long businessDetailsId;
@@ -60,4 +55,9 @@ public class StockWaitDetails extends BasePo {
      */
     private Integer status;
 
+    /**
+     * 采购明细id
+     */
+    private Long purchaseDetailId;
+
 }

+ 0 - 77
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitServiceImpl.java

@@ -2,8 +2,6 @@ package com.fjhx.wms.service.stock.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson2.JSONObject;
-import com.alibaba.fastjson2.JSONWriter;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -11,8 +9,6 @@ import com.fjhx.common.utils.Assert;
 import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.wms.entity.arrival.po.ArrivalDetailPo;
-import com.fjhx.wms.entity.arrival.po.ArrivalStockRecords;
-import com.fjhx.wms.entity.arrival.po.ArrivalStockRecordsDetails;
 import com.fjhx.wms.entity.purchase.po.PurchaseDetailPo;
 import com.fjhx.wms.entity.stock.dto.StockJournalDetailsDto;
 import com.fjhx.wms.entity.stock.dto.StockWaitDetailsDto;
@@ -171,34 +167,6 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
         return result;
     }
 
-//    @Override
-//    public StockWaitVo detailByWdly(Long id) {
-//        StockWait stockWait = this.getById(id);
-//        StockWaitVo result = BeanUtil.toBean(stockWait, StockWaitVo.class);
-//        List<StockWaitDetails> list = stockWaitDetailsService.list(q -> q.eq(StockWaitDetails::getStockWaitId, id));
-//        List<StockWaitDetailsVo> stockWaitDetailsVos = BeanUtil.copyToList(list, StockWaitDetailsVo.class);
-//        //根据业务id(到货id)查询采购单明细信息
-//
-//
-//        //赋值物品信息和采购信息
-//        List<Long> productIds = stockWaitDetailsVos.stream().map(StockWaitDetails::getProductId).collect(Collectors.toList());
-//        if (ObjectUtil.isNotEmpty(productIds)) {
-//            List<ProductInfo> productInfos = productInfoService.listByIds(productIds);
-//            Map<Long, ProductInfo> productInfoMap = productInfos.stream().collect(Collectors.toMap(ProductInfo::getId, Function.identity()));
-//            for (StockWaitDetailsVo stockWaitDetails : stockWaitDetailsVos) {
-//                ProductInfo productInfo = productInfoMap.get(stockWaitDetails.getProductId());
-//                if (ObjectUtil.isEmpty(productInfo)) {
-//                    continue;
-//                }
-//                stockWaitDetails.setProductName(productInfo.getName());
-//                stockWaitDetails.setProductCode(productInfo.getCode());
-//                stockWaitDetails.setProductCustomCode(productInfo.getCustomCode());
-//            }
-//        }
-//        result.setStockWaitDetailsList(stockWaitDetailsVos);
-//        return result;
-//    }
-
     @DSTransactional
     @Override
     public void add(StockWaitDetailsDto stockWaitDetailsDto) {
@@ -228,16 +196,10 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
         List<Stock> stockList = new ArrayList<>();
 
         List<StockWaitDetails> stockWaitDetailsDtoList = stockWaitDto.getStockWaitDetailsList();
-        Map<Long, StockWaitDetails> stockWaitDetailsMap = stockWaitDetailsDtoList.stream().collect(Collectors.toMap(StockWaitDetails::getId, Function.identity()));
 
         //更新已出入库数量以及待出入库状态
         stockWaitDetailsService.changeStockWaitStatus(stockWaitDto);
         StockWait stockWait = getById(stockWaitDto.getId());
-
-        String victoriatouristJson = stockWait.getVictoriatouristJson();
-        JSONObject json = ObjectUtil.isNotEmpty(victoriatouristJson) ? JSONObject.parseObject(victoriatouristJson) : new JSONObject();
-        json.put("receiptWarehouseId", stockWaitDto.getWarehouseId());
-        stockWait.setVictoriatouristJson(JSONObject.toJSONString(json, JSONWriter.Feature.WriteLongAsString));
         updateById(stockWait);
 
         //如果业务类型是 采购到货入库 计算结存单价[结存单价=(结存单价*库存数量+采购单价*入库数量)/(库存数量+入库数量)]
@@ -333,45 +295,6 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
         //保存出入库明细
         stockJournalDetailsService.saveBatch(stockJournalDetailsList);
 
-        //如果是采购到货 创建待质检记录
-        if (StockWaitType.PURCHASE_ARRIVAL_IN.getDetailType().equals(businessType)) {
-            //创建采购到货入库记录
-            ArrivalStockRecords arrivalStockRecords = new ArrivalStockRecords();
-            arrivalStockRecords.setStockWaitId(stockWait.getId());
-            arrivalStockRecords.setWarehouseId(stockWaitDto.getWarehouseId());
-            arrivalStockRecords.setQualityStatus(0);
-            arrivalStockRecords.setArrivalCode(json.getString("arrivalCode"));//设置到货编码
-            arrivalStockRecordsService.save(arrivalStockRecords);
-            //创建入库明细
-            List<ArrivalStockRecordsDetails> arrivalStockRecordsDetailsList = new ArrayList<>();
-            for (StockWaitDetails waitDetails : stockWaitDetailsDtoList) {
-                ArrivalStockRecordsDetails arrivalStockRecordsDetails = new ArrivalStockRecordsDetails();
-                arrivalStockRecordsDetails.setArrivalStockRecordsId(arrivalStockRecords.getId());
-                arrivalStockRecordsDetails.setProductInfoId(waitDetails.getProductId());
-                arrivalStockRecordsDetails.setQuantity(waitDetails.getQuantity());
-                arrivalStockRecordsDetails.setQualityQuantity(BigDecimal.ZERO);
-                arrivalStockRecordsDetailsList.add(arrivalStockRecordsDetails);
-            }
-            arrivalStockRecordsDetailsService.saveBatch(arrivalStockRecordsDetailsList);
-        }
-
-        //销售订单出库(维多利亚)
-        if (StockWaitType.SALE_ORDER_OUT.getDetailType().equals(businessType)) {
-//            wmsService.outbounds(stockWaitDto);
-            throw new ServiceException("操作失败");
-        }
-
-        //生产任务待出库
-        if (StockWaitType.PRODUCTION_TASK_OUT.getDetailType().equals(businessType)) {
-            for (StockWaitDetails stockWaitDetailsDto : stockWaitDetailsDtoList) {
-                StockWaitDetails stockWaitDetails = stockWaitDetailsMap.get(stockWaitDetailsDto.getId());
-                //减少冻结库存
-                StockFrozen stockFrozen = stockFrozenService.getOne(q -> q.eq(StockFrozen::getProductId, stockWaitDetails.getProductId()));
-                BigDecimal subtract = stockFrozen.getFrozenQuantity().subtract(stockWaitDetailsDto.getQuantity());
-                stockFrozen.setFrozenQuantity(subtract);
-                stockFrozenService.updateById(stockFrozen);
-            }
-        }
     }
 
     @Override