盘点报废
This commit is contained in:
parent
3475e6418c
commit
34a13018d8
|
|
@ -29,7 +29,10 @@ public class MaMachine extends BaseEntity {
|
|||
* 类型ID
|
||||
*/
|
||||
@ApiModelProperty(value = "类型ID")
|
||||
private long typeId;
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
/**
|
||||
* 类型ID
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -172,4 +172,7 @@ public class Constants
|
|||
public static final String INNER_PROTOCAL = "1"; //内部单位协议
|
||||
|
||||
public static final String OUTER_PROTOCAL = "2"; //外部单位协议
|
||||
|
||||
/** 盘点报废单号的开头字母 */
|
||||
public static final String PD_SCRAP_TASK_TYPE_LABEL = "PDB";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.sgzb.common.core.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2025/2/27 9:32
|
||||
*/
|
||||
@Getter
|
||||
public enum MaMachineStatusEnum {
|
||||
NEW_PURCHASE(14, "新购待入库"),
|
||||
IN_STORE(15, "在库"),
|
||||
IN_USE(16, "在用"),
|
||||
BACK_REPAIR(17, "退料检修"),
|
||||
REPAIR_TO_AUDIT(18, "检修待审核"),
|
||||
REPAIR_TO_STORE(19, "修试后待入库"),
|
||||
BACK_TO_SCRAP(20, "退料待报废"),
|
||||
REPAIR_TO_SCRAP(21, "维修待报废"),
|
||||
SCRAP_AUDIT(22, "已报废审核"),
|
||||
BACK_TO_STORE(84, "退料待入库"),
|
||||
SCRAP_TO_AUDIT(142, "报废待审核");
|
||||
|
||||
private final Integer status;
|
||||
private final String statusName;
|
||||
|
||||
MaMachineStatusEnum(Integer status, String statusName) {
|
||||
this.status = status;
|
||||
this.statusName = statusName;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,10 @@ public enum TaskTypeEnum {
|
|||
/**
|
||||
* 报废任务
|
||||
*/
|
||||
SCRAP_TASK(57, "报废任务");
|
||||
SCRAP_TASK(57, "报废任务"),
|
||||
|
||||
//盘点报废
|
||||
TM_TASK_PART_SCRAP(141, "盘点报废");
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.bonus.sgzb.common.core.utils;
|
|||
public enum HttpCodeEnum {
|
||||
// 成功
|
||||
SUCCESS(200, "操作成功"),
|
||||
//失败
|
||||
FAIL(400, "操作失败,请联系管理员"),
|
||||
// 登录
|
||||
NEED_LOGIN(401, "需要登录后操作"),
|
||||
NO_OPERATOR_AUTH(403, "无权限操作"),
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import com.bonus.sgzb.common.log.annotation.Log;
|
|||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||
import com.bonus.sgzb.common.security.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.sgzb.material.service.BackApplyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -34,6 +36,9 @@ public class BackReceiveController extends BaseController {
|
|||
@Resource
|
||||
private BackReceiveService backReceiveService;
|
||||
|
||||
@Resource
|
||||
private BackApplyService backApplyService;
|
||||
|
||||
/**
|
||||
* 退料接收列表
|
||||
*
|
||||
|
|
@ -58,6 +63,17 @@ public class BackReceiveController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改退料申请
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "修改退料申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/updateBackApply")
|
||||
public AjaxResult updateBackApply(@RequestBody BackApplyInfo bean) {
|
||||
return backApplyService.updateBackApply(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退料接收明细
|
||||
* @param record
|
||||
|
|
|
|||
|
|
@ -39,6 +39,18 @@ public class MaMachineController extends BaseController {
|
|||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 查询在库机具编号,存在数据拼接,盘点报废专用
|
||||
* @param maMachine
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询在库机具编号")
|
||||
@GetMapping("/getMachineList")
|
||||
public AjaxResult getMachineList(MaMachine maMachine)
|
||||
{
|
||||
return maMachineService.getMachineList(maMachine);
|
||||
}
|
||||
|
||||
@Log(title = "根据二维码查询机具设备", businessType = BusinessType.QUERY)
|
||||
@GetMapping("/getMachineByQrCode")
|
||||
public AjaxResult getMachineByQrCode(MaMachine maMachine) {
|
||||
|
|
|
|||
|
|
@ -55,4 +55,11 @@ public interface MaMachineMapper {
|
|||
Integer updateItemStatus(DataReceiveDetail dataReceiveDetail);
|
||||
|
||||
int delMachineByRfid(MaMachine machine);
|
||||
|
||||
/**
|
||||
* 查询机具列表
|
||||
* @param maMachine
|
||||
* @return
|
||||
*/
|
||||
List<MaMachine> getMachineList(MaMachine maMachine);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,4 +25,11 @@ public interface MaMachineService {
|
|||
MaMachine getMachineByQrCode(MaMachine maMachine);
|
||||
|
||||
AjaxResult pushNotifications(List<MaMachine> maMachineList);
|
||||
|
||||
/**
|
||||
* todo 查询在库机具编号,存在数据拼接,盘点报废专用
|
||||
* @param maMachine
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getMachineList(MaMachine maMachine);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.base.service.impl;
|
|||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.sgzb.base.api.domain.MaLabelBind;
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.base.api.domain.MaType;
|
||||
|
|
@ -15,9 +16,12 @@ import com.bonus.sgzb.common.core.constant.Constants;
|
|||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
||||
import com.bonus.sgzb.common.core.utils.RsaUtil;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
|
||||
import com.bonus.sgzb.material.exception.ExceptionDict;
|
||||
import com.bonus.sgzb.material.mapper.ScrapApplyDetailsMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -49,6 +53,9 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
@Resource
|
||||
private BaseIotMachineMapper baseIotMachineMapper;
|
||||
|
||||
@Resource
|
||||
private ScrapApplyDetailsMapper scrapApplyDetailsMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MaMachine> getMaMachine(MaMachine maMachine) {
|
||||
|
|
@ -227,6 +234,37 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
return AjaxResult.success("请求成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 查询在库机具编号,存在数据拼接,盘点报废专用
|
||||
* @param maMachine
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getMachineList(MaMachine maMachine) {
|
||||
List<MaMachine> typeList = maMachineMapper.getMachineList(maMachine);
|
||||
if (maMachine.getTaskId() != null && maMachine.getTypeId() != null) {
|
||||
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
|
||||
scrapApplyDetails.setTaskId(maMachine.getTaskId());
|
||||
scrapApplyDetails.setTypeId(maMachine.getTypeId());
|
||||
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.getDetailsList(scrapApplyDetails);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (ScrapApplyDetails details : list) {
|
||||
if (StringUtils.isNotBlank(details.getMaIds())) {
|
||||
String[] maIds = details.getMaIds().split(",");
|
||||
for (String maId : maIds) {
|
||||
MaMachine machine = new MaMachine();
|
||||
MaMachine machineVo = maMachineMapper.selectMaMachineByMaId(Long.parseLong(maId));
|
||||
machine.setMaId(machineVo.getMaId());
|
||||
machine.setMaCode(machineVo.getMaCode());
|
||||
typeList.add(machine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(typeList);
|
||||
}
|
||||
|
||||
private void resultDataHandler(String data) throws Exception {
|
||||
JSONObject object = JSONObject.parseObject(data);
|
||||
System.err.println(data);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class MaReceiveServiceImpl implements MaReceiveService {
|
|||
MaMachine maMachine = new MaMachine();
|
||||
maMachine.setMaCode(FieldGenerator.generateField());
|
||||
// maMachine.setTypeId(dataReceiveDetail.getTypeId());
|
||||
maMachine.setTypeId(1763);
|
||||
maMachine.setTypeId(1763L);
|
||||
maMachine.setMaStatus("15");
|
||||
maMachine.setCreateTime(new Date());
|
||||
maMachine.setSouceBy(2);
|
||||
|
|
|
|||
|
|
@ -7,12 +7,16 @@ import java.util.stream.Collectors;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.bonus.sgzb.common.core.enums.ScrapSourceEnum;
|
||||
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
|
||||
import com.bonus.sgzb.common.core.utils.ServletUtils;
|
||||
import com.bonus.sgzb.material.domain.*;
|
||||
import com.bonus.sgzb.material.service.IScrapApplyDetailsService;
|
||||
import com.bonus.sgzb.material.vo.ForecastWasteExcel;
|
||||
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
|
||||
import com.bonus.sgzb.material.vo.ScrapAudit;
|
||||
import com.bonus.sgzb.material.vo.ScrapTaskListVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -266,4 +270,76 @@ public class ScrapApplyDetailsController extends BaseController
|
|||
util.exportExcel(response, ForecastWasteExcelList, "预报废审核列表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务列表
|
||||
* @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
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "盘点报废审核")
|
||||
@PostMapping("/inventoryApprove")
|
||||
public AjaxResult inventoryApprove(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
||||
return scrapApplyDetailsService.inventoryApprove(scrapApplyDetails);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author bns
|
||||
*/
|
||||
@Data
|
||||
public class FileInfo {
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 模块id */
|
||||
private Long modelId;
|
||||
|
||||
/** 文件名称 */
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String name;
|
||||
|
||||
/** 文件路径 */
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
private String url;
|
||||
|
||||
/** 数据字典 */
|
||||
@ApiModelProperty(value = "数据字典")
|
||||
private Long dicId;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String size;
|
||||
private String type;
|
||||
private int words;
|
||||
private String creator;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.sgzb.material.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;
|
||||
}
|
||||
|
|
@ -27,6 +27,16 @@ public class ScrapApplyDetails extends BaseEntity
|
|||
@ApiModelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "库存数量")
|
||||
@ApiModelProperty(value = "库存数量")
|
||||
private BigDecimal storageNum;
|
||||
|
||||
@ApiModelProperty(value = "盘点报废编码详情")
|
||||
private List<MaCodeInfo> maCodeList;
|
||||
|
||||
@ApiModelProperty(value = "盘点报废文件结果集")
|
||||
private List<FileInfo> fileList;
|
||||
|
||||
/** 任务ID */
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
|
@ -94,6 +104,18 @@ public class ScrapApplyDetails extends BaseEntity
|
|||
private String maCode;
|
||||
private String buyPrice;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "机具ID结果集")
|
||||
private String maIds;
|
||||
|
||||
@ApiModelProperty(value = "管理方式")
|
||||
private String manageType;
|
||||
|
||||
@ApiModelProperty(value = "报废原因")
|
||||
private String scrapReason;
|
||||
|
||||
/**
|
||||
* 传入参数
|
||||
*/
|
||||
|
|
@ -116,49 +138,64 @@ public class ScrapApplyDetails extends BaseEntity
|
|||
@ApiModelProperty(value = "任务ID集合")
|
||||
private String taskIdList;
|
||||
|
||||
@ApiModelProperty(value = "任务id结果集")
|
||||
private List<Long> idList;
|
||||
|
||||
public void setId(Long id)
|
||||
@ApiModelProperty(value = "报废任务二级详细列表")
|
||||
private List<ScrapApplyDetails> scrapApplyDetailsList;
|
||||
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private Byte taskStatus;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setTaskId(Long taskId)
|
||||
public void setTaskId(Long taskId)
|
||||
{
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Long getTaskId()
|
||||
public Long getTaskId()
|
||||
{
|
||||
return taskId;
|
||||
}
|
||||
public void setParentId(Long parentId)
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
public void setMaId(Long maId)
|
||||
public void setMaId(Long maId)
|
||||
{
|
||||
this.maId = maId;
|
||||
}
|
||||
|
||||
public Long getMaId()
|
||||
public Long getMaId()
|
||||
{
|
||||
return maId;
|
||||
}
|
||||
public void setTypeId(Long typeId)
|
||||
public void setTypeId(Long typeId)
|
||||
{
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public Long getTypeId()
|
||||
public Long getTypeId()
|
||||
{
|
||||
return typeId;
|
||||
}
|
||||
|
|
@ -171,84 +208,84 @@ public class ScrapApplyDetails extends BaseEntity
|
|||
{
|
||||
return scrapNum;
|
||||
}
|
||||
public void setScrapSource(String scrapSource)
|
||||
public void setScrapSource(String scrapSource)
|
||||
{
|
||||
this.scrapSource = scrapSource;
|
||||
}
|
||||
|
||||
public String getScrapSource()
|
||||
public String getScrapSource()
|
||||
{
|
||||
return scrapSource;
|
||||
}
|
||||
public void setScrapType(String scrapType)
|
||||
public void setScrapType(String scrapType)
|
||||
{
|
||||
this.scrapType = scrapType;
|
||||
}
|
||||
|
||||
public String getScrapType()
|
||||
public String getScrapType()
|
||||
{
|
||||
return scrapType;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setAuditBy(Long auditBy)
|
||||
public void setAuditBy(Long auditBy)
|
||||
{
|
||||
this.auditBy = auditBy;
|
||||
}
|
||||
|
||||
public Long getAuditBy()
|
||||
public Long getAuditBy()
|
||||
{
|
||||
return auditBy;
|
||||
}
|
||||
public void setAuditTime(Date auditTime)
|
||||
public void setAuditTime(Date auditTime)
|
||||
{
|
||||
this.auditTime = auditTime;
|
||||
}
|
||||
|
||||
public Date getAuditTime()
|
||||
public Date getAuditTime()
|
||||
{
|
||||
return auditTime;
|
||||
}
|
||||
public void setAuditRemark(String auditRemark)
|
||||
public void setAuditRemark(String auditRemark)
|
||||
{
|
||||
this.auditRemark = auditRemark;
|
||||
}
|
||||
|
||||
public String getAuditRemark()
|
||||
public String getAuditRemark()
|
||||
{
|
||||
return auditRemark;
|
||||
}
|
||||
public void setFileUrl(String fileUrl)
|
||||
public void setFileUrl(String fileUrl)
|
||||
{
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
|
||||
public String getFileUrl()
|
||||
public String getFileUrl()
|
||||
{
|
||||
return fileUrl;
|
||||
}
|
||||
public void setCompanyId(Long companyId)
|
||||
public void setCompanyId(Long companyId)
|
||||
{
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public Long getCompanyId()
|
||||
public Long getCompanyId()
|
||||
{
|
||||
return companyId;
|
||||
}
|
||||
public void setFileName(String fileName)
|
||||
public void setFileName(String fileName)
|
||||
{
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName()
|
||||
public String getFileName()
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,4 +249,14 @@ public class TmTask implements Serializable {
|
|||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
public TmTask(Long taskId, Integer taskType, Integer taskStatus, Integer companyId, String code) {
|
||||
this.taskId = taskId;
|
||||
this.taskType = taskType;
|
||||
this.taskStatus = taskStatus;
|
||||
this.companyId = companyId;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public TmTask() {}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
package com.bonus.sgzb.material.domain.vo;
|
||||
|
||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物资类型对象 ma_type
|
||||
* @author syruan
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@ToString
|
||||
public class Type extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 类型ID */
|
||||
@ApiModelProperty(value = "类型ID")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
/** 类型名称 */
|
||||
@Excel(name = "规格型号", sort = 5)
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
/** 库管员昵称 */
|
||||
@ApiModelProperty(value = "库管员昵称")
|
||||
@Excel(name = "库管员昵称")
|
||||
private String keeperNickName;
|
||||
|
||||
/** 库管员昵称 */
|
||||
@ApiModelProperty(value = "库管员昵称id")
|
||||
@Excel(name = "库管员昵称id")
|
||||
private String keeperId;
|
||||
|
||||
/** 左侧树用户id */
|
||||
@Excel(name = "库管员昵称id")
|
||||
@ApiModelProperty(value = "左侧树用户id")
|
||||
private List<String> keeperArr;
|
||||
|
||||
/** 维修员昵称 */
|
||||
@ApiModelProperty(value = "维修员昵称")
|
||||
@Excel(name = "维修员昵称")
|
||||
private String repairNickName;
|
||||
|
||||
/** 维修员昵称 */
|
||||
@ApiModelProperty(value = "维修员昵称id")
|
||||
@Excel(name = "维修员昵称id")
|
||||
private String repairerId;
|
||||
private List<String> repairerArr;
|
||||
/** 仓库名称 */
|
||||
@ApiModelProperty(value = "物资仓库名称")
|
||||
@Excel(name = "物资仓库名称", sort = 6)
|
||||
private String houseName;
|
||||
|
||||
/** 仓库Id */
|
||||
@ApiModelProperty(value = "物资仓库Id")
|
||||
private Long houseId;
|
||||
|
||||
/** 上级ID */
|
||||
@ApiModelProperty(value = "上级ID")
|
||||
private Long parentId;
|
||||
|
||||
/** 实时库存 */
|
||||
@Excel(name = "实时库存")
|
||||
@ApiModelProperty(value = "实时库存")
|
||||
private BigDecimal storageNum;
|
||||
|
||||
/** 是否扣费 */
|
||||
@ApiModelProperty(value = "是否扣费,0:扣费, 1:不扣费")
|
||||
private Byte isCharging = 1;
|
||||
|
||||
@ApiModelProperty(value = "是否试验,0:未试验, 1:已试验")
|
||||
private Byte isTest = 0;
|
||||
|
||||
/** 检验周期 */
|
||||
@ApiModelProperty(value = "检验周期,单位:月")
|
||||
private Integer testCycle = 0;
|
||||
|
||||
/** 类型编号 */
|
||||
@ApiModelProperty(value = "类型编号")
|
||||
private String typeCode;
|
||||
|
||||
/** 规格编号 */
|
||||
@ApiModelProperty(value = "规格编号")
|
||||
private String modelCode;
|
||||
|
||||
/** 计量单位ID */
|
||||
@ApiModelProperty(value = "计量单位ID")
|
||||
private Long unitId;
|
||||
|
||||
/** 计量单位名称 */
|
||||
@ApiModelProperty(value = "计量单位名称")
|
||||
@Excel(name = "计量单位")
|
||||
private String unitName;
|
||||
|
||||
/** 计量单位名称值0整型1小数 */
|
||||
@ApiModelProperty(value = "计量单位名称0整型1小数")
|
||||
@Excel(name = "计量单位0整型1小数")
|
||||
private String unitValue;
|
||||
|
||||
/** 排序 */
|
||||
@ApiModelProperty(value = "排序")
|
||||
@Excel(name = "排序")
|
||||
private int sortNum;
|
||||
|
||||
@ApiModelProperty(value = "最大排序,用于Tree排序")
|
||||
private transient int maxSortPriority;
|
||||
|
||||
/** 管理方式(0编号 1计数) */
|
||||
@Excel(name = "管理方式(0编号 1计数)", readConverterExp = "0=编号,1=计数")
|
||||
@ApiModelProperty(value = "管理方式(0编号 1计数)")
|
||||
private String manageType;
|
||||
|
||||
/** 内部租赁单价 */
|
||||
@Excel(name = "内部租赁单价")
|
||||
@ApiModelProperty(value = "内部租赁单价")
|
||||
private BigDecimal leasePrice;
|
||||
|
||||
@ApiModelProperty(value = "是否更新租赁价格")
|
||||
private Boolean isUpdateLeasePrice;
|
||||
|
||||
/** 租赁费用生效时间 */
|
||||
@ApiModelProperty(value = "租赁费用生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "租赁费用生效时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date effTime;
|
||||
|
||||
/** 外部租赁单价 */
|
||||
@Excel(name = "外部租赁单价")
|
||||
@ApiModelProperty(value = "外部租赁单价")
|
||||
private BigDecimal rentPrice;
|
||||
|
||||
/** 采购价原值 */
|
||||
@Excel(name = "采购价原值")
|
||||
@ApiModelProperty(value = "采购价原值")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
/** 丢失赔偿比率 */
|
||||
@Excel(name = "丢失赔偿比率")
|
||||
@ApiModelProperty(value = "丢失赔偿比率")
|
||||
private BigDecimal payRatio;
|
||||
|
||||
/** 丢失赔偿价 */
|
||||
@ApiModelProperty(value = "丢失赔偿价")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ApiModelProperty(value = "???价")
|
||||
private BigDecimal finalPrice;
|
||||
|
||||
/** 税率 */
|
||||
@ApiModelProperty(value = "税率")
|
||||
private BigDecimal taxRatio;
|
||||
|
||||
/** 层级 */
|
||||
@ApiModelProperty(value = "层级")
|
||||
private String level;
|
||||
|
||||
/** 额定载荷 */
|
||||
@Excel(name = "额定载荷")
|
||||
@ApiModelProperty(value = "额定载荷")
|
||||
private String ratedLoad;
|
||||
|
||||
/** 试验载荷 */
|
||||
@Excel(name = "试验载荷")
|
||||
@ApiModelProperty(value = "试验载荷")
|
||||
private String testLoad;
|
||||
|
||||
/** 持荷时间 */
|
||||
@ApiModelProperty(value = "持荷时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "持荷时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private String holdingTime;
|
||||
|
||||
/** 库存预警数量 */
|
||||
@Excel(name = "库存预警数量")
|
||||
@ApiModelProperty(value = "库存预警数量")
|
||||
private Long warnNum;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 是否计划管理(0代表否 1代表是) */
|
||||
@Excel(name = "是否计划管理", readConverterExp = "0=代表否,1=代表是")
|
||||
private String isPlan;
|
||||
|
||||
/** 是否安措费机具(0代表否1代表是) */
|
||||
@Excel(name = "是否安措费机具", readConverterExp = "0=代表否1代表是")
|
||||
private String isAncuo;
|
||||
|
||||
/** 厂家规格型号 */
|
||||
@Excel(name = "厂家规格型号")
|
||||
@ApiModelProperty(value = "厂家规格型号")
|
||||
private String facModel;
|
||||
|
||||
/** 左侧树用户id */
|
||||
@Excel(name = "左侧树用户id")
|
||||
@ApiModelProperty(value = "左侧树用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "组织id")
|
||||
private Long companyId;
|
||||
|
||||
/** 推送智慧工程定义的门类分类机具编码 */
|
||||
@Excel(name = "推送智慧工程定义的门类分类机具编码")
|
||||
@ApiModelProperty(value = "推送智慧工程定义的门类分类机具编码")
|
||||
private String intelligentCode;
|
||||
|
||||
private String keyword;
|
||||
|
||||
private String maTypeName;
|
||||
|
||||
/** 子节点 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<Type> children = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
package com.bonus.sgzb.material.mapper;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.BackApplyInfo;
|
||||
import com.bonus.sgzb.material.domain.FileInfo;
|
||||
import com.bonus.sgzb.material.domain.RepairAuditDetails;
|
||||
import com.bonus.sgzb.material.domain.RepairRecord;
|
||||
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
|
||||
import com.bonus.sgzb.material.domain.vo.Type;
|
||||
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
|
||||
import com.bonus.sgzb.material.vo.ScrapTaskListVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -168,4 +171,80 @@ public interface ScrapApplyDetailsMapper
|
|||
List<ScrapApplyDetailsVO> getScrapApplyList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
List<ScrapApplyDetailsVO> scrapTaskReviewList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询报废申请详情列表
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
List<ScrapApplyDetails> getDetailsList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务列表
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
List<ScrapTaskListVo> selectInventoryList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询机型列表
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
List<Type> selectMaTypeList(Long typeId);
|
||||
|
||||
/**
|
||||
* 修改机型状态
|
||||
* @param applyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateMaStatus(ScrapApplyDetails applyDetails);
|
||||
|
||||
/**
|
||||
* 修改库存数量
|
||||
* @param applyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateStorageNum(ScrapApplyDetails applyDetails);
|
||||
|
||||
/**
|
||||
* 添加文件信息
|
||||
* @param fileInfo
|
||||
* @return
|
||||
*/
|
||||
int insertBmFileInfo(FileInfo fileInfo);
|
||||
|
||||
/**
|
||||
* 查询文件信息
|
||||
* @param fileInfo
|
||||
* @return
|
||||
*/
|
||||
List<FileInfo> selectBmFileInfoList(FileInfo fileInfo);
|
||||
|
||||
/**
|
||||
* 删除文件信息
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int delete(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 删除文件信息
|
||||
* @param fileInfo
|
||||
*/
|
||||
int deleteBmFileInfoByBizInfo(FileInfo fileInfo);
|
||||
|
||||
/**
|
||||
* 修改库存数量
|
||||
* @param details
|
||||
* @return
|
||||
*/
|
||||
int updateStorageNumAdd(ScrapApplyDetails details);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateTaskStatus(ScrapApplyDetails scrapApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,4 +99,12 @@ public interface TaskMapper {
|
|||
String selectTaskNumByMonths(@Param("date") Date nowDate, @Param("taskType") Integer taskType);
|
||||
|
||||
List<ScrapApplyDetailsVO> selectTmTaskListByDisposition(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 根据时间获取任务编号
|
||||
* @param date
|
||||
* @param taskType
|
||||
* @return
|
||||
*/
|
||||
String selectCodeByMonth(@Param("date") Date date, @Param("taskType") Integer taskType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package com.bonus.sgzb.material.service;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.material.domain.*;
|
||||
import com.bonus.sgzb.material.vo.ForecastWasteExcel;
|
||||
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
|
||||
import com.bonus.sgzb.material.vo.ScrapAudit;
|
||||
import com.bonus.sgzb.material.vo.ScrapTaskListVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -147,4 +149,46 @@ public interface IScrapApplyDetailsService
|
|||
* @return
|
||||
*/
|
||||
List<ForecastWasteExcel> exportForecastWaste(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务列表
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
List<ScrapTaskListVo> selectInventoryList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务详情
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
ScrapApplyDetails getDetailsList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 新增盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult savePutInfo(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 修改盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult updateList(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 删除盘点报废
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult delete(ScrapApplyDetails scrapApplyDetails);
|
||||
|
||||
/**
|
||||
* 盘点报废审核
|
||||
* @param scrapApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult inventoryApprove(ScrapApplyDetails scrapApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,21 +410,9 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
List<TypeTreeNode> listL21 = new ArrayList<>();
|
||||
List<BackApplyInfo> infoList = new ArrayList<>();
|
||||
try {
|
||||
/*// 根据id去back_check_details查询是否存在已经申请退料,存在则去除
|
||||
if (bean.getId() != null) {
|
||||
infoList = backApplyMapper.selectDetailsById(bean);
|
||||
}*/
|
||||
// 先查第四层类型
|
||||
listL4 = backApplyMapper.getUseTypeTreeL4(bean);
|
||||
if (CollectionUtils.isNotEmpty(listL4)) {
|
||||
/*if (CollectionUtils.isNotEmpty(infoList)) {
|
||||
// 将infoList中所有的typeId提取到一个Set中
|
||||
Set<Long> infoTypeIds = infoList.stream()
|
||||
.map(info -> Long.parseLong(info.getTypeId()))
|
||||
.collect(Collectors.toSet());
|
||||
// 从listL4中移除那些typeId在infoTypeIds中的元素
|
||||
listL4.removeIf(o -> infoTypeIds.contains(o.getTypeId()));
|
||||
}*/
|
||||
List<Long> list4ParentIds = listL4.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||
// 根据第四层parentId 查第三层类型
|
||||
listL3 = backApplyMapper.getUseTypeTreeL3(list4ParentIds);
|
||||
|
|
|
|||
|
|
@ -2,32 +2,36 @@ package com.bonus.sgzb.material.service.impl;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.sgzb.app.mapper.BackReceiveMapper;
|
||||
import com.bonus.sgzb.app.service.BackReceiveService;
|
||||
import com.bonus.sgzb.base.api.domain.BackApplyInfo;
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.base.mapper.MaMachineMapper;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.constant.TaskTypeConstants;
|
||||
import com.bonus.sgzb.common.core.enums.ReviewStatusEnum;
|
||||
import com.bonus.sgzb.common.core.enums.ScrapSourceEnum;
|
||||
import com.bonus.sgzb.common.core.enums.TaskStatusEnum;
|
||||
import com.bonus.sgzb.common.core.enums.TaskTypeEnum;
|
||||
import com.bonus.sgzb.common.core.enums.*;
|
||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.HttpCodeEnum;
|
||||
import com.bonus.sgzb.common.core.utils.StringHelper;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.domain.*;
|
||||
import com.bonus.sgzb.material.domain.vo.Type;
|
||||
import com.bonus.sgzb.material.exception.ExceptionDict;
|
||||
import com.bonus.sgzb.material.mapper.*;
|
||||
import com.bonus.sgzb.material.service.IScrapApplyDetailsService;
|
||||
import com.bonus.sgzb.material.vo.ForecastWasteExcel;
|
||||
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
|
||||
import com.bonus.sgzb.material.vo.ScrapAudit;
|
||||
import com.bonus.sgzb.material.vo.ScrapTaskListVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -62,6 +66,9 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
|||
@Resource
|
||||
BackReceiveService backReceiveService;
|
||||
|
||||
@Resource
|
||||
private MaMachineMapper maMachineMapper;
|
||||
|
||||
/**
|
||||
* 查询报废任务详细scrap_apply_details
|
||||
*
|
||||
|
|
@ -317,6 +324,413 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
|||
return ForecastWasteExcelList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘点报废任务列表
|
||||
* @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 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 = scrapApplyDetailsMapper.selectMaTypeList(applyDetails.getTypeId());
|
||||
if (CollectionUtils.isNotEmpty(maTypes)) {
|
||||
applyDetails.setStorageNum(maTypes.get(0).getStorageNum().add(BigDecimal.valueOf(applyDetails.getScrapNum())));
|
||||
}
|
||||
List<MaCodeInfo> maCodeList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(applyDetails.getMaIds())) {
|
||||
for (String maId : applyDetails.getMaIds().split(",")) {
|
||||
MaMachine maMachine = maMachineMapper.selectMaMachineByMaId(Long.parseLong(maId));
|
||||
MaCodeInfo maCodeInfo = new MaCodeInfo();
|
||||
maCodeInfo.setMaId(Long.valueOf(maId));
|
||||
maCodeInfo.setMaCode(maMachine.getMaCode());
|
||||
maCodeList.add(maCodeInfo);
|
||||
}
|
||||
applyDetails.setMaCodeList(maCodeList);
|
||||
}
|
||||
}
|
||||
// 查询文件信息
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
fileInfo.setDicId(Long.valueOf(TaskTypeEnum.TM_TASK_PART_SCRAP.getCode()));
|
||||
fileInfo.setModelId(scrapApplyDetails.getTaskId());
|
||||
List<FileInfo> bmFileInfos = scrapApplyDetailsMapper.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 savePutInfo(ScrapApplyDetails scrapApplyDetails) {
|
||||
if (scrapApplyDetails == null || CollectionUtils.isEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
|
||||
return AjaxResult.error("报废详情数据为空!");
|
||||
}
|
||||
for (ScrapApplyDetails details : scrapApplyDetails.getScrapApplyDetailsList()) {
|
||||
if (BigDecimal.valueOf(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());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改盘点报废
|
||||
* @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 (BigDecimal.valueOf(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.updateStorageNumAdd(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) {
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
fileInfo.setDicId(Long.valueOf(TaskTypeEnum.TM_TASK_PART_SCRAP.getCode()));
|
||||
fileInfo.setModelId(scrapApplyDetails.getTaskId());
|
||||
scrapApplyDetailsMapper.deleteBmFileInfoByBizInfo(fileInfo);
|
||||
}
|
||||
// 根据编辑提交的数据去和编辑前数据作对比,修改maId的状态
|
||||
extracted(scrapApplyDetails);
|
||||
TmTask tmTask = new TmTask();
|
||||
tmTask.setTaskId(scrapApplyDetails.getTaskId());
|
||||
tmTask.setTaskStatus(0);
|
||||
result = taskMapper.updateTmTask(tmTask);
|
||||
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 delete(ScrapApplyDetails scrapApplyDetails) {
|
||||
try {
|
||||
int result = 0;
|
||||
// 先根据taskId进行查询
|
||||
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.getDetailsList(scrapApplyDetails);
|
||||
// 恢复设备库存及设备状态
|
||||
for (ScrapApplyDetails details : list) {
|
||||
result = scrapApplyDetailsMapper.updateStorageNumAdd(details);
|
||||
if (result == 0) {
|
||||
return AjaxResult.error("库存回滚失败");
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = scrapApplyDetailsMapper.delete(scrapApplyDetails);
|
||||
if (result == 0) {
|
||||
return AjaxResult.error("删除主任务失败");
|
||||
}
|
||||
// 删除任务表
|
||||
result = taskMapper.deleteTmTaskByTaskId(scrapApplyDetails.getTaskId());
|
||||
if (result == 0) {
|
||||
return AjaxResult.error("删除任务信息失败");
|
||||
}
|
||||
// 删除文件信息
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
fileInfo.setDicId(Long.valueOf(TaskTypeEnum.TM_TASK_PART_SCRAP.getCode()));
|
||||
fileInfo.setModelId(scrapApplyDetails.getTaskId());
|
||||
result += scrapApplyDetailsMapper.deleteBmFileInfoByBizInfo(fileInfo);
|
||||
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
|
||||
public AjaxResult inventoryApprove(ScrapApplyDetails scrapApplyDetails) {
|
||||
if (CollectionUtil.isEmpty(scrapApplyDetails.getIdList())) {
|
||||
return AjaxResult.error("请选择要审核的报废单");
|
||||
}
|
||||
int result = 0;
|
||||
try {
|
||||
// 根据前端传的status来判断审核通过还是驳回(1 通过 ,2 驳回)
|
||||
for (Long taskId : scrapApplyDetails.getIdList()) {
|
||||
scrapApplyDetails.setTaskId(taskId);
|
||||
scrapApplyDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
scrapApplyDetails.setAuditTime(DateUtils.getNowDate());
|
||||
result += scrapApplyDetailsMapper.updateTaskStatus(scrapApplyDetails);
|
||||
// 修改任务状态
|
||||
TmTask tmTask = new TmTask();
|
||||
tmTask.setTaskId(taskId);
|
||||
tmTask.setTaskStatus(Integer.valueOf(scrapApplyDetails.getStatus()));
|
||||
result += taskMapper.updateTmTask(tmTask);
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("审核成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("审核失败", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据编辑提交的数据去和编辑前数据作对比,修改maId的状态
|
||||
* @param scrapApplyDetails
|
||||
*/
|
||||
private void extracted(ScrapApplyDetails scrapApplyDetails) {
|
||||
List<ScrapApplyDetails> detailsList = scrapApplyDetails.getScrapApplyDetailsList();
|
||||
for (ScrapApplyDetails details : detailsList) {
|
||||
if (CollectionUtils.isNotEmpty(details.getMaCodeList())) {
|
||||
List<Long> maIdList = details.getMaCodeList().stream()
|
||||
.map(MaCodeInfo::getMaId)
|
||||
.collect(Collectors.toList());
|
||||
scrapApplyDetails.setTypeId(details.getTypeId());
|
||||
List<ScrapApplyDetails> list1 = scrapApplyDetailsMapper.getDetailsList(scrapApplyDetails);
|
||||
if (CollectionUtils.isNotEmpty(list1)) {
|
||||
for (ScrapApplyDetails applyDetails : list1) {
|
||||
if (StringUtils.isNotBlank(applyDetails.getMaIds())) {
|
||||
String[] maIds = applyDetails.getMaIds().split(",");
|
||||
for (String maId : maIds) {
|
||||
if (!maIdList.contains(Long.parseLong(maId))) {
|
||||
// 更新设备状态
|
||||
ScrapApplyDetails info = new ScrapApplyDetails();
|
||||
info.setMaId(Long.parseLong(maId));
|
||||
info.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
|
||||
scrapApplyDetailsMapper.updateMaStatus(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件存储结果
|
||||
* @param scrapApplyDetails
|
||||
* @param result
|
||||
* @param newTaskId
|
||||
* @return
|
||||
*/
|
||||
private int getFileResult(ScrapApplyDetails scrapApplyDetails, int result, Long newTaskId) {
|
||||
if (CollectionUtils.isNotEmpty(scrapApplyDetails.getFileList())) {
|
||||
for (FileInfo fileInfo : scrapApplyDetails.getFileList()) {
|
||||
fileInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
fileInfo.setCreateTime(DateUtils.getNowDate());
|
||||
fileInfo.setDicId(Long.valueOf(TaskTypeEnum.TM_TASK_PART_SCRAP.getCode()));
|
||||
fileInfo.setModelId(newTaskId);
|
||||
result += scrapApplyDetailsMapper.insertBmFileInfo(fileInfo);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入任务表
|
||||
* @return
|
||||
*/
|
||||
private Long insertScrapTt() {
|
||||
Long newTask = null;
|
||||
// 生成盘点报废单号
|
||||
String code = genderBfTaskCode();
|
||||
TmTask tmTask = new TmTask(null, TaskTypeEnum.TM_TASK_PART_SCRAP.getCode(), 0,
|
||||
null, 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成报废单号
|
||||
* @return
|
||||
*/
|
||||
private String genderBfTaskCode() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String taskNum = taskMapper.selectCodeByMonth(nowDate, TaskTypeEnum.TM_TASK_PART_SCRAP.getCode());
|
||||
if (StringHelper.isNotEmpty(taskNum)) {
|
||||
// 将字符串转换为整数
|
||||
int num = Integer.parseInt(taskNum);
|
||||
// 执行加一操作
|
||||
num++;
|
||||
// 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0
|
||||
taskNum = String.format("%04d", num);
|
||||
} else {
|
||||
taskNum = "0001";
|
||||
}
|
||||
String code = Constants.PD_SCRAP_TASK_TYPE_LABEL + format + "-" + taskNum;
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报废详情存储结果
|
||||
* @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.setScrapNum(1);
|
||||
applyDetails.setStatus(MaMachineStatusEnum.SCRAP_TO_AUDIT.getStatus().toString());
|
||||
// 更改设备状态
|
||||
result += scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
||||
applyDetails.setStatus("0");
|
||||
// 添加【报废详情表】
|
||||
result += scrapApplyDetailsMapper.insertScrapApplyDetails(applyDetails);
|
||||
}
|
||||
} else {
|
||||
applyDetails.setStatus("0");
|
||||
// 添加【报废详情表】
|
||||
result += scrapApplyDetailsMapper.insertScrapApplyDetails(applyDetails);
|
||||
}
|
||||
// 更改设备库存
|
||||
if (CollectionUtils.isNotEmpty(applyDetails.getMaCodeList())) {
|
||||
applyDetails.setScrapNum(applyDetails.getMaCodeList().size());
|
||||
applyDetails.setTypeId(applyDetails.getMaCodeList().get(0).getTypeId());
|
||||
}
|
||||
result += scrapApplyDetailsMapper.updateStorageNum(applyDetails);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断关键字是否包含
|
||||
* @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 taskId
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
package com.bonus.sgzb.material.vo;
|
||||
|
||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2025/2/26 18:14
|
||||
*/
|
||||
@Data
|
||||
public class ScrapTaskListVo {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private String ids;
|
||||
|
||||
@ApiModelProperty(value = "ids结果集")
|
||||
private List<Long> idList;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private Byte taskStatus;
|
||||
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private Byte taskType;
|
||||
|
||||
@ApiModelProperty(value = "组织id")
|
||||
private Long companyId;
|
||||
|
||||
@ApiModelProperty(value = "协议id")
|
||||
private Long agreementId;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "退料单位名称")
|
||||
@Excel(name = "退料单位")
|
||||
private String backUnit;
|
||||
|
||||
@ApiModelProperty(value = "退料工程名称")
|
||||
@Excel(name = "工程名称")
|
||||
private String backPro;
|
||||
|
||||
@ApiModelProperty(value = "报废单号")
|
||||
@Excel(name = "报废单号")
|
||||
private String scrapCode;
|
||||
|
||||
@ApiModelProperty(value = "维修单号")
|
||||
@Excel(name = "维修单号")
|
||||
private String repairCode;
|
||||
|
||||
@ApiModelProperty(value = "机具类型")
|
||||
@Excel(name = "物资类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "任务创建人昵称")
|
||||
@Excel(name = "提交人")
|
||||
private String createName;
|
||||
|
||||
@ApiModelProperty(value = "任务创建人")
|
||||
private Long createBy;
|
||||
|
||||
@ApiModelProperty(value = "任务创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "提交时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "审核人")
|
||||
private Long auditBy;
|
||||
|
||||
@ApiModelProperty(value = "审核人")
|
||||
@Excel(name = "审核人")
|
||||
private String auditByName;
|
||||
|
||||
@ApiModelProperty(value = "审核时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "审核时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date auditTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "任务状态名称")
|
||||
@Excel(name = "状态")
|
||||
private String taskStatusName;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -387,4 +387,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join data_receive_detail drd on mm.ma_id = drd.ma_id
|
||||
WHERE drd.item_id = #{itemId}
|
||||
</select>
|
||||
|
||||
<select id="getMachineList" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
|
||||
SELECT
|
||||
mt1.type_name as deviceType,
|
||||
mt.type_name as specificationType,
|
||||
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
|
||||
mm.ma_status = '15' and mt.type_id = #{typeId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -198,6 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="fileUrl != null">file_url,</if>
|
||||
<if test="companyId != null">company_id,</if>
|
||||
<if test="fileName != null">file_name,</if>
|
||||
<if test="scrapReason != null and scrapReason != ''">scrap_reason,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
|
|
@ -220,6 +221,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="fileUrl != null">#{fileUrl},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="fileName != null">#{fileName},</if>
|
||||
<if test="scrapReason != null and scrapReason != ''">#{scrapReason},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="addBackDetails">
|
||||
|
|
@ -235,6 +237,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
values (#{taskId},#{repairId},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},#{status},#{createBy},now(),#{updateBy},now(),#{companyId});
|
||||
</insert>
|
||||
|
||||
<insert id="insertBmFileInfo">
|
||||
insert into sys_file_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="modelId != null">model_id,</if>
|
||||
<if test="name != null">file_name,</if>
|
||||
<if test="url != null">file_url,</if>
|
||||
<if test="dicId != null">dic_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="modelId != null">#{modelId},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="url != null">#{url},</if>
|
||||
<if test="dicId != null">#{dicId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScrapApplyDetails" parameterType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
|
||||
update scrap_apply_details
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
|
@ -272,6 +294,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="delete">
|
||||
delete from scrap_apply_details where task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBmFileInfoByBizInfo">
|
||||
delete from sys_file_info
|
||||
<where>
|
||||
<if test="dicId != null "> and dic_id = #{dicId}</if>
|
||||
<if test="modelId != null "> and model_id = #{modelId}</if>
|
||||
</where>
|
||||
</delete>
|
||||
|
||||
<select id="selectScrapAuditList" resultMap="ScrapApplyDetailsResult">
|
||||
select sad.* ,mt.type_name specificationType, mt1.type_name machineTypeName, mma.ma_code maCode
|
||||
from scrap_apply_details sad
|
||||
|
|
@ -315,6 +349,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateMaStatus">
|
||||
update ma_machine
|
||||
set ma_status = #{status}
|
||||
where ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<update id="updateStorageNum">
|
||||
update ma_type
|
||||
set num = num - IFNULL(#{scrapNum}, 0)
|
||||
where type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateStorageNumAdd">
|
||||
update ma_type
|
||||
set num = num + IFNULL(#{scrapNum}, 0)
|
||||
where type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateTaskStatus">
|
||||
update scrap_apply_details
|
||||
set status = #{status},
|
||||
audit_by = #{auditBy},
|
||||
audit_time = #{auditTime}
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<select id="selectTypeNameByTaskId" resultType="java.lang.String">
|
||||
select GROUP_CONCAT(type_name) typeName from
|
||||
(select distinct sad.task_id, mt1.type_name
|
||||
|
|
@ -560,4 +620,101 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
order by tk.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getDetailsList" resultType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
|
||||
SELECT
|
||||
sad.task_id AS taskId,
|
||||
mt.type_id AS typeId,
|
||||
mt1.type_name AS machineTypeName,
|
||||
mt.type_name AS specificationType,
|
||||
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}
|
||||
<if test="typeId != null">
|
||||
AND sad.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
mt1.type_name like concat('%', #{keyword}, '%') or
|
||||
mt.type_name like concat('%', #{keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY
|
||||
sad.type_id
|
||||
</select>
|
||||
|
||||
<select id="selectInventoryList" resultType="com.bonus.sgzb.material.vo.ScrapTaskListVo">
|
||||
SELECT
|
||||
tt.task_id as taskId,
|
||||
GROUP_CONCAT( sad.id ) AS ids,
|
||||
tt.code AS scrapCode,
|
||||
GROUP_CONCAT( DISTINCT mt1.type_name ) AS type,
|
||||
sad.create_by AS createName,
|
||||
sad.create_time AS createTime,
|
||||
tt.task_status AS taskStatus
|
||||
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 tm_task tt on sad.task_id = tt.task_id
|
||||
AND tt.task_type = 141
|
||||
where sad.scrap_source = '3'
|
||||
<if test="taskStatus != null "> and tt.task_status = #{taskStatus}</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="selectMaTypeList" resultType="com.bonus.sgzb.material.domain.vo.Type">
|
||||
select
|
||||
m.type_id as typeId,
|
||||
CASE m.manage_type
|
||||
WHEN 0 THEN
|
||||
IFNULL(subquery0.num, 0)
|
||||
ELSE
|
||||
IFNULL(m.num, 0)
|
||||
END as storageNum
|
||||
from ma_type m
|
||||
left join (SELECT mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
count(mm.ma_id) num
|
||||
FROM ma_machine mm
|
||||
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
WHERE mm.ma_code is not null and mm.ma_status in (15)
|
||||
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id
|
||||
where
|
||||
m.del_flag = '0'
|
||||
AND m.type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
<select id="selectBmFileInfoList" resultType="com.bonus.sgzb.material.domain.FileInfo">
|
||||
select
|
||||
id as id, model_id as modelId, file_name as name,
|
||||
file_url as url, dic_id as dicId, create_by as createBy, create_time as createTime
|
||||
from sys_file_info
|
||||
<where>
|
||||
<if test="modelId != null ">and model_id = #{modelId}</if>
|
||||
<if test="name != null and name != ''">and file_name like concat('%', #{name}, '%')</if>
|
||||
<if test="url != null and url != ''">and file_url = #{url}</if>
|
||||
<if test="dicId != null ">and dic_id = #{dicId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -330,4 +330,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY tk.CODE
|
||||
order by tk.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCodeByMonth" resultType="java.lang.String">
|
||||
SELECT SUBSTRING(`code`, - 4) as code
|
||||
FROM tm_task
|
||||
WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m')
|
||||
AND task_type = #{taskType}
|
||||
ORDER BY create_time DESC LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue