盘点报废
This commit is contained in:
parent
03f6d6fa87
commit
445cd5b722
|
|
@ -67,6 +67,9 @@ public class MaterialConstants {
|
|||
/** 报废单号的开头字母 */
|
||||
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";
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.common.biz.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author : mashuai
|
||||
* @version : 1.0
|
||||
* 报废任务状态枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ScrapSourceEnum {
|
||||
|
||||
BACK_SCRAP("1", "退料"),
|
||||
REPAIR_SCRAP("2", "维修报废"),
|
||||
INVENTORY_SCRAP("3", "盘点报废");
|
||||
|
||||
private final String status;
|
||||
private final String statusName;
|
||||
|
||||
ScrapSourceEnum(String status, String statusName) {
|
||||
this.status = status;
|
||||
this.statusName = statusName;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,9 @@ public enum TmTaskTypeEnum {
|
|||
TM_TASK_REPAIR_INPUT(11, "修饰后入库任务"),
|
||||
TM_TASK_PART_LEASE(12, "配件领料任务"),
|
||||
TM_TASK_PART_TYPE(13, "配件新购"),
|
||||
TM_TASK_REPAIR_NUM(14, "数量维修人员信息附件");
|
||||
TM_TASK_REPAIR_NUM(14, "数量维修人员信息附件"),
|
||||
//盘点报废
|
||||
TM_TASK_PART_SCRAP(15, "盘点报废");
|
||||
|
||||
private final Integer taskTypeId;
|
||||
private final String taskTypeName;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,17 @@ public class MachineController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询在库机具编号
|
||||
*/
|
||||
@ApiOperation(value = "查询在库机具编号")
|
||||
//@RequiresPermissions("ma:machine:typeList")
|
||||
@GetMapping("/getMachineList")
|
||||
public AjaxResult getMachineList(Type type)
|
||||
{
|
||||
return machineService.getMachineList(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -98,4 +98,11 @@ public interface MachineMapper
|
|||
* @return 影响条数
|
||||
*/
|
||||
int updateStatus(@Param("maId") Long maId, @Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* 查询在库机具编号
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
List<Machine> getMachineList(Type type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public interface TypeMapper {
|
|||
// 查询物资类型的内部租赁价
|
||||
BigDecimal selectLeasePriceByTypeId(Long typeId);
|
||||
|
||||
List<Type> selectMaTypeList(String typeName);
|
||||
List<Type> selectMaTypeList(@Param("typeId") Long typeId,@Param("typeName") String typeName);
|
||||
|
||||
/**
|
||||
* 查询物资类型
|
||||
|
|
|
|||
|
|
@ -69,4 +69,11 @@ public interface IMachineService
|
|||
* @return
|
||||
*/
|
||||
AjaxResult selectByTypeList(Type type);
|
||||
|
||||
/**
|
||||
* 查询在库机具编号
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getMachineList(Type type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,4 +147,15 @@ public class MachineServiceImpl implements IMachineService
|
|||
List<Type> typeList = machineMapper.selectByTypeList(type);
|
||||
return AjaxResult.success(typeList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询在库机具编号
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getMachineList(Type type) {
|
||||
List<Machine> typeList = machineMapper.getMachineList(type);
|
||||
return AjaxResult.success(typeList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class TypeServiceImpl implements ITypeService {
|
|||
*/
|
||||
@Override
|
||||
public List<Type> getEquipmentType(Long typeId, String typeName) {
|
||||
List<Type> maTypes = typeMapper.selectMaTypeList("");
|
||||
List<Type> maTypes = typeMapper.selectMaTypeList(typeId, typeName);
|
||||
List<Type> list = new ArrayList<>();
|
||||
for (Type maType : maTypes) {
|
||||
if (maType.getParentId() == 0) {
|
||||
|
|
|
|||
|
|
@ -664,11 +664,12 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
for (final RepairAuditDetails details : repairAuditDetailsByQuery) {
|
||||
RepairAuditDetails dto = repairApplyDetailsMapper.selectById(details.getRepairId());
|
||||
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.selectScrapByTaskId(dto);
|
||||
//修改机具状态
|
||||
if (null != details.getMaId()) {
|
||||
repairAuditDetailsMapper.updateMachine(details);
|
||||
}
|
||||
if (details.getRepairedNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||
//修改机具状态为修试后待入库
|
||||
if (null != details.getMaId()) {
|
||||
details.setStatus(MaMachineStatusEnum.REPAIR_TO_STORE.getStatus().toString());
|
||||
repairAuditDetailsMapper.updateMachine(details);
|
||||
}
|
||||
final RepairInputDetails inputVo = new RepairInputDetails();
|
||||
BeanUtils.copyProperties(details, inputVo);
|
||||
inputVo.setRepairNum(details.getRepairedNum());
|
||||
|
|
@ -679,6 +680,11 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
inputList.add(inputVo);
|
||||
}
|
||||
if (details.getScrapNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||
//修改机具状态为报废待审核
|
||||
if (null != details.getMaId()) {
|
||||
details.setStatus(MaMachineStatusEnum.SCRAP_TO_AUDIT.getStatus().toString());
|
||||
repairAuditDetailsMapper.updateMachine(details);
|
||||
}
|
||||
ScrapApplyDetails bean = null;
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
bean = list.get(0);
|
||||
|
|
@ -689,7 +695,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
|
||||
scrapApplyDetails.setTaskId(newScrapTaskId);
|
||||
scrapApplyDetails.setTypeId(details.getTypeId());
|
||||
scrapApplyDetails.setMaId(details.getMaId());
|
||||
scrapApplyDetails.setMaId(details.getMaId() == null ? null : details.getMaId());
|
||||
scrapApplyDetails.setScrapNum(details.getScrapNum());
|
||||
scrapApplyDetails.setScrapSource("2");
|
||||
scrapApplyDetails.setStatus("0");
|
||||
|
|
|
|||
|
|
@ -509,11 +509,6 @@ public class RepairServiceImpl implements RepairService {
|
|||
if (CollectionUtil.isNotEmpty(repairDeviceVO.getNumberScrapRepairPartList())) {
|
||||
// 判断报废数量是否为空
|
||||
if (repairDeviceVO.getNumberScrapRepairPartList().get(0).getScrapNum() != null && repairDeviceVO.getNumberScrapRepairPartList().get(0).getScrapNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||
// 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量
|
||||
RepairTaskDetails details = repairMapper.getById(bean.getId());
|
||||
if (Objects.isNull(details)) {
|
||||
throw new ServiceException("此维修记录不存在,请检查后提交!");
|
||||
}
|
||||
// 分拆维修单, 准备数据
|
||||
scrapRepairNum = repairDeviceVO.getNumberScrapRepairPartList().get(0).getScrapNum();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,67 @@ public class ScrapApplyDetailsController extends BaseController {
|
|||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务列表
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询盘点报废任务列表")
|
||||
// @RequiresPermissions("scrap:details:list")
|
||||
@GetMapping("/inventoryList")
|
||||
public AjaxResult inventoryList(ScrapApplyDetails scrapApplyDetails) {
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<ScrapTaskListVo> list = scrapApplyDetailsService.selectInventoryList(scrapApplyDetails);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务详情
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询盘点报废任务详情")
|
||||
// @RequiresPermissions("scrap:details:list")
|
||||
@GetMapping("/getDetailsList")
|
||||
public AjaxResult getDetailsList(ScrapApplyDetails scrapApplyDetails) {
|
||||
ScrapApplyDetails details = scrapApplyDetailsService.getDetailsList(scrapApplyDetails);
|
||||
return AjaxResult.success(details);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增盘点报废")
|
||||
@PostMapping("/addList")
|
||||
public AjaxResult savePutInfo(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
||||
return scrapApplyDetailsService.savePutInfo(scrapApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改盘点报废")
|
||||
@PostMapping("/updateList")
|
||||
public AjaxResult updateList(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
||||
return scrapApplyDetailsService.updateList(scrapApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除盘点报废")
|
||||
@PostMapping("/delete")
|
||||
public AjaxResult delete(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
||||
return scrapApplyDetailsService.delete(scrapApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询报废台账任务列表
|
||||
* @param scrapApplyDetails
|
||||
|
|
@ -119,6 +180,17 @@ public class ScrapApplyDetailsController extends BaseController {
|
|||
return scrapApplyDetailsService.approve(scrapApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点报废审核通过
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "盘点报废审核通过")
|
||||
@PostMapping("/inventoryApprove")
|
||||
public AjaxResult inventoryApprove(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
||||
return scrapApplyDetailsService.inventoryApprove(scrapApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报废台账审核通过
|
||||
* @param scrapApplyDetails
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.material.scrap.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 盘点报废编码信息
|
||||
* @Author ma_sh
|
||||
* @create 2025/2/17 9:26
|
||||
*/
|
||||
@Data
|
||||
public class MaCodeInfo {
|
||||
|
||||
/** 规格ID */
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "机具ID")
|
||||
private Long maId;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
@ApiModelProperty(value = "库存数量")
|
||||
private BigDecimal storageNum;
|
||||
}
|
||||
|
|
@ -44,6 +44,9 @@ public class ScrapApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "报废任务一级详细列表")
|
||||
private List<ScrapTaskListVo> scrapTaskListVoList;
|
||||
|
||||
@ApiModelProperty(value = "盘点报废编码详情")
|
||||
private List<MaCodeInfo> maCodeList;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务ID")
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
|
|
@ -85,6 +88,12 @@ public class ScrapApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "机具ID")
|
||||
private Long maId;
|
||||
|
||||
@ApiModelProperty(value = "机具ID结果集")
|
||||
private String maIds;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
/** 规格ID */
|
||||
@Excel(name = "规格ID")
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
|
|
@ -125,6 +134,10 @@ public class ScrapApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "购置价")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
@Excel(name = "库存数量")
|
||||
@ApiModelProperty(value = "库存数量")
|
||||
private BigDecimal storageNum;
|
||||
|
||||
/** 报废数量 */
|
||||
@Excel(name = "报废数量")
|
||||
@ApiModelProperty(value = "报废数量")
|
||||
|
|
@ -185,6 +198,7 @@ public class ScrapApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "文件url")
|
||||
private String fileUrl;
|
||||
|
||||
@ApiModelProperty(value = "盘点报废文件结果集")
|
||||
private List<BmFileInfo> fileList;
|
||||
|
||||
/** 报废备注 */
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
|
|
@ -15,6 +16,12 @@ import java.util.Date;
|
|||
@Data
|
||||
public class ScrapTaskListVo {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private String ids;
|
||||
|
||||
@ApiModelProperty(value = "ids结果集")
|
||||
private List<Long> idList;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
private Long taskId;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ public class ScrapTotalListVo {
|
|||
@Excel(name = "报废类型")
|
||||
private String scrapStyle;
|
||||
|
||||
@ApiModelProperty(value = "(1退料2,维修审核,3盘点报废)")
|
||||
private String scrapSource;
|
||||
|
||||
/** (0自然,1人为) */
|
||||
@Excel(name = "损坏类型", readConverterExp = "0=自然损坏,1=人为损坏")
|
||||
private String scrapType;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.material.repair.domain.RepairRecord;
|
|||
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 报废任务详细Mapper接口
|
||||
|
|
@ -122,4 +123,47 @@ public interface ScrapApplyDetailsMapper {
|
|||
* @return
|
||||
*/
|
||||
int ledgerApprove(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务列表
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
List<ScrapTaskListVo> selectInventoryList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 根据年份和月份查询最大任务编号
|
||||
* @param year
|
||||
* @param month
|
||||
* @return
|
||||
*/
|
||||
int getMonthMaxOrderByDate(@Param("year") String year, @Param("month") String month);
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务详情
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
List<ScrapApplyDetails> getDetailsList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int delete(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 更新库存数量
|
||||
* @param applyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateStorageNum(ScrapApplyDetails applyDetails);
|
||||
|
||||
/**
|
||||
* 盘点报废审核通过
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateTaskStatus(ScrapApplyDetails scrapApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,4 +112,46 @@ public interface IScrapApplyDetailsService {
|
|||
* @return
|
||||
*/
|
||||
ScrapTotalListVo getTotalPrice(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务列表
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
List<ScrapTaskListVo> selectInventoryList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 新增盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult savePutInfo(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务详情
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
ScrapApplyDetails getDetailsList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 删除盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult delete(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 修改盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult updateList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 盘点报废审核通过
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult inventoryApprove(ScrapApplyDetails scrapApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.enums.*;
|
||||
|
|
@ -18,6 +19,9 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.mapper.TypeMapper;
|
||||
import com.bonus.material.scrap.domain.MaCodeInfo;
|
||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
|
|
@ -54,6 +58,9 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
|||
@Resource
|
||||
private BmFileInfoMapper fileInfoMapper;
|
||||
|
||||
@Resource
|
||||
private TypeMapper typeMapper;
|
||||
|
||||
/**
|
||||
* 查询报废任务详细
|
||||
*
|
||||
|
|
@ -353,7 +360,11 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
|||
.collect(Collectors.toList());
|
||||
applyDetails.setIdList(longList);
|
||||
applyDetails.setTaskIdList(longTaskList);
|
||||
applyDetails.setScrapStyle("维修报废");
|
||||
if ("2".equals(applyDetails.getScrapSource())) {
|
||||
applyDetails.setScrapStyle("维修报废");
|
||||
} else if ("3".equals(applyDetails.getScrapSource())) {
|
||||
applyDetails.setScrapStyle("盘点报废");
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
@ -408,27 +419,58 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
|||
scrapApplyDetails.setTaskId(taskId);
|
||||
List<ScrapApplyDetails> scrapApplyDetailsList = scrapApplyDetailsMapper.selectRepairQuestListByTaskId(scrapApplyDetails);
|
||||
scrapApplyDetails.setAgreementId(agreementId);
|
||||
// 维修报废标志
|
||||
boolean sourceWxFlag = false;
|
||||
if (CollectionUtils.isNotEmpty(scrapApplyDetailsList)) {
|
||||
if (ScrapSourceEnum.REPAIR_SCRAP.getStatus().equals(scrapApplyDetailsList.get(0).getScrapSource())) {
|
||||
sourceWxFlag = true;
|
||||
}
|
||||
}
|
||||
//插入任务表
|
||||
Long newTaskId = insertTt(taskId);
|
||||
result += insertTta(newTaskId, scrapApplyDetails);
|
||||
Long newTaskId = null;
|
||||
if (sourceWxFlag) {
|
||||
newTaskId = insertTt(taskId);
|
||||
result += insertTta(newTaskId, scrapApplyDetails);
|
||||
} else {
|
||||
newTaskId = insertScrapTt();
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(scrapApplyDetailsList)) {
|
||||
for (ScrapApplyDetails applyDetails : scrapApplyDetailsList) {
|
||||
if (idList.contains(applyDetails.getId())) {
|
||||
applyDetails.setLedgerStatus("2");
|
||||
applyDetails.setLedgerStatus(ScrapTaskStatusEnum.SCRAP_TASK_TO_REJECT.getStatus().toString());
|
||||
applyDetails.setLedgerBy(SecurityUtils.getUserId());
|
||||
applyDetails.setLedgerTime(DateUtils.getNowDate());
|
||||
applyDetails.setRejectReason(scrapApplyDetails.getRejectReason());
|
||||
result = scrapApplyDetailsMapper.ledgerApprove(applyDetails);
|
||||
if (applyDetails.getMaId() != null) {
|
||||
// 维修报废
|
||||
if (applyDetails.getMaId() != null && ScrapSourceEnum.REPAIR_SCRAP.getStatus().equals(applyDetails.getScrapSource())) {
|
||||
applyDetails.setStatus(MaMachineStatusEnum.BACK_REPAIR.getStatus().toString());
|
||||
result += scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
||||
// 盘点报废
|
||||
} else if (applyDetails.getMaId() != null && ScrapSourceEnum.INVENTORY_SCRAP.getStatus().equals(applyDetails.getScrapSource())){
|
||||
applyDetails.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
|
||||
result += scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
||||
}
|
||||
// 维修报废
|
||||
if (ScrapSourceEnum.REPAIR_SCRAP.getStatus().equals(applyDetails.getScrapSource())) {
|
||||
Long backId = scrapApplyDetailsMapper.selectBackIdByTaskId(applyDetails.getParentId());
|
||||
applyDetails.setCreateBy(SecurityUtils.getUsername());
|
||||
applyDetails.setCreateTime(DateUtils.getNowDate());
|
||||
applyDetails.setBackId(backId);
|
||||
applyDetails.setNewTaskId(newTaskId);
|
||||
result += insertWxTask(applyDetails);
|
||||
// 盘点报废
|
||||
} else if (ScrapSourceEnum.INVENTORY_SCRAP.getStatus().equals(applyDetails.getScrapSource())) {
|
||||
applyDetails.setTaskId(newTaskId);
|
||||
applyDetails.setStatus(ScrapTaskStatusEnum.SCRAP_TASK_TO_REJECT.getStatus().toString());
|
||||
applyDetails.setLedgerStatus(ScrapTaskStatusEnum.SCRAP_TASK_NO_FINISHED.getStatus().toString());
|
||||
applyDetails.setLedgerBy(null);
|
||||
applyDetails.setLedgerTime(null);
|
||||
applyDetails.setCreateBy(SecurityUtils.getUsername());
|
||||
applyDetails.setCreateTime(DateUtils.getNowDate());
|
||||
applyDetails.setRejectReason(null);
|
||||
result += scrapApplyDetailsMapper.insertScrapApplyDetails(applyDetails);
|
||||
}
|
||||
Long backId = scrapApplyDetailsMapper.selectBackIdByTaskId(applyDetails.getParentId());
|
||||
applyDetails.setCreateBy(SecurityUtils.getUsername());
|
||||
applyDetails.setCreateTime(DateUtils.getNowDate());
|
||||
applyDetails.setBackId(backId);
|
||||
applyDetails.setNewTaskId(newTaskId);
|
||||
result += insertWxTask(applyDetails);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -468,6 +510,319 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
|||
return scrapTotalListVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务列表
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ScrapTaskListVo> selectInventoryList(ScrapApplyDetails scrapApplyDetails) {
|
||||
try {
|
||||
List<ScrapTaskListVo> list = scrapApplyDetailsMapper.selectInventoryList(scrapApplyDetails);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (ScrapTaskListVo scrapTaskListVo : list) {
|
||||
List<String> asList = Arrays.asList(scrapTaskListVo.getIds().split(","));
|
||||
List<Long> longList = asList.stream()
|
||||
.map(Long::parseLong)
|
||||
.collect(Collectors.toList());
|
||||
scrapTaskListVo.setIdList(longList);
|
||||
}
|
||||
String keyWord = scrapApplyDetails.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(keyWord)) {
|
||||
list = list.stream()
|
||||
.filter(item -> containsScrapKeyword(item, keyWord))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error("查询失败", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult savePutInfo(ScrapApplyDetails scrapApplyDetails) {
|
||||
if (scrapApplyDetails == null || CollectionUtils.isEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
|
||||
return AjaxResult.error("报废详情数据为空!");
|
||||
}
|
||||
for (ScrapApplyDetails details : scrapApplyDetails.getScrapApplyDetailsList()) {
|
||||
if (CollectionUtils.isNotEmpty(details.getMaCodeList())) {
|
||||
details.setStorageNum(details.getMaCodeList().get(0).getStorageNum());
|
||||
details.setScrapNum(BigDecimal.valueOf(details.getMaCodeList().size()));
|
||||
}
|
||||
if (details.getScrapNum().compareTo(details.getStorageNum()) > 0) {
|
||||
return AjaxResult.error("报废数量不能大于库存数量!");
|
||||
}
|
||||
}
|
||||
try {
|
||||
int result = 0;
|
||||
Long newTaskId = insertScrapTt();
|
||||
result = getScrapResult(scrapApplyDetails, result, newTaskId);
|
||||
result = getFileResult(scrapApplyDetails, result, newTaskId);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("新增失败", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报废详情存储结果
|
||||
* @param scrapApplyDetails
|
||||
* @param result
|
||||
* @param newTaskId
|
||||
* @return
|
||||
*/
|
||||
private int getScrapResult(ScrapApplyDetails scrapApplyDetails, int result, Long newTaskId) {
|
||||
List<ScrapApplyDetails> detailsList = scrapApplyDetails.getScrapApplyDetailsList();
|
||||
for (ScrapApplyDetails applyDetails : detailsList) {
|
||||
applyDetails.setTaskId(newTaskId);
|
||||
applyDetails.setCreateBy(SecurityUtils.getUsername());
|
||||
applyDetails.setCreateTime(DateUtils.getNowDate());
|
||||
applyDetails.setScrapSource("3");
|
||||
if (CollectionUtils.isNotEmpty(applyDetails.getMaCodeList())) {
|
||||
for (MaCodeInfo maCodeInfo : applyDetails.getMaCodeList()) {
|
||||
applyDetails.setMaId(maCodeInfo.getMaId());
|
||||
applyDetails.setTypeId(maCodeInfo.getTypeId());
|
||||
applyDetails.setScrapNum(BigDecimal.ONE);
|
||||
applyDetails.setStatus(MaMachineStatusEnum.SCRAP_TO_AUDIT.getStatus().toString());
|
||||
// 更改设备状态
|
||||
result += scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
||||
}
|
||||
}
|
||||
applyDetails.setStatus("0");
|
||||
// 添加【报废详情表】
|
||||
result += scrapApplyDetailsMapper.insertScrapApplyDetails(applyDetails);
|
||||
// 更改设备库存
|
||||
if (CollectionUtils.isNotEmpty(applyDetails.getMaCodeList())) {
|
||||
applyDetails.setScrapNum(BigDecimal.valueOf(applyDetails.getMaCodeList().size()));
|
||||
}
|
||||
result += scrapApplyDetailsMapper.updateStorageNum(applyDetails);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件存储结果
|
||||
* @param scrapApplyDetails
|
||||
* @param result
|
||||
* @param newTaskId
|
||||
* @return
|
||||
*/
|
||||
private int getFileResult(ScrapApplyDetails scrapApplyDetails, int result, Long newTaskId) {
|
||||
if (CollectionUtils.isNotEmpty(scrapApplyDetails.getFileList())) {
|
||||
for (BmFileInfo fileInfo : scrapApplyDetails.getFileList()) {
|
||||
fileInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
fileInfo.setCreateTime(DateUtils.getNowDate());
|
||||
fileInfo.setFileType(6L);
|
||||
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId());
|
||||
fileInfo.setTaskId(newTaskId);
|
||||
result += fileInfoMapper.insertBmFileInfo(fileInfo);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入任务表
|
||||
* @return
|
||||
*/
|
||||
private Long insertScrapTt() {
|
||||
Long newTask = null;
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId());
|
||||
// 生成盘点报废单号
|
||||
String code = genderBfTaskCode(thisMonthMaxOrder);
|
||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PART_SCRAP.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 scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ScrapApplyDetails getDetailsList(ScrapApplyDetails scrapApplyDetails) {
|
||||
try {
|
||||
ScrapApplyDetails details = new ScrapApplyDetails();
|
||||
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.getDetailsList(scrapApplyDetails);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (ScrapApplyDetails applyDetails : list) {
|
||||
List<Type> maTypes = typeMapper.selectMaTypeList(applyDetails.getTypeId(), " ");
|
||||
if (CollectionUtils.isNotEmpty(maTypes)) {
|
||||
applyDetails.setStorageNum(maTypes.get(0).getStorageNum());
|
||||
}
|
||||
}
|
||||
// 查询文件信息
|
||||
BmFileInfo fileInfo = new BmFileInfo();
|
||||
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId());
|
||||
fileInfo.setFileType(6L);
|
||||
fileInfo.setTaskId(scrapApplyDetails.getTaskId());
|
||||
List<BmFileInfo> bmFileInfos = fileInfoMapper.selectBmFileInfoList(fileInfo);
|
||||
if (CollectionUtils.isNotEmpty(bmFileInfos)) {
|
||||
details.setFileList(bmFileInfos);
|
||||
}
|
||||
details.setScrapApplyDetailsList(list);
|
||||
}
|
||||
return details;
|
||||
} catch (Exception e) {
|
||||
log.error("查询失败", e);
|
||||
throw new RuntimeException("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult delete(ScrapApplyDetails scrapApplyDetails) {
|
||||
try {
|
||||
int result = scrapApplyDetailsMapper.delete(scrapApplyDetails);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
} catch (Exception e) {
|
||||
log.error("删除失败", e);
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult updateList(ScrapApplyDetails scrapApplyDetails) {
|
||||
if (scrapApplyDetails == null || CollectionUtils.isEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
|
||||
return AjaxResult.error("报废详情数据为空!");
|
||||
}
|
||||
for (ScrapApplyDetails details : scrapApplyDetails.getScrapApplyDetailsList()) {
|
||||
if (CollectionUtils.isNotEmpty(details.getMaCodeList())) {
|
||||
details.setStorageNum(details.getMaCodeList().get(0).getStorageNum());
|
||||
details.setScrapNum(BigDecimal.valueOf(details.getMaCodeList().size()));
|
||||
}
|
||||
if (details.getScrapNum().compareTo(details.getStorageNum()) > 0) {
|
||||
return AjaxResult.error("报废数量不能大于库存数量!");
|
||||
}
|
||||
}
|
||||
try {
|
||||
int result = 0;
|
||||
// 先根据taskId进行查询
|
||||
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.getDetailsList(scrapApplyDetails);
|
||||
// 先根据taskId进行删除,然后再走新增
|
||||
result += scrapApplyDetailsMapper.delete(scrapApplyDetails);
|
||||
// 恢复设备库存及设备状态
|
||||
for (ScrapApplyDetails details : list) {
|
||||
result += scrapApplyDetailsMapper.updateStorageNum(details);
|
||||
if (StringUtils.isNotBlank(details.getMaIds())) {
|
||||
String[] maIds = details.getMaIds().split(",");
|
||||
// 转换为long类型
|
||||
for (String maId : maIds) {
|
||||
Long maIdLong = Long.parseLong(maId);
|
||||
// 更新设备状态
|
||||
ScrapApplyDetails applyDetails = new ScrapApplyDetails();
|
||||
applyDetails.setMaId(maIdLong);
|
||||
applyDetails.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
|
||||
scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除文件信息
|
||||
if (result > 0) {
|
||||
BmFileInfo fileInfo = new BmFileInfo();
|
||||
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId());
|
||||
fileInfo.setFileType(6L);
|
||||
fileInfo.setTaskId(scrapApplyDetails.getTaskId());
|
||||
fileInfoMapper.deleteBmFileInfoByBizInfo(fileInfo);
|
||||
}
|
||||
result = getScrapResult(scrapApplyDetails, result, scrapApplyDetails.getTaskId());
|
||||
result = getFileResult(scrapApplyDetails, result, scrapApplyDetails.getTaskId());
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("新增失败", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点报废审核通过
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult inventoryApprove(ScrapApplyDetails scrapApplyDetails) {
|
||||
if (CollectionUtil.isEmpty(scrapApplyDetails.getTaskIdList())) {
|
||||
return AjaxResult.error("请选择要审核的报废单");
|
||||
}
|
||||
int result = 0;
|
||||
try {
|
||||
for (Long taskId : scrapApplyDetails.getTaskIdList()) {
|
||||
scrapApplyDetails.setTaskId(taskId);
|
||||
result += scrapApplyDetailsMapper.updateTaskStatus(scrapApplyDetails);
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("审核成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("审核失败", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成报废单号
|
||||
* @param thisMonthMaxOrder
|
||||
* @return
|
||||
*/
|
||||
private String genderBfTaskCode(int thisMonthMaxOrder) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
return MaterialConstants.PD_SCRAP_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断关键字是否包含
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
private boolean containsScrapKeyword(ScrapTaskListVo item, String keyWord) {
|
||||
return (item.getType() != null && item.getType().contains(keyWord)) ||
|
||||
(item.getScrapCode() != null && item.getScrapCode().contains(keyWord)) ||
|
||||
(item.getCreateName() != null && item.getCreateName().contains(keyWord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增维修单
|
||||
* @param applyDetails
|
||||
|
|
|
|||
|
|
@ -392,6 +392,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getMachineList" resultType="com.bonus.material.ma.domain.Machine">
|
||||
SELECT
|
||||
mt1.type_name as materialName,
|
||||
mt.type_name as materialModel,
|
||||
mt.type_id as typeId,
|
||||
mm.ma_id as maId,
|
||||
mm.ma_code as maCode
|
||||
FROM
|
||||
ma_machine mm
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
WHERE
|
||||
mt.type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteMachineByMaCodeAndTypeId">
|
||||
delete from ma_machine where ma_code = #{maCode} and type_id = #{typeId}
|
||||
and ma_status = '0'
|
||||
|
|
|
|||
|
|
@ -519,6 +519,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeName != null and typeName !=''">
|
||||
AND m.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeId != null and typeId !=''">
|
||||
AND m.type_id = #{typeId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<update id="updateMachine">
|
||||
UPDATE ma_machine SET ma_status = 5 WHERE ma_id = #{maId}
|
||||
UPDATE ma_machine SET ma_status = #{status} WHERE ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<select id="getPartDetailsByTaskId" resultType="com.bonus.material.repair.domain.RepairPart">
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_user su1 on sad.audit_by = su1.user_id
|
||||
left join repair_audit_details rad ON sad.parent_id = rad.id
|
||||
left join tm_task tt2 ON tt2.task_id = rad.task_id
|
||||
<where>
|
||||
where
|
||||
sad.scrap_source = '2'
|
||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 0">
|
||||
and tt.task_status = #{appTaskStatus}
|
||||
|
|
@ -74,7 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( sad.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY sad.task_id,bui.unit_name,bpi.pro_name
|
||||
order by tt.create_time desc
|
||||
</select>
|
||||
|
|
@ -158,6 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="companyId != null">company_id,</if>
|
||||
<if test="fileName != null">file_name,</if>
|
||||
<if test="fileUrl != null">file_url,</if>
|
||||
<if test="scrapReason != null and scrapReason != ''">scrap_reason,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
|
|
@ -179,6 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="fileName != null">#{fileName},</if>
|
||||
<if test="fileUrl != null">#{fileUrl},</if>
|
||||
<if test="scrapReason != null and scrapReason != ''">#{scrapReason},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -291,6 +293,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStorageNum">
|
||||
update ma_type
|
||||
set storage_num = storage_num - IFNULL(#{scrapNum}, 0)
|
||||
where type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateTaskStatus">
|
||||
update scrap_apply_details
|
||||
set status = #{status}
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScrapApplyDetailsById" parameterType="Long">
|
||||
delete from scrap_apply_details where id = #{id}
|
||||
</delete>
|
||||
|
|
@ -302,6 +316,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="delete">
|
||||
delete from scrap_apply_details where task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
<select id="getByRepairId" resultType="com.bonus.material.repair.domain.RepairAuditDetails">
|
||||
select task_id as taskId,
|
||||
ma_id as maId,
|
||||
|
|
@ -370,7 +388,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sad.scrap_type AS scrapType,
|
||||
GROUP_CONCAT( DISTINCT sad.create_by ) AS createName,
|
||||
DATE_FORMAT( sad.create_time, '%Y-%m' ) AS month,
|
||||
sad.ledger_status AS ledgerStatus
|
||||
sad.ledger_status AS ledgerStatus,
|
||||
sad.scrap_source AS scrapSource
|
||||
FROM
|
||||
scrap_apply_details sad
|
||||
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
|
||||
|
|
@ -393,7 +412,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sad.scrap_type,
|
||||
DATE_FORMAT(
|
||||
sad.create_time,
|
||||
'%Y-%m')
|
||||
'%Y-%m'),
|
||||
sad.scrap_source
|
||||
</select>
|
||||
|
||||
<select id="selectInventoryList" resultType="com.bonus.material.scrap.domain.vo.ScrapTaskListVo">
|
||||
SELECT
|
||||
GROUP_CONCAT( sad.id ) AS ids,
|
||||
tt.code AS scrapCode,
|
||||
GROUP_CONCAT( DISTINCT mt2.type_name ) AS type,
|
||||
sad.create_by AS createName,
|
||||
sad.create_time AS createTime,
|
||||
sad.`status` AS status
|
||||
FROM
|
||||
scrap_apply_details sad
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN tm_task tt on sad.task_id = tt.task_id
|
||||
AND tt.task_type = 15
|
||||
where sad.scrap_source = '3'
|
||||
<if test="status != null "> and sad.`status` = #{status}</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( sad.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
GROUP BY sad.task_id
|
||||
ORDER BY sad.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getMonthMaxOrderByDate" resultType="java.lang.Integer">
|
||||
select
|
||||
COALESCE(max(month_order), 0) from scrap_apply_details
|
||||
where
|
||||
month(create_time) = #{month} and year(create_time) = #{year}
|
||||
</select>
|
||||
|
||||
<select id="getDetailsList" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails">
|
||||
SELECT
|
||||
sad.CODE AS code,
|
||||
sad.task_id AS taskId,
|
||||
mt.type_id AS typeId,
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.unit_name AS unitName,
|
||||
SUM(sad.scrap_num) AS scrapNum,
|
||||
GROUP_CONCAT( DISTINCT sad.ma_id ) AS maIds,
|
||||
GROUP_CONCAT( DISTINCT mm.ma_code ) AS maCode,
|
||||
mt.manage_type AS manageType,
|
||||
sad.scrap_reason AS scrapReason
|
||||
FROM
|
||||
scrap_apply_details sad
|
||||
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON sad.ma_id = mm.ma_id
|
||||
where
|
||||
sad.task_id = #{taskId}
|
||||
GROUP BY
|
||||
sad.type_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue