刘小明
2024-07-09 f37449146d61a49388f557210cad944f032efefe
名称统一
8个文件已修改
151 ■■■■■ 已修改文件
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaRepairInfoMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/PmsProductApplication.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/ExcelVo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaRepairInfoMapper.java
@@ -26,5 +26,5 @@
    int updateByPrimaryKey(StaRepairInfo record);
    List<StaRepairInfo> selectByDeviceNo(String equipNo);
    List<StaRepairInfo> selectByDeviceNo(String deviceNo);
}
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java
@@ -75,11 +75,11 @@
    /**
     * 记录设备周期内容
     */
    public String equipCycleContent;
    public String deviceCycleContent;
    @AssertTrue(message = "请输入记录设备周期内容")
    public boolean isEquipCycleContentValid() {
        return !isRecord || (isRecord && StringUtils.isNotBlank(equipCycleContent));
    public boolean isDeviceCycleContentValid() {
        return !isRecord || (isRecord && StringUtils.isNotBlank(deviceCycleContent));
    }
    /**
pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
@@ -13,7 +13,7 @@
        <result property="isStart" column="is_start" jdbcType="TINYINT"/>
        <result property="isEnd" column="is_end" jdbcType="TINYINT"/>
        <result property="isRecord" column="is_record" jdbcType="TINYINT"/>
        <result property="equipCycleContent" column="equip_cycle_content" jdbcType="VARCHAR"/>
        <result property="deviceCycleContent" column="device_cycle_content" jdbcType="VARCHAR"/>
        <result property="deleted" column="deleted" jdbcType="TINYINT"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <association property="instruction"
@@ -23,7 +23,7 @@
    <sql id="Base_Column_List">
        id,process_id,sort,
        content,node_type,is_start,is_end,
        is_record,equip_cycle_content,deleted,
        is_record,device_cycle_content,deleted,
        remark
    </sql>
@@ -60,7 +60,7 @@
                <if test="isStart != null">is_start,</if>
                <if test="isEnd != null">is_end,</if>
                <if test="isRecord != null">is_record,</if>
                <if test="equipCycleContent != null">equip_cycle_content,</if>
                <if test="deviceCycleContent != null">device_cycle_content,</if>
                <if test="deleted != null">deleted,</if>
                <if test="remark != null">remark,</if>
        </trim>
@@ -73,7 +73,7 @@
                <if test="isStart != null">#{isStart,jdbcType=TINYINT},</if>
                <if test="isEnd != null">#{isEnd,jdbcType=TINYINT},</if>
                <if test="isRecord != null">#{isRecord,jdbcType=TINYINT},</if>
                <if test="equipCycleContent != null">#{equipCycleContent,jdbcType=VARCHAR},</if>
                <if test="deviceCycleContent != null">#{deviceCycleContent,jdbcType=VARCHAR},</if>
                <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if>
                <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
        </trim>
@@ -82,7 +82,7 @@
    <insert id="insertMany" parameterType="java.util.List">
       INSERT INTO pr_production_node (id,process_id,sort,
        content,node_type,is_start,is_end,
        is_record,equip_cycle_content,deleted,
        is_record,device_cycle_content,deleted,
        remark) VALUES
       <foreach item="item" index="index" collection="list" open="(" separator="),(" close=")">
           #{item.id},
@@ -93,7 +93,7 @@
           #{item.isStart},
           #{item.isEnd},
           #{item.isRecord},
           #{item.equipCycleContent},
           #{item.deviceCycleContent},
           #{item.deleted},
           #{item.remark}
       </foreach>
@@ -124,8 +124,8 @@
                <if test="isRecord != null">
                    is_record = #{isRecord,jdbcType=TINYINT},
                </if>
                <if test="equipCycleContent != null">
                    equip_cycle_content = #{equipCycleContent,jdbcType=VARCHAR},
                <if test="deviceCycleContent != null">
                    device_cycle_content = #{deviceCycleContent,jdbcType=VARCHAR},
                </if>
                <if test="deleted != null">
                    deleted = #{deleted,jdbcType=TINYINT},
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/PmsProductApplication.java
@@ -1,5 +1,7 @@
package com.dy.pmsProduct;
import com.dy.common.schedulerTask.SchedulerTaskSupport;
import com.dy.common.schedulerTask.Test;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -14,6 +16,12 @@
    public static void main(String[] args) {
        SpringApplication.run(PmsProductApplication.class, args);
        try {
            SchedulerTaskSupport.addSecondlyJob("test", "testGroup", Test.class, null,
                    10, 1, -1) ;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java
@@ -104,14 +104,14 @@
    /**
     * 增加设备号
     */
    @PostMapping(path="addEquip")
    @PostMapping(path="addDevice")
    @SsoPowerAop(power = "-1")
    @Log("增加设备号")
    public BaseResponse<?> addEquip(@RequestBody QueryVo vo){
    public BaseResponse<?> addDevice(@RequestBody QueryVo vo){
        if(vo.addNum == null || vo.addNum <= 0 || vo.planId == null){
            return BaseResponseUtils.buildFail("参数错误");
        }
        int count = sv.addEquip(vo.planId,vo.addNum);
        int count = sv.addDevice(vo.planId,vo.addNum);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
@@ -119,28 +119,28 @@
        }
    }
    @PostMapping(path="someEquip")
    @PostMapping(path="someDevice")
    @SsoPowerAop(power = "-1")
    @Log("分页查询设备号")
    public BaseResponse<QueryResultVo<List<PrDevice>>> someEquip(@RequestBody QueryVo queryVo){
        QueryResultVo<List<PrDevice>> list = sv.selectSomeEquip(queryVo) ;
    public BaseResponse<QueryResultVo<List<PrDevice>>> someDevice(@RequestBody QueryVo queryVo){
        QueryResultVo<List<PrDevice>> list = sv.selectSomeDevice(queryVo) ;
        return BaseResponseUtils.buildSuccess(list);
    }
    @GetMapping(path="exportEquip")
    @GetMapping(path="exportDevice")
    @SsoPowerAop(power = "-1")
    @Log("导出设备号")
    public void exportEquip(Long batchId, HttpServletResponse response){
    public void exportDevice(Long batchId, HttpServletResponse response){
        Date start = new Date() ;
        List<Converter> list = new ArrayList<>();
        List<PrDevice> equipList = sv.selectEquipByBatchId(batchId) ;
        List<PrDevice> deviceList = sv.selectDeviceByBatchId(batchId) ;
        // 使用并行流提高性能
        equipList.parallelStream().forEach(equip -> {
        deviceList.parallelStream().forEach(device -> {
            ExcelVo vo = new ExcelVo();
            vo.equipNo = equip.deviceNo;
            vo.deviceNo = device.deviceNo;
            try {
                vo.qrCode = QrCodeUtil.genQrCode(vo.equipNo);
                vo.qrCode = QrCodeUtil.genQrCode(vo.deviceNo);
            } catch (IOException | WriterException e) {
                e.printStackTrace();
            }
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java
@@ -15,6 +15,7 @@
import com.dy.pmsGlobal.pojoPr.PrBatchNumber;
import com.dy.pmsGlobal.pojoPr.PrDevice;
import com.dy.pmsGlobal.pojoPr.PrProductionProcess;
import com.dy.pmsGlobal.util.QrCodeConstant;
import com.dy.pmsGlobal.util.QrCodeUtil;
import com.dy.pmsGlobal.util.UserUtil;
import lombok.extern.slf4j.Slf4j;
@@ -35,11 +36,10 @@
    private static final int BATCH_SIZE = 100; // 批量处理大小
    private static final String CODE_FORMAT = "%03d";
    private static final String CODE_FORMAT_7 = "%07d";
    private static final String TYPE_CODE_EQUIP = "110";
    private PrAssemblyPlanMapper assemblyDao;
    private UserUtil userUtil;
    private PrBatchNumberMapper batchDao;
    private PrDeviceMapper equipDao;
    private PrDeviceMapper deviceDao;
    private PltProductMapper productDao;
    private PrProductionProcessMapper processDao;
    @Autowired
@@ -55,8 +55,8 @@
        this.userUtil = userUtil;
    }
    @Autowired
    public void setEquipDao(PrDeviceMapper equipDao) {
        this.equipDao = equipDao;
    public void setDeviceDao(PrDeviceMapper deviceDao) {
        this.deviceDao = deviceDao;
    }
    @Autowired
    public void setProductDao(PltProductMapper productDao) {
@@ -88,7 +88,7 @@
            plan.creator = loginUser.id;
        }
        batchDao.insertSelective(batch);
        insertEquip(plan.proId,batch.id,batch.batchNumber,plan.number,1);
        insertDevice(plan.proId,batch.id,batch.batchNumber,plan.number,1);
        plan.batchId = batch.id;
        plan.status =PlanStatusEnum.NORMAL.getCode();
@@ -123,21 +123,21 @@
            batch.proId = plan.proId;
            batchDao.updateByPrimaryKeySelective(batch);
            equipDao.deleteByBatchId(origPlan.batchId);
            insertEquip(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,1);
            deviceDao.deleteByBatchId(origPlan.batchId);
            insertDevice(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,1);
        }else if(origPlan.number < plan.number){
            //数量增加则新增设备号
            insertEquip(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,origPlan.number+1);
            insertDevice(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,origPlan.number+1);
        }
        return assemblyDao.updateByPrimaryKeySelective(plan);
    }
    @Transactional
    public int addEquip(Long planId,int num){
    public int addDevice(Long planId,int num){
        PrAssemblyPlan plan = assemblyDao.selectByPrimaryKey(planId);
        PrBatchNumber batch = batchDao.selectByPrimaryKey(plan.batchId);
        int count =insertEquip(plan.proId,plan.batchId,batch.batchNumber,num + plan.number,plan.number+1);
        int count =insertDevice(plan.proId,plan.batchId,batch.batchNumber,num + plan.number,plan.number+1);
//        plan.number = plan.number + num;
//        assemblyDao.updateByPrimaryKeySelective (plan);
        return count;
@@ -152,27 +152,27 @@
     * @param number 数量
     * @return 插入数量
     */
    private int insertEquip(Long proId,Long batchId,String batchCode,Integer number,int startIndex){
    private int insertDevice(Long proId,Long batchId,String batchCode,Integer number,int startIndex){
        log.info("批量插入设备");
        PltProduct product = productDao.selectByPrimaryKey(proId);
        List<PrDevice> list = new java.util.ArrayList<>();
        for(int i= startIndex ;i<= number;i++){
            PrDevice equip = new PrDevice();
            equip.proId = proId;
            equip.batchId = batchId;
            equip.deviceNo = getEquipNo(product.code,batchCode,i);
            equip.status = 0;
            list.add(equip);
            PrDevice device = new PrDevice();
            device.proId = proId;
            device.batchId = batchId;
            device.deviceNo = getDeviceNo(product.code,batchCode,i);
            device.status = 0;
            list.add(device);
        }
        return insertBatchEquip(list);
        return insertBatchDevice(list);
    }
    private int insertBatchEquip(List<PrDevice> list) {
    private int insertBatchDevice(List<PrDevice> list) {
        int count = 0;
        for (int i = 0; i < list.size(); i += BATCH_SIZE) {
            List<PrDevice> subList = list.subList(i, Math.min(i + BATCH_SIZE, list.size()));
            // 调用MyBatis插入这批数据
            count += equipDao.insertBatch(subList);
            count += deviceDao.insertBatch(subList);
        }
        return count;
    }
@@ -192,26 +192,26 @@
            return currentDay + String.format(CODE_FORMAT, nextCode);
        }
    }
    private static String getEquipNo(String proCode,String batchCode,int index){
        String equipNo = TYPE_CODE_EQUIP + proCode + batchCode +
    private static String getDeviceNo(String proCode,String batchCode,int index){
        String deviceNo = QrCodeConstant.TypeProduct + proCode + batchCode +
                String.format(CODE_FORMAT_7, index);
        return equipNo;
        return deviceNo;
    }
    public static void main(String[] args) {
        List<PrDevice> list = new java.util.ArrayList<>();
        for(int i= 1 ;i<= 10000;i++){
            PrDevice equip = new PrDevice();
            equip.proId = 2024052310512000003l;
            equip.batchId = 2024053017154400004l;
            equip.deviceNo = getEquipNo("002","2024001",i);
            equip.status = 0;
            PrDevice device = new PrDevice();
            device.proId = 2024052310512000003l;
            device.batchId = 2024053017154400004l;
            device.deviceNo = getDeviceNo("002","2024001",i);
            device.status = 0;
            list.add(equip);
            list.add(device);
        }
        list.forEach(equip->{
            System.out.println(equip.deviceNo);
        list.forEach(device->{
            System.out.println(device.deviceNo);
        });
    }
@@ -239,23 +239,23 @@
        return rsVo ;
    }
    public QueryResultVo<List<PrDevice>> selectSomeEquip(QueryVo queryVo) {
    public QueryResultVo<List<PrDevice>> selectSomeDevice(QueryVo queryVo) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
        //查询符合条件的记录总数
        Long itemTotal = equipDao.selectSomeCount(params);
        Long itemTotal = deviceDao.selectSomeCount(params);
        QueryResultVo<List<PrDevice>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ;
        //计算分页等信息
        rsVo.calculateAndSet(itemTotal, params);
        //查询符合条件的记录
        rsVo.obj = equipDao.selectSome(params);
        rsVo.obj.forEach(equip->{
            equip.qrCode = QrCodeUtil.genQrCodeString(equip.deviceNo);
        rsVo.obj = deviceDao.selectSome(params);
        rsVo.obj.forEach(device->{
            device.qrCode = QrCodeUtil.genQrCodeString(device.deviceNo);
        });
        return rsVo ;
    }
    public List<PrDevice> selectEquipByBatchId(Long batchId) {
        return equipDao.selectByBatchId(batchId);
    public List<PrDevice> selectDeviceByBatchId(Long batchId) {
        return deviceDao.selectByBatchId(batchId);
    }
    /**
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/ExcelVo.java
@@ -36,7 +36,7 @@
public class ExcelVo implements Converter<byte[]> {
    @ColumnWidth(40)
    @ExcelProperty("设备号")
    public String equipNo ;
    public String deviceNo ;
    @ColumnWidth(40)   //设置列宽(可以修饰类,也可以修饰具体属性)
    @ExcelProperty(value = "设备二维码", converter = ExcelVo.class)
pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
@@ -36,6 +36,7 @@
    private StaDeviceLastMapper deviceLastDao;
    private StaDeviceLifeMapper deviceLifeDao;
    private StaDeviceLifeLastMapper deviceLifeLastDao;
    private StaWipSnExMapper wipSnExDao;
    private StaDeviceProductionLogMapper deviceProductionLogDao;
    private StaAssemblyWorkLastMapper assemblyWorkLastDao;
@@ -52,7 +53,6 @@
    private OthFileMapper othFileMapper;
    @Value("${dy.webFile.fmUrl}")
    private String fmUrl;
    @Autowired
    public void setDeviceLastDao(StaDeviceLastMapper deviceLastDao) {
        this.deviceLastDao = deviceLastDao;
@@ -117,6 +117,10 @@
    public void setOthFileMapper(OthFileMapper othFileMapper) {
        this.othFileMapper = othFileMapper;
    }
    @Autowired
    public void setDeviceLifeLastDao(StaDeviceLifeLastMapper deviceLifeLastDao) {
        this.deviceLifeLastDao = deviceLifeLastDao;
    }
    @Transactional
    public int save(QueryVo params) {
@@ -173,7 +177,16 @@
    private void saveDeviceLife(StaDeviceLast deviceLast) {
        StaDeviceLife life = new StaDeviceLife();
        BeanUtils.copyProperties(deviceLast, life);
        life.setId(null);
        deviceLifeDao.insertSelective(life);
        StaDeviceLifeLast lastLife = new StaDeviceLifeLast();
        BeanUtils.copyProperties(deviceLast, lastLife);
        lastLife.setId(null);
        int count = deviceLifeLastDao.updateByDeviceNo(lastLife);
        if (count == 0){
            deviceLifeLastDao.insertSelective(lastLife);
        }
    }
    private StaDeviceLast buildDeviceLast(QueryVo params, StaAssemblyWorkLast workLast,String deviceNo) {
@@ -200,7 +213,7 @@
        PrProductionNode node = nodeDao.selectByPrimaryKey(workLast.nodeId);
        record.nodeContent = node.content;
        if (node.isRecord) {
            record.deviceCycleContent = node.equipCycleContent;
            record.deviceCycleContent = node.deviceCycleContent;
        }
        record.status = getStatus(params.status, node.isEnd,params.workType);
        return record;