Browse Source

生产任务检索条件

yzc 1 year ago
parent
commit
b4c2f82b33

+ 25 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/production/dto/ProductionSchedulingSelectDto.java

@@ -33,4 +33,29 @@ public class ProductionSchedulingSelectDto extends BaseSelectDto {
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date schedulingDate;
 
+    /**
+     * 业务公司
+     */
+    private Long contractCompanyId;
+
+    /**
+     * 生产状态 0未开始 1进行中 2已完成
+     */
+    private String produceStatus;
+    /**
+     * 是否逾期
+     */
+    private Integer isOverdue;
+
+    /**
+     * 交期开始时间
+     */
+    private Date staDeliveryPeriod;
+
+    /**
+     * 交期结束时间
+     */
+    private Date endDeliveryPeriod;
+
+
 }

+ 7 - 0
hx-mes/src/main/java/com/fjhx/mes/mapper/production/ProduceOrderDetailMapper.java

@@ -6,6 +6,7 @@ import com.fjhx.mes.entity.production.po.ProductionOrderDetail;
 import com.fjhx.mes.entity.production.vo.ProductionOrderDetailVo;
 import com.fjhx.mes.entity.production.vo.ProductionSchedulingVo;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -19,6 +20,7 @@ import java.util.List;
  * @author
  * @since 2024-01-10
  */
+@Mapper
 public interface ProduceOrderDetailMapper extends BaseMapper<ProductionOrderDetail> {
 
     /**
@@ -32,4 +34,9 @@ public interface ProduceOrderDetailMapper extends BaseMapper<ProductionOrderDeta
      * 获取所有工序指定日期排程信息
      */
     List<ProductionSchedulingVo> getProcessesSchedulingByDay(String dayDate);
+
+    /**
+     * 获取所有工序指定日期排程信息
+     */
+    List<ProductionSchedulingVo> getProcessesScheduling(@Param("dayDate") String dayDate, @Param("ew") IWrapper<ProductionOrderDetail> wrapper);
 }

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

@@ -372,7 +372,8 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
 
         //单个工序查询
         String dayDate = DateUtil.format(dto.getSchedulingDate(), "yyyy-MM-dd");
-        List<ProductionSchedulingVo> productionSchedulingList = baseMapper.getProcessesSchedulingByDay(dayDate);
+        IWrapper<ProductionOrderDetail> pageCommWrapper = getPageCommWrapper(dto);
+        List<ProductionSchedulingVo> productionSchedulingList = baseMapper.getProcessesScheduling(dayDate, pageCommWrapper);
 
         JSONObject json = new JSONObject();
         json.put("onHandCount", getPage(onHandCountDto).getTotal());//在手任务(没排程的任务数)

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

@@ -10,15 +10,18 @@ import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.mes.entity.production.dto.ProductionSchedulingDto;
 import com.fjhx.mes.entity.production.dto.ProductionSchedulingSelectDto;
 import com.fjhx.mes.entity.production.po.ProductionOrder;
+import com.fjhx.mes.entity.production.po.ProductionOrderDetail;
 import com.fjhx.mes.entity.production.po.ProductionScheduling;
 import com.fjhx.mes.entity.production.vo.ProductionOrderDetailVo;
 import com.fjhx.mes.entity.production.vo.ProductionSchedulingVo;
 import com.fjhx.mes.mapper.production.ProduceOrderDetailMapper;
 import com.fjhx.mes.mapper.production.ProductionSchedulingMapper;
 import com.fjhx.mes.service.production.ProductionSchedulingService;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -40,16 +43,48 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched
 
     private final ProductInfoService productInfoService;
     private final ProduceOrderDetailMapper produceOrderDetailMapper;
+    private final ISysUserService sysUserService;
 
     @Autowired
-    public ProductionSchedulingServiceImpl(ProductInfoService productInfoService, ProduceOrderDetailMapper produceOrderDetailMapper) {
+    public ProductionSchedulingServiceImpl(ProductInfoService productInfoService, ProduceOrderDetailMapper produceOrderDetailMapper, ISysUserService sysUserService) {
         this.productInfoService = productInfoService;
         this.produceOrderDetailMapper = produceOrderDetailMapper;
+        this.sysUserService = sysUserService;
     }
 
     @Override
     public Page<ProductionSchedulingVo> getPage(ProductionSchedulingSelectDto dto) {
         IWrapper<ProductionScheduling> wrapper = getWrapper();
+
+        //===============================================================================================
+        //业务公司过滤
+        wrapper.eq("c.of_company_id", dto.getContractCompanyId());
+        //生产公司
+        wrapper.eq("po", ProductionOrder::getCompanyId, dto.getCompanyId());
+        //生产状态
+        String produceStatus = dto.getProduceStatus();
+        if (ObjectUtil.isNotEmpty(produceStatus)) {
+            wrapper.in("pod", ProductionOrderDetail::getProduceStatus, produceStatus.split(","));
+        }
+        //是否逾期过滤
+        if (ObjectUtil.isNotEmpty(dto.getIsOverdue())) {
+            wrapper.eq("IF(IFNULL(po.finish_time,NOW())>po.delivery_period,1,0)", dto.getIsOverdue());
+        }
+        //交期-时间范围过滤
+        wrapper.ge("po", ProductionOrder::getDeliveryPeriod, dto.getStaDeliveryPeriod());
+        wrapper.le("po", ProductionOrder::getDeliveryPeriod, dto.getEndDeliveryPeriod());
+
+        //关键字
+        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());
+            wrapper.and(q -> q
+                    .like("po.code", dto.getKeyword())
+                    .or().in("c.create_user", uIds)
+            );
+        }
+        //======================================================================================================
+
         //只显示投产的数据
         wrapper.isNotNull("po.produce_time");
         //工序id过滤

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

@@ -58,4 +58,20 @@
             AND ps.scheduling_date = #{dayDate}
         GROUP BY pp.id
     </select>
+
+    <select id="getProcessesScheduling"
+            resultType="com.fjhx.mes.entity.production.vo.ProductionSchedulingVo">
+        SELECT pp.id                 AS processesId,
+               pp.`name`             AS processesName,
+               count(DISTINCT ps.id) AS quantity
+        FROM production_processes pp
+                 LEFT JOIN (select ps.id, ps.processes_id, ps.scheduling_date
+                            from production_scheduling ps
+                                     LEFT JOIN production_order_detail pod ON ps.task_id = pod.id
+                                     left join production_order po on pod.produce_order_id = po.id
+                                     LEFT JOIN contract c on po.contract_id = c.id
+                                ${ew.customSqlSegment}) ps ON ps.processes_id = pp.id
+            AND ps.scheduling_date = #{dayDate}
+        group by pp.id
+    </select>
 </mapper>

+ 1 - 0
hx-mes/src/main/resources/mapper/production/ProductionSchedulingMapper.xml

@@ -21,6 +21,7 @@
                  LEFT JOIN production_order_detail pod ON ps.task_id = pod.id
                  LEFT JOIN production_order po ON pod.produce_order_id = po.id
                  LEFT JOIN production_processes pp ON ps.processes_id = pp.id
+                 LEFT JOIN contract c ON po.contract_id = c.id
             ${ew.customSqlSegment}
     </select>
 

+ 4 - 3
hx-purchase/src/main/java/com/fjhx/purchase/entity/subscribe/po/SubscribeDetail.java

@@ -92,9 +92,10 @@ public class SubscribeDetail extends BasePo {
     private String productType;
 
     /**
-     * 所属分类
-     */
-    private Long productCategoryId;
+	 * 所属分类
+	 */
+	@TableField(exist = false)
+	private Long productCategoryId;
 
     /**
      * 所属分类

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

@@ -340,7 +340,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         } else {
             wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
             wrapper.ne("t1", Contract::getIsShow, 1);
-            wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
+//            wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
         }
         if (StringUtils.isNotEmpty(dto.getUserId())) {
             wrapper.eq("t1.salesmanId", dto.getUserId());