Prechádzať zdrojové kódy

处理状态位统计问题和修复前端bug

oyq28 3 rokov pred
rodič
commit
66b1b501c2

+ 12 - 1
imcs-bt-be/imcs-authority-server/src/main/java/com/github/zuihou/api/OpsAppApi.java

@@ -85,7 +85,18 @@ public class OpsAppApi {
         ProductionResource productionResource = BeanUtil.toBean(params.getModel(), ProductionResource.class);
         queryWrap.eq(ProductionResource::getStatus, "1").orderByDesc(ProductionResource::getCreateTime);
         if (StringUtils.isNotEmpty(productionResource.getOnlineStatus())) {
-            List<String> ids = productionTenantResourceService.getEquStatusIds(productionResource.getOnlineStatus());
+            List<String> ids = null;
+            //过滤处理设备状态
+            if(productionResource.getOnlineStatus().equals("2")) {
+                ids = productionTenantResourceService.getEquStatusIds(productionResource.getOnlineStatus());
+            }else if(productionResource.getOnlineStatus().equals("3")){
+                //过滤处理缺料状态
+                ids = productionTenantResourceService.getEquLackDevIds().stream().map(p->p.getId().toString()).collect(toList());
+            }
+            if (ids.size() == 0) {
+                //默认查询 确保查询数据为空
+                ids.add(0, "0");
+            }
             queryWrap.in(ProductionResource::getId, ids);
         }
         IPage<ProductionResource> list = productionTenantResourceService.pageList(page, queryWrap);

+ 2 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/dao/ProductionTenantResourceMapper.java

@@ -33,4 +33,6 @@ public interface ProductionTenantResourceMapper extends SuperMapper<ProductionRe
     Integer getEquLockCount(Long equId);
 
     Map getDevStatusMap(@Param("id")Long equId);
+
+    List<ProductionResource> getEquLackDevIds();
 }

+ 2 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/service/ProductionTenantResourceService.java

@@ -32,4 +32,6 @@ public interface ProductionTenantResourceService extends SuperService<Production
     Integer getEquLockCount(Long equId);
 
     Map getDevStatusMap(Long equId);
+
+    List<ProductionResource> getEquLackDevIds();
 }

+ 5 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/service/impl/ProductionTenantResourceServiceImpl.java

@@ -83,4 +83,9 @@ public class ProductionTenantResourceServiceImpl extends SuperServiceImpl<Produc
     public Map getDevStatusMap(Long equId) {
         return baseMapper.getDevStatusMap(equId);
     }
+
+    @Override
+    public List<ProductionResource> getEquLackDevIds() {
+        return baseMapper.getEquLackDevIds();
+    }
 }

+ 3 - 3
imcs-bt-be/imcs-business-biz/src/main/resources/mapper_business/base/order/OrderMapper.xml

@@ -191,7 +191,7 @@
         <if test="id != null">
             and o.order_equ_id = #{id}
         </if>
-        and o.order_status='1'
+        and o.order_status='6'
         union
         select 0,0,0,0,count(1) as num5,0, 0, 0, 0 from bt_order o
         <if test="orgIds != null and orgIds != ''">
@@ -229,7 +229,7 @@
         <if test="id != null">
             and o.order_equ_id = #{id}
         </if>
-        and o.order_status = '1'
+        and o.order_status = '6'
         union
         select 0,0,0,0,0,0, count(p.id) as num7, 0, 0 from imcs_tenant_productionresource p where p.status = '1'
         <if test="id != null">
@@ -256,7 +256,7 @@
         <if test="id != null">
             and o.order_equ_id = #{id}
         </if>
-        and o.order_status = '1'
+        and o.order_status = '6'
         union
         select 0,0,0,0,0,0, 0, 0, count(distinct p.id) from imcs_tenant_productionresource p left join bt_equ_barrel b on b.equ_id = p.id
         where p.status = '1' and b.residue_warn>=b.mtr_residue

+ 5 - 0
imcs-bt-be/imcs-business-biz/src/main/resources/mapper_business/base/productionresource/ProductionresourceMapper.xml

@@ -118,6 +118,11 @@
         </if>
     </select>
 
+    <select id="getEquLackDevIds" resultType="com.github.zuihou.business.productionresource.entity.ProductionResource">
+        select distinct p.id from imcs_tenant_productionresource p left join bt_equ_barrel b on b.equ_id = p.id
+        where p.status = '1' and b.residue_warn>=b.mtr_residue
+    </select>
+
     <select id="getDevStatusMap" parameterType="hashMap" resultType="java.util.Map">
         select sum(num1) as barrelLackNum,
                sum(num2) as barrelExprNum,