修饰优化
This commit is contained in:
parent
89ed25dc38
commit
c961c0c3c6
|
|
@ -7,6 +7,7 @@ import com.bonus.common.biz.domain.BmStorageLog;
|
|||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutRequestVo;
|
||||
import com.bonus.common.biz.domain.purchase.PurchaseDto;
|
||||
import com.bonus.common.biz.enums.InputOutEnum;
|
||||
import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
|
||||
import com.bonus.common.biz.service.AsyncStoreLogService;
|
||||
import com.bonus.common.biz.utils.HttpResult;
|
||||
|
|
@ -147,6 +148,7 @@ public class StoreLogAspect {
|
|||
bmStorageLog.setPreStoreNum(leaseOutDetails.getPreStoreNum());
|
||||
bmStorageLog.setOutNum(leaseOutDetails.getInputNum());
|
||||
bmStorageLog.setPostStoreNum(leaseOutDetails.getPostStoreNum());
|
||||
bmStorageLog.setOutType(InputOutEnum.NUMBER_DEVICE.getTypeId());
|
||||
bmStorageLogList.add(bmStorageLog);
|
||||
}
|
||||
}
|
||||
|
|
@ -167,6 +169,7 @@ public class StoreLogAspect {
|
|||
bmStorageLog.setPreStoreNum(leaseOutDetails.getPreStoreNum());
|
||||
bmStorageLog.setOutNum(BigDecimal.valueOf(lod.getLeaseOutDetailsList().size()));
|
||||
bmStorageLog.setPostStoreNum(leaseOutDetails.getPreStoreNum().subtract(bmStorageLog.getOutNum()));
|
||||
bmStorageLog.setOutType(InputOutEnum.CODE_DEVICE.getTypeId());
|
||||
bmStorageLogList.add(bmStorageLog);
|
||||
}
|
||||
}
|
||||
|
|
@ -190,8 +193,10 @@ public class StoreLogAspect {
|
|||
.map(PurchaseDto::getMaCode)
|
||||
.collect(Collectors.joining(","));
|
||||
bmStorageLog.setMaCode(maCode);
|
||||
bmStorageLog.setInputType(InputOutEnum.CODE_DEVICE.getTypeId());
|
||||
} else {
|
||||
bmStorageLog.setInNum(purchaseDto.getInputNum());
|
||||
bmStorageLog.setInputType(InputOutEnum.NUMBER_DEVICE.getTypeId());
|
||||
}
|
||||
bmStorageLogList.add(bmStorageLog);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ public class MaterialConstants {
|
|||
/** 报废单号的开头字母 */
|
||||
public static final String SCRAP_TASK_TYPE_LABEL = "BF";
|
||||
|
||||
/** 修饰入库单号的开头字母 */
|
||||
public static final String REPAIR_INPUT_TASK_TYPE_LABEL = "R";
|
||||
|
||||
/**
|
||||
* 内部单位协议
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class BmStorageLog extends BaseEntity
|
|||
@ApiModelProperty(value = "规格id")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "机具id")
|
||||
@ApiModelProperty(value = "机具code")
|
||||
private String maCode;
|
||||
|
||||
/** 操作前库存数量 */
|
||||
|
|
@ -53,11 +53,17 @@ public class BmStorageLog extends BaseEntity
|
|||
@ApiModelProperty(value = "入库数量")
|
||||
private BigDecimal inNum;
|
||||
|
||||
@ApiModelProperty(value = "入库方式 0数量,1编码,2二维码,3标准箱")
|
||||
private Integer inputType;
|
||||
|
||||
/** 出库数量 */
|
||||
@Excel(name = "出库数量")
|
||||
@ApiModelProperty(value = "出库数量")
|
||||
private BigDecimal outNum;
|
||||
|
||||
@ApiModelProperty(value = "出库方式 0数量,1编码,2二维码,3标准箱")
|
||||
private Integer outType;
|
||||
|
||||
/** 退库接收-总数量 */
|
||||
@Excel(name = "退库接收-总数量")
|
||||
@ApiModelProperty(value = "退库接收-总数量")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.common.biz.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 出入库方式
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/17 14:42
|
||||
*/
|
||||
@Getter
|
||||
public enum InputOutEnum {
|
||||
|
||||
CODE_DEVICE(0, "编码"),
|
||||
NUMBER_DEVICE(1, "数量"),
|
||||
QR_CODE(2, "二维码"),
|
||||
STANDARD_BOX(3, "标准箱");
|
||||
|
||||
|
||||
private final Integer typeId;
|
||||
private final String typeName;
|
||||
|
||||
InputOutEnum(Integer typeId, String typeName) {
|
||||
this.typeId = typeId;
|
||||
this.typeName = typeName;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,8 @@ public enum TmTaskTypeEnum {
|
|||
TM_TASK_SETTLEMENT(7, "结算任务"),
|
||||
TM_TASK_CHECK(8, "检验任务"),
|
||||
TM_TASK_FACTORY_MANAGEMENT(9, "物资厂家管理任务"),
|
||||
TM_TASK_AGREEMENT_MANAGEMENT(10, "新增协议任务");
|
||||
TM_TASK_AGREEMENT_MANAGEMENT(10, "新增协议任务"),
|
||||
TM_TASK_REPAIR_INPUT(11, "修饰后入库任务");
|
||||
|
||||
private final Integer taskTypeId;
|
||||
private final String taskTypeName;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ public class RepairAuditDetails extends BaseEntity {
|
|||
/** ID */
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "协议id")
|
||||
private Long agreementId;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务ID")
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.repair.service.impl;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.vo.KeyValueVO;
|
||||
import com.bonus.common.biz.enums.RepairInputStatusEnum;
|
||||
import com.bonus.common.biz.enums.RepairTaskStatusEnum;
|
||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
|
|
@ -67,6 +68,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
@Resource
|
||||
private RepairInputDetailsMapper repairInputDetailsMapper;
|
||||
|
||||
@Resource
|
||||
private TmTaskAgreementMapper taskAgreementMapper;
|
||||
|
||||
@Override
|
||||
public List<RepairPart> getPartRecord(RepairAuditDetails repairAuditDetails) {
|
||||
RepairAuditDetails bean = repairAuditDetailsMapper.getRepairId(repairAuditDetails);
|
||||
|
|
@ -479,8 +483,14 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
|
||||
String status = repairAuditDetails.get(0).getStatus(); // 1通过 2驳回
|
||||
if ("1".equals(status)) {
|
||||
repairInputDetailsMapper.deleteRepairInputDetailsByTaskId(repairAuditDetails.get(0).getTaskId());
|
||||
batchInsertRepairInputDetails(repairAuditDetailsByQuery, status);
|
||||
for (RepairAuditDetails repairAuditDetail : repairAuditDetails) {
|
||||
repairInputDetailsMapper.deleteRepairInputDetailsByTaskId(repairAuditDetail.getTaskId());
|
||||
Long agreementId = taskAgreementMapper.selectAgreementIdByTaskId(repairAuditDetail.getTaskId());
|
||||
List<Long> taskIdList = new ArrayList<>();
|
||||
taskIdList.add(repairAuditDetail.getTaskId());
|
||||
List<RepairAuditDetails> repairAuditDetailList = repairAuditDetailsMapper.selectRepairAuditDetailsByTaskIds(taskIdList);
|
||||
batchInsertRepairInputDetails(repairAuditDetailList, agreementId);
|
||||
}
|
||||
} else if ("2".equals(status)) {
|
||||
for (RepairAuditDetails auditDetails : repairAuditDetails) {
|
||||
repairApplyDetailsMapper.updateRepairApplyDetailsAfterReject(
|
||||
|
|
@ -520,7 +530,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
}
|
||||
String status = repairAuditDetails.get(0).getStatus(); // 1通过 2驳回
|
||||
if ("1".equals(status)) {
|
||||
batchInsertRepairInputDetails(repairAuditDetails, status);
|
||||
//根据任务id查询协议id
|
||||
Long agreementId = taskAgreementMapper.selectAgreementIdByTaskId(repairAuditDetails.get(0).getTaskId());
|
||||
batchInsertRepairInputDetails(repairAuditDetails, agreementId);
|
||||
} else if ("2".equals(status)) {
|
||||
for (RepairAuditDetails auditDetails : repairAuditDetails) {
|
||||
repairApplyDetailsMapper.updateRepairApplyDetailsAfterReject(
|
||||
|
|
@ -542,18 +554,71 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
// System.out.println(b);
|
||||
// }
|
||||
|
||||
private void batchInsertRepairInputDetails(List<RepairAuditDetails> repairAuditDetailsByQuery, String status) {
|
||||
private void batchInsertRepairInputDetails(List<RepairAuditDetails> repairAuditDetailsByQuery, Long agreementId) {
|
||||
//插入任务表
|
||||
Long newTaskId = insertTt();
|
||||
insertTta(newTaskId, agreementId);
|
||||
List<RepairInputDetails> inputList = new ArrayList<>();
|
||||
for (RepairAuditDetails details : repairAuditDetailsByQuery) {
|
||||
RepairInputDetails inputVo = new RepairInputDetails();
|
||||
BeanUtils.copyProperties(details, inputVo);
|
||||
inputVo.setRepairNum(details.getRepairedNum());
|
||||
inputVo.setAuditId(details.getId());
|
||||
inputVo.setStatus("0");
|
||||
inputVo.setTaskId(newTaskId);
|
||||
inputVo.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
inputList.add(inputVo);
|
||||
}
|
||||
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入任务关联表
|
||||
* @param newTaskId
|
||||
* @param agreementId
|
||||
*/
|
||||
private void insertTta(Long newTaskId, Long agreementId) {
|
||||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(newTaskId, agreementId);
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
|
||||
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入任务表
|
||||
* @return
|
||||
*/
|
||||
private Long insertTt() {
|
||||
Long newTask = null;
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_REPAIR_INPUT.getTaskTypeId());
|
||||
// 生成修饰入库单号
|
||||
String code = genderWxTaskCode(thisMonthMaxOrder);
|
||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_REPAIR_INPUT.getTaskTypeId(), RepairInputStatusEnum.Input_TASK_NO_FINISHED.getStatus(),
|
||||
null,thisMonthMaxOrder + 1, code);
|
||||
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||
tmTask.setCreateBy(SecurityUtils.getUsername());
|
||||
// 插入任务
|
||||
int taskId = taskMapper.insertTmTask(tmTask);
|
||||
// 如果插入成功且返回的 taskId 大于 0
|
||||
if (taskId > 0 && tmTask.getTaskId() > 0) {
|
||||
newTask = tmTask.getTaskId();
|
||||
}
|
||||
return newTask;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成修饰入库单号
|
||||
* @param thisMonthMaxOrder
|
||||
* @return
|
||||
*/
|
||||
private String genderWxTaskCode(int thisMonthMaxOrder) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
return MaterialConstants.REPAIR_INPUT_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除修试审核详细
|
||||
*
|
||||
|
|
|
|||
|
|
@ -321,6 +321,9 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
*/
|
||||
private int processCodeTypeReject(RepairInputDetails repairInputDetails) {
|
||||
int result = 0;
|
||||
//插入任务表
|
||||
Long newTaskId = insertTt();
|
||||
result += insertTta(newTaskId, repairInputDetails);
|
||||
for (RepairInputDetails inputDetails : repairInputDetails.getMaCodeList()) {
|
||||
inputDetails.setStatus(RepairInputStatusEnum.Input_TASK_TO_REJECT.getStatus().toString());
|
||||
inputDetails.setTaskId(repairInputDetails.getTaskId());
|
||||
|
|
@ -333,9 +336,6 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
|
||||
inputDetails.setStatus(MaMachineStatusEnum.BACK_REPAIR.getStatus().toString());
|
||||
updateRepairInputInfo(inputDetails);
|
||||
//插入任务表
|
||||
Long newTaskId = insertTt();
|
||||
result += insertTta(newTaskId, repairInputDetails);
|
||||
result += insertWxTask(newTaskId, inputDetails);
|
||||
}
|
||||
if (result > 0) {
|
||||
|
|
|
|||
|
|
@ -64,4 +64,11 @@ public interface TmTaskAgreementMapper {
|
|||
int deleteTmTaskAgreementByTaskIds(Long[] taskIds);
|
||||
|
||||
String getAgreementId(String taskId);
|
||||
|
||||
/**
|
||||
* 根据任务ID获取协议ID
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
Long selectAgreementIdByTaskId(Long taskId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ma_code, create_time, creator, remark, manage_type,
|
||||
type_name, type_model_name, pre_store_num, in_num, out_num,
|
||||
back_num, pass_num, repair_num, agreement_id,
|
||||
scrap_num, `status`, post_store_num, result_code, result_msg, json_result
|
||||
scrap_num, `status`, post_store_num, result_code, result_msg, json_result,
|
||||
input_type, out_type
|
||||
) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(
|
||||
|
|
@ -133,7 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item.typeModelName}, #{item.preStoreNum}, #{item.inNum},#{item.outNum},
|
||||
#{item.backNum}, #{item.passNum}, #{item.repairNum}, #{item.agreementId},
|
||||
#{item.scrapNum}, #{item.status}, #{item.postStoreNum},
|
||||
#{item.resultCode}, #{item.resultMsg}, #{item.jsonResult}
|
||||
#{item.resultCode}, #{item.resultMsg}, #{item.jsonResult}, #{item.inputType},
|
||||
#{item.outType}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
|
|
|||
|
|
@ -100,4 +100,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from tm_task_agreement
|
||||
where task_id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="selectAgreementIdByTaskId" resultType="java.lang.Long">
|
||||
select agreement_id
|
||||
from tm_task_agreement
|
||||
where task_id = #{taskId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue