Selaa lähdekoodia

生产任务加字段

yzc 11 kuukautta sitten
vanhempi
commit
1fc16ac202

+ 8 - 0
hx-item/src/main/java/com/fjhx/item/entity/product/po/ProductClassify.java

@@ -1,10 +1,13 @@
 package com.fjhx.item.entity.product.po;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * <p>
  * 产品分类
@@ -43,4 +46,9 @@ public class ProductClassify extends BasePo {
      */
     private Integer sort;
 
+    @TableField(exist = false)
+    private String treeName;
+    @TableField(exist = false)
+    private List<String> nameList;
+
 }

+ 5 - 0
hx-item/src/main/java/com/fjhx/item/service/product/ProductClassifyService.java

@@ -6,6 +6,7 @@ import com.fjhx.item.entity.product.po.ProductClassify;
 import com.ruoyi.common.core.service.BaseService;
 
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -43,4 +44,8 @@ public interface ProductClassifyService extends BaseService<ProductClassify> {
      */
     List<Long> getChildIdList(long classifyId);
 
+    /**
+     * 获取分类树名称Map
+     */
+    Map<Long, ProductClassify> getNameTreeMap();
 }

+ 30 - 3
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductClassifyServiceImpl.java

@@ -13,9 +13,9 @@ import com.ruoyi.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 
 /**
@@ -141,4 +141,31 @@ public class ProductClassifyServiceImpl extends ServiceImpl<ProductClassifyMappe
 
     }
 
+    @Override
+    public Map<Long, ProductClassify> getNameTreeMap() {
+        List<ProductClassify> productClassifyList = this.list();
+        if (ObjectUtil.isEmpty(productClassifyList)) {
+            return new HashMap<>();
+        }
+        Map<Long, ProductClassify> productClassifyMap = productClassifyList.stream()
+                .collect(Collectors.toMap(ProductClassify::getId, Function.identity()));
+        for (ProductClassify productClassify : productClassifyList) {
+            List<String> classifyNameGroup = new ArrayList<>();
+            classifyNameGroup.add(productClassify.getName());
+
+            Long parentId = productClassify.getParentId();
+            while (parentId != null) {
+                ProductClassify tempClassify = productClassifyMap.get(parentId);
+                if (ObjectUtil.isEmpty(tempClassify)) {
+                    break;
+                }
+                classifyNameGroup.add(0, tempClassify.getName());
+                parentId = tempClassify.getParentId();
+            }
+            productClassify.setNameList(classifyNameGroup);
+            productClassify.setTreeName(classifyNameGroup.stream().collect(Collectors.joining(" / ")));
+        }
+        return productClassifyList.stream().collect(Collectors.toMap(ProductClassify::getId, Function.identity()));
+    }
+
 }

+ 5 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/production/dto/ProduceOrderDetailSelectDto.java

@@ -79,4 +79,9 @@ public class ProduceOrderDetailSelectDto extends BaseSelectDto {
      */
     private Integer isHand;
 
+    /**
+     * 是否欠料过滤
+     */
+    private Integer lackStatus;
+
 }

+ 40 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/production/vo/ProductionOrderDetailVo.java

@@ -63,6 +63,29 @@ public class ProductionOrderDetailVo extends ProductionOrderDetail {
      */
     private String productRemark;
 
+    /**
+     * 分类名称
+     */
+    private String productClassifyName;
+    private String productClassifyNames;
+
+    /**
+     * 正面纹路
+     */
+    private String productFrontalTexture;
+    /**
+     * 反面纹路
+     */
+    private String productReverseTexture;
+    /**
+     * LOGO长
+     */
+    private BigDecimal productLogoLength;
+    /**
+     * LOGO宽
+     */
+    private BigDecimal productLogoWidth;
+
 
     /**
      * 交期
@@ -165,4 +188,21 @@ public class ProductionOrderDetailVo extends ProductionOrderDetail {
      * 业务公司名称
      */
     private String contractCompanyName;
+
+    /**
+     * 合同部门名称
+     */
+    private Long contractDeptId;
+    private String contractDeptName;
+
+    /**
+     * 客户
+     */
+    private Long customerId;
+    private String customerName;
+
+    /**
+     * 欠料状态
+     */
+    private Integer lackStatus;
 }

+ 36 - 0
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProduceOrderDetailServiceImpl.java

@@ -7,7 +7,11 @@ import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.common.utils.Assert;
+import com.fjhx.customer.entity.customer.po.Customer;
+import com.fjhx.customer.service.customer.CustomerService;
+import com.fjhx.item.entity.product.po.ProductClassify;
 import com.fjhx.item.entity.product.po.ProductInfo;
+import com.fjhx.item.service.product.ProductClassifyService;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.mes.entity.production.dto.ProduceOrderDetailSelectDto;
 import com.fjhx.mes.entity.production.dto.ProductionOrderDetailDto;
@@ -68,6 +72,10 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
     private ISysUserService sysUserService;
     @Autowired
     private ProductionSchedulingService productionSchedulingService;
+    @Autowired
+    private CustomerService customerService;
+    @Autowired
+    private ProductClassifyService productClassifyService;
 
     @Override
     public Page<ProductionOrderDetailVo> getPage(ProduceOrderDetailSelectDto dto) {
@@ -124,11 +132,16 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
         wrapper.le("po", ProductionOrder::getCreateTime, dto.getEndTime());
         //关键字
         if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
+            //创建人检索
             List<SysUser> list = sysUserService.list(IWrapper.<SysUser>getWrapper().like(SysUser::getNickName, dto.getKeyword()));
             List<Long> uIds = list.stream().map(SysUser::getUserId).collect(Collectors.toList());
+            //客户检索
+            List<Long> cuIds = customerService.listObject(Customer::getId, q -> q.in(Customer::getName, dto.getKeyword()));
+
             wrapper.and(q -> q
                     .like("po.code", dto.getKeyword())
                     .or().in("c.create_user", uIds)
+                    .or().in("c.buy_corporation_id", cuIds)
             );
         }
 
@@ -153,6 +166,11 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
             wrapper.eq("c.contract_type", dto.getContractType());
         }
 
+        //欠料状态过滤
+        if (ObjectUtil.isNotEmpty(dto.getLackStatus())) {
+            wrapper.apply("IFNULL( t2.lackStatus, 0 ) = {0}", dto.getLackStatus());
+        }
+
         return wrapper;
     }
 
@@ -217,6 +235,8 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
         //获取生产公司信息
         Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(null);
 
+        //获取产品分类Map
+        Map<Long, ProductClassify> productClassifyNameTreeMap = productClassifyService.getNameTreeMap();
 
         for (ProductionOrderDetailVo record : records) {
             //赋值产品信息
@@ -230,7 +250,16 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
                 record.setProductWidth(product.getWidth());
                 record.setProductHeight(product.getHeight());
                 record.setProductColor(product.getColor());
+                record.setProductFrontalTexture(product.getFrontalTexture());
+                record.setProductReverseTexture(product.getReverseTexture());
+                record.setProductLogoLength(product.getLogoLength());
+                record.setProductLogoWidth(product.getLogoWidth());
+
 
+                //赋值分类
+                ProductClassify productClassify = productClassifyNameTreeMap.getOrDefault(product.getProductClassifyId(), new ProductClassify());
+                record.setProductClassifyName(productClassify.getName());
+                record.setProductClassifyNames(productClassify.getTreeName());
             }
 
 //            //赋值原材料信息
@@ -256,11 +285,18 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
             record.setCompanyName(companyNameMap.get(record.getCompanyId()));
             record.setContractCompanyName(companyNameMap.get(record.getContractCompanyId()));
 
+            //赋值部门名称
+            record.setContractDeptName(companyNameMap.get(record.getContractDeptId()));
         }
 
         //赋值业务员名称
         UserUtil.assignmentNickName(records, ProductionOrderDetailVo::getSaleUserId, ProductionOrderDetailVo::setSaleUserName);
 
+        //赋值客户名称
+        customerService.attributeAssign(records, ProductionOrderDetailVo::getCustomerId, (item, customer) -> {
+            item.setCustomerName(customer.getName());
+        });
+
         return page;
     }
 

+ 1 - 1
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProduceOrderServiceImpl.java

@@ -169,7 +169,7 @@ public class ProduceOrderServiceImpl extends ServiceImpl<ProduceOrderMapper, Pro
 
         //欠料状态过滤
         if (ObjectUtil.isNotEmpty(dto.getLackStatus())) {
-            wrapper.apply("IFNULL( t2.lackStatus, 0 )", dto.getLackStatus());
+            wrapper.apply("IFNULL( t2.lackStatus, 0 ) = {0}", dto.getLackStatus());
         }
 
         Page<ProductionOrderVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);

+ 15 - 1
hx-mes/src/main/resources/mapper/production/ProduceOrderDetailMapper.xml

@@ -30,10 +30,24 @@
                c.prod_remark,
                c.create_user                                                  as saleUserId,
                c.contract_type,
-               c.of_company_id                                                as contractCompanyId
+               c.of_company_id                                                as contractCompanyId,
+               c.dept_id                                                      as contractDeptId,
+               c.buy_corporation_id                                           as customerId,
+               IFNULL(t2.lackStatus, 0)                                       as lackStatus
         FROM production_order_detail pod
                  LEFT JOIN production_order po ON pod.produce_order_id = po.id
                  LEFT JOIN contract c ON pod.contract_id = c.id
+                 LEFT JOIN (SELECT sd.prod_order_id,
+                                   CASE
+                                       WHEN SUM(CASE WHEN sd.`status` IN (15, 30) OR ep.arrival_status != 20 OR sw.`status` != 2 THEN 1 ELSE 0 END) >
+                                            0 THEN 1
+                                       ELSE 0 END AS lackStatus
+                            FROM subscribe_detail sd
+                                     LEFT JOIN ehsd_purchase_product epp ON epp.subscribe_detail_id = sd.id
+                                     LEFT JOIN ehsd_purchase ep ON epp.purchase_id = ep.id
+                                AND ep.`status` IN (10, 30, 60)
+                                     LEFT JOIN stock_wait sw ON sw.purchase_id = ep.id
+                            GROUP BY sd.prod_order_id) t2 ON t2.prod_order_id = pod.produce_order_id
     </sql>
 
     <select id="getPage" resultType="com.fjhx.mes.entity.production.vo.ProductionOrderDetailVo">