Selaa lähdekoodia

feature 甘特图相关代码提交

xiahan 1 vuosi sitten
vanhempi
commit
cc628a35a9

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

@@ -12,5 +12,5 @@ import java.util.Date;
  */
 public interface GanttService {
 
-    R getListByCondition(Date startTime, Date endTime, String factoryId, String workshopId);
+    R getListByCondition(Date searchDate,  String factoryId, String workshopId);
 }

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

@@ -12,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -47,17 +50,19 @@ public class GanttServiceImpl implements GanttService {
     /**
      * 根据条件获取gantt
      *
-     * @param startTime
+     * @param searchDate
      * @param endTime
      * @param factoryId
      * @param workshopId
      * @return
      */
     @Override
-    public R getListByCondition(Date startTime, Date endTime, String factoryId, String workshopId) {
+    public R getListByCondition(Date searchDate, String factoryId, String workshopId) {
+        List<Date> searchDateList = getSearchDate(searchDate);
         List<String> workShopIdList = StringUtils.isNotBlank(workshopId) ? Arrays.asList(workshopId.split(",")) : new ArrayList<>();
         // 获取 工序作业信息
-        List<GanttVos> apsProcessOperationProcessEquDos = apsProcessOperationProcessEquDao.getGanttDataList(startTime, endTime, factoryId, workShopIdList);
+        List<GanttVos> apsProcessOperationProcessEquDos = apsProcessOperationProcessEquDao.getGanttDataList(searchDateList.get(0),
+                searchDateList.get(1), factoryId, workShopIdList);
         // 需要返回给前端的数据
         List<ScheduleGanttVo> resultVo = new ArrayList<>();
         if (apsProcessOperationProcessEquDos.isEmpty()) {
@@ -140,6 +145,10 @@ public class GanttServiceImpl implements GanttService {
                     dateVo.setProcessdetailids(ganttVos.stream().map(GanttVos::getId).distinct().collect(Collectors.joining(",")));
                     dateVo.setProcessids(ganttVos.stream().map(GanttVos::getProcessid).distinct().collect(Collectors.joining(",")));
                     dateVo.setGanttVos(ganttVos);
+                    dateVo.setWorkstatus(ganttVos.stream().map(GanttVos::getWorkstatus).distinct().collect(Collectors.joining(",")));
+                    dateVo.setLockmark(ganttVos.stream().map(GanttVos::getLockmark).distinct().collect(Collectors.joining(",")));
+                    dateVo.setConflict(ganttVos.get(0).getConflict());
+                    dateVo.setProductionorderid(ganttVos.stream().map(GanttVos::getProductionorderid).collect(Collectors.joining(",")));
                     resultVo.add(dateVo);
                 }
             }
@@ -202,4 +211,24 @@ public class GanttServiceImpl implements GanttService {
         }
         return  dateFormat.format(date);
     }
+
+    /**
+     * 根据传入日期获取 该日期的前6天和后6天
+     * @param date
+     * @return
+     */
+    private List<Date> getSearchDate(Date date){
+
+        LocalDateTime now = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+        // 获取前6天的0点0分01秒
+        LocalDateTime sixDaysAgoStart = now.minusDays(6).truncatedTo(ChronoUnit.DAYS).plusSeconds(1);
+
+
+        // 获取后6天的23点59分59秒
+        LocalDateTime sixDaysLaterEnd = now.plusDays(6).truncatedTo(ChronoUnit.DAYS).plusHours(23).plusMinutes(59).plusSeconds(59);
+        List<Date> returnDate = new ArrayList();
+        returnDate.add(Date.from(sixDaysAgoStart.atZone(ZoneId.systemDefault()).toInstant()));
+        returnDate.add(Date.from(sixDaysLaterEnd.atZone(ZoneId.systemDefault()).toInstant()));
+        return returnDate;
+    }
 }

+ 9 - 2
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProcessOperationProcessEquDao.xml

@@ -150,13 +150,14 @@
         a1.PROCESSWORKSHOP,
         a1.PROCESSDEVICEID,
         a1.PROCESSDEVICE,
-        Date(a6.DELIVERYDATE) AS DELIVERYDATE,
+        DATE(a6.DELIVERYDATE) AS DELIVERYDATE,
         a2.PROCESSNAME,
         a1.STARTINGROLL,
         a1.REPORTROLL,
         a1.CHECKOUTROLL,
         a1.UNFINISHROLL,
         a1.WORKSTATUS,
+        a1.LOCKMARK,
         (select CUSTOMERABBREVIATION from aps_customer_management where ID =
         IF(IFNULL(a5.MERGEORDERNUMBER,'')='',a6.CUSTOMID,(select CUSTOMID from aps_production_merge_order where
         ORDERNO=a5.MERGEORDERNUMBER ) )
@@ -164,7 +165,13 @@
         a1.ID,
         a3.ID AS blankOrderId,
         a6.ID AS productionorderid,
-        a2.ID as processid
+        a2.ID as processid,
+        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
+        DATE(a6.SCHEDULEDELIVERYDATE)> DATE(a6.DELIVERYDATE)
+        ),1,0) as conflict
         FROM
         aps_process_operation_process_equ a1
         LEFT JOIN aps_process_operation a2 ON a1.PROCESSID = a2.ID

+ 17 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/GanttVos.java

@@ -84,6 +84,10 @@ public class GanttVos {
      * 作业状态
      */
     private String workstatus;
+    /**
+     * 锁定状态
+     */
+    private String lockmark;
     /**
      * 客户简称
      */
@@ -104,4 +108,17 @@ public class GanttVos {
      * 工序作业明细ID
      */
     private String id;
+    /**
+     * 承诺交货日期
+     */
+    private Date promisedeliverydate;
+    /**
+     *  排程交货日期
+     */
+    private Date scheduledeliverydate;
+
+    /**
+     * 冲突
+     */
+    private Boolean conflict;
 }

+ 17 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ScheduleGanttVo.java

@@ -82,6 +82,23 @@ public class ScheduleGanttVo {
      */
     private String processids;
 
+    /**
+     * 作业状态
+     */
+    private String workstatus;
+    /**
+     * 锁定状态
+     */
+    private String lockmark;
+
+    /**
+     * 冲突
+     */
+    private Boolean conflict;
+    /**
+     * 订单ID
+     */
+    private String productionorderid;
     /**
      * 详细对象
      */

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

@@ -34,11 +34,10 @@ public class GanttController {
      * @return
      */
     @GetMapping("/list")
-    public R updateRelevantInformation(@RequestParam(name = "startTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
-                                       @RequestParam(name = "endTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
+    public R updateRelevantInformation(@RequestParam(name = "startTime") @DateTimeFormat(pattern = "yyyy-MM-dd") Date searchDate,
                                        @RequestParam(name = "factoryId") String factoryId,
                                        @RequestParam(name = "workshopId", required = false) String workshopId) {
-        return ganttService.getListByCondition(startTime, endTime, factoryId, workshopId);
+        return ganttService.getListByCondition(searchDate, factoryId, workshopId);
     }
 
 }