This commit is contained in:
hayu 2025-08-28 21:25:23 +08:00
parent f840b2820a
commit d0d2904e15
6 changed files with 84 additions and 2 deletions

View File

@ -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<WsMaInfo> 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<WsMaInfo> list = service.getGadgetList(info);
ExcelUtil<WsMaInfo> 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);
}
}

View File

@ -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;
/**

View File

@ -100,4 +100,18 @@ public interface WsMaInfoMapper {
* @return 机具信息集合
*/
List<WsMaInfo> getGadgetList(WsMaInfo info);
/**
* 新增机具信息
* @param info 机具信息
* @return 条数
*/
int addWsMaInfoData(WsMaInfo info);
/**
* 根据编码查询机具信息
* @param info 查询条件
* @return 机具信息集合
*/
int selectCountByCode(WsMaInfo info);
}

View File

@ -92,4 +92,11 @@ public interface WsMaInfoService {
* @return
*/
List<WsMaInfo> getGadgetList(WsMaInfo info);
/**
* 新增小工具编码信息
* @param info
* @return
*/
AjaxResult addWsMaInfoData(WsMaInfo info);
}

View File

@ -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("添加小工具编码信息列表失败");
}
}
}

View File

@ -151,6 +151,14 @@
]]>
</if>
</select>
<select id="selectCountByCode" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ws_ma_info
WHERE ma_code = #{maCode}
and ma_name = #{maName}
and ma_model = #{maModel}
and is_active = '1'
</select>
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true"
@ -161,6 +169,13 @@
DATE(DATE_SUB(DATE_ADD(NOW(), INTERVAL 1 YEAR), INTERVAL 1 DAY)),
#{repairMan}, #{checkMan}, #{phone}, #{result}, #{type}, #{modelId}, #{isActive}, #{optUser}, now(), #{qrCode})
</insert>
<insert id="addWsMaInfoData">
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())
</insert>
<update id="update" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo">
UPDATE ws_ma_info