Browse Source

排产的后台代码和功能

master
Rui_Li 4 years ago
parent
commit
2d208724d6
  1. 59
      src/main/java/com/gaotao/modules/schedule/controller/SchedulingController.java
  2. 9
      src/main/java/com/gaotao/modules/schedule/mapper/ScheduleMapper.java
  3. 25
      src/main/java/com/gaotao/modules/schedule/mapper/SchedulingMapper.java
  4. 21
      src/main/java/com/gaotao/modules/schedule/service/SchedulingService.java
  5. 9
      src/main/java/com/gaotao/modules/schedule/service/impl/ScheduleServiceImpl.java
  6. 32
      src/main/java/com/gaotao/modules/schedule/service/impl/SchedulingServiceImpl.java
  7. 9
      src/main/resources/mapper/schedule/ScheduleMapper.xml
  8. 17
      src/main/resources/mapper/schedule/SchedulingMapper.xml

59
src/main/java/com/gaotao/modules/schedule/controller/SchedulingController.java

@ -0,0 +1,59 @@
package com.gaotao.modules.schedule.controller;
import com.gaotao.common.utils.R;
import com.gaotao.modules.schedule.data.SearchScheduleData;
import com.gaotao.modules.schedule.data.ShiftInfoData;
import com.gaotao.modules.schedule.service.SchedulingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
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
* @Description 排产的操作
* @DateTime 2022/2/28 11:15
* @Param
* @return
**/
@RestController
@RequestMapping(value = "/scheduling")
public class SchedulingController {
@Autowired
private SchedulingService schedulingService;
/**
* @Author LR
* @Description 获取当前的机台对应的加工中心
* @DateTime 2022/2/28 14:39
* @Param [inData]
* @return com.gaotao.common.utils.R
**/
@PostMapping(value = "getCurrentWorkCenterNoByResourceId")
public R getCurrentWorkCenterNoByResourceId(@RequestBody SearchScheduleData inData){
String workCenterNo = schedulingService.getCurrentWorkCenterNoByResourceId(inData);
return R.ok()
.put("code", 200)
.put("msg", "操作成功!")
.put("workCenterNo", workCenterNo);
}
}

9
src/main/java/com/gaotao/modules/schedule/mapper/ScheduleMapper.java

@ -395,4 +395,13 @@ public interface ScheduleMapper {
* @return java.util.List<com.gaotao.modules.schedule.data.SfdcMaterialData>
**/
List<SfdcMaterialData> getSfdcMaterialHistBySeqNo(SearchScheduleData inData);
/**
* @Author LR
* @Description 获取当前加工中心机台对应的calendarId
* @DateTime 2022/2/28 11:57
* @Param [inData]
* @return java.util.Map<java.lang.String,java.lang.Object>
**/
Map<String, Object> getCalendarId(SearchScheduleData inData);
}

25
src/main/java/com/gaotao/modules/schedule/mapper/SchedulingMapper.java

@ -0,0 +1,25 @@
package com.gaotao.modules.schedule.mapper;
import com.gaotao.modules.schedule.data.SearchScheduleData;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @Author LR
* @Description 接口mapper
* @DateTime 2022/2/28 14:42
* @Param
* @return
**/
@Mapper
@Repository
public interface SchedulingMapper {
/**
* @Author LR
* @Description 获取当前的机台对应的加工中心
* @DateTime 2022/2/28 14:48
* @Param [inData]
* @return java.lang.String
**/
String getCurrentWorkCenterNoByResourceId(SearchScheduleData inData);
}

21
src/main/java/com/gaotao/modules/schedule/service/SchedulingService.java

@ -0,0 +1,21 @@
package com.gaotao.modules.schedule.service;
import com.gaotao.modules.schedule.data.SearchScheduleData;
/**
* @Author LR
* @Description 排产使用的service
* @DateTime 2022/2/28 14:40
* @Param
* @return
**/
public interface SchedulingService {
/**
* @Author LR
* @Description 获取当前的机台对应的加工中心
* @DateTime 2022/2/28 14:44
* @Param [inData]
* @return java.lang.String
**/
String getCurrentWorkCenterNoByResourceId(SearchScheduleData inData);
}

9
src/main/java/com/gaotao/modules/schedule/service/impl/ScheduleServiceImpl.java

@ -32,15 +32,16 @@ public class ScheduleServiceImpl implements ScheduleService {
@Override
public List<ShiftInfoData> getResourceRestList(SearchScheduleData inData) {
//获取当前加工中心机台的数据
List<ResourceOutData> resourceList = scheduleMapper.getResourceLIst(inData);
//获取当前加工中心机台对应的calendarId
Map<String, Object> resultMap = scheduleMapper.getCalendarId(inData);
//判断是否存在当前的加工中心机台数据
if (resourceList.size() == 0) {
if (resultMap.size() == 0) {
//throw new RuntimeException("");
return new ArrayList<ShiftInfoData>();
} else {
//设置查询的条件
inData.setCalendarId(resourceList.get(0).getCalendarId());
String calendarId = String.valueOf(resultMap.get("calendarId"));
inData.setCalendarId(calendarId);
}
return scheduleMapper.getResourceRestList(inData);
}

32
src/main/java/com/gaotao/modules/schedule/service/impl/SchedulingServiceImpl.java

@ -0,0 +1,32 @@
package com.gaotao.modules.schedule.service.impl;
import com.gaotao.common.exception.RRException;
import com.gaotao.modules.schedule.data.SearchScheduleData;
import com.gaotao.modules.schedule.mapper.SchedulingMapper;
import com.gaotao.modules.schedule.service.SchedulingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Author LR
* @Description 排产接口的实现类
* @DateTime 2022/2/28 14:41
* @Param
* @return
**/
@Service
public class SchedulingServiceImpl implements SchedulingService {
@Autowired
private SchedulingMapper schedulingMapper;
@Override
public String getCurrentWorkCenterNoByResourceId(SearchScheduleData inData) {
String workCenterNo = schedulingMapper.getCurrentWorkCenterNoByResourceId(inData);
//判断是否存在
if(null == workCenterNo || "".equalsIgnoreCase(workCenterNo)){
throw new RRException("机台编码有误!");
}
return workCenterNo;
}
}

9
src/main/resources/mapper/schedule/ScheduleMapper.xml

@ -996,4 +996,13 @@
ORDER BY smh.HistSeqNo DESC
</select>
<!--获取当前加工中心机台对应的calendarId-->
<select id="getCalendarId" parameterType="SearchScheduleData" resultType="java.util.HashMap">
SELECT wcr.CalendarID calendarId,
(SELECT cd.CalendarDesc FROM Calendar cd WHERE wcr.Site = cd.Site AND wcr.CalendarID = cd.CalendarID) calendarDesc,
Efficiency efficiency
FROM WorkCenterResource wcr
WHERE wcr.Site = #{site} AND wcr.WorkCenterNo = #{workCenterNo} AND wcr.ResourceID = #{resourceId}
</select>
</mapper>

17
src/main/resources/mapper/schedule/SchedulingMapper.xml

@ -0,0 +1,17 @@
<?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.mapper.SchedulingMapper">
<!--查询加工中心的信息通过机台-->
<select id="getCurrentWorkCenterNoByResourceId" parameterType="SearchScheduleData" resultType="java.lang.String">
SELECT WorkCenterNo workCenterNo FROM WorkCenterResource wcr
<where>
wcr.Site = #{site}
<if test="resourceId != null and resourceId != ''">
AND wcr.ResourceID = #{resourceId}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save