diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java index 3a7752a3..7b101472 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java @@ -1,5 +1,6 @@ package com.bonus.material.codeCollection.controller; +import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.page.TableDataInfo; @@ -9,12 +10,11 @@ import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.codeCollection.domain.WsMaInfo; import com.bonus.material.codeCollection.service.WsMaInfoService; import com.bonus.material.common.annotation.PreventRepeatSubmit; -import com.bonus.material.ma.domain.Machine; -import com.bonus.material.ma.domain.vo.MachineVo; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -106,4 +106,24 @@ public class WsMaInfoController extends BaseController { List list = service.getGadgetList(info); return getDataTable(list); } + + + /** + * 导出小工具编码信息列表 + */ + @ApiOperation(value = "导出小工具编码信息列表") + @SysLog(title = "小工具编码信息管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出小工具编码信息列表") + @PostMapping("/exportGadgetList") + public void exportGadgetList(HttpServletResponse response, WsMaInfo info) { + List list = service.getGadgetList(info); + ExcelUtil util = new ExcelUtil<>(WsMaInfo.class); + util.exportExcel(response, list, "领料出库数据"); + } + + @ApiOperation(value = "新增小工具编码信息") + @SysLog(title = "新增小工具编码信息", businessType = OperaType.INSERT, logType = 1, module = "小工具编码信息管理->新增") + @PostMapping("/addWsMaInfoData") + public AjaxResult addWsMaInfoData(@RequestBody WsMaInfo info) { + return service.addWsMaInfoData(info); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java index d9d78c44..4350bbc5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java @@ -1,5 +1,6 @@ package com.bonus.material.codeCollection.domain; +import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; @@ -28,16 +29,19 @@ public class WsMaInfo { /** * 机具名称,如“电焊机”、“搅拌机” */ + @Excel(name = "设备类型") private String maName; /** * 机具型号,例如“WX-3000” */ + @Excel(name = "规格型号") private String maModel; /** * 机具编号,企业内部唯一标识编号 */ + @Excel(name = "设备编号") private String maCode; /** @@ -48,21 +52,25 @@ public class WsMaInfo { /** * 本次检验时间,格式建议为 yyyy-MM-dd */ + @Excel(name = "本次检验时间") private String thisCheckTime; /** * 下次检验时间,格式建议为 yyyy-MM-dd */ + @Excel(name = "下次检验时间") private String nextCheckTime; /** * 检修员姓名,表示最近一次负责检修的人员 */ + @Excel(name = "检修员") private String repairMan; /** * 检验员姓名,表示本次设备检验的执行人员 */ + @Excel(name = "检验员") private String checkMan; /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java index e1063f6a..a4fe6f56 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java @@ -100,4 +100,18 @@ public interface WsMaInfoMapper { * @return 机具信息集合 */ List getGadgetList(WsMaInfo info); + + /** + * 新增机具信息 + * @param info 机具信息 + * @return 条数 + */ + int addWsMaInfoData(WsMaInfo info); + + /** + * 根据编码查询机具信息 + * @param info 查询条件 + * @return 机具信息集合 + */ + int selectCountByCode(WsMaInfo info); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java index 3ef70f2b..dce7612a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java @@ -92,4 +92,11 @@ public interface WsMaInfoService { * @return */ List getGadgetList(WsMaInfo info); + + /** + * 新增小工具编码信息 + * @param info + * @return + */ + AjaxResult addWsMaInfoData(WsMaInfo info); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java index 83cacede..a59c6746 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java @@ -2,6 +2,7 @@ package com.bonus.material.codeCollection.service.impl; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.codeCollection.domain.WsMaInfo; import com.bonus.material.codeCollection.mapper.WsMaInfoMapper; import com.bonus.material.codeCollection.service.WsMaInfoService; @@ -220,4 +221,21 @@ public class WsMaInfoServiceImpl implements WsMaInfoService { return new ArrayList<>(); } } + + @Override + public AjaxResult addWsMaInfoData(WsMaInfo info) { + try { + info.setOptUser(SecurityUtils.getLoginUser().getSysUser().getNickName()); + //查询是否存在 + int count = mapper.selectCountByCode(info); + if (count > 0){ + return AjaxResult.error("该类型下此编码已存在"); + } + int i = mapper.addWsMaInfoData(info); + return i > 0 ? AjaxResult.success("添加小工具编码信息列表成功") : AjaxResult.error("添加小工具编码信息列表失败"); + } catch (Exception e) { + log.error("添加小工具编码信息列表:", e.getMessage()); + return AjaxResult.error("添加小工具编码信息列表失败"); + } + } } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml index 3ed24f7b..f69b555d 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml @@ -151,6 +151,14 @@ ]]> + + + INSERT INTO ws_ma_info (ma_name, ma_model, ma_code, this_check_time, next_check_time, + repair_man, check_man, phone, result, model_id, is_active, opt_user, opt_time) + VALUES (#{maName}, #{maModel}, #{maCode}, #{thisCheckTime}, + #{nextCheckTime}, + #{repairMan}, #{checkMan}, #{phone}, #{result}, #{modelId}, '1', #{optUser}, now()) + UPDATE ws_ma_info