8 changed files with 281 additions and 1 deletions
-
34src/main/java/com/gaotao/modules/schedule/controller/ScheduleController.java
-
25src/main/java/com/gaotao/modules/schedule/dao/ScheduleMapper.java
-
78src/main/java/com/gaotao/modules/schedule/data/BaseData.java
-
59src/main/java/com/gaotao/modules/schedule/data/ShiftInfoData.java
-
23src/main/java/com/gaotao/modules/schedule/service/ScheduleService.java
-
26src/main/java/com/gaotao/modules/schedule/service/impl/ScheduleServiceImpl.java
-
2src/main/resources/application.yml
-
35src/main/resources/mapper/schedule/ScheduleMapper.xml
@ -0,0 +1,34 @@ |
|||
package com.gaotao.modules.schedule.controller; |
|||
|
|||
import com.gaotao.common.utils.R; |
|||
import com.gaotao.modules.schedule.data.ShiftInfoData; |
|||
import com.gaotao.modules.schedule.service.ScheduleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 生产订单排产 |
|||
* @author LR |
|||
* @date 2021/10/20 11:04 |
|||
**/ |
|||
@RestController |
|||
@RequestMapping(value = "/schedule") |
|||
public class ScheduleController { |
|||
|
|||
@Autowired |
|||
private ScheduleService scheduleService; |
|||
|
|||
public R getResourceRestList(@RequestBody ShiftInfoData inData){ |
|||
List<ShiftInfoData> resultList = scheduleService.getResourceRestList(inData); |
|||
return R.ok().put("msg", "操作成功!").put("rows", resultList).put("total", resultList.size()); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.gaotao.modules.schedule.dao; |
|||
|
|||
import com.gaotao.modules.schedule.data.ShiftInfoData; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author LR |
|||
* @Title: ScheduleMapper |
|||
* 生产订单排产dao |
|||
* @Date 2021/10/20 11:20 |
|||
*/ |
|||
@Mapper |
|||
public interface ScheduleMapper { |
|||
|
|||
/** |
|||
* TODO 按照工厂+机台+排产日期查询休息的信息 |
|||
* @author LR |
|||
* @date 2021/10/21 13:14 |
|||
* @param inData |
|||
* @return java.util.List<com.gaotao.modules.schedule.data.ShiftInfoData> |
|||
**/ |
|||
List<ShiftInfoData> getResourceRestList(ShiftInfoData inData); |
|||
} |
|||
@ -0,0 +1,78 @@ |
|||
package com.gaotao.modules.schedule.data; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.apache.ibatis.type.Alias; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author LR |
|||
* @Title: BaseInData |
|||
* 基础的入参类 |
|||
* @Date 2021/10/20 15:28 |
|||
*/ |
|||
@Alias("BaseData") |
|||
public class BaseData { |
|||
private int id; |
|||
private String site; |
|||
private String createdBy; |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date createdDate; |
|||
private String updatedBy; |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date updatedDate;//更细时间 |
|||
|
|||
public BaseData() { |
|||
} |
|||
|
|||
public int getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(int id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getSite() { |
|||
return site; |
|||
} |
|||
|
|||
public void setSite(String site) { |
|||
this.site = site; |
|||
} |
|||
|
|||
public String getCreatedBy() { |
|||
return createdBy; |
|||
} |
|||
|
|||
public void setCreatedBy(String createdBy) { |
|||
this.createdBy = createdBy; |
|||
} |
|||
|
|||
public Date getCreatedDate() { |
|||
return createdDate; |
|||
} |
|||
|
|||
public void setCreatedDate(Date createdDate) { |
|||
this.createdDate = createdDate; |
|||
} |
|||
|
|||
public String getUpdatedBy() { |
|||
return updatedBy; |
|||
} |
|||
|
|||
public void setUpdatedBy(String updatedBy) { |
|||
this.updatedBy = updatedBy; |
|||
} |
|||
|
|||
public Date getUpdatedDate() { |
|||
return updatedDate; |
|||
} |
|||
|
|||
public void setUpdatedDate(Date updatedDate) { |
|||
this.updatedDate = updatedDate; |
|||
} |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
package com.gaotao.modules.schedule.data; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.apache.ibatis.type.Alias; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author LR |
|||
* @Title: ShiftSearchData |
|||
* 班次查询使用 |
|||
* @Date 2021/10/20 15:39 |
|||
*/ |
|||
@Alias("ShiftInfoData") |
|||
public class ShiftInfoData extends BaseData { |
|||
private String resourceId; |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date scheduleDate; |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date ShiftDate; |
|||
private String ShiftInfo; |
|||
public ShiftInfoData() { |
|||
} |
|||
|
|||
public String getResourceId() { |
|||
return resourceId; |
|||
} |
|||
|
|||
public void setResourceId(String resourceId) { |
|||
this.resourceId = resourceId; |
|||
} |
|||
|
|||
public Date getScheduleDate() { |
|||
return scheduleDate; |
|||
} |
|||
|
|||
public void setScheduleDate(Date scheduleDate) { |
|||
this.scheduleDate = scheduleDate; |
|||
} |
|||
|
|||
public Date getShiftDate() { |
|||
return ShiftDate; |
|||
} |
|||
|
|||
public void setShiftDate(Date shiftDate) { |
|||
ShiftDate = shiftDate; |
|||
} |
|||
|
|||
public String getShiftInfo() { |
|||
return ShiftInfo; |
|||
} |
|||
|
|||
public void setShiftInfo(String shiftInfo) { |
|||
ShiftInfo = shiftInfo; |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package com.gaotao.modules.schedule.service; |
|||
|
|||
import com.gaotao.modules.schedule.data.ShiftInfoData; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author LR |
|||
* @Title: ScheduleService |
|||
* 生产订单排产 |
|||
* @Date 2021/10/21 11:26 |
|||
*/ |
|||
public interface ScheduleService { |
|||
|
|||
/** |
|||
* TODO 查询工厂+排产日期下的休息信息 |
|||
* @author LR |
|||
* @date 2021/10/21 13:08 |
|||
* @param inData |
|||
* @return java.util.List<com.gaotao.modules.schedule.data.ShiftInfoData> |
|||
**/ |
|||
List<ShiftInfoData> getResourceRestList(ShiftInfoData inData); |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package com.gaotao.modules.schedule.service.impl; |
|||
|
|||
import com.gaotao.modules.schedule.dao.ScheduleMapper; |
|||
import com.gaotao.modules.schedule.data.ShiftInfoData; |
|||
import com.gaotao.modules.schedule.service.ScheduleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author LR |
|||
* @Title: ScheduleServiceImpl |
|||
* 生产订单排产实现 |
|||
* @Date 2021/10/21 11:27 |
|||
*/ |
|||
@Service |
|||
public class ScheduleServiceImpl implements ScheduleService { |
|||
@Autowired |
|||
private ScheduleMapper scheduleMapper; |
|||
|
|||
@Override |
|||
public List<ShiftInfoData> getResourceRestList(ShiftInfoData inData) { |
|||
return scheduleMapper.getResourceRestList(inData); |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.gaotao.modules.schedule.dao.ScheduleMapper"> |
|||
|
|||
<!--查询机台+排产日期的休息信息--> |
|||
<select id="searchShopOrderScript" parameterType="ShiftInfoData" resultType="ShiftInfoData"> |
|||
Select top 10 ScheduleDate shiftDate, ()CONVERT(Varchar(200), (Case when ExceptDuration1<![CDATA[ <> ]]>0 then CONVERT(Varchar(10),Convert(float,ExceptTime1)) + '/' + CONVERT(Varchar(10),Convert(float,ExceptDuration1)) else '' end) |
|||
+' ; '+ |
|||
(Case when ExceptDuration2<![CDATA[ <> ]]>0 then CONVERT(Varchar(10),Convert(float,ExceptTime2)) + '/' + CONVERT(Varchar(10),Convert(float,ExceptDuration2)) else '' end) |
|||
+' ; '+ |
|||
(Case when ExceptDuration3<![CDATA[ <> ]]>0 then CONVERT(Varchar(10),Convert(float,ExceptTime3)) + '/' + CONVERT(Varchar(10),Convert(float,ExceptDuration3)) else '' end) |
|||
+' ; '+ |
|||
(Case when ExceptDuration4<![CDATA[ <> ]]>0 then CONVERT(Varchar(10),Convert(float,ExceptTime4)) + '/' + CONVERT(Varchar(10),Convert(float,ExceptDuration4)) else '' end) |
|||
+' ; '+ |
|||
(Case when ExceptDuration5<![CDATA[ <> ]]>0 then CONVERT(Varchar(10),Convert(float,ExceptTime5)) + '/' + CONVERT(Varchar(10),Convert(float,ExceptDuration5)) else '' end) |
|||
+' ; '+ |
|||
(Case when ExceptDuration6<![CDATA[ <> ]]>0 then CONVERT(Varchar(10),Convert(float,ExceptTime6)) + '/' + CONVERT(Varchar(10),Convert(float,ExceptDuration6)) else '' end) |
|||
) as shiftInfo from Calendar_Exception cde |
|||
<where> |
|||
WHERE Site = '1' and CalendarID = 'GD-1' and ScheduleDate >= '2021/10/20' |
|||
<if test="site != null and site != ''"> |
|||
AND cde.Site = #{site} |
|||
</if> |
|||
<if test="resourceId != null and resourceId != ''"> |
|||
AND cde.CalendarID = #{resourceId} |
|||
</if> |
|||
<if test="scheduleDate != null and scheduleDate != ''"> |
|||
AND cde.ScheduleDate <![CDATA[ >= ]]> #{scheduleDate} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
|
|||
|
|||
</mapper> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue