Browse Source

运行管理中心数据权限过滤操作

oyq28 4 years ago
parent
commit
5fbbad9ac4
12 changed files with 102 additions and 25 deletions
  1. 2 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/dao/OrderMapper.java
  2. 4 3
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/dao/PlanMapper.java
  3. 3 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderServiceImpl.java
  4. 2 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/PlanServiceImpl.java
  5. 42 8
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java
  6. 8 6
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/OrderMapper.xml
  7. 6 4
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/PlanMapper.xml
  8. 1 0
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/ZZoneController.java
  9. 8 0
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/OrderPageDTO.java
  10. 7 0
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/OrderSaveDTO.java
  11. 8 0
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/OrderUpdateDTO.java
  12. 11 1
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/Order.java

+ 2 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/dao/OrderMapper.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.github.zuihou.base.mapper.SuperMapper;
 import com.github.zuihou.business.operationManagementCenter.entity.Order;
 
+import com.github.zuihou.database.mybatis.auth.DataScope;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -23,7 +24,7 @@ import java.util.Map;
 @Repository
 public interface OrderMapper extends SuperMapper<Order> {
 
-    IPage<Order> pageList(IPage page,@Param("custDesc")String custDesc, @Param(Constants.WRAPPER) Wrapper<Order> queryWrapper);
+    IPage<Order> pageList(IPage page, @Param("custDesc")String custDesc, @Param(Constants.WRAPPER) Wrapper<Order> queryWrapper, DataScope dataScope);
 
 
     Map<String,String> getOrderStatusCount();

+ 4 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/dao/PlanMapper.java

@@ -7,6 +7,7 @@ import com.github.zuihou.base.mapper.SuperMapper;
 import com.github.zuihou.business.operationManagementCenter.entity.Order;
 import com.github.zuihou.business.operationManagementCenter.entity.Plan;
 
+import com.github.zuihou.database.mybatis.auth.DataScope;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -25,9 +26,9 @@ import java.util.Map;
 @Repository
 public interface PlanMapper extends SuperMapper<Plan> {
 
-    IPage<Plan> pageList(IPage page,@Param("bomDesc")String bomDesc,@Param("orderName")String orderName,@Param("taskBatchNo")String taskBatchNo,@Param("orderProduceStatus")String orderProduceStatus,
-                         @Param("pdeliveryTimeStart")String pdeliveryTimeStart,@Param("pdeliveryTimeEnd")String pdeliveryTimeEnd,
-                         @Param("deliveryTimeStart")String deliveryTimeStart,@Param("deliveryTimeEnd")String deliveryTimeEnd,@Param(Constants.WRAPPER) Wrapper<Plan> queryWrapper);
+    IPage<Plan> pageList(IPage page, @Param("bomDesc")String bomDesc, @Param("orderName")String orderName, @Param("taskBatchNo")String taskBatchNo, @Param("orderProduceStatus")String orderProduceStatus,
+                         @Param("pdeliveryTimeStart")String pdeliveryTimeStart, @Param("pdeliveryTimeEnd")String pdeliveryTimeEnd,
+                         @Param("deliveryTimeStart")String deliveryTimeStart, @Param("deliveryTimeEnd")String deliveryTimeEnd, @Param(Constants.WRAPPER) Wrapper<Plan> queryWrapper, DataScope dataScope);
 
     Map<String,String> getPlanStatusCount();
 

+ 3 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderServiceImpl.java

@@ -37,6 +37,7 @@ import com.github.zuihou.common.constant.CodeRuleModule;
 import com.github.zuihou.common.constant.RepeatCacheKey;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
+import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.security.model.SysUser;
@@ -122,7 +123,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
 
     @Override
     public IPage<Order> pageList(IPage page,String sustDesc, LbqWrapper<Order> wrapper) {
-        return baseMapper.pageList(page,sustDesc, wrapper);
+        return baseMapper.pageList(page,sustDesc, wrapper, new DataScope());
     }
 
     @Override
@@ -151,6 +152,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
         order.setStatus("1");
         order.setOrderName(data.get("orderName").toString());
         order.setCustId(Long.parseLong(data.get("custId")==null?"0":data.get("custId").toString()));
+        order.setZoneId(Long.parseLong(data.get("zoneId")==null?"0":data.get("zoneId").toString()));
         order.setDeliveryTime(DateUtil.stringToDate3(data.get("deliveryTime").toString()));
         order.setOrderTime(DateUtil.stringToDate3(data.get("orderTime").toString()));
         super.save(order);

+ 2 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/PlanServiceImpl.java

@@ -18,6 +18,7 @@ import com.github.zuihou.business.productionReadyCenter.service.BomProcedureServ
 import com.github.zuihou.common.constant.CodeRuleModule;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.context.BaseContextHandler;
+import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.security.model.SysUser;
@@ -230,7 +231,7 @@ public class PlanServiceImpl extends SuperServiceImpl<PlanMapper, Plan> implemen
 
     @Override
     public IPage<Plan> pageList(IPage page,String bomDesc,String orderName,String taskBatchNo,String orderProduceStatus, String pdeliveryTimeStart,String pdeliveryTimeEnd,String deliveryTimeStart,String deliveryTimeEnd, LbqWrapper<Plan> wrapper) {
-        return baseMapper.pageList(page,bomDesc,orderName,taskBatchNo,orderProduceStatus, pdeliveryTimeStart,pdeliveryTimeEnd,deliveryTimeStart,deliveryTimeEnd,wrapper);
+        return baseMapper.pageList(page,bomDesc,orderName,taskBatchNo,orderProduceStatus, pdeliveryTimeStart,pdeliveryTimeEnd,deliveryTimeStart,deliveryTimeEnd,wrapper, new DataScope());
     }
 
     @Override

+ 42 - 8
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java

@@ -216,12 +216,45 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 //                    redisTemplate.opsForValue().set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
                 }
             }
-        }
-        return map;
-    }
-
-
-
+//            if(count==0){//第一步的时候锁定资源
+//                //判断机器人是否为空
+//                String jrqarr[] = {resourceAutoCode.getResourceId().toString()};
+//                List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//                Map<String,List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
+//
+//                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                //机器人手抓没被锁定,并且有空闲未知
+//                if (CollectionUtil.isNotEmpty(jqrList)&&jqrList.size()>1&&jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
+//                    //满足条件--机器人空闲,设备或线边库有一个空闲
+//                    Storge startStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+//                    map.put("Data", startStore);
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE,"moveMaterial");
+//                }
+//                map.put("result", (CollectionUtil.isNotEmpty(jqrList) )&&jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS));
+//            }else if(count == 1){
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE,"fetchMaterial");
+//                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+//                map.put("fromStorge", currentStore);
+//                map.put("Data", currentStore);
+//                //出入库类型
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                //目的地为机器人手臂
+//                map.put("toStorge", jqrStorge);
+//                map.put("result", true);
+//            }else if(count == 2){
+//                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE,"putMaterial");
+//                map.put("fromStorge", currentStore);
+//                //出入库类型
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                //目的地为机器人手臂
+//                Storge hcwStorge = (Storge)redisTemplate.opsForValue().get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                map.put("Data", hcwStorge);
+//                map.put("toStorge", hcwStorge);
+//                map.put("result", true);
+//            }
+//        }
+            return map;
 
 
         //质量中心机器人
@@ -1516,8 +1549,9 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 //                map.put("result", true);
 //            }
 //
-//        }
-//        return map;
+        }
+        return map;
+    }
 
     @Override
     public Map operation(JSONObject jsonObject, JSONObject bizJsonObject, Map<String, Object> map) {

+ 8 - 6
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/OrderMapper.xml

@@ -9,6 +9,7 @@
         <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
         <result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
         <result column="cust_id" jdbcType="BIGINT" property="custId"/>
+        <result column="zone_id" jdbcType="BIGINT" property="zoneId"/>
         <result column="source" jdbcType="VARCHAR" property="source"/>
         <result column="order_status" jdbcType="VARCHAR" property="orderStatus"/>
         <result column="audit_status" jdbcType="VARCHAR" property="auditStatus"/>
@@ -34,7 +35,7 @@
     <sql id="Base_Column_List">
         id,create_time,update_time,
         order_no, cust_id, source, order_status, audit_status, status, plan_status, order_time, delivery_time, remark, create_user, update_user, prority,produce_num,product_num,complete_num,process,order_name,
-        scheduling_status, rhythm_type, produce_status,custDesc,zoenDesc,planBomNum,stayPlanNum,planNum
+        scheduling_status, rhythm_type, produce_status,custDesc,zoenDesc,planBomNum,stayPlanNum,planNum,org_id, zone_id
     </sql>
 
     <!-- 分页 -->
@@ -42,15 +43,16 @@
         select
         <include refid="Base_Column_List"/>
         from (
-            select a.*,b.cust_name as custDesc,c.name as zoenDesc,ifnull(g.planBomNum,0) as planBomNum,(ifnull(a.product_num,0) - ifnull(g.planBomNum,0)) as stayPlanNum,
+            select a.*,b.cust_name as custDesc,c.org_id,c.name as zoenDesc,ifnull(g.planBomNum,0) as planBomNum,(ifnull(a.product_num,0) - ifnull(g.planBomNum,0)) as stayPlanNum,
         ROUND(ifnull(a.complete_num,0)*100/ifnull(a.product_num,0),0)process,
         ifnull(h.planNum,0) as planNum from imcs_o_order a
             left join imcs_c_cust b on a.cust_id = b.id
-            left join (
-                select oz.order_id,GROUP_CONCAT(ze.name) name from imcs_o_order_zone oz
-                left join imcs_z_zone ze on oz.zone_id = ze.id
+            left join
+            /*(
+                select oz.order_id,GROUP_CONCAT(ze.name) name,oz.org_id from imcs_z_zone ze
                 GROUP BY oz.order_id
-            ) c on a.id = c.order_id
+            ) */
+            imcs_z_zone  c on a.zone_id = c.id
             left join (-- 已计划产品数
               select order_id,count(1) as planBomNum from imcs_p_plan_product pp where 1=1 group by order_id
             )g on a.id = g.order_id

+ 6 - 4
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/PlanMapper.xml

@@ -27,7 +27,7 @@
     <sql id="Base_Column_List">
         id,create_time,update_time,order_product_id,
         plan_no, order_id, audit_status, remark, create_user, plan_status, update_user, start_time, end_time, scheduling_status, produce_status,partsNo,partsAlias,bomAlias,deliveryTime,pdeliveryTime,
-         prority, status,rhythm_type,orderNo,orderStatus,orderName,source,bomDesc,process,planBomNum,zoenDesc,completeNum,qualification
+         prority, status,rhythm_type,orderNo,orderStatus,orderName,source,bomDesc,process,planBomNum,zoenDesc,completeNum,qualification,org_id
     </sql>
 
     <!-- 分页 -->
@@ -35,7 +35,7 @@
         select
         <include refid="Base_Column_List"/>
         from (
-        select a.*,b.order_no as orderNo,b.order_name orderName,b.source,b.order_status as orderStatus,c.bomDesc,c.partsNo,c.partsAlias,c.bomAlias,c.pdeliveryTime,b.delivery_time deliveryTime,c.order_product_id,
+        select a.*,b.order_no as orderNo,b.order_name orderName,b.source,b.order_status as orderStatus,c.bomDesc,c.partsNo,c.partsAlias,c.bomAlias,c.pdeliveryTime,b.delivery_time deliveryTime,c.order_product_id,d.org_id,
         CASE WHEN ifnull(v.completeCount ,0)=0 then 0 else round(100 *( v.verifyCount / v.completeCount),2) end qualification, ifnull(v.completeCount ,0) as completeNum,
         CASE WHEN ifnull(w.taskCount,0)=0 then 0 else  round(100 *( wcCount / taskCount),2) end process,ifnull(c.plan_bom_num,0) as planBomNum,d.name as zoenDesc from imcs_p_plan a
         left join (
@@ -46,11 +46,13 @@
         left join imcs_b_bom bo on pp.bom_id = bo.id
         left join imcs_o_order_product op on pp.order_product_id = op.id
         ) c on a.id= c.plan_id
-        left join (
+        left join
+        /*(
         select pz.plan_id,GROUP_CONCAT(ze.name) name from imcs_p_plan_zone pz
         left join imcs_z_zone ze on pz.zone_id = ze.id
         GROUP BY pz.plan_id
-        ) d on a.id = d.plan_id
+        ) */
+        imcs_z_zone d on d.id = b.zone_id
         LEFT JOIN ( SELECT t.plan_id, count(1) taskCount,  sum(CASE WHEN t. STATUS = '3' THEN 1 ELSE 0 END) wcCount FROM imcs_t_task t GROUP BY t.plan_id) w ON a.id = w.plan_id
         LEFT JOIN ( SELECT i.plan_id, count(1) completeCount, sum(CASE WHEN i. test_result = '1' THEN 1 ELSE 0 END) verifyCount FROM imcs_t_workpiece i GROUP BY i.plan_id ) v ON a.id = v.plan_id
         where 1=1

+ 1 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/ZZoneController.java

@@ -17,6 +17,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 import com.github.zuihou.base.controller.SuperController;
 import com.github.zuihou.base.R;
+import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 import com.github.zuihou.log.annotation.SysLog;

+ 8 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/OrderPageDTO.java

@@ -57,6 +57,14 @@ public class OrderPageDTO implements Serializable {
     @ApiModelProperty(value = "客户ID")
     @NotNull(message = "客户ID不能为空")
     private Long custId;
+
+    /**
+     * 客户ID
+     */
+    @ApiModelProperty(value = "场地ID")
+    @NotNull(message = "场地ID不能为空")
+    private Long zoneId;
+
     /**
      * 来源(1-系统内2-系统外)
      */

+ 7 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/OrderSaveDTO.java

@@ -58,6 +58,13 @@ public class OrderSaveDTO implements Serializable {
     @ApiModelProperty(value = "客户ID")
     @NotNull(message = "客户ID不能为空")
     private Long custId;
+
+    /**
+     * 客户ID
+     */
+    @ApiModelProperty(value = "场地ID")
+    @NotNull(message = "场地ID不能为空")
+    private Long zoneId;
     /**
      * 来源(1-系统内2-系统外)
      */

+ 8 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/OrderUpdateDTO.java

@@ -62,6 +62,14 @@ public class OrderUpdateDTO implements Serializable {
     @ApiModelProperty(value = "客户ID")
     @NotNull(message = "客户ID不能为空")
     private Long custId;
+
+    /**
+     * 客户ID
+     */
+    @ApiModelProperty(value = "场地ID")
+    @NotNull(message = "场地ID不能为空")
+    private Long zoneId;
+
     /**
      * 来源(1-系统内2-系统外)
      */

+ 11 - 1
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/Order.java

@@ -83,6 +83,15 @@ public class Order extends Entity<Long> {
     @Excel(name = "客户ID")
     private Long custId;
 
+    /**
+     * 场地ID
+     */
+    @ApiModelProperty(value = "场地ID")
+    @NotNull(message = "场地ID不能为空")
+    @TableField("zone_id")
+    @Excel(name = "场地ID")
+    private Long zoneId;
+
     /**
      * 来源(1-系统内2-系统外)
      */
@@ -254,7 +263,7 @@ public class Order extends Entity<Long> {
 
     @Builder
     public Order(Long id, LocalDateTime createTime, LocalDateTime updateTime,
-                    String orderNo, Long custId, String source, String orderStatus, String auditStatus,
+                    String orderNo, Long custId, Long zoneId, String source, String orderStatus, String auditStatus,
                     String status, String planStatus, Date orderTime, Date deliveryTime, String remark,
                     Integer prority, String schedulingStatus, String rhythmType, String produceStatus) {
         this.id = id;
@@ -262,6 +271,7 @@ public class Order extends Entity<Long> {
         this.updateTime = updateTime;
         this.orderNo = orderNo;
         this.custId = custId;
+        this.zoneId = zoneId;
         this.source = source;
         this.orderStatus = orderStatus;
         this.auditStatus = auditStatus;