Procházet zdrojové kódy

feature 获取甘特图列表接口改造

xiahan před 1 rokem
rodič
revize
d6a09c07b1

+ 3 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProcessOperationProcessEquDao.java

@@ -40,7 +40,9 @@ public interface ApsProcessOperationProcessEquDao extends BaseMapper<ApsProcessO
                                     @Param("factoryId") String factoryId,
                                     @Param("workshopIds") List<String> workshopId,
                                     @Param("orderNos") List<String> orderNo,
-                                    @Param("processids") String processids);
+                                    @Param("processids") String processids,
+                                    @Param("productionLineIds")List<String> productionLineId,
+                                    @Param("equIds") List<String> equId);
 
     void updateAboutStateByProcessId(@Param("updateIds") List<ProcessIdRelationVo> updateIds);
 

+ 3 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/GanttService.java

@@ -3,6 +3,7 @@ package com.rongwei.bscommon.sys.service;
 import com.rongwei.rwcommon.base.R;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * GanttService class
@@ -12,5 +13,6 @@ import java.util.Date;
  */
 public interface GanttService {
 
-    R getListByCondition(Date searchDate,  String factoryId, String workshopId,String orderNo);
+    R getListByCondition(Date searchDate, String factoryId, List<String> workshopId, List<String> orderNo,
+                         List<String> productionLineId,List<String> equId);
 }

+ 13 - 9
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/GanttServiceImpl.java

@@ -60,27 +60,31 @@ public class GanttServiceImpl implements GanttService {
 
     /**
      * 根据条件获取gantt
-     *
      * @param searchDate
-     * @param endTime
      * @param factoryId
-     * @param workshopId
+     * @param workShopIdList
+     * @param orderNoList
+     * @param productionLineId
+     * @param equId
      * @return
      */
     @Override
-    public R getListByCondition(Date searchDate, String factoryId, String workshopId,String orderNo) {
+    public R getListByCondition(Date searchDate, String factoryId,
+                                List<String> workShopIdList,
+                                List<String> orderNoList,
+                                List<String> productionLineId,
+                                List<String> equId) {
         log.info("甘特图查询开始时间:"+ DateUtil.now());
         List<Date> searchDateList = getSearchDate(searchDate);
-        List<String> workShopIdList = StringUtils.isNotBlank(workshopId) ? Arrays.asList(workshopId.split(",")) : new ArrayList<>();
-        // 获取 工序作业信息
-        List<String> orderNoList=StringUtils.isBlank(orderNo)?null:Arrays.asList(orderNo.split(","));
         List<GanttVos> apsProcessOperationProcessEquDos = apsProcessOperationProcessEquDao.getGanttDataList(
                 searchDateList==null?null:searchDateList.get(0),
                 searchDateList==null?null:searchDateList.get(1),
                 factoryId,
                 workShopIdList,
                 orderNoList,
-                null);
+                null,
+                productionLineId,
+                equId);
         // 需要返回给前端的数据
         List<ScheduleGanttVo> resultVo = new ArrayList<>();
         if (apsProcessOperationProcessEquDos.isEmpty()) {
@@ -294,7 +298,7 @@ public class GanttServiceImpl implements GanttService {
                 if(queryProcessids != null && queryProcessids.size()>0){
                     String joinids = "'" + CollUtil.join(queryProcessids, "','") + "'";
                     retGantvos = apsProcessOperationProcessEquDao.getGanttDataList(
-                            null,null,null,null,null,joinids);
+                            null,null,null,null,null,joinids,null,null);
                 }
             }
 

+ 27 - 6
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProcessOperationProcessEquDao.xml

@@ -175,9 +175,10 @@
         Date(a6.PROMISEDELIVERYDATE) as PROMISEDELIVERYDATE,
         Date(a6.SCHEDULEDELIVERYDATE) as SCHEDULEDELIVERYDATE,
         if((a6.PROMISEDELIVERYDATE is not null and DATE(a6.SCHEDULEDELIVERYDATE)> DATE(a6.PROMISEDELIVERYDATE))
-               or ((a6.PROMISEDELIVERYDATE is null or  DATE(a6.SCHEDULEDELIVERYDATE) &lt;= DATE(a6.PROMISEDELIVERYDATE)) and
+        or ((a6.PROMISEDELIVERYDATE is null or DATE(a6.SCHEDULEDELIVERYDATE) &lt;= DATE(a6.PROMISEDELIVERYDATE)) and
         DATE(a6.SCHEDULEDELIVERYDATE)> DATE(a6.DELIVERYDATE)
-        ),1,0) as conflict
+        ),1,0) as conflict,
+        a1.CONFLICTLEVEL
         FROM
         aps_process_operation_process_equ a1
         LEFT JOIN aps_process_operation a2 ON a1.PROCESSID = a2.ID
@@ -186,6 +187,10 @@
         LEFT JOIN aps_product_detail a5 ON a4.PRODUCTID = a5.ID
         LEFT JOIN aps_production_order a6 on a6.ID= a5.MAINID
         LEFT JOIN aps_customer_management a7 on a6.CUSTOMID= a7.ID
+        <if test="productionLineIds != null and productionLineIds.size()>0">
+            LEFT JOIN aps_resources_equipment ape on ape.EQUIPMENTID = a1.PROCESSDEVICEID
+            LEFT JOIN aps_production_line apl on ape.MAINID =apl.ID
+        </if>
         <where>
             a1.DELETED ='0'
             AND a2.DELETED = '0'
@@ -193,21 +198,37 @@
             AND a4.DELETED = '0'
             AND a5.DELETED = '0'
             AND a6.DELETED='0'
+            <if test="productionLineIds != null and productionLineIds.size()>0">
+                AND ape.DELETED = '0'
+                AND apl.DELETED = '0'
+            </if>
             <if test="workshopIds != null and workshopIds.size()>0">
                 and a1.PROCESSWORKSHOPID in
                 <foreach collection="workshopIds" item="workshopId" open="(" close=")" separator=",">
                     #{workshopId}
                 </foreach>
             </if>
-            <if test="factoryId != null and factoryId != '' and factoryId != 'ALL'">and a1.TENANTID = #{factoryId}</if>
-            <if test="startTime != null ">and a1.PLANSTARTDATE &gt;= #{startTime}</if>
-            <if test="endTime != null ">and a1.PLANENDDATE &lt;= #{endTime}</if>
             <if test="orderNos !=null and orderNos.size()>0">
-                and  a6.ORDERNO in
+                and a6.ORDERNO in
                 <foreach collection="orderNos" item="orderNo" open="(" close=")" separator=",">
                     #{orderNo}
                 </foreach>
             </if>
+            <if test="equIds != null and equIds.size()>0">
+                and a1.PROCESSDEVICEID in
+                <foreach collection="equIds" item="equId" open="(" close=")" separator=",">
+                    #{equId}
+                </foreach>
+            </if>
+            <if test="productionLineIds != null and productionLineIds.size()>0">
+                and apl.ID in
+                <foreach collection="productionLineIds" item="productionLineId" open="(" close=")" separator=",">
+                    #{productionLineId}
+                </foreach>
+            </if>
+            <if test="factoryId != null and factoryId != '' and factoryId != 'ALL'">and a1.TENANTID = #{factoryId}</if>
+            <if test="startTime != null ">and a1.PLANSTARTDATE &gt;= #{startTime}</if>
+            <if test="endTime != null ">and a1.PLANENDDATE &lt;= #{endTime}</if>
             <if test="processids != null ">and a1.PROCESSID in (${processids})</if>
         </where>
         order by a1.PLANSTARTDATE asc,a1.PLANENDDATE asc

+ 11 - 2
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/GanttVos.java

@@ -138,8 +138,17 @@ public class GanttVos {
      * 冲突
      */
     private Boolean conflict;
-
+    /**
+     * 是否冲突
+     */
     private String hasconflict;
-
+    /**
+     *冲突描述
+     */
     private String conflictdes;
+
+    /**
+     *冲突等级(hard:强制冲突,soft:非强制冲突)
+     */
+    private String conflictlevel;
 }

+ 21 - 6
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ProcessGanttListVo.java

@@ -1,19 +1,34 @@
 package com.rongwei.bsentity.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class ProcessGanttListVo {
-
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date startTime;
 
     private String factoryId;
-
-    private String workshopId;
-
-    private String orderNo;
-
+    /**
+     * 车间
+     */
+    private List<String> workshopId;
+    /**
+     * 订单
+     */
+    private List<String> orderNo;
+    /**
+     * 产线
+     */
+    private List<String> productionLineId;
+    /**
+     * 设备ID
+     */
+    private List<String> equId;
 }

+ 5 - 2
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/GanttController.java

@@ -32,11 +32,13 @@ public class GanttController {
      * @return
      */
     @GetMapping("/list")
+    @Deprecated
     public R updateRelevantInformation(@RequestParam(name = "startTime", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date searchDate,
                                        @RequestParam(name = "factoryId") String factoryId,
                                        @RequestParam(name = "workshopId", required = false) String workshopId,
                                        @RequestParam(name = "orderNo",required = false) String orderNo) {
-        return ganttService.getListByCondition(searchDate, factoryId, workshopId,orderNo);
+//        return ganttService.getListByCondition(searchDate, factoryId, workshopId,orderNo);
+        return R.ok();
     }
 
     /**
@@ -47,7 +49,8 @@ public class GanttController {
     @PostMapping("/processGanttList")
     public R processGanttList(@RequestBody ProcessGanttListVo processGanttListVo) {
         return ganttService.getListByCondition(processGanttListVo.getStartTime(), processGanttListVo.getFactoryId(),
-                processGanttListVo.getWorkshopId(),processGanttListVo.getOrderNo());
+                processGanttListVo.getWorkshopId(), processGanttListVo.getOrderNo(),
+                processGanttListVo.getProductionLineId(), processGanttListVo.getEquId());
     }
 
     /**