| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | import org.jeecg.modules.mdc.service.IMdcStandardProcessDurationService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | |
| | | |
| | | import org.jeecg.modules.mdc.service.IMdcStandardProcessDurationService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @Description: 标准加工时间表 |
| | | * @Description: 标准加工时间 |
| | | * @Author: Lius |
| | | * @Date: 2023-07-17 |
| | | * @Date: 2024-07-08 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "标准加工时间表") |
| | | @Api(tags = "标准加工时间") |
| | | @RestController |
| | | @RequestMapping("/mdc/mdcStandardProcessDuration") |
| | | public class MdcStandardProcessDurationController extends JeecgController<MdcStandardProcessDuration, IMdcStandardProcessDurationService> { |
| | |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "标准加工时间表-分页列表查询") |
| | | @ApiOperation(value = "标准加工时间表-分页列表查询", notes = "标准加工时间表-分页列表查询") |
| | | @AutoLog(value = "标准加工时间-分页列表查询") |
| | | @ApiOperation(value = "标准加工时间-分页列表查询", notes = "标准加工时间-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(MdcStandardProcessDuration mdcStandardProcessDuration, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | QueryWrapper<MdcStandardProcessDuration> queryWrapper = QueryGenerator.initQueryWrapper(mdcStandardProcessDuration, req.getParameterMap()); |
| | | Page<MdcStandardProcessDuration> page = new Page<MdcStandardProcessDuration>(pageNo, pageSize); |
| | | IPage<MdcStandardProcessDuration> pageList = mdcStandardProcessDurationService.pageList(userId, page, mdcStandardProcessDuration, req); |
| | | IPage<MdcStandardProcessDuration> pageList = mdcStandardProcessDurationService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | |
| | | * @param mdcStandardProcessDuration |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "标准加工时间表-添加") |
| | | @ApiOperation(value = "标准加工时间表-添加", notes = "标准加工时间表-添加") |
| | | @AutoLog(value = "标准加工时间-添加") |
| | | @ApiOperation(value = "标准加工时间-添加", notes = "标准加工时间-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody MdcStandardProcessDuration mdcStandardProcessDuration) { |
| | | if (StringUtils.isBlank(mdcStandardProcessDuration.getEquipmentIds())) { |
| | | return Result.error("未选择设备,请排查"); |
| | | } |
| | | boolean flag = mdcStandardProcessDurationService.addData(mdcStandardProcessDuration); |
| | | return flag ? Result.ok("添加成功") : Result.error("添加失败"); |
| | | mdcStandardProcessDurationService.save(mdcStandardProcessDuration); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param mdcStandardProcessDuration |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "标准加工时间表-编辑") |
| | | @ApiOperation(value = "标准加工时间表-编辑", notes = "标准加工时间表-编辑") |
| | | @AutoLog(value = "标准加工时间-编辑") |
| | | @ApiOperation(value = "标准加工时间-编辑", notes = "标准加工时间-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody MdcStandardProcessDuration mdcStandardProcessDuration) { |
| | | mdcStandardProcessDurationService.updateById(mdcStandardProcessDuration); |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "标准加工时间表-通过id删除") |
| | | @ApiOperation(value = "标准加工时间表-通过id删除", notes = "标准加工时间表-通过id删除") |
| | | @AutoLog(value = "标准加工时间-通过id删除") |
| | | @ApiOperation(value = "标准加工时间-通过id删除", notes = "标准加工时间-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
| | | mdcStandardProcessDurationService.removeById(id); |
| | |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "标准加工时间表-批量删除") |
| | | @ApiOperation(value = "标准加工时间表-批量删除", notes = "标准加工时间表-批量删除") |
| | | @AutoLog(value = "标准加工时间-批量删除") |
| | | @ApiOperation(value = "标准加工时间-批量删除", notes = "标准加工时间-批量删除") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | this.mdcStandardProcessDurationService.removeByIds(Arrays.asList(ids.split(","))); |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "标准加工时间表-通过id查询") |
| | | @ApiOperation(value = "标准加工时间表-通过id查询", notes = "标准加工时间表-通过id查询") |
| | | @AutoLog(value = "标准加工时间-通过id查询") |
| | | @ApiOperation(value = "标准加工时间-通过id查询", notes = "标准加工时间-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | MdcStandardProcessDuration mdcStandardProcessDuration = mdcStandardProcessDurationService.getById(id); |
| | |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, MdcStandardProcessDuration mdcStandardProcessDuration) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | return mdcStandardProcessDurationService.exportXls(userId, mdcStandardProcessDuration); |
| | | return super.exportXls(request, mdcStandardProcessDuration, MdcStandardProcessDuration.class, "标准加工时间"); |
| | | } |
| | | |
| | | /** |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 标准加工时间表 |
| | | * @Description: 标准加工时间 |
| | | * @Author: Lius |
| | | * @Date: 2023-07-17 |
| | | * @Date: 2024-07-08 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("mdc_standard_process_duration") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "mdc_standard_process_duration对象", description = "标准加工时间表") |
| | | @ApiModel(value = "mdc_standard_process_duration对象", description = "标准加工时间") |
| | | public class MdcStandardProcessDuration extends JeecgEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -4120597972937450875L; |
| | | private static final long serialVersionUID = -4064895242484730766L; |
| | | |
| | | /** |
| | | * 设备编号 |
| | | */ |
| | | @Excel(name = "设备编号", width = 15) |
| | | @ApiModelProperty(value = "设备编号") |
| | | private String equipmentId; |
| | | /** |
| | | * 设备名称 |
| | | */ |
| | | @Excel(name = "设备名称", width = 20) |
| | | @ApiModelProperty(value = "设备名称") |
| | | private String equipmentName; |
| | | /** |
| | | * 零件号 |
| | | */ |
| | |
| | | /** |
| | | * 时长 |
| | | */ |
| | | @Excel(name = "时长", width = 15) |
| | | @ApiModelProperty(value = "时长") |
| | | @Excel(name = "时长(分钟)", width = 15) |
| | | @ApiModelProperty(value = "时长(分钟)") |
| | | private Integer duration; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Excel(name = "备注", width = 25) |
| | | @Excel(name = "备注", width = 15) |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 前台传入 判断每个id |
| | | */ |
| | | @TableField(exist = false) |
| | | private String parentId; |
| | | |
| | | /** |
| | | * 前台传入 车间层级:1 部门层级:2 |
| | | */ |
| | | @TableField(exist = false) |
| | | private String typeTree; |
| | | |
| | | /** |
| | | * 部门parentId 关联子集id |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<String> mdcSectionIds; |
| | | |
| | | @TableField(exist = false) |
| | | private String equipmentIds; |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.dto.MdcProcessQuantityDto; |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 标准加工时间表 |
| | | * @Description: 标准加工时间 |
| | | * @Author: Lius |
| | | * @Date: 2023-07-17 |
| | | * @Date: 2024-07-08 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface MdcStandardProcessDurationMapper extends BaseMapper<MdcStandardProcessDuration> { |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param page |
| | | * @param mdcStandardProcessDuration |
| | | * @return |
| | | */ |
| | | IPage<MdcStandardProcessDuration> pageList(Page<MdcStandardProcessDuration> page, @Param("mdcStandardProcessDuration") MdcStandardProcessDuration mdcStandardProcessDuration); |
| | | |
| | | List<MdcProcessQuantityDto> findByEquipmentId(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | } |
| | |
| | | <!--分页查询--> |
| | | <select id="pageList" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto"> |
| | | SELECT |
| | | mpq.id id, |
| | | mspd.equipment_id equipmentId, |
| | | mspd.equipment_name equipmentName, |
| | | mspd.parts_code partsCode, |
| | | mspd.batch_code batchCode, |
| | | mspd.sequence_number sequenceNumber, |
| | | mpq.standard_id standardId, |
| | | mpq.efficient_date efficientDate, |
| | | mpq.process_quantity processQuantity, |
| | | mspd.duration duration, |
| | | mpq.remark remark, |
| | | mpq.create_by createBy, |
| | | mpq.create_time createTime, |
| | | mpq.update_by updateBy, |
| | | mpq.update_time updateTime |
| | | FROM mdc_process_quantity mpq LEFT JOIN mdc_standard_process_duration mspd ON mpq.standard_id = mspd.id |
| | | t1.id id, |
| | | t1.equipment_id equipmentId, |
| | | t3.equipment_name equipmentName, |
| | | t2.parts_code partsCode, |
| | | t2.batch_code batchCode, |
| | | t2.sequence_number sequenceNumber, |
| | | t1.standard_id standardId, |
| | | t1.efficient_date efficientDate, |
| | | t1.process_quantity processQuantity, |
| | | t2.duration duration, |
| | | t1.remark remark, |
| | | t1.create_by createBy, |
| | | t1.create_time createTime, |
| | | t1.update_by updateBy, |
| | | t1.update_time updateTime |
| | | FROM |
| | | mdc_process_quantity t1 |
| | | LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id |
| | | LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id |
| | | <where> |
| | | <if test="mdcProcessQuantity.equipmentId != null and mdcProcessQuantity.equipmentId != ''"> |
| | | AND mspd.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%') |
| | | AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.equipmentName != null and mdcProcessQuantity.equipmentName != ''"> |
| | | AND mspd.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%') |
| | | AND t3.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.partsCode != null and mdcProcessQuantity.partsCode != ''"> |
| | | AND mspd.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%') |
| | | AND t2.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.batchCode != null and mdcProcessQuantity.batchCode != ''"> |
| | | AND mspd.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%') |
| | | AND t2.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.sequenceNumber != null and mdcProcessQuantity.sequenceNumber != ''"> |
| | | AND mspd.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%') |
| | | AND t2.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.startTime != null and mdcProcessQuantity.endTime != null"> |
| | | AND mpq.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime } |
| | | AND t1.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime } |
| | | </if> |
| | | <if test="mdcProcessQuantity.processQuantity != null and mdcProcessQuantity.processQuantity != ''"> |
| | | AND mpq.process_quantity = #{ mdcProcessQuantity.processQuantity } |
| | | AND t1.process_quantity = #{ mdcProcessQuantity.processQuantity } |
| | | </if> |
| | | <if test="mdcProcessQuantity.mdcSectionIds != null and mdcProcessQuantity.mdcSectionIds.size() > 0 "> |
| | | AND mspd.equipment_id IN |
| | | AND t1.equipment_id IN |
| | | <foreach collection="mdcProcessQuantity.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ORDER BY mspd.equipment_name ASC, mpq.efficient_date DESC |
| | | ORDER BY t3.equipment_name ASC, t1.efficient_date DESC |
| | | </select> |
| | | |
| | | <!--导出数据查询--> |
| | | <select id="list" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto"> |
| | | SELECT |
| | | mpq.id id, |
| | | mspd.equipment_id equipmentId, |
| | | mspd.equipment_name equipmentName, |
| | | mspd.parts_code partsCode, |
| | | mspd.batch_code batchCode, |
| | | mspd.sequence_number sequenceNumber, |
| | | mpq.standard_id standardId, |
| | | mpq.efficient_date efficientDate, |
| | | mpq.process_quantity processQuantity, |
| | | mspd.duration duration, |
| | | mpq.remark remark, |
| | | mpq.create_by createBy, |
| | | mpq.create_time createTime, |
| | | mpq.update_by updateBy, |
| | | mpq.update_time updateTime |
| | | FROM mdc_process_quantity mpq LEFT JOIN mdc_standard_process_duration mspd ON mpq.standard_id = mspd.id |
| | | t1.id id, |
| | | t1.equipment_id equipmentId, |
| | | t3.equipment_name equipmentName, |
| | | t2.parts_code partsCode, |
| | | t2.batch_code batchCode, |
| | | t2.sequence_number sequenceNumber, |
| | | t1.standard_id standardId, |
| | | t1.efficient_date efficientDate, |
| | | t1.process_quantity processQuantity, |
| | | t2.duration duration, |
| | | t1.remark remark, |
| | | t1.create_by createBy, |
| | | t1.create_time createTime, |
| | | t1.update_by updateBy, |
| | | t1.update_time updateTime |
| | | FROM |
| | | mdc_process_quantity t1 |
| | | LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id |
| | | LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id |
| | | <where> |
| | | <if test="mdcProcessQuantity.equipmentId != null and mdcProcessQuantity.equipmentId != ''"> |
| | | AND mspd.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%') |
| | | AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.equipmentName != null and mdcProcessQuantity.equipmentName != ''"> |
| | | AND mspd.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%') |
| | | AND t3.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.partsCode != null and mdcProcessQuantity.partsCode != ''"> |
| | | AND mspd.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%') |
| | | AND t2.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.batchCode != null and mdcProcessQuantity.batchCode != ''"> |
| | | AND mspd.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%') |
| | | AND t2.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.sequenceNumber != null and mdcProcessQuantity.sequenceNumber != ''"> |
| | | AND mspd.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%') |
| | | AND t2.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%') |
| | | </if> |
| | | <if test="mdcProcessQuantity.startTime != null and mdcProcessQuantity.endTime != null"> |
| | | AND mpq.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime } |
| | | AND t1.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime } |
| | | </if> |
| | | <if test="mdcProcessQuantity.processQuantity != null and mdcProcessQuantity.processQuantity != ''"> |
| | | AND mpq.process_quantity = #{ mdcProcessQuantity.processQuantity } |
| | | AND t1.process_quantity = #{ mdcProcessQuantity.processQuantity } |
| | | </if> |
| | | <if test="mdcProcessQuantity.mdcSectionIds != null and mdcProcessQuantity.mdcSectionIds.size() > 0 "> |
| | | AND mspd.equipment_id IN |
| | | AND t1.equipment_id IN |
| | | <foreach collection="mdcProcessQuantity.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ORDER BY mspd.equipment_name ASC, mpq.efficient_date DESC |
| | | ORDER BY t3.equipment_name ASC, t1.efficient_date DESC |
| | | </select> |
| | | |
| | | <!--根据id查询--> |
| | | <select id="findById" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto"> |
| | | SELECT |
| | | mpq.id id, |
| | | mspd.equipment_id equipmentId, |
| | | mspd.equipment_name equipmentName, |
| | | mspd.parts_code partsCode, |
| | | mspd.batch_code batchCode, |
| | | mspd.sequence_number sequenceNumber, |
| | | mpq.standard_id standardId, |
| | | mpq.efficient_date efficientDate, |
| | | mpq.process_quantity processQuantity, |
| | | mspd.duration duration, |
| | | mpq.remark remark, |
| | | mpq.create_by createBy, |
| | | mpq.create_time createTime, |
| | | mpq.update_by updateBy, |
| | | mpq.update_time updateTime |
| | | FROM mdc_process_quantity mpq LEFT JOIN mdc_standard_process_duration mspd ON mpq.standard_id = mspd.id |
| | | WHERE mpq.id = { id } |
| | | t1.id id, |
| | | t1.equipment_id equipmentId, |
| | | t3.equipment_name equipmentName, |
| | | t2.parts_code partsCode, |
| | | t2.batch_code batchCode, |
| | | t2.sequence_number sequenceNumber, |
| | | t1.standard_id standardId, |
| | | t1.efficient_date efficientDate, |
| | | t1.process_quantity processQuantity, |
| | | t2.duration duration, |
| | | t1.remark remark, |
| | | t1.create_by createBy, |
| | | t1.create_time createTime, |
| | | t1.update_by updateBy, |
| | | t1.update_time updateTime |
| | | FROM mdc_process_quantity t1 |
| | | LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id |
| | | LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id |
| | | WHERE t1.id = #{ id } |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.mdc.mapper.MdcStandardProcessDurationMapper"> |
| | | |
| | | <!--分页查询--> |
| | | <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcStandardProcessDuration"> |
| | | SELECT * FROM mdc_standard_process_duration |
| | | <where> |
| | | <if test="mdcStandardProcessDuration.equipmentId != null and mdcStandardProcessDuration.equipmentId != ''"> |
| | | AND equipment_id LIKE CONCAT(CONCAT('%',#{ mdcStandardProcessDuration.equipmentId }),'%') |
| | | </if> |
| | | <if test="mdcStandardProcessDuration.equipmentName != null and mdcStandardProcessDuration.equipmentName != ''"> |
| | | AND equipment_name LIKE CONCAT(CONCAT('%',#{ mdcStandardProcessDuration.equipmentName }),'%') |
| | | </if> |
| | | <if test="mdcStandardProcessDuration.partsCode != null and mdcStandardProcessDuration.partsCode != ''"> |
| | | AND parts_code LIKE CONCAT(CONCAT('%',#{ mdcStandardProcessDuration.partsCode }),'%') |
| | | </if> |
| | | <if test="mdcStandardProcessDuration.batchCode != null and mdcStandardProcessDuration.batchCode != ''"> |
| | | AND batch_code LIKE CONCAT(CONCAT('%',#{ mdcStandardProcessDuration.batchCode }),'%') |
| | | </if> |
| | | <if test="mdcStandardProcessDuration.sequenceNumber != null and mdcStandardProcessDuration.sequenceNumber != ''"> |
| | | AND sequence_number LIKE CONCAT(CONCAT('%',#{ mdcStandardProcessDuration.sequenceNumber }),'%') |
| | | </if> |
| | | <if test="mdcStandardProcessDuration.mdcSectionIds != null and mdcStandardProcessDuration.mdcSectionIds.size() > 0 "> |
| | | AND equipment_id IN |
| | | <foreach collection="mdcStandardProcessDuration.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ORDER BY equipment_name ASC |
| | | <select id="findByEquipmentId" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto"> |
| | | SELECT |
| | | t1.id id, |
| | | t1.equipment_id equipmentId, |
| | | t3.equipment_name equipmentName, |
| | | t2.parts_code partsCode, |
| | | t2.batch_code batchCode, |
| | | t2.sequence_number sequenceNumber, |
| | | t1.standard_id standardId, |
| | | t1.efficient_date efficientDate, |
| | | t1.process_quantity processQuantity, |
| | | t2.duration duration, |
| | | t1.remark remark, |
| | | t1.create_by createBy, |
| | | t1.create_time createTime, |
| | | t1.update_by updateBy, |
| | | t1.update_time updateTime |
| | | FROM mdc_process_quantity t1 |
| | | LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id |
| | | LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id |
| | | WHERE t1.equipment_id = #{ equipmentId } AND t1.efficient_date LIKE CONCAT(CONCAT('%',#{ validDate }),'%') |
| | | </select> |
| | | </mapper> |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Description: 标准加工时间表 |
| | | * @Description: 标准加工时间 |
| | | * @Author: Lius |
| | | * @Date: 2023-07-17 |
| | | * @Date: 2024-07-08 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IMdcStandardProcessDurationService extends IService<MdcStandardProcessDuration> { |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * 根据设备id计算标准加工时间 |
| | | * |
| | | * @param userId |
| | | * @param page |
| | | * @param mdcStandardProcessDuration |
| | | * @param req |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | IPage<MdcStandardProcessDuration> pageList(String userId, Page<MdcStandardProcessDuration> page, MdcStandardProcessDuration mdcStandardProcessDuration, HttpServletRequest req); |
| | | |
| | | /** |
| | | * 导出 |
| | | * |
| | | * @param userId |
| | | * @param mdcStandardProcessDuration |
| | | * @return |
| | | */ |
| | | ModelAndView exportXls(String userId, MdcStandardProcessDuration mdcStandardProcessDuration); |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param mdcStandardProcessDuration |
| | | * @return |
| | | */ |
| | | boolean addData(MdcStandardProcessDuration mdcStandardProcessDuration); |
| | | |
| | | BigDecimal findByEquipmentId(String equipmentId, String validDate); |
| | | } |
| | |
| | | import org.jeecg.modules.mdc.constant.MdcConstant; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | import org.jeecg.modules.mdc.mapper.MdcOverallEquipmentEfficiencyMapper; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | |
| | | mdcOverallEquipmentEfficiency.setProcessQuantity(processQuantity); |
| | | |
| | | // 标准加工时间(分钟) |
| | | MdcStandardProcessDuration mdcStandardProcessDuration = mdcStandardProcessDurationService.getOne(new LambdaQueryWrapper<MdcStandardProcessDuration>().eq(MdcStandardProcessDuration::getEquipmentId, equipmentId)); |
| | | if (mdcStandardProcessDuration != null) { |
| | | mdcOverallEquipmentEfficiency.setStandardProcessDuration(new BigDecimal(mdcStandardProcessDuration.getDuration()).multiply(processQuantity)); |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setStandardProcessDuration(BigDecimal.ZERO); |
| | | } |
| | | BigDecimal standardProcessDuration = mdcStandardProcessDurationService.findByEquipmentId(equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setStandardProcessDuration(standardProcessDuration); |
| | | |
| | | if ("FANUC".equals(mdcEquipment.getDriveType())) { |
| | | // (新)性能开动率 = 理论标准加工时长 * 件数 /(主轴运行时间) |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | |
| | | 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcNoplanClose; |
| | | import org.jeecg.modules.mdc.dto.MdcProcessQuantityDto; |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | import org.jeecg.modules.mdc.mapper.MdcStandardProcessDurationMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcStandardProcessDurationService; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * @Description: 标准加工时间表 |
| | | * @Description: 标准加工时间 |
| | | * @Author: Lius |
| | | * @Date: 2023-07-17 |
| | | * @Date: 2024-07-08 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class MdcStandardProcessDurationServiceImpl extends ServiceImpl<MdcStandardProcessDurationMapper, MdcStandardProcessDuration> implements IMdcStandardProcessDurationService { |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * 根据设备id计算标准加工时间 |
| | | * |
| | | * @param userId |
| | | * @param page |
| | | * @param mdcStandardProcessDuration |
| | | * @param req |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<MdcStandardProcessDuration> pageList(String userId, Page<MdcStandardProcessDuration> page, MdcStandardProcessDuration mdcStandardProcessDuration, HttpServletRequest req) { |
| | | List<String> equipmentIds = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getParentId()) && StringUtils.isEmpty(mdcStandardProcessDuration.getEquipmentId())) { |
| | | if ("2".equals(mdcStandardProcessDuration.getTypeTree())) { |
| | | //部门层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcStandardProcessDuration.getParentId()); |
| | | } else { |
| | | //产线层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcStandardProcessDuration.getParentId()); |
| | | } |
| | | } else if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getEquipmentId())) { |
| | | //单台设备信息 |
| | | mdcStandardProcessDuration.setMdcSectionIds(Collections.singletonList(mdcStandardProcessDuration.getEquipmentId())); |
| | | } else { |
| | | //查询用户拥有的所有设备信息 |
| | | if ("2".equals(mdcStandardProcessDuration.getTypeTree())) { |
| | | //部门层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); |
| | | } else { |
| | | //产线层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); |
| | | } |
| | | } |
| | | |
| | | if (mdcStandardProcessDuration.getMdcSectionIds() == null || mdcStandardProcessDuration.getMdcSectionIds().isEmpty()) { |
| | | mdcStandardProcessDuration.setMdcSectionIds(equipmentIds); |
| | | } |
| | | |
| | | if (mdcStandardProcessDuration.getMdcSectionIds() == null || mdcStandardProcessDuration.getMdcSectionIds().isEmpty()) { |
| | | return null; |
| | | } |
| | | return this.baseMapper.pageList(page, mdcStandardProcessDuration); |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | * |
| | | * @param userId |
| | | * @param mdcStandardProcessDuration |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ModelAndView exportXls(String userId, MdcStandardProcessDuration mdcStandardProcessDuration) { |
| | | LambdaQueryWrapper<MdcStandardProcessDuration> queryWrapper = new LambdaQueryWrapper<>(); |
| | | List<String> equipmentIds = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getParentId()) && StringUtils.isEmpty(mdcStandardProcessDuration.getEquipmentId())) { |
| | | if ("2".equals(mdcStandardProcessDuration.getTypeTree())) { |
| | | //部门层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcStandardProcessDuration.getParentId()); |
| | | } else { |
| | | //产线层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcStandardProcessDuration.getParentId()); |
| | | } |
| | | } else if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getEquipmentId())) { |
| | | //单台设备信息 |
| | | mdcStandardProcessDuration.setMdcSectionIds(Collections.singletonList(mdcStandardProcessDuration.getEquipmentId())); |
| | | } else { |
| | | //查询用户所拥有的所有设备信息 |
| | | if ("2".equals(mdcStandardProcessDuration.getTypeTree())) { |
| | | //部门层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); |
| | | } else { |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); |
| | | } |
| | | } |
| | | if (mdcStandardProcessDuration.getMdcSectionIds() == null || mdcStandardProcessDuration.getMdcSectionIds().isEmpty()) { |
| | | mdcStandardProcessDuration.setMdcSectionIds(equipmentIds); |
| | | } |
| | | if (mdcStandardProcessDuration.getMdcSectionIds() == null || mdcStandardProcessDuration.getMdcSectionIds().isEmpty()) { |
| | | return null; |
| | | } else { |
| | | queryWrapper.in(MdcStandardProcessDuration::getEquipmentId, mdcStandardProcessDuration.getMdcSectionIds()); |
| | | } |
| | | if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getEquipmentId())) { |
| | | queryWrapper.like(MdcStandardProcessDuration::getEquipmentId, mdcStandardProcessDuration.getEquipmentId()); |
| | | } |
| | | if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getEquipmentName())) { |
| | | queryWrapper.like(MdcStandardProcessDuration::getEquipmentName, mdcStandardProcessDuration.getEquipmentName()); |
| | | } |
| | | if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getPartsCode())) { |
| | | queryWrapper.like(MdcStandardProcessDuration::getPartsCode, mdcStandardProcessDuration.getPartsCode()); |
| | | } |
| | | if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getBatchCode())) { |
| | | queryWrapper.like(MdcStandardProcessDuration::getBatchCode, mdcStandardProcessDuration.getBatchCode()); |
| | | } |
| | | if (StringUtils.isNotEmpty(mdcStandardProcessDuration.getSequenceNumber())) { |
| | | queryWrapper.like(MdcStandardProcessDuration::getSequenceNumber, mdcStandardProcessDuration.getSequenceNumber()); |
| | | } |
| | | queryWrapper.orderByAsc(MdcStandardProcessDuration::getEquipmentName); |
| | | // Step.2 AutoPoi 导出Excel |
| | | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
| | | List<MdcStandardProcessDuration> mdcStandardProcessDurations = this.baseMapper.selectList(queryWrapper); |
| | | // 导出文件名称 |
| | | mv.addObject(NormalExcelConstants.FILE_NAME, "标准加工时间列表"); |
| | | mv.addObject(NormalExcelConstants.CLASS, MdcStandardProcessDuration.class); |
| | | //获取当前登录用户 |
| | | //update-begin---author:wangshuai ---date:20211227 for:[JTC-116]导出人写死了------------ |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("标准加工时间列表数据", "导出人:" + user.getRealname(), "标准加工时间")); |
| | | //update-end---author:wangshuai ---date:20211227 for:[JTC-116]导出人写死了------------ |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, mdcStandardProcessDurations); |
| | | return mv; |
| | | } |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * |
| | | * @param mdcStandardProcessDuration |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addData(MdcStandardProcessDuration mdcStandardProcessDuration) { |
| | | boolean result = false; |
| | | String[] equipmentIds = mdcStandardProcessDuration.getEquipmentIds().split(","); |
| | | for (String equipmentId : equipmentIds) { |
| | | MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(equipmentId); |
| | | MdcStandardProcessDuration standardProcessDuration = new MdcStandardProcessDuration(); |
| | | BeanUtils.copyProperties(mdcStandardProcessDuration, standardProcessDuration); |
| | | standardProcessDuration.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | standardProcessDuration.setEquipmentName(mdcEquipment.getEquipmentName()); |
| | | boolean b = super.save(standardProcessDuration); |
| | | if (b) { |
| | | result = true; |
| | | public BigDecimal findByEquipmentId(String equipmentId, String validDate) { |
| | | BigDecimal result = BigDecimal.ZERO; |
| | | List<MdcProcessQuantityDto> list = this.baseMapper.findByEquipmentId(equipmentId, validDate); |
| | | if (list != null && !list.isEmpty()) { |
| | | for (MdcProcessQuantityDto mdcProcessQuantityDto : list) { |
| | | Integer duration = mdcProcessQuantityDto.getDuration(); |
| | | Integer processQuantity = mdcProcessQuantityDto.getProcessQuantity(); |
| | | result = result.add(new BigDecimal(duration * processQuantity)); |
| | | } |
| | | } |
| | | return result; |