Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3542b435ed
|
|
@ -56,7 +56,7 @@ public class MachineController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询在库机具编号
|
* todo 查询在库机具编号,存在数据拼接,盘点报废专用
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "查询在库机具编号")
|
@ApiOperation(value = "查询在库机具编号")
|
||||||
//@RequiresPermissions("ma:machine:typeList")
|
//@RequiresPermissions("ma:machine:typeList")
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ public interface IMachineService
|
||||||
AjaxResult selectByTypeList(Type type);
|
AjaxResult selectByTypeList(Type type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询在库机具编号
|
* todo 查询在库机具编号,存在数据拼接,盘点报废专用
|
||||||
* @param type
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.ma.domain.vo.MachineVo;
|
import com.bonus.material.ma.domain.vo.MachineVo;
|
||||||
import com.bonus.material.purchase.config.RemoteConfig;
|
import com.bonus.material.purchase.config.RemoteConfig;
|
||||||
import com.bonus.system.api.RemoteUserService;
|
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
||||||
|
import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.ma.mapper.MachineMapper;
|
import com.bonus.material.ma.mapper.MachineMapper;
|
||||||
|
|
@ -36,6 +37,9 @@ public class MachineServiceImpl implements IMachineService
|
||||||
@Resource
|
@Resource
|
||||||
private RemoteConfig remoteConfig;
|
private RemoteConfig remoteConfig;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScrapApplyDetailsMapper scrapApplyDetailsMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询机具设备管理
|
* 查询机具设备管理
|
||||||
*
|
*
|
||||||
|
|
@ -149,13 +153,33 @@ public class MachineServiceImpl implements IMachineService
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询在库机具编号
|
* todo 查询在库机具编号,存在数据拼接,盘点报废专用
|
||||||
* @param type
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getMachineList(Type type) {
|
public AjaxResult getMachineList(Type type) {
|
||||||
List<Machine> typeList = machineMapper.getMachineList(type);
|
List<Machine> typeList = machineMapper.getMachineList(type);
|
||||||
|
if (type.getTaskId() != null && type.getTypeId() != null) {
|
||||||
|
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
|
||||||
|
scrapApplyDetails.setTaskId(type.getTaskId());
|
||||||
|
scrapApplyDetails.setTypeId(type.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) {
|
||||||
|
Machine machine = new Machine();
|
||||||
|
MachineVo machineVo = machineMapper.selectMachineByMaId(Long.parseLong(maId));
|
||||||
|
machine.setMaId(machineVo.getMaId());
|
||||||
|
machine.setMaCode(machineVo.getMaCode());
|
||||||
|
typeList.add(machine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return AjaxResult.success(typeList);
|
return AjaxResult.success(typeList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.bonus.common.biz.config.ListPagingUtil;
|
||||||
import com.bonus.common.core.utils.ServletUtils;
|
import com.bonus.common.core.utils.ServletUtils;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
|
import com.bonus.material.scrap.domain.vo.ScrapDetailsListVo;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -132,6 +133,64 @@ public class ScrapApplyDetailsController extends BaseController {
|
||||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询报废台账列表")
|
||||||
|
// @RequiresPermissions("scrap:details:list")
|
||||||
|
@GetMapping("/getScrapList")
|
||||||
|
public AjaxResult getScrapList(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||||
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||||
|
List<ScrapTotalListVo> list = scrapApplyDetailsService.getScrapList(scrapApplyDetails);
|
||||||
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出报废台账列表
|
||||||
|
* @param response
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "导出报废台账列表")
|
||||||
|
//@RequiresPermissions("scrap:details:export")
|
||||||
|
@PostMapping("/exportScrapList")
|
||||||
|
public void exportScrapList(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
List<ScrapTotalListVo> list = scrapApplyDetailsService.getScrapList(scrapApplyDetails);
|
||||||
|
ExcelUtil<ScrapTotalListVo> util = new ExcelUtil<>(ScrapTotalListVo.class);
|
||||||
|
util.exportExcel(response, list, "报废台账任务数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账明细列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询报废台账明细列表")
|
||||||
|
// @RequiresPermissions("scrap:details:list")
|
||||||
|
@GetMapping("/getScrapDetailsList")
|
||||||
|
public AjaxResult getScrapDetailsList(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||||
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||||
|
List<ScrapDetailsListVo> list = scrapApplyDetailsService.getScrapDetailsList(scrapApplyDetails);
|
||||||
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出报废台账列表
|
||||||
|
* @param response
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "导出报废台账明细列表")
|
||||||
|
//@RequiresPermissions("scrap:details:export")
|
||||||
|
@PostMapping("/exportScrapDetailsList")
|
||||||
|
public void exportScrapDetailsList(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
List<ScrapDetailsListVo> list = scrapApplyDetailsService.getScrapDetailsList(scrapApplyDetails);
|
||||||
|
ExcelUtil<ScrapDetailsListVo> util = new ExcelUtil<>(ScrapDetailsListVo.class);
|
||||||
|
util.exportExcel(response, list, "报废台账明细数据");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询报废台账审核总费用
|
* 查询报废台账审核总费用
|
||||||
* @param scrapApplyDetails
|
* @param scrapApplyDetails
|
||||||
|
|
@ -181,11 +240,11 @@ public class ScrapApplyDetailsController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盘点报废审核通过
|
* 盘点报废审核
|
||||||
* @param scrapApplyDetails
|
* @param scrapApplyDetails
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "盘点报废审核通过")
|
@ApiOperation(value = "盘点报废审核")
|
||||||
@PostMapping("/inventoryApprove")
|
@PostMapping("/inventoryApprove")
|
||||||
public AjaxResult inventoryApprove(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
public AjaxResult inventoryApprove(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
||||||
return scrapApplyDetailsService.inventoryApprove(scrapApplyDetails);
|
return scrapApplyDetailsService.inventoryApprove(scrapApplyDetails);
|
||||||
|
|
|
||||||
|
|
@ -100,16 +100,16 @@ public class ScrapApplyDetails extends BaseEntity {
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "规格型号名称")
|
@ApiModelProperty(value = "规格型号名称")
|
||||||
private String typeModelName;
|
private String typeName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "物资类型ID")
|
@ApiModelProperty(value = "物资类型ID")
|
||||||
private Long typeNameId;
|
private Long typeNameId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "物资类型名称")
|
@ApiModelProperty(value = "物资类型名称")
|
||||||
private String typeName;
|
private String maTypeName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "管理方式")
|
@ApiModelProperty(value = "管理方式")
|
||||||
private Byte manageType;
|
private String manageType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "单位")
|
@ApiModelProperty(value = "单位")
|
||||||
private String unitName;
|
private String unitName;
|
||||||
|
|
@ -213,6 +213,10 @@ public class ScrapApplyDetails extends BaseEntity {
|
||||||
@ApiModelProperty(value = "结束时间")
|
@ApiModelProperty(value = "结束时间")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "本次审核周期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM")
|
||||||
|
private String month;
|
||||||
|
|
||||||
@ApiModelProperty(value = "台账审核状态 0待审核,1已审核,2驳回")
|
@ApiModelProperty(value = "台账审核状态 0待审核,1已审核,2驳回")
|
||||||
private String ledgerStatus;
|
private String ledgerStatus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.bonus.material.scrap.domain.vo;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废台账返回实体类
|
||||||
|
* @author ma_sh
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ScrapDetailsListVo {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物资类型名称")
|
||||||
|
@Excel(name = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/** 规格ID */
|
||||||
|
@ApiModelProperty(value = "规格ID")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格型号名称")
|
||||||
|
@Excel(name = "规格型号")
|
||||||
|
private String typeModelName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "单位")
|
||||||
|
@Excel(name = "计量单位")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/** 报废数量 */
|
||||||
|
@Excel(name = "报废数量")
|
||||||
|
@ApiModelProperty(value = "报废数量")
|
||||||
|
private BigDecimal scrapNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "费用合计")
|
||||||
|
@Excel(name = "报废费用(万元)")
|
||||||
|
private BigDecimal totalCost;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "购置价")
|
||||||
|
private BigDecimal buyPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "报废类型")
|
||||||
|
@Excel(name = "报废类型")
|
||||||
|
private String scrapStyle;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "(1退料2,维修审核,3盘点报废)")
|
||||||
|
private String scrapSource;
|
||||||
|
|
||||||
|
/** (0自然,1人为) */
|
||||||
|
@Excel(name = "损坏类型", readConverterExp = "0=自然损坏,1=人为损坏")
|
||||||
|
private String scrapType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务创建人昵称")
|
||||||
|
@Excel(name = "审核人")
|
||||||
|
private String auditName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "本次审核周期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "审核日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private String month;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "台账审核状态 0待审核,1已审核,2驳回")
|
||||||
|
private String ledgerStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "台账审核状态 0待审核,1已审核,2驳回")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -28,7 +28,6 @@ public class ScrapTotalListVo {
|
||||||
private List<Long> taskIdList;
|
private List<Long> taskIdList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "物资类型名称")
|
@ApiModelProperty(value = "物资类型名称")
|
||||||
@Excel(name = "类型名称")
|
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
/** 规格ID */
|
/** 规格ID */
|
||||||
|
|
@ -36,13 +35,16 @@ public class ScrapTotalListVo {
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "规格型号名称")
|
@ApiModelProperty(value = "规格型号名称")
|
||||||
@Excel(name = "规格型号")
|
|
||||||
private String typeModelName;
|
private String typeModelName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "单位")
|
@ApiModelProperty(value = "单位")
|
||||||
@Excel(name = "计量单位")
|
|
||||||
private String unitName;
|
private String unitName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "本次审核周期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM")
|
||||||
|
@Excel(name = "月份")
|
||||||
|
private String month;
|
||||||
|
|
||||||
/** 报废数量 */
|
/** 报废数量 */
|
||||||
@Excel(name = "报废数量")
|
@Excel(name = "报废数量")
|
||||||
@ApiModelProperty(value = "报废数量")
|
@ApiModelProperty(value = "报废数量")
|
||||||
|
|
@ -56,27 +58,18 @@ public class ScrapTotalListVo {
|
||||||
private BigDecimal buyPrice;
|
private BigDecimal buyPrice;
|
||||||
|
|
||||||
@ApiModelProperty(value = "报废类型")
|
@ApiModelProperty(value = "报废类型")
|
||||||
@Excel(name = "报废类型")
|
|
||||||
private String scrapStyle;
|
private String scrapStyle;
|
||||||
|
|
||||||
@ApiModelProperty(value = "(1退料2,维修审核,3盘点报废)")
|
@ApiModelProperty(value = "(1退料2,维修审核,3盘点报废)")
|
||||||
private String scrapSource;
|
private String scrapSource;
|
||||||
|
|
||||||
/** (0自然,1人为) */
|
/** (0自然,1人为) */
|
||||||
@Excel(name = "损坏类型", readConverterExp = "0=自然损坏,1=人为损坏")
|
|
||||||
private String scrapType;
|
private String scrapType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务创建人昵称")
|
@ApiModelProperty(value = "任务创建人昵称")
|
||||||
@Excel(name = "提交人")
|
|
||||||
private String createName;
|
private String createName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "本次审核周期")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM")
|
|
||||||
@Excel(name = "本次审核周期")
|
|
||||||
private String month;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "台账审核状态 0待审核,1已审核,2驳回")
|
@ApiModelProperty(value = "台账审核状态 0待审核,1已审核,2驳回")
|
||||||
@Excel(name = "状态", readConverterExp = "0=待审核,1=已审核,2=驳回")
|
|
||||||
private String ledgerStatus;
|
private String ledgerStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@ package com.bonus.material.scrap.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.repair.domain.RepairAuditDetails;
|
import com.bonus.material.repair.domain.RepairAuditDetails;
|
||||||
import com.bonus.material.repair.domain.RepairRecord;
|
import com.bonus.material.repair.domain.RepairRecord;
|
||||||
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
||||||
|
import com.bonus.material.scrap.domain.vo.ScrapDetailsListVo;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -166,4 +168,25 @@ public interface ScrapApplyDetailsMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int updateTaskStatus(ScrapApplyDetails scrapApplyDetails);
|
int updateTaskStatus(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ScrapTotalListVo> getScrapList(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账明细列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ScrapDetailsListVo> getScrapDetailsList(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库存
|
||||||
|
* @param typeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Type> selectMaTypeList(Long typeId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
||||||
|
import com.bonus.material.scrap.domain.vo.ScrapDetailsListVo;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||||
|
|
||||||
|
|
@ -149,9 +150,23 @@ public interface IScrapApplyDetailsService {
|
||||||
AjaxResult updateList(ScrapApplyDetails scrapApplyDetails);
|
AjaxResult updateList(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盘点报废审核通过
|
* 盘点报废审核
|
||||||
* @param scrapApplyDetails
|
* @param scrapApplyDetails
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult inventoryApprove(ScrapApplyDetails scrapApplyDetails);
|
AjaxResult inventoryApprove(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ScrapTotalListVo> getScrapList(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账明细列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ScrapDetailsListVo> getScrapDetailsList(ScrapApplyDetails scrapApplyDetails);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.scrap.service.impl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -22,6 +23,7 @@ import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.ma.mapper.TypeMapper;
|
import com.bonus.material.ma.mapper.TypeMapper;
|
||||||
import com.bonus.material.scrap.domain.MaCodeInfo;
|
import com.bonus.material.scrap.domain.MaCodeInfo;
|
||||||
|
import com.bonus.material.scrap.domain.vo.ScrapDetailsListVo;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
|
|
@ -58,9 +60,6 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
@Resource
|
@Resource
|
||||||
private BmFileInfoMapper fileInfoMapper;
|
private BmFileInfoMapper fileInfoMapper;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private TypeMapper typeMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询报废任务详细
|
* 查询报废任务详细
|
||||||
*
|
*
|
||||||
|
|
@ -554,10 +553,6 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
return AjaxResult.error("报废详情数据为空!");
|
return AjaxResult.error("报废详情数据为空!");
|
||||||
}
|
}
|
||||||
for (ScrapApplyDetails details : scrapApplyDetails.getScrapApplyDetailsList()) {
|
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) {
|
if (details.getScrapNum().compareTo(details.getStorageNum()) > 0) {
|
||||||
return AjaxResult.error("报废数量不能大于库存数量!");
|
return AjaxResult.error("报废数量不能大于库存数量!");
|
||||||
}
|
}
|
||||||
|
|
@ -594,19 +589,23 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
if (CollectionUtils.isNotEmpty(applyDetails.getMaCodeList())) {
|
if (CollectionUtils.isNotEmpty(applyDetails.getMaCodeList())) {
|
||||||
for (MaCodeInfo maCodeInfo : applyDetails.getMaCodeList()) {
|
for (MaCodeInfo maCodeInfo : applyDetails.getMaCodeList()) {
|
||||||
applyDetails.setMaId(maCodeInfo.getMaId());
|
applyDetails.setMaId(maCodeInfo.getMaId());
|
||||||
applyDetails.setTypeId(maCodeInfo.getTypeId());
|
|
||||||
applyDetails.setScrapNum(BigDecimal.ONE);
|
applyDetails.setScrapNum(BigDecimal.ONE);
|
||||||
applyDetails.setStatus(MaMachineStatusEnum.SCRAP_TO_AUDIT.getStatus().toString());
|
applyDetails.setStatus(MaMachineStatusEnum.SCRAP_TO_AUDIT.getStatus().toString());
|
||||||
// 更改设备状态
|
// 更改设备状态
|
||||||
result += scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
result += scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
||||||
|
applyDetails.setStatus("0");
|
||||||
|
// 添加【报废详情表】
|
||||||
|
result += scrapApplyDetailsMapper.insertScrapApplyDetails(applyDetails);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
applyDetails.setStatus("0");
|
||||||
|
// 添加【报废详情表】
|
||||||
|
result += scrapApplyDetailsMapper.insertScrapApplyDetails(applyDetails);
|
||||||
}
|
}
|
||||||
applyDetails.setStatus("0");
|
|
||||||
// 添加【报废详情表】
|
|
||||||
result += scrapApplyDetailsMapper.insertScrapApplyDetails(applyDetails);
|
|
||||||
// 更改设备库存
|
// 更改设备库存
|
||||||
if (CollectionUtils.isNotEmpty(applyDetails.getMaCodeList())) {
|
if (CollectionUtils.isNotEmpty(applyDetails.getMaCodeList())) {
|
||||||
applyDetails.setScrapNum(BigDecimal.valueOf(applyDetails.getMaCodeList().size()));
|
applyDetails.setScrapNum(BigDecimal.valueOf(applyDetails.getMaCodeList().size()));
|
||||||
|
applyDetails.setTypeId(applyDetails.getMaCodeList().get(0).getTypeId());
|
||||||
}
|
}
|
||||||
result += scrapApplyDetailsMapper.updateStorageNum(applyDetails);
|
result += scrapApplyDetailsMapper.updateStorageNum(applyDetails);
|
||||||
}
|
}
|
||||||
|
|
@ -640,7 +639,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
*/
|
*/
|
||||||
private Long insertScrapTt() {
|
private Long insertScrapTt() {
|
||||||
Long newTask = null;
|
Long newTask = null;
|
||||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId());
|
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId(), null);
|
||||||
// 生成盘点报废单号
|
// 生成盘点报废单号
|
||||||
String code = genderBfTaskCode(thisMonthMaxOrder);
|
String code = genderBfTaskCode(thisMonthMaxOrder);
|
||||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId(), RepairInputStatusEnum.INPUT_TASK_NO_FINISHED.getStatus(),
|
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId(), RepairInputStatusEnum.INPUT_TASK_NO_FINISHED.getStatus(),
|
||||||
|
|
@ -668,9 +667,18 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.getDetailsList(scrapApplyDetails);
|
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.getDetailsList(scrapApplyDetails);
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
for (ScrapApplyDetails applyDetails : list) {
|
for (ScrapApplyDetails applyDetails : list) {
|
||||||
List<Type> maTypes = typeMapper.selectMaTypeList(applyDetails.getTypeId(), " ");
|
List<Type> maTypes = scrapApplyDetailsMapper.selectMaTypeList(applyDetails.getTypeId());
|
||||||
if (CollectionUtils.isNotEmpty(maTypes)) {
|
if (CollectionUtils.isNotEmpty(maTypes)) {
|
||||||
applyDetails.setStorageNum(maTypes.get(0).getStorageNum());
|
applyDetails.setStorageNum(maTypes.get(0).getStorageNum().add(applyDetails.getScrapNum()));
|
||||||
|
}
|
||||||
|
List<MaCodeInfo> maCodeList = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotBlank(applyDetails.getMaIds())) {
|
||||||
|
for (String maId : applyDetails.getMaIds().split(",")) {
|
||||||
|
MaCodeInfo maCodeInfo = new MaCodeInfo();
|
||||||
|
maCodeInfo.setMaId(Long.valueOf(maId));
|
||||||
|
maCodeList.add(maCodeInfo);
|
||||||
|
}
|
||||||
|
applyDetails.setMaCodeList(maCodeList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 查询文件信息
|
// 查询文件信息
|
||||||
|
|
@ -722,10 +730,6 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
return AjaxResult.error("报废详情数据为空!");
|
return AjaxResult.error("报废详情数据为空!");
|
||||||
}
|
}
|
||||||
for (ScrapApplyDetails details : scrapApplyDetails.getScrapApplyDetailsList()) {
|
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) {
|
if (details.getScrapNum().compareTo(details.getStorageNum()) > 0) {
|
||||||
return AjaxResult.error("报废数量不能大于库存数量!");
|
return AjaxResult.error("报废数量不能大于库存数量!");
|
||||||
}
|
}
|
||||||
|
|
@ -760,20 +764,55 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
fileInfo.setTaskId(scrapApplyDetails.getTaskId());
|
fileInfo.setTaskId(scrapApplyDetails.getTaskId());
|
||||||
fileInfoMapper.deleteBmFileInfoByBizInfo(fileInfo);
|
fileInfoMapper.deleteBmFileInfoByBizInfo(fileInfo);
|
||||||
}
|
}
|
||||||
|
// 根据编辑提交的数据去和编辑前数据作对比,修改maId的状态
|
||||||
|
extracted(scrapApplyDetails);
|
||||||
result = getScrapResult(scrapApplyDetails, result, scrapApplyDetails.getTaskId());
|
result = getScrapResult(scrapApplyDetails, result, scrapApplyDetails.getTaskId());
|
||||||
result = getFileResult(scrapApplyDetails, result, scrapApplyDetails.getTaskId());
|
result = getFileResult(scrapApplyDetails, result, scrapApplyDetails.getTaskId());
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return AjaxResult.success("新增成功");
|
return AjaxResult.success("修改成功");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("新增失败", e);
|
log.error("修改失败", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
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 scrapApplyDetails
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -784,6 +823,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
}
|
}
|
||||||
int result = 0;
|
int result = 0;
|
||||||
try {
|
try {
|
||||||
|
// 根据前端传的status来判断审核通过还是驳回(1 通过 ,2 驳回)
|
||||||
for (Long taskId : scrapApplyDetails.getTaskIdList()) {
|
for (Long taskId : scrapApplyDetails.getTaskIdList()) {
|
||||||
scrapApplyDetails.setTaskId(taskId);
|
scrapApplyDetails.setTaskId(taskId);
|
||||||
result += scrapApplyDetailsMapper.updateTaskStatus(scrapApplyDetails);
|
result += scrapApplyDetailsMapper.updateTaskStatus(scrapApplyDetails);
|
||||||
|
|
@ -798,6 +838,43 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ScrapTotalListVo> getScrapList(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
return scrapApplyDetailsMapper.getScrapList(scrapApplyDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账明细列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ScrapDetailsListVo> getScrapDetailsList(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
List<ScrapDetailsListVo> list = scrapApplyDetailsMapper.getScrapDetailsList(scrapApplyDetails);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
for (ScrapDetailsListVo applyDetails : list) {
|
||||||
|
BigDecimal totalCost = applyDetails.getScrapNum().multiply(applyDetails.getBuyPrice()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP);
|
||||||
|
applyDetails.setTotalCost(totalCost);
|
||||||
|
if ("2".equals(applyDetails.getScrapSource())) {
|
||||||
|
applyDetails.setScrapStyle("维修报废");
|
||||||
|
} else if ("3".equals(applyDetails.getScrapSource())) {
|
||||||
|
applyDetails.setScrapStyle("盘点报废");
|
||||||
|
}
|
||||||
|
if ("0".equals(applyDetails.getScrapType())) {
|
||||||
|
applyDetails.setScrapType("自然损坏");
|
||||||
|
} else if ("1".equals(applyDetails.getScrapType())) {
|
||||||
|
applyDetails.setScrapType("人为损坏");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成报废单号
|
* 生成报废单号
|
||||||
* @param thisMonthMaxOrder
|
* @param thisMonthMaxOrder
|
||||||
|
|
@ -838,7 +915,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
*/
|
*/
|
||||||
private Long insertTt(Long preTaskId) {
|
private Long insertTt(Long preTaskId) {
|
||||||
Long newTask = null;
|
Long newTask = null;
|
||||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId());
|
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId(), null);
|
||||||
// 生成维修单号
|
// 生成维修单号
|
||||||
String code = genderWxTaskCode(thisMonthMaxOrder);
|
String code = genderWxTaskCode(thisMonthMaxOrder);
|
||||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId(), RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus(),
|
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId(), RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus(),
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||||
AND mt1.del_flag = '0'
|
AND mt1.del_flag = '0'
|
||||||
WHERE
|
WHERE
|
||||||
mt.type_id = #{typeId}
|
mm.ma_status = '1' and mt.type_id = #{typeId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteMachineByMaCodeAndTypeId">
|
<delete id="deleteMachineByMaCodeAndTypeId">
|
||||||
|
|
|
||||||
|
|
@ -418,22 +418,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectInventoryList" resultType="com.bonus.material.scrap.domain.vo.ScrapTaskListVo">
|
<select id="selectInventoryList" resultType="com.bonus.material.scrap.domain.vo.ScrapTaskListVo">
|
||||||
SELECT
|
SELECT
|
||||||
|
tt.task_id as taskId,
|
||||||
GROUP_CONCAT( sad.id ) AS ids,
|
GROUP_CONCAT( sad.id ) AS ids,
|
||||||
tt.code AS scrapCode,
|
tt.code AS scrapCode,
|
||||||
GROUP_CONCAT( DISTINCT mt2.type_name ) AS type,
|
GROUP_CONCAT( DISTINCT mt1.type_name ) AS type,
|
||||||
sad.create_by AS createName,
|
sad.create_by AS createName,
|
||||||
sad.create_time AS createTime,
|
sad.create_time AS createTime,
|
||||||
sad.`status` AS status
|
tt.task_status AS taskStatus
|
||||||
FROM
|
FROM
|
||||||
scrap_apply_details sad
|
scrap_apply_details sad
|
||||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
|
||||||
AND mt.del_flag = '0'
|
AND mt.del_flag = '0'
|
||||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||||
AND mt1.del_flag = '0'
|
AND mt1.del_flag = '0'
|
||||||
LEFT JOIN tm_task tt on sad.task_id = tt.task_id
|
LEFT JOIN tm_task tt on sad.task_id = tt.task_id
|
||||||
AND tt.task_type = 15
|
AND tt.task_type = 15
|
||||||
where sad.scrap_source = '3'
|
where sad.scrap_source = '3'
|
||||||
<if test="status != null "> and sad.`status` = #{status}</if>
|
<if test="taskStatus != null "> and tt.task_status = #{taskStatus}</if>
|
||||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
<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} ]]>
|
<![CDATA[and DATE_FORMAT( sad.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -450,11 +451,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="getDetailsList" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails">
|
<select id="getDetailsList" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails">
|
||||||
SELECT
|
SELECT
|
||||||
sad.CODE AS code,
|
|
||||||
sad.task_id AS taskId,
|
sad.task_id AS taskId,
|
||||||
mt.type_id AS typeId,
|
mt.type_id AS typeId,
|
||||||
mt1.type_name AS typeName,
|
mt1.type_name AS maTypeName,
|
||||||
mt.type_name AS typeModelName,
|
mt.type_name AS typeName,
|
||||||
mt.unit_name AS unitName,
|
mt.unit_name AS unitName,
|
||||||
SUM(sad.scrap_num) AS scrapNum,
|
SUM(sad.scrap_num) AS scrapNum,
|
||||||
GROUP_CONCAT( DISTINCT sad.ma_id ) AS maIds,
|
GROUP_CONCAT( DISTINCT sad.ma_id ) AS maIds,
|
||||||
|
|
@ -470,8 +470,109 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_machine mm ON sad.ma_id = mm.ma_id
|
LEFT JOIN ma_machine mm ON sad.ma_id = mm.ma_id
|
||||||
where
|
where
|
||||||
sad.task_id = #{taskId}
|
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
|
GROUP BY
|
||||||
sad.type_id
|
sad.type_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getScrapList" resultType="com.bonus.material.scrap.domain.vo.ScrapTotalListVo">
|
||||||
|
SELECT
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt.type_id AS typeId,
|
||||||
|
mt.type_name AS typeModelName,
|
||||||
|
mt.unit_name AS unitName,
|
||||||
|
mt.manage_type AS manageType,
|
||||||
|
sum( sad.scrap_num ) AS scrapNum,
|
||||||
|
mt.buy_price AS buyPrice,
|
||||||
|
GROUP_CONCAT( DISTINCT sad.create_by ) AS createName,
|
||||||
|
DATE_FORMAT( sad.ledger_time, '%Y-%m' ) AS month,
|
||||||
|
sad.ledger_status AS ledgerStatus,
|
||||||
|
TRIM(TRAILING '0' FROM CAST(SUM(ROUND(mt.buy_price) * ROUND(sad.scrap_num)) / 10000 AS CHAR)) AS totalCost
|
||||||
|
FROM
|
||||||
|
scrap_apply_details sad
|
||||||
|
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
|
WHERE sad.`status` = '1' and sad.ledger_status = '1'
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
<![CDATA[
|
||||||
|
AND DATE_FORMAT( sad.create_time, '%Y-%m' ) BETWEEN DATE_FORMAT(#{startTime}, '%Y-%m') AND DATE_FORMAT(#{endTime}, '%Y-%m')
|
||||||
|
]]>
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
DATE_FORMAT(
|
||||||
|
sad.ledger_time,
|
||||||
|
'%Y-%m')
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getScrapDetailsList" resultType="com.bonus.material.scrap.domain.vo.ScrapDetailsListVo">
|
||||||
|
SELECT
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt.type_id AS typeId,
|
||||||
|
mt.type_name AS typeModelName,
|
||||||
|
mt.unit_name AS unitName,
|
||||||
|
mt.manage_type AS manageType,
|
||||||
|
sum( sad.scrap_num ) AS scrapNum,
|
||||||
|
mt.buy_price AS buyPrice,
|
||||||
|
sad.scrap_type AS scrapType,
|
||||||
|
GROUP_CONCAT( DISTINCT su.nick_name ) AS auditName,
|
||||||
|
DATE_FORMAT( sad.ledger_time, '%Y-%m-%d' ) AS month,
|
||||||
|
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
|
||||||
|
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN sys_user su on sad.ledger_by = su.user_id
|
||||||
|
WHERE sad.`status` = '1' and sad.ledger_status = '1'
|
||||||
|
DATE_FORMAT( sad.ledger_time, '%Y-%m' ) = #{month}
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
mt2.type_name like concat('%', #{keyWord}, '%') or
|
||||||
|
mt.type_name like concat('%', #{keyWord}, '%') or
|
||||||
|
sad.scrap_type like concat('%', #{keyWord}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
<![CDATA[
|
||||||
|
AND DATE_FORMAT( sad.ledger_time, '%Y-%m' ) BETWEEN DATE_FORMAT(#{startTime}, '%Y-%m') AND DATE_FORMAT(#{endTime}, '%Y-%m')
|
||||||
|
]]>
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
sad.type_id,
|
||||||
|
sad.scrap_type,
|
||||||
|
sad.scrap_source
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMaTypeList" resultType="com.bonus.material.ma.domain.Type">
|
||||||
|
select
|
||||||
|
m.type_id as typeId,
|
||||||
|
CASE m.manage_type
|
||||||
|
WHEN 0 THEN
|
||||||
|
IFNULL(subquery0.num, 0)
|
||||||
|
ELSE
|
||||||
|
IFNULL(m.storage_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 (1)
|
||||||
|
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>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue