XiaoRuby
2023-09-04 91b2da2c3a42656e842f7c9e0c4af6aa02dbaa3a
MOM系统-9-04 生产报工
已添加1个文件
已修改11个文件
169 ■■■■ 文件已修改
production-server/src/main/java/com/yuanchu/mom/controller/ProductionPlanController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/controller/ProductionReportController.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/mapper/ManufactureOrderProcessMapper.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/mapper/ManufactureSchedulingMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/service/ManufactureOrderProcessService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/service/ManufactureSchedulingService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/service/impl/ManufactureOrderProcessServiceImpl.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/service/impl/ManufactureOrderServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/service/impl/ManufactureSchedulingServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/resources/mapper/ManufactureOrderProcessMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/resources/mapper/ManufactureSchedulingMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
system-run/src/main/resources/application-dev.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
production-server/src/main/java/com/yuanchu/mom/controller/ProductionPlanController.java
@@ -46,7 +46,6 @@
        return Result.success(manufactureOrderService.sePros(schedulingId));
    }
    @ApiOperation(value = "根据生产订单查看生产计划")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "manOrdId", value = "生产订单id", dataTypeClass = Integer.class, required = true),
@@ -59,19 +58,16 @@
        return Result.success(manufactureSchedulingService.selectProduceTable(manOrdId, productName, startTime, endTime));
    }
    @ApiOperation(value = "查看排产详情-->失焦修改时间")
    @ApiOperation(value = "查看排产详情-->切换修改时间与周期")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "technologyId", value = "工序Id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "schedulingId", value = "排产Id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "startTime", value = "开始时间", dataTypeClass = String.class, required = true, dataType = "date")
            @ApiImplicitParam(name = "startTime", value = "开始时间", dataTypeClass = String.class, required = true, dataType = "date"),
            @ApiImplicitParam(name = "period", value = "周期", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/update_time")
    public Result<?> updateTime(Integer technologyId, Integer schedulingId, String startTime) {
        Integer isUpdateSuccess = manufactureOrderProcessService.updateTime(technologyId, schedulingId, startTime);
        if (isUpdateSuccess >= 1) {
            return Result.success("更新成功!");
        }
        return Result.fail("更新失败!");
    public Result<?> updateTime(Integer technologyId, Integer schedulingId, String startTime, Integer period) {
        manufactureOrderProcessService.updateTime(technologyId, schedulingId, startTime, period);
        return Result.success("更新成功!");
    }
}
production-server/src/main/java/com/yuanchu/mom/controller/ProductionReportController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
package com.yuanchu.mom.controller;
import com.yuanchu.mom.service.ManufactureSchedulingService;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * ç”Ÿäº§è®¢å•表(ManufactureOrder)表控制层
 *
 * @author XiaoRuby
 * @since 2023-09-3 14:16:24
 */
@Api(tags = "生产管理-->生产报工")
@RestController
@RequestMapping("/productionReport")
public class ProductionReportController {
    @Autowired
    private ManufactureSchedulingService manufactureSchedulingService;
    @ApiOperation(value = "查询生产订单列表")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "pageSize", value = "页数", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "countSize", value = "条数/页", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "customerName", value = "客户名称", dataTypeClass = String.class),
            @ApiImplicitParam(name = "orderNumber", value = "订单编号", dataTypeClass = String.class),
            @ApiImplicitParam(name = "productName", value = "产品名称", dataTypeClass = String.class)
    })
    @GetMapping("/selectAllManord")
    public Result<?> selectAllManord(Integer pageSize, Integer countSize, String customerName, String orderNumber, String productName, Integer type) {
        return Result.success();
    }
    @ApiOperation(value = "点击新增-->查询所有排产计划")
    @PostMapping("add_show_scheduling")
    public Result<?> reportSelectScheduling() {
        manufactureSchedulingService.reportSelectScheduling();
        return Result.success();
    }
    @ApiOperation(value = "报工增加")
    @PostMapping("add")
    public Result<?> productionReportAdd() {
        return Result.success();
    }
}
production-server/src/main/java/com/yuanchu/mom/mapper/ManufactureOrderProcessMapper.java
@@ -2,7 +2,9 @@
import com.yuanchu.mom.mybatis_config.MyBaseMapper;
import com.yuanchu.mom.pojo.ManufactureOrderProcess;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.Date;
import java.util.List;
/**
 * <p>
@@ -14,4 +16,7 @@
 */
public interface ManufactureOrderProcessMapper extends MyBaseMapper<ManufactureOrderProcess> {
    Integer updateTime(List<ManufactureOrderProcess> list);
    Date selectSchedulingStartTime(Integer schedulingId);
}
production-server/src/main/java/com/yuanchu/mom/mapper/ManufactureSchedulingMapper.java
@@ -21,4 +21,6 @@
    List<Map<String, Object>> selectProduceTable(Integer manOrdId, String productName, String startTime, String endTime);
    Map<String, Object> sePros(Integer schedulingId);
    List<Map<String, Object>> reportSelectScheduling();
}
production-server/src/main/java/com/yuanchu/mom/service/ManufactureOrderProcessService.java
@@ -2,6 +2,7 @@
import com.yuanchu.mom.pojo.ManufactureOrderProcess;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@@ -22,5 +23,6 @@
     * @param startTime å¼€å§‹æ—¶é—´
     * @return
     */
    Integer updateTime(Integer technologyId, Integer schedulingId, String startTime);
    @Transactional(rollbackFor = Exception.class)
    void updateTime(Integer technologyId, Integer schedulingId, String startTime, Integer period);
}
production-server/src/main/java/com/yuanchu/mom/service/ManufactureSchedulingService.java
@@ -22,4 +22,6 @@
    List<Map<String, Object>> selectProduceTable(Integer manOrdId, String productName, String startTime, String endTime);
    Map<String, Object> sePros(Integer schedulingId);
    List<Map<String, Object>> reportSelectScheduling();
}
production-server/src/main/java/com/yuanchu/mom/service/impl/ManufactureOrderProcessServiceImpl.java
@@ -2,12 +2,18 @@
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yuanchu.mom.pojo.ManufactureOrderProcess;
import com.yuanchu.mom.mapper.ManufactureOrderProcessMapper;
import com.yuanchu.mom.pojo.ManufactureScheduling;
import com.yuanchu.mom.service.ManufactureOrderProcessService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.service.ManufactureSchedulingService;
import com.yuanchu.mom.utils.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -29,22 +35,32 @@
    @Resource
    private ManufactureOrderProcessMapper manufactureOrderProcessMapper;
    @Autowired
    private ManufactureSchedulingService manufactureSchedulingService;
    @Override
    public void batchInsert(List<ManufactureOrderProcess> manufactureOrderProcessesDate) {
        manufactureOrderProcessMapper.insertBatchSomeColumn(manufactureOrderProcessesDate);
    }
    @Override
    public Integer updateTime(Integer technologyId, Integer schedulingId, String startTime) {
//        // Hutool å·¥å…·ç±»è®¡ç®—间隔小时
    public void updateTime(Integer technologyId, Integer schedulingId, String startTime, Integer period) {
        // å…ˆæ›´æ–°å‘¨æœŸ
        LambdaUpdateWrapper<ManufactureOrderProcess> updateWrapper = Wrappers.<ManufactureOrderProcess>lambdaUpdate()
                .eq(ManufactureOrderProcess::getId, technologyId)
                .set(ManufactureOrderProcess::getPeriod, period);
        manufactureOrderProcessMapper.update(new ManufactureOrderProcess(), updateWrapper);
        // å¦‚果周期更新完成,根据排产Id查询所有的工序Id与每道工序周期,经过处理然后批量更新开始时间与结束时间
        // Hutool å·¥å…·ç±»è®¡ç®—间隔小时
        Date startTime1 = DateUtil.parse(startTime);
        // æ ¹æ®æŽ’产Id查询所有对应的工序数据
        LambdaQueryWrapper<ManufactureOrderProcess> queryWrapper = Wrappers.<ManufactureOrderProcess>lambdaQuery()
                .eq(ManufactureOrderProcess::getManufactureSchedulingId, schedulingId)
                .select(ManufactureOrderProcess::getId, ManufactureOrderProcess::getPeriod);
        List<ManufactureOrderProcess> list = manufactureOrderProcessMapper.selectList(queryWrapper);
        //
        // å¼€å§‹å¤„理日期
        for (int i = 0; i < list.size(); i++) {
            if (Objects.equals(list.get(i).getId(), technologyId)){
                list.get(i).setStartTime(startTime1);
@@ -58,8 +74,18 @@
                break;
            }
        }
        MyUtil.PrintLog(list.toString());
        return null;
//        return manufactureOrderProcessMapper.updateTime(list);
        manufactureOrderProcessMapper.updateTime(list);
        // å¦‚果批量更新时间成功,开始更新排产表中的开始时间与结束时间
        // èŽ·å–å·¥è‰ºçš„è®¡åˆ’å¼€å§‹æ—¶é—´
        Date startDate = manufactureOrderProcessMapper.selectSchedulingStartTime(schedulingId);
        // èŽ·å–å·¥è‰ºçš„æœ€æ™šå®Œæˆæ—¶é—´
        Date endDate = list.get(list.size() - 1).getEndTime();
        LambdaUpdateWrapper<ManufactureScheduling> updateWrapper1 = Wrappers.<ManufactureScheduling>lambdaUpdate()
                .eq(ManufactureScheduling::getId, schedulingId)
                .set(ManufactureScheduling::getStartTime, startDate)
                .set(ManufactureScheduling::getEndTime, endDate);
        manufactureSchedulingService.update(new ManufactureScheduling(), updateWrapper1);
    }
}
production-server/src/main/java/com/yuanchu/mom/service/impl/ManufactureOrderServiceImpl.java
@@ -13,6 +13,7 @@
import com.yuanchu.mom.pojo.ManufactureScheduling;
import com.yuanchu.mom.service.ManufactureOrderService;
import com.yuanchu.mom.service.ManufactureSchedulingService;
import com.yuanchu.mom.utils.MyUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -50,6 +51,7 @@
    public Map<String, Object> sePros(Integer schedulingId) {
        //基本信息
        Map<String, Object> manufactureOrder = manufactureSchedulingService.sePros(schedulingId);
        MyUtil.PrintLog(manufactureOrder.toString());
        //计划编制
        List<Map<String, Object>> mapList = manualTechnologyMapper.selectListTowTree(schedulingId);
        manufactureOrder.put("message",mapList);
production-server/src/main/java/com/yuanchu/mom/service/impl/ManufactureSchedulingServiceImpl.java
@@ -40,4 +40,9 @@
    public Map<String, Object> sePros(Integer schedulingId) {
        return manufactureSchedulingMapper.sePros(schedulingId);
    }
    @Override
    public List<Map<String, Object>> reportSelectScheduling() {
        return manufactureSchedulingMapper.reportSelectScheduling();
    }
}
production-server/src/main/resources/mapper/ManufactureOrderProcessMapper.xml
@@ -2,4 +2,32 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.ManufactureOrderProcessMapper">
    <update id="updateTime" parameterType="integer">
        UPDATE manufacture_order_process p
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="start_time =case" suffix="end,">
                <foreach collection="list" item="list" index="index">
                    WHEN p.id=#{list.id} THEN #{list.startTime}
                </foreach>
            </trim>
            <trim prefix="end_time =case" suffix="end,">
                <foreach collection="list" item="list" index="index">
                    WHEN p.id=#{list.id} THEN #{list.endTime}
                </foreach>
            </trim>
        </trim>
        WHERE p.id in
        <foreach collection="list" item="list" index="index" separator="," open="(" close=")">
            <if test="list.startTime != null and list.endTime != null">
                #{list.id, jdbcType=BIGINT}
            </if>
        </foreach>
    </update>
    <select id="selectSchedulingStartTime" resultType="date">
        SELECT DATE_FORMAT(p.`start_time`, '%Y-%m-%d')
        FROM manufacture_order_process p
        WHERE p.`manufacture_scheduling_id` = #{schedulingId}
            LIMIT 1
    </select>
</mapper>
production-server/src/main/resources/mapper/ManufactureSchedulingMapper.xml
@@ -36,4 +36,8 @@
        WHERE s.`manufacture_order_id` = o.`id`
          AND s.`id` = #{schedulingId}
    </select>
    <select id="reportSelectScheduling" resultType="map">
    </select>
</mapper>
system-run/src/main/resources/application-dev.yml
@@ -34,7 +34,7 @@
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driverClassName: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.110.209:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
    url: jdbc:mysql://192.168.191.113:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
    username: user
    password: 123456
    druid:
@@ -59,7 +59,7 @@
    # redis数据库索引(默认为0),我们使用索引为3的数据库,避免和其他数据库冲突
    database: 0
    # redis服务器地址(默认为localhost)
    host: 192.168.110.209
    host: 192.168.191.113
    # redis端口(默认为6379)
    port: 6379
    # redis访问密码(默认为空)