现场维修

This commit is contained in:
jiang 2025-06-25 18:14:50 +08:00
parent 002f325cb1
commit 108d3c7d95
13 changed files with 298 additions and 66 deletions

View File

@ -46,46 +46,77 @@ public class MaterialConstants {
public final static String STRING_ADMIN = "admin";
/** 新购号的开头字母 */
/**
* 新购号的开头字母
*/
public final static String PURCHASE_TASK_TYPE_LABEL = "XG";
/** 协议号的开头字母 */
/**
* 协议号的开头字母
*/
public static final String AGREEMENT_PREFIX = "H";
/** 领料单号的开头字母 */
/**
* 领料单号的开头字母
*/
public static final String LEASE_TASK_TYPE_LABEL = "L";
/** 机具公司领料单号的开头字母 */
/**
* 机具公司领料单号的开头字母
*/
public static final String JJ_LEASE_TASK_TYPE_LABEL = "JJL";
/** 安全工器具领料单号的开头字母 */
/**
* 安全工器具领料单号的开头字母
*/
public static final String AQ_LEASE_TASK_TYPE_LABEL = "AQL";
/** 宏源领料单号的开头字母 */
/**
* 宏源领料单号的开头字母
*/
public static final String HY_LEASE_TASK_TYPE_LABEL = "HYL";
/** 退料单号的开头字母 */
/**
* 退料单号的开头字母
*/
public static final String BACK_TASK_TYPE_LABEL = "T";
/** 维修单号的开头字母 */
/**
* 维修单号的开头字母
*/
public static final String REPAIR_TASK_TYPE_LABEL = "WX";
/** 维修审核单号的开头字母 */
/**
* 维修审核单号的开头字母
*/
public static final String REPAIR_AUDIT_TYPE_LABEL = "WS";
/** 报废单号的开头字母 */
/**
* 报废单号的开头字母
*/
public static final String SCRAP_TASK_TYPE_LABEL = "BF";
/** 盘点报废单号的开头字母 */
/**
* 盘点报废单号的开头字母
*/
public static final String PD_SCRAP_TASK_TYPE_LABEL = "PDB";
/** 修饰入库单号的开头字母 */
/**
* 修饰入库单号的开头字母
*/
public static final String REPAIR_INPUT_TASK_TYPE_LABEL = "R";
/** 配件新购号的开头字母 */
/**
* 配件新购号的开头字母
*/
public final static String PART_TASK_TYPE_LABEL = "PJXG";
/** 配件领料单号的开头字母 */
/**
* 配件领料单号的开头字母
*/
public static final String PART_LEASE_TASK_TYPE_LEASE = "LP";
/** 现场维修的开头字母 */

View File

@ -4,6 +4,7 @@ import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
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;
@ -25,7 +26,6 @@ public class WsMaInfoController extends BaseController {
private WsMaInfoService service;
@ApiOperation(value = "根据ID获取机具信息")
@PreventRepeatSubmit
@SysLog(title = "机具信息查询", businessType = OperaType.QUERY, logType = 1, module = "机具管理->查询")
@GetMapping("/{id}")
public AjaxResult getById(@PathVariable Integer id) {
@ -33,7 +33,6 @@ public class WsMaInfoController extends BaseController {
}
@ApiOperation(value = "查询所有机具信息列表")
@PreventRepeatSubmit
@SysLog(title = "机具信息列表查询", businessType = OperaType.QUERY, logType = 1, module = "机具管理->查询")
@GetMapping("/list")
public AjaxResult getAll() {
@ -42,15 +41,15 @@ public class WsMaInfoController extends BaseController {
}
@ApiOperation(value = "新增机具信息")
@PreventRepeatSubmit
@SysLog(title = "机具信息新增", businessType = OperaType.INSERT, logType = 1, module = "机具管理->新增")
@PostMapping("/addWsMaInfo")
public AjaxResult save(@RequestBody WsMaInfo info) {
info.setOptUser(SecurityUtils.getLoginUser().getSysUser().getNickName());
return service.save(info);
}
@ApiOperation(value = "更新机具信息")
@PreventRepeatSubmit
@SysLog(title = "机具信息更新", businessType = OperaType.UPDATE, logType = 1, module = "机具管理->更新")
@PostMapping("/updateWsMaInfo")
public AjaxResult update(@RequestBody WsMaInfo info) {
@ -58,7 +57,6 @@ public class WsMaInfoController extends BaseController {
}
@ApiOperation(value = "删除机具信息")
@PreventRepeatSubmit
@SysLog(title = "机具信息删除", businessType = OperaType.DELETE, logType = 1, module = "机具管理->删除")
@PostMapping("/{id}")
public AjaxResult delete(@PathVariable Integer id) {
@ -66,7 +64,6 @@ public class WsMaInfoController extends BaseController {
}
@ApiOperation(value = "获取机具类型")
@PreventRepeatSubmit
@SysLog(title = "获取机具类型", businessType = OperaType.DELETE, logType = 1, module = "获取机具类型")
@PostMapping("/getMaTypeData")
public AjaxResult getMaTypeData() {
@ -74,11 +71,18 @@ public class WsMaInfoController extends BaseController {
}
@ApiOperation(value = "获取机具类型")
@PreventRepeatSubmit
@SysLog(title = "获取机具类型", businessType = OperaType.DELETE, logType = 1, module = "获取机具类型")
@ApiOperation(value = "获取机具规格")
@SysLog(title = "获取机具规格", businessType = OperaType.DELETE, logType = 1, module = "获取机具规格")
@PostMapping("/getMaModeData")
public AjaxResult getMaModeData(@RequestParam Integer parentId) {
return service.getMaModeData(parentId);
public AjaxResult getMaModeData(@RequestBody WsMaInfo info) {
return service.getMaModeData(info.getParentId());
}
@ApiOperation(value = "获取出厂厂家")
@SysLog(title = "获取出厂厂家", businessType = OperaType.DELETE, logType = 1, module = "获取出厂厂家")
@PostMapping("/getSupplier")
public AjaxResult getSupplier() {
return service.getSupplier();
}
}

View File

@ -17,6 +17,10 @@ public class WsMaInfo {
* 主键自增ID
*/
private Integer id;
/**
* 父类id
*/
private Integer parentId;
/**
* 机具名称电焊机搅拌机

View File

@ -3,6 +3,7 @@ package com.bonus.material.codeCollection.mapper;
import com.bonus.material.codeCollection.domain.WsMaInfo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -71,4 +72,27 @@ public interface WsMaInfoMapper {
@MapKey("id")
List<Map<String, Objects>> getMaModeData(Integer parentId);
/**
* 获取出厂厂家
*
* @return 出厂厂家集合
*/
@MapKey("id")
List<Map<String, Objects>> getSupplier();
/**
* 判断编码是否存在
*
* @param maModel 规格
* @param maCode 编码
* @return 条数
*/
int existsByModelAndCode(@Param("maModel") String maModel, @Param("maCode") String maCode);
/**
* 更新时间
*
* @return 条数
*/
int updateCheckTime(Integer id);
}

View File

@ -69,4 +69,12 @@ public interface WsMaInfoService {
* @return 机具规格集合
*/
AjaxResult getMaModeData(Integer parentId);
/**
* 获取出厂厂家
*
* @return 出厂厂家集合
*/
AjaxResult getSupplier();
}

View File

@ -75,6 +75,11 @@ public class WsMaInfoServiceImpl implements WsMaInfoService {
@Override
public AjaxResult save(WsMaInfo info) {
try {
int i = mapper.existsByModelAndCode(info.getMaModel(), info.getMaCode());
if (ObjectUtils.isNotEmpty(i)) {
mapper.updateCheckTime(i);
return AjaxResult.error("该机具规格与编码已存在,请勿重复添加!");
}
int result = mapper.insert(info);
return result > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
} catch (Exception e) {
@ -144,14 +149,30 @@ public class WsMaInfoServiceImpl implements WsMaInfoService {
/**
* 获取机具规格下拉选
*
* @param parentId
* @param parentId 父类id
* @return 机具规格集合
*/
@Override
public AjaxResult getMaModeData(Integer parentId) {
try {
List<Map<String, Objects>> maTypeData = mapper.getMaModeData(parentId);
return ObjectUtils.isNotEmpty(maTypeData) ? AjaxResult.success(maTypeData) : AjaxResult.error("");
List<Map<String, Objects>> maModeData = mapper.getMaModeData(parentId);
return ObjectUtils.isNotEmpty(maModeData) ? AjaxResult.success(maModeData) : AjaxResult.error("");
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("");
}
}
/**
* 获取出厂厂家
*
* @return 出厂厂家集合
*/
@Override
public AjaxResult getSupplier() {
try {
List<Map<String, Objects>> supplier = mapper.getSupplier();
return ObjectUtils.isNotEmpty(supplier) ? AjaxResult.success(supplier) : AjaxResult.error("");
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("");

View File

@ -106,4 +106,33 @@ public class FieldMaintenanceController extends BaseController {
return error();
}
}
@ApiOperation(value = "提交任务")
@PreventRepeatSubmit
@SysLog(title = "现场维修任务", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->删除任务")
@PostMapping("/deleteFieldApplyDetailsById")
public AjaxResult deleteFieldApplyDetailsById(@RequestBody FieldApplyDetails fieldApplyDetails) {
try {
return fieldMaintenanceService.deleteFieldApplyDetailsById(fieldApplyDetails.getParentId(), fieldApplyDetails.getTypeId());
} catch (Exception e) {
return error();
}
}
@ApiOperation(value = "提交任务")
@PreventRepeatSubmit
@SysLog(title = "现场维修任务", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->删除任务")
@PostMapping("/insertDetails")
public AjaxResult insertDetails(@RequestBody List<FieldApplyDetails> fieldApplyDetailsList) {
// 示例逻辑遍历每条记录
for (FieldApplyDetails detail : fieldApplyDetailsList) {
// TODO: 插入数据库例如调用 service.insert(detail)
System.out.println("处理 detail: " + detail);
fieldMaintenanceService.insertDetails(detail);
}
return AjaxResult.success("插入成功,共 " + fieldApplyDetailsList.size() + "");
}
}

View File

@ -3,12 +3,14 @@ package com.bonus.material.fieldMaintenance.domain;
import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.common.core.annotation.Excel;
import com.bonus.material.back.domain.MaCodeDto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Accessors(chain = true)
@ -94,4 +96,24 @@ public class FieldApplyDetails {
private Integer isFinished;
private String keyWord;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -2,6 +2,7 @@ package com.bonus.material.fieldMaintenance.mapper;
import com.bonus.material.fieldMaintenance.domain.FieldApplyDetails;
import com.bonus.material.fieldMaintenance.domain.FieldApplyInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -41,5 +42,7 @@ public interface FieldMaintenanceMapper {
*/
int deleteFieldApplyInfoById(Integer id);
int deleteFieldApplyDetailsById(@Param("id") Long id, @Param("typeId") Long typeId);
int insertDetails(FieldApplyDetails fieldApplyDetails);
}

View File

@ -4,6 +4,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.fieldMaintenance.domain.FieldApplyDetails;
import com.bonus.material.fieldMaintenance.domain.FieldApplyInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -49,4 +50,11 @@ public interface FieldMaintenanceService {
* @return 条数
*/
AjaxResult submitTask(Long taskId);
AjaxResult deleteFieldApplyDetailsById(Long id,Long typeId);
AjaxResult insertDetails(FieldApplyDetails fieldApplyDetails);
}

View File

@ -165,6 +165,37 @@ public class FieldMaintenanceImpl implements FieldMaintenanceService {
return null;
}
/**
* @param id
* @param typeId
* @return
*/
@Override
public AjaxResult deleteFieldApplyDetailsById(Long id, Long typeId) {
try {
int i = fieldMaintenanceMapper.deleteFieldApplyDetailsById(id, typeId);
return i > 0 ? AjaxResult.success() : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* @param fieldApplyDetails
* @return
*/
@Override
public AjaxResult insertDetails(FieldApplyDetails fieldApplyDetails) {
try {
int i = fieldMaintenanceMapper.insertDetails(fieldApplyDetails);
return i > 0 ? AjaxResult.success() : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* 生成现场维修任务单号

View File

@ -26,6 +26,31 @@
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<insert id="insertDetails">
INSERT INTO field_apply_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="parentId != null">parent_id,</if>
<if test="typeId != null">type_id,</if>
<if test="preNum != null">pre_num,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="maCode != null">ma_code,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="parentId != null">#{taskId},</if>
<if test="typeId != null">#{typeId},</if>
<if test="preNum != null">#{preNum},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="maCode != null">#{maCode},</if>
</trim>
</insert>
<update id="deleteFieldApplyInfoById" parameterType="java.lang.Integer">
UPDATE field_apply_info
@ -33,6 +58,12 @@
update_time = NOW()
WHERE id = #{id}
</update>
<delete id="deleteFieldApplyDetailsById">
DELETE
FROM field_apply_details
WHERE parent_id = #{id}
and type_id = #{typeId}
</delete>
<select id="selectFieldApplyInfoList"
resultType="com.bonus.material.fieldMaintenance.domain.FieldApplyInfo">
@ -127,7 +158,6 @@
resultType="com.bonus.material.fieldMaintenance.domain.FieldApplyDetails">
SELECT
fad.id AS id,
fad.CODE AS CODE,
fad.parent_id AS parentId,
fad.type_id AS typeId,
mt2.type_name AS materialType,
@ -137,16 +167,10 @@
mt.unit_value AS unitValue,
mt.manage_type AS manageType,
SUM(fad.pre_num) AS preNum,
fad.use_num AS num,
fad.STATUS AS STATUS,
fad.create_by AS createBy,
fad.create_time AS createTime,
fad.update_by AS updateBy,
fad.update_time AS updateTime,
fad.remark AS remark,
fad.ap_detection AS apDetection,
fad.bad_num AS badNum,
fad.good_num AS goodNum,
mt.manage_type AS manageType
FROM
field_apply_details fad

View File

@ -24,11 +24,14 @@
</resultMap>
<select id="selectById" resultMap="BaseResultMap">
SELECT * FROM ws_ma_info WHERE id = #{id}
SELECT *
FROM ws_ma_info
WHERE id = #{id}
</select>
<select id="selectAll" resultMap="BaseResultMap">
SELECT * FROM ws_ma_info
SELECT *
FROM ws_ma_info
</select>
<select id="getMaTypeData" resultType="java.util.Map">
@ -44,45 +47,65 @@
SELECT type_id AS id,
type_name AS `name`
FROM ma_type
WHERE parent_id =#{parentId}
WHERE parent_id = #{parentId}
AND del_flag = '0'
</select>
<select id="getSupplier" resultType="java.util.Map">
SELECT supplier_id AS id,
supplier AS `name`
FROM ma_supplier_info
WHERE del_flag = '0'
</select>
<select id="existsByModelAndCode" resultType="java.lang.Integer">
SELECT id
FROM ws_ma_info
WHERE ma_model = #{maModel}
AND ma_code = #{maCode}
LIMIT 1
</select>
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO ws_ma_info (
ma_name, ma_model, ma_code, supplier, this_check_time, next_check_time,
repair_man, check_man, phone, result, type, model_id, is_active, opt_user, opt_time
) VALUES (
#{maName}, #{maModel}, #{maCode}, #{supplier}, #{thisCheckTime}, #{nextCheckTime},
#{repairMan}, #{checkMan}, #{phone}, #{result}, #{type}, #{modelId}, #{isActive}, #{optUser}, #{optTime}
)
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true"
keyProperty="id">
INSERT INTO ws_ma_info (ma_name, ma_model, ma_code, supplier, this_check_time, next_check_time,
repair_man, check_man, phone, result, type, model_id, is_active, opt_user, opt_time)
VALUES (#{maName}, #{maModel}, #{maCode}, #{supplier}, DATE(now()),
DATE(DATE_SUB(DATE_ADD(NOW(), INTERVAL 1 YEAR), INTERVAL 1 DAY)),
#{repairMan}, #{checkMan}, #{phone}, #{result}, #{type}, #{modelId}, #{isActive}, #{optUser}, now())
</insert>
<update id="update" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo">
UPDATE ws_ma_info SET
ma_name = #{maName},
ma_model = #{maModel},
ma_code = #{maCode},
supplier = #{supplier},
this_check_time = #{thisCheckTime},
next_check_time = #{nextCheckTime},
repair_man = #{repairMan},
check_man = #{checkMan},
phone = #{phone},
result = #{result},
type = #{type},
model_id = #{modelId},
is_active = #{isActive},
opt_user = #{optUser},
opt_time = #{optTime}
UPDATE ws_ma_info
SET ma_name = #{maName},
ma_model = #{maModel},
ma_code = #{maCode},
supplier = #{supplier},
this_check_time = #{thisCheckTime},
next_check_time = #{nextCheckTime},
repair_man = #{repairMan},
check_man = #{checkMan},
phone = #{phone},
result = #{result},
type = #{type},
model_id = #{modelId},
is_active = #{isActive},
opt_user = #{optUser},
opt_time = #{optTime}
WHERE id = #{id}
</update>
<update id="updateCheckTime">
UPDATE ws_ma_info
SET this_check_time = DATE(now()),
next_check_time = DATE(DATE_SUB(DATE_ADD(NOW(), INTERVAL 1 YEAR), INTERVAL 1 DAY)),
opt_time = DATE(now())
WHERE id = #{id}
</update>
<delete id="deleteById" parameterType="int">
DELETE FROM ws_ma_info WHERE id = #{id}
DELETE
FROM ws_ma_info
WHERE id = #{id}
</delete>
</mapper>