Browse Source

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

sunyadv 6 years ago
parent
commit
a3ddd79a59

+ 2 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/constant/Constant.java

@@ -12,6 +12,6 @@ public class Constant {
     public static final Integer PRODUCER_COMPANY = 1;//生产方编号
     public static final Integer PRODUCER_COMPANY = 1;//生产方编号
     public static final Integer SYS_PARENT_ID = 0;//系统管理员的上级id
     public static final Integer SYS_PARENT_ID = 0;//系统管理员的上级id
     public static final Integer SYS_ID = 1;//系统管理员的id
     public static final Integer SYS_ID = 1;//系统管理员的id
-
-
+    public static final String MOULD_PREFIX = "YMMJ";//模具编号前缀
+    public static final String PROJECT_PREFIX = "YMXM";//项目编号
 }
 }

+ 54 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldEquipmentController.java

@@ -0,0 +1,54 @@
+package com.hssx.cloudmodel.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.cloudmodel.entity.MouldEquipment;
+import com.hssx.cloudmodel.entity.Project;
+import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.service.MouldEquipmentService;
+import com.hssx.cloudmodel.service.UserService;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ *
+ * @author 吴涛涛
+ * @since 2019-08-02
+ */
+@Controller
+@RequestMapping("/mouldequipment")
+public class MouldEquipmentController {
+    @Autowired
+    private MouldEquipmentService mouldEquipmentService;
+    @Autowired
+    private UserService userService;
+    /**
+     * 添加/修改模具设备
+     * 添加参数:equipmentName 设备名称,useLife 使用年限, equipmentNo 设备编号 ,
+     * belongCompanyId 所属公司id ,equipmentName 设备名称
+     * 修改时需多传的参数 id 设备id ,isUse 是否启用 0-不启用 1-启用
+     * @return
+     */
+    @ApiOperation("添加/修改模具设备")
+    @RequestMapping("/addOrUpdate")
+    @ResponseBody
+    public HttpRespMsg addOrUpdate(MouldEquipment mouldEquipment,String token) {
+        HttpRespMsg msg = new HttpRespMsg();
+        QueryWrapper<User> qw = new QueryWrapper<>();
+        qw.eq("head_imgurl",token);
+        User user = userService.getOne(qw);
+        msg = mouldEquipmentService.addAndUpdateMouldEquipment(mouldEquipment,user);
+        return msg;
+    }
+
+}
+

+ 155 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/MouldEquipment.java

@@ -0,0 +1,155 @@
+package com.hssx.cloudmodel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-02
+ */
+@TableName("tb_mould_equipment")
+public class MouldEquipment extends Model<MouldEquipment> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 模具设备表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 设备名称
+     */
+    @TableField("equipment_name")
+    private String equipmentName;
+
+    /**
+     * 启动时间
+     */
+    @TableField("start_time")
+    private LocalDateTime startTime;
+
+    /**
+     * 结束时间
+     */
+    @TableField("end_time")
+    private LocalDateTime endTime;
+
+    /**
+     * 使用年限 单位:年
+     */
+    @TableField("use_life")
+    private Integer useLife;
+
+    /**
+     * 所属公司id
+     */
+    @TableField("belong_company_id")
+    private Integer belongCompanyId;
+
+    /**
+     * 设备编号
+     */
+    @TableField("equipment_no")
+    private String equipmentNo;
+
+    /**
+     * 是否启用 0-未启用,1-启用
+     */
+    @TableField("is_use")
+    private Integer isUse;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getEquipmentName() {
+        return equipmentName;
+    }
+
+    public void setEquipmentName(String equipmentName) {
+        this.equipmentName = equipmentName;
+    }
+
+    public LocalDateTime getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(LocalDateTime startTime) {
+        this.startTime = startTime;
+    }
+
+    public LocalDateTime getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(LocalDateTime endTime) {
+        this.endTime = endTime;
+    }
+
+    public Integer getUseLife() {
+        return useLife;
+    }
+
+    public void setUseLife(Integer useLife) {
+        this.useLife = useLife;
+    }
+
+    public Integer getBelongCompanyId() {
+        return belongCompanyId;
+    }
+
+    public void setBelongCompanyId(Integer belongCompanyId) {
+        this.belongCompanyId = belongCompanyId;
+    }
+
+    public String getEquipmentNo() {
+        return equipmentNo;
+    }
+
+    public void setEquipmentNo(String equipmentNo) {
+        this.equipmentNo = equipmentNo;
+    }
+
+    public Integer getIsUse() {
+        return isUse;
+    }
+
+    public void setIsUse(Integer isUse) {
+        this.isUse = isUse;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "MouldEquipment{" +
+        "id=" + id +
+        ", equipmentName=" + equipmentName +
+        ", startTime=" + startTime +
+        ", endTime=" + endTime +
+        ", useLife=" + useLife +
+        ", belongCompanyId=" + belongCompanyId +
+        ", equipmentNo=" + equipmentNo +
+        ", isUse=" + isUse +
+        "}";
+    }
+}

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/MouldEquipmentMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.mapper;
+
+import com.hssx.cloudmodel.entity.MouldEquipment;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-02
+ */
+public interface MouldEquipmentMapper extends BaseMapper<MouldEquipment> {
+
+}

+ 19 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/MouldEquipmentService.java

@@ -0,0 +1,19 @@
+package com.hssx.cloudmodel.service;
+
+import com.hssx.cloudmodel.entity.MouldEquipment;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-02
+ */
+public interface MouldEquipmentService extends IService<MouldEquipment> {
+
+    HttpRespMsg addAndUpdateMouldEquipment(MouldEquipment mouldEquipment, User user);
+}

+ 40 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java

@@ -0,0 +1,40 @@
+package com.hssx.cloudmodel.service.impl;
+
+import com.hssx.cloudmodel.entity.MouldEquipment;
+import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.mapper.MouldEquipmentMapper;
+import com.hssx.cloudmodel.service.MouldEquipmentService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-02
+ */
+@Service
+public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper, MouldEquipment> implements MouldEquipmentService {
+    @Autowired
+    MouldEquipmentMapper mouldEquipmentMapper;
+    @Override
+    public HttpRespMsg addAndUpdateMouldEquipment(MouldEquipment mouldEquipment, User user) {
+        HttpRespMsg msg  = new HttpRespMsg();
+        if(user.getParentId() == 0){
+            if(mouldEquipment.getId() == null){
+                //添加设备
+                mouldEquipmentMapper.insert(mouldEquipment);
+            }else{
+                //修改设备
+                mouldEquipmentMapper.updateById(mouldEquipment);
+            }
+        }else{
+            msg.setError("对不起,您不是管理员,不具备设备创建的权限");
+        }
+        return msg;
+    }
+}

+ 2 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectServiceImpl.java

@@ -3,6 +3,7 @@ package com.hssx.cloudmodel.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.hssx.cloudmodel.constant.Constant;
 import com.hssx.cloudmodel.entity.*;
 import com.hssx.cloudmodel.entity.*;
 import com.hssx.cloudmodel.entity.vo.ProjectVO;
 import com.hssx.cloudmodel.entity.vo.ProjectVO;
 import com.hssx.cloudmodel.mapper.*;
 import com.hssx.cloudmodel.mapper.*;
@@ -66,7 +67,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     project.setCreator(user.getUsername());
                     project.setCreator(user.getUsername());
                     project.setOwnerCompany(user.getCompanyId());
                     project.setOwnerCompany(user.getCompanyId());
                     project.setOwnerCompanyName(company.getCompanyName());
                     project.setOwnerCompanyName(company.getCompanyName());
-                    project.setProjectNo("YMXM"+seq);
+                    project.setProjectNo(Constant.PROJECT_PREFIX+seq);
                     projectMapper.insert(project);
                     projectMapper.insert(project);
                     //添加生产方关联公司
                     //添加生产方关联公司
                     if(customerCompanyIds != null && !"".equals(customerCompanyIds) && customerCompanyNames != null && !"".equals(customerCompanyNames)){
                     if(customerCompanyIds != null && !"".equals(customerCompanyIds) && customerCompanyNames != null && !"".equals(customerCompanyNames)){

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("tb_custom_company");
+        strategy.setInclude("tb_mould_equipment");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);
         strategy.setControllerMappingHyphenStyle(true);

+ 22 - 0
cloud-model/src/main/resources/mapper/MouldEquipmentMapper.xml

@@ -0,0 +1,22 @@
+<?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.hssx.cloudmodel.mapper.MouldEquipmentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.MouldEquipment">
+        <id column="id" property="id" />
+        <result column="equipment_name" property="equipmentName" />
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="use_life" property="useLife" />
+        <result column="belong_company_id" property="belongCompanyId" />
+        <result column="equipment_no" property="equipmentNo" />
+        <result column="is_use" property="isUse" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, equipment_name, start_time, end_time, use_life, belong_company_id, equipment_no, is_use
+    </sql>
+
+</mapper>

+ 9 - 3
ys_vue/src/views/base/allocation.vue

@@ -32,7 +32,13 @@
       <el-table-column prop="name" label="模具名称" width="100" sortable></el-table-column>
       <el-table-column prop="name" label="模具名称" width="100" sortable></el-table-column>
       <el-table-column prop="mouldNumber" label="模具编号" width="120" sortable></el-table-column>
       <el-table-column prop="mouldNumber" label="模具编号" width="120" sortable></el-table-column>
       <el-table-column prop="assets" label="资产方" width="120" sortable></el-table-column>
       <el-table-column prop="assets" label="资产方" width="120" sortable></el-table-column>
-      <el-table-column prop="state" label="模具状态" width="100" sortable></el-table-column>
+      <el-table-column prop="state" label="模具状态" width="100" sortable>
+        <template slot-scope="scope">
+          <span v-if="scope.row.state == true">运行</span>
+          <span v-else>停止</span>
+          <el-switch v-model="scope.row.state"></el-switch>
+        </template>
+      </el-table-column>
       <el-table-column label="操作" width="160" sortable>
       <el-table-column label="操作" width="160" sortable>
         <el-button size="small">修改</el-button>
         <el-button size="small">修改</el-button>
         <el-button type="danger" size="small">删除</el-button>
         <el-button type="danger" size="small">删除</el-button>
@@ -98,7 +104,7 @@ export default {
           name: "墨盒",
           name: "墨盒",
           mouldNumber: "MUJU123456",
           mouldNumber: "MUJU123456",
           assets: "南京火石闪信",
           assets: "南京火石闪信",
-          state: "1"
+          state: true
         },
         },
         {
         {
           deviceNumber: "7891011",
           deviceNumber: "7891011",
@@ -107,7 +113,7 @@ export default {
           name: "墨盒2",
           name: "墨盒2",
           mouldNumber: "MUJU654321",
           mouldNumber: "MUJU654321",
           assets: "南京火石闪信",
           assets: "南京火石闪信",
-          state: "0"
+          state: false
         }
         }
       ],
       ],
       newAllocation: {
       newAllocation: {

+ 1 - 1
ys_vue/src/views/detection/detection.vue

@@ -40,7 +40,7 @@
       <el-table-column prop="lifetime" label="模具寿命" width="100" sortable></el-table-column>
       <el-table-column prop="lifetime" label="模具寿命" width="100" sortable></el-table-column>
       <el-table-column label="模具保养" width="100" sortable>
       <el-table-column label="模具保养" width="100" sortable>
         <template slot-scope="scope">
         <template slot-scope="scope">
-          <el-button size="small" @click="toMaintenance(scope.row.number)">不需要</el-button>
+          <a style="color: #409EFF; cursor: pointer" @click="toMaintenance(scope.row.number)">不需要</a>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
       <el-table-column label="模具更新" width="100" sortable>
       <el-table-column label="模具更新" width="100" sortable>