| | |
| | | package com.mes.damage.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.entity.DamagePrint; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.opctask.entity.LoadGlassDeviceTaskHistory; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | |
| | | @ResponseBody |
| | | public class DamageController { |
| | | |
| | | @Autowired(required=true) |
| | | @Autowired(required = true) |
| | | private DamageService damageService; |
| | | |
| | | @ApiOperation("报工数据查询") |
| | | @PostMapping("/selectDamage") |
| | | public Result selectDamage(@RequestBody Map map) { |
| | | String startTime=map.get("startTime").toString(); |
| | | String endTime=map.get("endTime").toString(); |
| | | int type =Integer.parseInt(map.get("type").toString()); |
| | | int status =Integer.parseInt(map.get("status").toString()); |
| | | String workingProcedure =map.get("workingProcedure").toString(); |
| | | return Result.build(200,"查询成功",damageService.selectDamage(startTime,endTime,type,status, workingProcedure)); |
| | | public Result<Page<Damage>> selectDamage(@RequestBody Map map) { |
| | | String startTime = map.get("startTime").toString(); |
| | | String endTime = map.get("endTime").toString(); |
| | | int type = Integer.parseInt(map.get("type").toString()); |
| | | int status = Integer.parseInt(map.get("status").toString()); |
| | | String workingProcedure = map.get("workingProcedure").toString(); |
| | | int pageNo = Integer.parseInt(map.get("pageNo").toString()); |
| | | int pageSize = Integer.parseInt(map.get("pageSize").toString()); |
| | | return Result.build(200, "查询成功", damageService.selectDamage(startTime, endTime, type, status, workingProcedure, pageNo, pageSize)); |
| | | } |
| | | |
| | | @ApiOperation("报工") |
| | | @PostMapping("/submitDamage") |
| | | public Result submitDamage(@RequestBody List<Damage> damageList) { |
| | | damageService.submitDamage(damageList); |
| | | if(damageList.get(0).getStatus()==1){ |
| | | if (damageList.get(0).getStatus() == 1) { |
| | | damageList.forEach(damage -> damage.setStatus(3)); |
| | | }else{ |
| | | } else { |
| | | damageList.forEach(damage -> damage.setStatus(8)); |
| | | } |
| | | damageService.updateBatchById(damageList); |
| | | return Result.build(200,"报工成功",1); |
| | | return Result.build(200, "报工成功", 1); |
| | | } |
| | | |
| | | @ApiOperation("报工数据修改") |
| | | @PostMapping("/updateDamage") |
| | | public Result updateDamage(@RequestBody List<Damage> damageList) { |
| | | damageService.updateBatchById(damageList); |
| | | return Result.build(200,"修改成功",1); |
| | | return Result.build(200, "修改成功", 1); |
| | | } |
| | | |
| | | @ApiOperation("报工数据新增") |
| | | @PostMapping("/insertDamage") |
| | | public Result insertDamage(@RequestBody Damage damage) { |
| | | damageService.insertDamage(damage); |
| | | return Result.build(200,"新增成功",1); |
| | | return Result.build(200, "新增成功", 1); |
| | | } |
| | | |
| | | @ApiOperation("拿走数据查询") |
| | | @PostMapping("/selectDamagePrint") |
| | | public Result selectDamagePrint(@RequestBody Damage damage) { |
| | | List<DamagePrint> damage2=damageService.selectDamagePrint(damage); |
| | | return Result.build(200,"查询成功",damage2); |
| | | List<DamagePrint> damage2 = damageService.selectDamagePrint(damage); |
| | | return Result.build(200, "查询成功", damage2); |
| | | } |
| | | |
| | | @ApiOperation("拿走打印查询") |
| | | @PostMapping("/selectDamagePrintDetails") |
| | | public Result selectDamagePrintDetails(@RequestBody Damage damage) { |
| | | List<DamagePrint> damage2=damageService.selectDamagePrintDetails(damage); |
| | | return Result.build(200,"查询成功",damage2); |
| | | List<DamagePrint> damage2 = damageService.selectDamagePrintDetails(damage); |
| | | return Result.build(200, "查询成功", damage2); |
| | | } |
| | | |
| | | @ApiOperation("自动报工") |
| | | @PostMapping("/autoSubmitReport") |
| | | public Result autoSubmitReport(String glassId, int deviceId, String workingProcedure, String remark, int type) { |
| | | damageService.autoSubmitReport(glassId,deviceId,workingProcedure,remark,type); |
| | | return Result.build(200,"查询成功",""); |
| | | damageService.autoSubmitReport(glassId, deviceId, workingProcedure, remark, type); |
| | | return Result.build(200, "查询成功", ""); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.damage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.entity.DamagePrint; |
| | | import com.mes.opctask.entity.LoadGlassDeviceTaskHistory; |
| | | import com.mes.pp.entity.ReportingWork; |
| | | import com.mes.pp.entity.ReportingWorkDetail; |
| | | import com.mes.utils.Result; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public interface DamageService extends MPJBaseService<Damage> { |
| | | |
| | | List<Damage> selectDamage(String startTime, String endTime, int type, int status, String workingProcedure); |
| | | Page<Damage> selectDamage( |
| | | String startTime, |
| | | String endTime, |
| | | int type, |
| | | int status, |
| | | String workingProcedure, |
| | | int pageNum, // 新增:动态页码 |
| | | int pageSize // 新增:动态每页条数 |
| | | ); |
| | | |
| | | // List<Damage> selectDamage(String startTime, String endTime, int type, int status, String workingProcedure); |
| | | |
| | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.opctask.entity.LoadGlassDeviceTaskHistory; |
| | | import com.mes.pp.entity.DamageDetails; |
| | | import com.mes.pp.entity.ReportingWork; |
| | | import com.mes.pp.entity.ReportingWorkDetail; |
| | |
| | | /** |
| | | * 查询报工信息 |
| | | */ |
| | | @Override |
| | | public List<Damage> selectDamage(String startTime, String endTime, int type, int status, String workingProcedure) { |
| | | LambdaQueryWrapper<Damage> damageSelectWrapper = new LambdaQueryWrapper<>(); |
| | | damageSelectWrapper.between(Damage::getDamageTime, startTime, endTime); |
| | | if (type != 0) { |
| | | damageSelectWrapper.eq(Damage::getType, type); |
| | | } |
| | | if (status != 0) { |
| | | damageSelectWrapper.eq(Damage::getStatus, status); |
| | | } |
| | | if (!"0".equals(workingProcedure)) { |
| | | damageSelectWrapper.eq(Damage::getWorkingProcedure, workingProcedure); |
| | | } |
| | | List<Damage> damageList = baseMapper.selectList(damageSelectWrapper); |
| | | |
| | | // for (Damage damage : damageList) { |
| | | // damage.setStatus(2); |
| | | // } |
| | | return damageList; |
| | | /** |
| | | * 分页查询损坏记录 |
| | | * @param startTime 开始时间(格式:yyyy-MM-dd HH:mm:ss) |
| | | * @param endTime 结束时间(格式:yyyy-MM-dd HH:mm:ss) |
| | | * @param type 损坏类型(0表示查询所有类型) |
| | | * @param status 状态(0表示查询所有状态) |
| | | * @param workingProcedure 工序("0"表示查询所有工序) |
| | | * @param pageNum 页码(从1开始) |
| | | * @param pageSize 每页条数 |
| | | * @return 分页后的损坏记录列表 |
| | | */ |
| | | @Override |
| | | public Page<Damage> selectDamage( |
| | | String startTime, |
| | | String endTime, |
| | | int type, |
| | | int status, |
| | | String workingProcedure, |
| | | int pageNum, // 新增:动态页码 |
| | | int pageSize // 新增:动态每页条数 |
| | | ) { |
| | | Page<Damage> page = new Page<>(pageNum, pageSize); |
| | | |
| | | LambdaQueryWrapper<Damage> damageSelectWrapper = new LambdaQueryWrapper<>(); |
| | | damageSelectWrapper.between(Damage::getDamageTime, startTime, endTime) |
| | | .eq(type != 0, Damage::getType, type) |
| | | .eq(status != 0, Damage::getStatus, status) |
| | | .eq(!"0".equals(workingProcedure), Damage::getWorkingProcedure, workingProcedure); |
| | | |
| | | return this.page(page, damageSelectWrapper); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | void batchInsert(@Param("list") List<OptimizeProject> projectList); |
| | | |
| | | /** |
| | | * 更新工程排产信息 |
| | | * |
| | | * @param engineerId |
| | | * @param types |
| | | */ |
| | | void deleteByScheduling(@Param("engineerId") String engineerId,@Param("types") List<Integer> types); |
| | | } |
| | |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import io.swagger.models.auth.In; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | /** |
| | | * 查询可领取的任务工程信息 |
| | | * |
| | | * @return List<OptimizeProject> |
| | | */ |
| | | List<OptimizeProject> listByState(OptimizeRequest optimizeRequest); |
| | |
| | | * 将工程信息更新状态为已领取 |
| | | */ |
| | | void changeTask(String engineeringId, int i); |
| | | |
| | | /** |
| | | * 完成工程任务改为300 |
| | | * |
| | | * @return |
| | | */ |
| | | boolean overTask(UpPattenUsage sequence, int state); |
| | | |
| | | /** |
| | | * 获取正在进行中的任务 |
| | | * |
| | |
| | | |
| | | /** |
| | | * 查询工程信息 |
| | | * |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> queryEngineer(); |
| | | |
| | | /** |
| | | * 查询工程排序信息 |
| | | * |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> engineerScheduling(OptimizeProject optimizeProject); |
| | | |
| | | /** |
| | | * 更新工程排产信息 |
| | | * |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> updateEngineerScheduling(Integer type , List<OptimizeProject> engineerList); |
| | | List<OptimizeProject> updateEngineerScheduling(Integer type, List<OptimizeProject> engineerList); |
| | | |
| | | /** |
| | | * 删除工程排产信息 |
| | | * |
| | | * @return |
| | | */ |
| | | void deleteengineerSchedulingByid(String engineerId, List<Integer> types); |
| | | } |
| | |
| | | package com.mes.pp.service.impl; |
| | | |
| | | import cn.smallbun.screw.core.util.CollectionUtils; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | // 计算二个月前的时间 |
| | | LocalDateTime twoMonthAgo = LocalDateTime.now().minusMonths(2); |
| | | LambdaQueryWrapper<OptimizeProject> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.select(OptimizeProject::getProjectNo) |
| | | wrapper.select(OptimizeProject::getProjectNo, OptimizeProject::getProjectName) |
| | | .eq(OptimizeProject::getState, optimizeRequest.getState()) |
| | | .ge(OptimizeProject::getCreateTime, twoMonthAgo); |
| | | List<OptimizeProject> glass = this.list(wrapper); |
| | |
| | | Engineering engineering = engineerings.get(i); |
| | | OptimizeProject newProject = new OptimizeProject(); |
| | | newProject.setProjectNo(engineering.getEngineerId()); |
| | | newProject.setProjectName(engineering.getEngineerName()); |
| | | // 将新创建的 OptimizeProject 对象添加到 glass 列表中 |
| | | glass.add(newProject); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<OptimizeProject> updateEngineerScheduling(Integer type , List<OptimizeProject> projectList) { |
| | | public List<OptimizeProject> updateEngineerScheduling(Integer type, List<OptimizeProject> projectList) { |
| | | // 1. 删除对应类型的数据 |
| | | baseMapper.deleteByType(type); |
| | | |
| | |
| | | project.setState(100); |
| | | project.setId(null); // 清除ID |
| | | }); |
| | | |
| | | // 3. 批量插入新数据 |
| | | baseMapper.batchInsert(projectList); |
| | | if (CollectionUtils.isNotEmpty(projectList)) { |
| | | // 3. 批量插入新数据 |
| | | baseMapper.batchInsert(projectList); |
| | | } |
| | | |
| | | return projectList; |
| | | } |
| | | |
| | | @Override |
| | | public void deleteengineerSchedulingByid(String engineerId, List<Integer> types) { |
| | | baseMapper.deleteByScheduling(engineerId, types); |
| | | } |
| | | } |
| | |
| | | </resultMap> |
| | | |
| | | <select id="saveProject" parameterType="com.mes.pp.entity.request.OptimizeRequest" resultMap="sequenceMap"> |
| | | select a.project_no, 1 as glass_type, a.width, a.height, REGEXP_REPLACE(b.glass_thickness, '\\D', '')as glass_thickness, a.heat_layout_sort, 0 as state |
| | | select a.project_no, |
| | | 1 as glass_type, |
| | | a.width, |
| | | a.height, |
| | | REGEXP_REPLACE(b.glass_thickness, '\\D', '') as glass_thickness, |
| | | a.heat_layout_sort, |
| | | 0 as state |
| | | from optimize_detail a |
| | | left join optimize_project b on a.project_no = b.project_no |
| | | where a.project_no = #{projectNo} |
| | |
| | | p.project_name |
| | | from pp.optimize_project p |
| | | where p.state = 100 |
| | | and p.project_no not in ( |
| | | and p.project_no not in ( |
| | | select es.project_no |
| | | from north_glass_mes.engineer_scheduling es |
| | | where es.project_no is not null |
| | | ) |
| | | ) |
| | | order by p.id |
| | | </select> |
| | | |
| | | <select id="engineerScheduling" parameterType="com.mes.pp.entity.request.OptimizeRequest" resultMap="resultMap"> |
| | | select es.project_no, |
| | | es.project_name, |
| | | es.type |
| | | es.project_name, |
| | | es.type |
| | | from north_glass_mes.engineer_scheduling es |
| | | where es.state = 100 |
| | | <if test="type != null and type != ''"> |
| | |
| | | |
| | | <!-- 根据类型删除engineer_scheduling表中的数据 --> |
| | | <delete id="deleteByType"> |
| | | DELETE FROM north_glass_mes.engineer_scheduling |
| | | DELETE |
| | | FROM north_glass_mes.engineer_scheduling |
| | | WHERE type = #{type} |
| | | </delete> |
| | | <delete id="deleteByScheduling"> |
| | | DELETE |
| | | FROM north_glass_mes.engineer_scheduling |
| | | WHERE project_no = #{engineerId} |
| | | and type in ( |
| | | <foreach collection="types" item="item" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </delete> |
| | | |
| | | <!-- 批量插入数据到engineer_scheduling表 --> |
| | | <insert id="batchInsert"> |