功能优化
This commit is contained in:
parent
419605f4c2
commit
023ad15fe4
|
|
@ -90,4 +90,7 @@ public class BmQrcodeInfo extends BaseEntity
|
|||
@ApiModelProperty(value = "工程ID")
|
||||
private Long proId;
|
||||
|
||||
@ApiModelProperty(value = "机具ID")
|
||||
private Long maId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1620,8 +1620,8 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
boolean isValid = CollectionUtil.isEmpty(clzList) && CollectionUtil.isNotEmpty(recordList);
|
||||
// 构建结果消息
|
||||
String msg = isValid
|
||||
? "监测到" + bmQrcodeInfo.getQrCode() + "符合出库条件,请确认是否出库!"
|
||||
: "监测到" + bmQrcodeInfo.getQrCode() + "编码不符合出库条件,请检查后重新提交!";
|
||||
? "监测到" + bmQrcodeInfo.getMaCode() + "符合出库条件,请确认是否出库!"
|
||||
: "监测到" + bmQrcodeInfo.getMaCode() + "编码不符合出库条件,请检查后重新提交!";
|
||||
if (!isValid) {
|
||||
recordList = new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,4 +237,18 @@ public interface LeaseApplyInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
int updateLeaseNumTwo(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询领用单的领用单出库数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
LeaseApplyDetails getPublishNum(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 修改领用单的领用单出库数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateLeasePublish(LeaseApplyDetails leaseApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -754,14 +754,25 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
public AjaxResult updateLeaseNum(LeaseApplyDetails leaseApplyDetails) {
|
||||
try {
|
||||
if (leaseApplyDetails.getNewTypeId()!= null){
|
||||
// 根据parentId查询发布数量
|
||||
LeaseApplyDetails applyDetails = leaseApplyInfoMapper.getPublishNum(leaseApplyDetails);
|
||||
// 根据传入的值判断少了多少发布数量
|
||||
if (applyDetails != null) {
|
||||
BigDecimal num = leaseApplyDetails.getPublishNum().subtract(leaseApplyDetails.getPreNum());
|
||||
leaseApplyDetails.setPublishNum(applyDetails.getPublishNum().subtract(num));
|
||||
}
|
||||
int res = leaseApplyInfoMapper.updateLeaseNum(leaseApplyDetails);
|
||||
if (res<=0){
|
||||
return AjaxResult.error("修改失败");
|
||||
if (res <= 0){
|
||||
return AjaxResult.error("修改领用表失败");
|
||||
}
|
||||
res = leaseApplyInfoMapper.updateLeasePublish(leaseApplyDetails);
|
||||
if (res <= 0){
|
||||
return AjaxResult.error("修改领料发布表失败");
|
||||
}
|
||||
} else {
|
||||
int res = leaseApplyInfoMapper.updateLeaseNumTwo(leaseApplyDetails);
|
||||
if (res<=0){
|
||||
return AjaxResult.error("修改失败");
|
||||
if (res <= 0){
|
||||
return AjaxResult.error("修改领料表失败");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("修改成功");
|
||||
|
|
|
|||
|
|
@ -411,5 +411,31 @@ public class RepairController extends BaseController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询在修工程维修列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询在修工程维修列表")
|
||||
@GetMapping("/getRepairProjectList")
|
||||
public AjaxResult getRepairProjectList(RepairProjectInfo bean) {
|
||||
startPage();
|
||||
List<RepairProjectInfo> list = service.getRepairProjectList(bean);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出在修工程维修列表
|
||||
* @param response
|
||||
* @param bean
|
||||
*/
|
||||
@ApiOperation(value = "导出在修工程维修列表")
|
||||
@PostMapping("/exportRepairProjectList")
|
||||
public void exportRepairProjectList(HttpServletResponse response, RepairProjectInfo bean) {
|
||||
List<RepairProjectInfo> list = service.getRepairProjectList(bean);
|
||||
ExcelUtil<RepairProjectInfo> util = new ExcelUtil<RepairProjectInfo>(RepairProjectInfo.class);
|
||||
util.exportExcel(response, list, "在修工程维修列表");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 维修详细对象 repair_apply_details
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class RepairProjectInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 维修时间 */
|
||||
@Excel(name = "维修时间", width = 20)
|
||||
@ApiModelProperty(value = "维修时间")
|
||||
private String repairTime;
|
||||
|
||||
/** 维修单号 */
|
||||
@Excel(name = "维修单号")
|
||||
@ApiModelProperty(value = "维修单号")
|
||||
private String repairCode;
|
||||
|
||||
/** 规格ID */
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private Long typeId;
|
||||
|
||||
/** 退料单位 */
|
||||
@Excel(name = "退料单位", width = 30)
|
||||
@ApiModelProperty(value = "退料单位")
|
||||
private String backUnitName;
|
||||
|
||||
/** 退料工程 */
|
||||
@Excel(name = "退料工程", width = 40)
|
||||
@ApiModelProperty(value = "退料工程")
|
||||
private String backProjectName;
|
||||
|
||||
/** 机具类型 */
|
||||
@Excel(name = "机具类型")
|
||||
@ApiModelProperty(value = "机具类型")
|
||||
private String maTypeName;
|
||||
|
||||
/** 机具规格 */
|
||||
@Excel(name = "机具规格")
|
||||
@ApiModelProperty(value = "机具规格")
|
||||
private String maTypeModel;
|
||||
|
||||
/** 机具单位 */
|
||||
@Excel(name = "机具单位")
|
||||
@ApiModelProperty(value = "机具单位")
|
||||
private String unitName;
|
||||
|
||||
/** 在修数量 */
|
||||
@Excel(name = "在修数量")
|
||||
@ApiModelProperty(value = "在修数量(定损+维修)")
|
||||
private BigDecimal repairNum;
|
||||
|
||||
@ApiModelProperty(value = "定损数量")
|
||||
private BigDecimal dsNum;
|
||||
|
||||
@ApiModelProperty(value = "维修数量")
|
||||
private BigDecimal num;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
}
|
||||
|
|
@ -152,4 +152,11 @@ public interface RepairInputDetailsMapper {
|
|||
* @return
|
||||
*/
|
||||
int selectRepairInputDetailsByAuditId(RepairInputDetails input);
|
||||
|
||||
/**
|
||||
* 根据taskId以及typeId查询该设备是否已经入库
|
||||
* @param repairInputDetails
|
||||
* @return
|
||||
*/
|
||||
RepairInputDetails selectInfoNum(RepairInputDetails repairInputDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,4 +434,11 @@ public interface RepairMapper {
|
|||
* @return
|
||||
*/
|
||||
List<RepairPartDetails> getDetailsListAppTwo(RepairPartDetails bean);
|
||||
|
||||
/**
|
||||
* 查询在修工程维修列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<RepairProjectInfo> getRepairProjectList(RepairProjectInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,4 +159,11 @@ public interface RepairService {
|
|||
* @return
|
||||
*/
|
||||
List<RepairDeviceSummaryVo> getAppRepairMaTypeListNew(RepairTaskDetails bean);
|
||||
|
||||
/**
|
||||
* 查询在修工程维修列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<RepairProjectInfo> getRepairProjectList(RepairProjectInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -608,8 +608,26 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
|
||||
// 编码类型入库
|
||||
if (CollectionUtils.isNotEmpty(repairInputDetails.getMaCodeList())) {
|
||||
for (RepairInputDetails inputDetails : repairInputDetails.getMaCodeList()) {
|
||||
inputDetails.setTaskId(repairInputDetails.getTaskId());
|
||||
inputDetails.setTypeId(repairInputDetails.getTypeId());
|
||||
// 根据taskId以及typeId查询该设备是否已经入库
|
||||
RepairInputDetails info = repairInputDetailsMapper.selectInfoNum(inputDetails);
|
||||
if (info != null) {
|
||||
if (info.getInputNum().compareTo(info.getRepairNum()) >= 0) {
|
||||
throw new ServiceException("该设备已经入库,请勿重复入库");
|
||||
}
|
||||
}
|
||||
}
|
||||
result += processCodeTypeStorage(repairInputDetails);
|
||||
} else {
|
||||
// 根据taskId以及typeId查询该设备是否已经入库
|
||||
RepairInputDetails inputDetails = repairInputDetailsMapper.selectInfoNum(repairInputDetails);
|
||||
if (inputDetails != null) {
|
||||
if (inputDetails.getInputNum().compareTo(inputDetails.getRepairNum()) >= 0) {
|
||||
throw new ServiceException("该设备已经入库,请勿重复入库");
|
||||
}
|
||||
}
|
||||
// 数量类型入库
|
||||
result += processQuantityTypeStorage(repairInputDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1795,6 +1795,21 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询在修工程维修列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RepairProjectInfo> getRepairProjectList(RepairProjectInfo bean) {
|
||||
try {
|
||||
return repairMapper.getRepairProjectList(bean);
|
||||
} catch (Exception e) {
|
||||
log.error("查询在修工程维修列表", e.getMessage());
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询修试查询-维修配件查询列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1228,7 +1228,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0'
|
||||
where
|
||||
sai.status = '0'
|
||||
AND mm.ma_code = #{maCode}
|
||||
<if test="maId != null">
|
||||
AND mm.ma_id = #{maId}
|
||||
</if>
|
||||
<if test="maCode != null and maCode != ''">
|
||||
AND mm.ma_code = #{maCode}
|
||||
</if>
|
||||
<if test="typeId != null and typeId != ''">
|
||||
AND mt.type_id = #{typeId}
|
||||
</if>
|
||||
|
|
@ -1259,7 +1264,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bu.type_id in (32, 36)
|
||||
AND bp.pro_id = #{proId}
|
||||
AND sai.`status` = '0'
|
||||
AND mm.ma_code like concat('%',#{maCode},'%')
|
||||
<if test="maCode != null and maCode != ''">
|
||||
AND mm.ma_code like concat('%',#{maCode},'%')
|
||||
</if>
|
||||
<if test="maId != null">
|
||||
AND mm.ma_id = #{maId}
|
||||
</if>
|
||||
<if test="typeId != null and typeId != ''">
|
||||
AND mt.type_id = #{typeId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -806,24 +806,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
is_confirm = 2
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateLeaseNum">
|
||||
update lease_apply_details
|
||||
set pre_num = #{preNum},
|
||||
publish_num=#{preNum}
|
||||
|
||||
set publish_num=#{publishNum}
|
||||
where parent_id = #{parentId}
|
||||
and new_type = #{newTypeId};
|
||||
|
||||
update lease_publish_details
|
||||
set num = #{preNum}
|
||||
where parent_id = #{parentId}
|
||||
and new_type = #{newTypeId};
|
||||
AND new_type = #{newTypeId}
|
||||
</update>
|
||||
|
||||
<update id="updateLeaseNumTwo">
|
||||
update lease_apply_details
|
||||
set pre_num = #{preNum}
|
||||
set pre_num = #{preNum}
|
||||
where parent_id = #{parentId}
|
||||
and type_id = #{typeId}
|
||||
AND type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateLeasePublish">
|
||||
update lease_publish_details
|
||||
set num = #{preNum}
|
||||
where parent_id = #{parentId}
|
||||
AND new_type = #{newTypeId}
|
||||
AND publish_task = #{publishTask}
|
||||
</update>
|
||||
|
||||
<select id="getUserList" resultMap="LeaseApplyInfoResult">
|
||||
|
|
@ -923,4 +926,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
parent_id = #{id} and al_num > 0
|
||||
</select>
|
||||
<select id="getPublishNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
SELECT
|
||||
parent_id AS parentId,
|
||||
type_id AS typeId,
|
||||
publish_num AS publishNum
|
||||
FROM
|
||||
lease_apply_details
|
||||
WHERE
|
||||
parent_id = #{parentId}
|
||||
and new_type = #{newTypeId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -734,7 +734,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mm.type_id as typeId,
|
||||
sd.dict_label as maStatus,
|
||||
mm.qr_code as qrCode,
|
||||
mm.ma_vender as maVender,
|
||||
-- 判断ma_vender是否为数字,是则取msi.supplier,否则取mm.ma_vender
|
||||
CASE
|
||||
WHEN mm.ma_vender REGEXP '^[0-9]+$' THEN msi.supplier
|
||||
ELSE mm.ma_vender
|
||||
END as maVender,
|
||||
mm.out_fac_time as outFacTime,
|
||||
mm.out_fac_code as outFacCode,
|
||||
mm.assets_code as assetsCode,
|
||||
|
|
|
|||
|
|
@ -74,8 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
CASE mt.manage_type
|
||||
WHEN 0 THEN
|
||||
IFNULL(subquery0.num, 0) + IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0)
|
||||
+ IFNULL(subquery2.dsNum, 0) + IFNULL(subquery3.repairAuditNum, 0)
|
||||
ELSE
|
||||
IFNULL(mt.storage_num, 0) + IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0)
|
||||
+ IFNULL(subquery2.dsNum, 0) + IFNULL(subquery3.repairAuditNum, 0)
|
||||
END AS inventoryNum,
|
||||
mt2.is_statics AS isStatics
|
||||
FROM ma_type mt
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY rd.task_id
|
||||
) AS combined_results
|
||||
ORDER BY
|
||||
taskStatus,
|
||||
createTime DESC
|
||||
</select>
|
||||
|
||||
|
|
@ -588,6 +587,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where audit_id = #{auditId}
|
||||
</select>
|
||||
|
||||
<select id="selectInfoNum" resultType="com.bonus.common.biz.domain.repair.RepairInputDetails">
|
||||
SELECT
|
||||
repair_num AS repairNum,
|
||||
IFNULL( input_num, 0 ) + IFNULL( reject_num, 0 ) AS inputNum
|
||||
FROM
|
||||
repair_input_details
|
||||
WHERE
|
||||
task_id = #{taskId}
|
||||
AND type_id = #{typeId}
|
||||
<if test="maId != null">
|
||||
AND ma_id = #{maId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="updateBoxStatus">
|
||||
update bm_qrcode_box set box_status = 6
|
||||
where box_code = #{boxCode}
|
||||
|
|
|
|||
|
|
@ -1396,6 +1396,70 @@
|
|||
GROUP BY rad.task_id, rad.type_id, rad.ma_id
|
||||
</select>
|
||||
|
||||
<select id="getRepairProjectList" resultType="com.bonus.material.repair.domain.vo.RepairProjectInfo">
|
||||
SELECT
|
||||
mt.type_id AS typeId,
|
||||
mt2.type_name AS maTypeName,
|
||||
mt.type_name AS maTypeModel,
|
||||
mt.unit_name AS unitName,
|
||||
IFNULL(subquery2.dsNum, 0) AS dsNum,
|
||||
IFNULL(subquery2.repairNum, 0) AS num,
|
||||
IFNULL(subquery2.dsNum, 0) + IFNULL(subquery2.repairNum, 0) AS repairNum,
|
||||
subquery2.taskCode AS repairCode,
|
||||
subquery2.unitName AS backUnitName,
|
||||
subquery2.proName AS backProjectName,
|
||||
subquery2.createTime AS repairTime
|
||||
FROM ma_type mt
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt2.type_id AS thirdTypeId,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(CASE WHEN tt.task_status = 0 and rad.is_ds = 1 THEN IFNULL(rad.repair_num, 0) ELSE 0 END) AS dsNum,
|
||||
SUM(CASE WHEN tt.task_status = 4 and rad.is_ds = 0 THEN (IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) - IFNULL(rad.scrap_num, 0)) ELSE 0 END) AS repairNum,
|
||||
tt.code AS taskCode,
|
||||
bu.unit_name AS unitName,
|
||||
bp.pro_name AS proName,
|
||||
tt.create_time AS createTime
|
||||
FROM repair_apply_details rad
|
||||
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
|
||||
WHERE
|
||||
tt.task_status IN (0, 4) and tt.code is not null
|
||||
GROUP BY
|
||||
mt.type_id,
|
||||
tt.`code`
|
||||
) AS subquery2 ON subquery2.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
|
||||
WHERE mt.del_flag = '0' and mt.`level` = 4
|
||||
AND IFNULL(subquery2.dsNum, 0) + IFNULL(subquery2.repairNum, 0) > 0
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
subquery2.taskCode like concat('%', #{keyWord}, '%')
|
||||
OR subquery2.unitName like concat('%', #{keyWord}, '%')
|
||||
OR subquery2.proName like concat('%', #{keyWord}, '%')
|
||||
OR mt2.type_name like concat('%', #{keyWord}, '%')
|
||||
OR mt.type_name like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[AND DATE_FORMAT( subquery2.createTime, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
GROUP BY mt.type_id,
|
||||
subquery2.taskCode
|
||||
</select>
|
||||
|
||||
<update id="updateRepairedAndScrapNum">
|
||||
update
|
||||
repair_apply_details
|
||||
|
|
|
|||
Loading…
Reference in New Issue