Procházet zdrojové kódy

评审时间 问题处理

yzc před 10 měsíci
rodič
revize
f2f8aecc02

+ 7 - 0
hx-mes/src/main/resources/mapper/production/ProduceOrderDetailMapper.xml

@@ -20,6 +20,13 @@
                pod.update_time,
                pod.del_flag,
                pod.report_lock,
+               pod.expect_begin_time,
+               pod.expect_delivery_time,
+               pod.is_agree_work,
+               pod.cabinet_exit_time,
+               pod.is_cabinet_confirm,
+               pod.work_remark,
+               pod.begin_work_status,
                po.code                                                        AS orderCode,
                po.create_time                                                 AS orderCreateTime,
                po.produce_time,

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractVo.java

@@ -282,5 +282,10 @@ public class ContractVo extends Contract {
      */
     private String sampleCode;
 
+    /**
+     * 评审耗时
+     */
+    private BigDecimal reviewElapsedTime;
+
 }
 

+ 13 - 2
hx-sale/src/main/java/com/fjhx/sale/flow/ContractReviewFlow.java

@@ -5,6 +5,8 @@ import com.fjhx.common.enums.FlowStatusEnum1;
 import com.fjhx.flow.core.FlowDelegate;
 import com.fjhx.flow.enums.FlowStatusEnum;
 import com.fjhx.flow.enums.NodeTypeEnum;
+import com.fjhx.item.entity.product.po.ProductInfo;
+import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.sale.entity.contract.dto.ContractProductDto;
 import com.fjhx.sale.entity.contract.po.Contract;
 import com.fjhx.sale.entity.contract.po.ContractProduct;
@@ -17,17 +19,22 @@ import org.springframework.stereotype.Component;
 import java.util.Date;
 import java.util.List;
 
+/**
+ * 订单评审流程
+ */
 @Component
 public class ContractReviewFlow extends FlowDelegate {
 
     private final ContractService contractService;
     private final ContractProductService contractProductService;
     private final ContractProductBomService contractProductBomService;
+    private final ProductInfoService productInfoService;
 
-    public ContractReviewFlow(ContractService contractService, ContractProductService contractProductService, ContractProductBomService contractProductBomService) {
+    public ContractReviewFlow(ContractService contractService, ContractProductService contractProductService, ContractProductBomService contractProductBomService, ProductInfoService productInfoService) {
         this.contractService = contractService;
         this.contractProductService = contractProductService;
         this.contractProductBomService = contractProductBomService;
+        this.productInfoService = productInfoService;
     }
 
     @Override
@@ -46,6 +53,10 @@ public class ContractReviewFlow extends FlowDelegate {
                 .set(ContractProduct::getReviewFlowId, flowId)
         );
 
+        //赋值产品信息
+        ProductInfo productInfo = productInfoService.getById(dto.getProductId());
+        submitData.put("productCode", productInfo.getCustomCode());
+
         return dto.getId();
     }
 
@@ -92,7 +103,7 @@ public class ContractReviewFlow extends FlowDelegate {
         );
         if (count == 0) {
             contractService.update(q -> q
-                    .eq(Contract::getId, contractProduct.getId())
+                    .eq(Contract::getId, contractProduct.getContractId())
                     .set(Contract::getReviewStatus, FlowStatusEnum1.PASS.getKey())
                     .set(Contract::getReviewEndTime, new Date())
             );

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

@@ -599,6 +599,12 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             //赋值产品明细
             p.setContractProductList(cpMap.get(p.getId()));
 
+            //生产耗时小数处理
+            BigDecimal reviewElapsedTime = p.getReviewElapsedTime();
+            if (ObjectUtil.isNotEmpty(reviewElapsedTime)) {
+                p.setReviewElapsedTime(reviewElapsedTime.setScale(2, BigDecimal.ROUND_HALF_UP));
+            }
+
         }
 
         // 赋值流程id

+ 13 - 10
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -16,30 +16,33 @@
                      (t1.sumClaimMoney - t1.invoiceAmount)                                 as unInvoiceAmount,
                      (CASE WHEN t1.sumClaimMoney &lt; t1.outboundAmount THEN 1 ELSE 0 END) AS isSpecialOutbound
               FROM (SELECT t1.*,
-                           c.name                              customerName,
+                           c.name                                                                                 customerName,
                            (SELECT IFNULL(SUM(cc.contract_money), 0)
                             FROM claim_contract cc
                                      JOIN claim cl ON cc.claim_id = cl.id
                             WHERE cl.confirm_status = 1
-                              and cc.contract_id = t1.id)   AS sumClaimMoney,
+                              and cc.contract_id = t1.id)                                                      AS sumClaimMoney,
                            po.produce_status,
-                           IFNULL(t3.quantity, 0)           AS waitStockQuantity,
-                           IFNULL(t3.receipt_quantity, 0)   AS receiptStockQuantity,
+                           IFNULL(t3.quantity, 0)                                                              AS waitStockQuantity,
+                           IFNULL(t3.receipt_quantity, 0)                                                      AS receiptStockQuantity,
                            IFNULL(
                                    (SELECT sum(pod.finish_quantity * cp.price)
                                     FROM contract_product cp
                                              JOIN production_order_detail pod ON pod.contract_detail_id = cp.id
                                     WHERE cp.contract_id = t1.id)
-                               , 0)                         AS settledAmount,
-                           po.delivery_period               as prodDeliveryPeriod,
-                           IFNULL(t4.deliverQuantity, 0)    as deliverQuantity,
-                           IFNULL(t4.notDeliverQuantity, 0) as notDeliverQuantity,
+                               ,
+                                   0)                                                                          AS settledAmount,
+                           po.delivery_period                                                                  as prodDeliveryPeriod,
+                           IFNULL(t4.deliverQuantity, 0)                                                       as deliverQuantity,
+                           IFNULL(t4.notDeliverQuantity, 0)                                                    as notDeliverQuantity,
                            (SELECT IFNULL(sum(iacd.amount), 0)
                             FROM invoice_apply_contract_detail iacd
                                      JOIN invoice_apply ia ON iacd.invoice_apply_id = ia.id
                             WHERE ia.`status` IN (10, 30, 60)
-                              AND iacd.contract_id = c.id)  AS invoiceAmount,
-                           IFNULL(cor_1.outbound_amount, 0) AS outboundAmount
+                              AND iacd.contract_id = c.id)                                                     AS invoiceAmount,
+                           IFNULL(cor_1.outbound_amount, 0)                                                    AS outboundAmount,
+                           TIMESTAMPDIFF(MINUTE, t1.review_begin_time, IFNULL(t1.review_end_time, now())) /
+                           24                                                                                  AS reviewElapsedTime
                     FROM contract t1
                              left join customer c on t1.buy_corporation_id = c.id
                              LEFT JOIN production_order po ON po.contract_id = t1.id

+ 12 - 12
hx-sale/src/main/resources/mapper/contract/ContractProductMapper.xml

@@ -4,19 +4,19 @@
 
     <select id="getPage" resultType="com.fjhx.sale.entity.contract.vo.ContractProductVo">
         SELECT t1.id,
-               t2.create_time AS contractTime,
+               t2.create_time     AS contractTime,
                t1.contract_id,
                t1.product_id,
-               t2.`code`      AS contractCode,
-               t2.user_name   AS userName,
-               t2.create_user AS salesmanId,
-               t2.version     AS contractVersion,
+               t2.`code`          AS contractCode,
+               t2.user_name       AS userName,
+               t2.create_user     AS salesmanId,
+               t2.version         AS contractVersion,
                t1.expend_quantity AS expendQuantity,
                (SELECT create_time
                 FROM claim_contract
                 WHERE contract_id = t2.id
                 ORDER BY create_time DESC
-                                 LIMIT 1)               AS claimTime,
+                                     LIMIT 1)               AS claimTime,
                t2.contract_template_id AS contractTemplateId,
                t1.quantity,
                t2.company_id,
@@ -240,12 +240,12 @@
                c.`code`           AS contractCode,
                c.delivery_time    AS contractDeliveryTime,
                c.salesman_id,
-               su.nick_name    AS salesmanName,
-               c.quality_lv    AS contractQualityLv,
-               cu.`name`       AS customerName,
-               pi.custom_code  AS productCode,
-               pi.color        AS productColor,
-               pi.material     AS productMaterial
+               su.nick_name       AS salesmanName,
+               c.quality_lv       AS contractQualityLv,
+               cu.`name`          AS customerName,
+               pi.custom_code     AS productCode,
+               pi.color           AS productColor,
+               pi.material        AS productMaterial
         FROM contract_product cp
                  JOIN contract c ON cp.contract_id = c.id
                  LEFT JOIN customer cu ON c.buy_corporation_id = cu.id