Merge branch 'master' of http://192.168.0.56:3000/bonus/Bonus-Cloud-Material
This commit is contained in:
commit
8e8cdb0931
|
|
@ -3,6 +3,7 @@ package com.bonus.common.biz.config;
|
|||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.RegionUtil;
|
||||
|
|
@ -52,6 +53,14 @@ public class PoiOutPage {
|
|||
return workbook;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建标题行
|
||||
* @param sheet
|
||||
* @param titleStyle
|
||||
* @param filename
|
||||
* @param nColumn
|
||||
* @return
|
||||
*/
|
||||
private static int createTitleRow(HSSFSheet sheet, HSSFCellStyle titleStyle, String filename, int nColumn) {
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
row.setHeightInPoints(30);
|
||||
|
|
@ -62,6 +71,14 @@ public class PoiOutPage {
|
|||
return 1; // 下一行是表头
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表头行
|
||||
* @param sheet
|
||||
* @param headerStyle
|
||||
* @param list
|
||||
* @param rowNum
|
||||
* @return
|
||||
*/
|
||||
private static int createHeaderRow(HSSFSheet sheet, HSSFCellStyle headerStyle, List<String> list, int rowNum) {
|
||||
HSSFRow row = sheet.createRow(rowNum);
|
||||
row.setHeightInPoints(20);
|
||||
|
|
@ -74,6 +91,14 @@ public class PoiOutPage {
|
|||
return rowNum + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充数据行
|
||||
* @param sheet
|
||||
* @param result
|
||||
* @param contentStyle
|
||||
* @param nColumn
|
||||
* @param rowNum
|
||||
*/
|
||||
private static void createDataRows(HSSFSheet sheet, List<Map<String, Object>> result, HSSFCellStyle contentStyle, int nColumn, int rowNum) {
|
||||
for (Map<String, Object> resultRow : result) {
|
||||
List<Object> rowData = map2List(resultRow);
|
||||
|
|
@ -104,6 +129,12 @@ public class PoiOutPage {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置单元格数据
|
||||
* @param cell
|
||||
* @param contentStyle
|
||||
* @param data
|
||||
*/
|
||||
private static void setCellValue(HSSFCell cell, HSSFCellStyle contentStyle, Object data) {
|
||||
if (isNumeric(data)) {
|
||||
contentStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.00"));
|
||||
|
|
@ -115,6 +146,14 @@ public class PoiOutPage {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个空的工作表
|
||||
* @param sheet
|
||||
* @param list
|
||||
* @param titleStyle
|
||||
* @param headerStyle
|
||||
* @param filename
|
||||
*/
|
||||
private static void createEmptySheet(HSSFSheet sheet, List<String> list, HSSFCellStyle titleStyle, HSSFCellStyle headerStyle, String filename) {
|
||||
int nColumn = list.size();
|
||||
int rowNum = createTitleRow(sheet, titleStyle, filename, nColumn);
|
||||
|
|
@ -275,8 +314,12 @@ public class PoiOutPage {
|
|||
return list;
|
||||
}
|
||||
|
||||
// 以下是创建样式的方法(可根据需要调整)
|
||||
|
||||
/**
|
||||
* 创建标题样式
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle createTitleStyle(HSSFWorkbook workbook) {
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
|
|
@ -288,24 +331,61 @@ public class PoiOutPage {
|
|||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表头样式
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle createHeaderStyle(HSSFWorkbook workbook) {
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setBold(true);
|
||||
font.setFontHeightInPoints((short) 12);
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
style.setFont(font);
|
||||
|
||||
// 设置边框
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 设置边框颜色为黑色
|
||||
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建内容样式
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle createCellStyle(HSSFWorkbook workbook) {
|
||||
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
style.setFont(font);
|
||||
|
||||
// 设置边框
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 设置边框颜色为黑色
|
||||
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
|
||||
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,6 +111,15 @@ public class BmQrBoxController extends BaseController {
|
|||
return qrBoxService.updateBmQrcodeInfoByCode(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二维码管理 -- 扫码获取绑定物资信息
|
||||
*/
|
||||
@ApiOperation(value = "二维码管理 -- 扫码获取绑定物资信息")
|
||||
@GetMapping("/get_ma_info_by_qrcode")
|
||||
public AjaxResult appCreateByCode(@RequestParam(value = "qrCode") String qrCode) {
|
||||
return qrBoxService.getMaInfoByQrCode(qrCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP -- 新购入库扫码 -- BoxCode查询标准箱信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class ComplexQueryController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--查询在库机具设备详情")
|
||||
@GetMapping("/exportStorageInfoList")
|
||||
@PostMapping("/exportStorageInfoList")
|
||||
public void exportStorageInfoList(HttpServletResponse response, StorageInfo bean) {
|
||||
List<StorageInfo> list = complexQueryService.getMaCodeList(bean);
|
||||
ExcelUtil<StorageInfo> util = new ExcelUtil<>(StorageInfo.class);
|
||||
|
|
@ -127,7 +127,7 @@ public class ComplexQueryController extends BaseController {
|
|||
* @param bean
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--导出在用设备详情")
|
||||
@GetMapping("/exportUserRecordList")
|
||||
@PostMapping("/exportUserRecordList")
|
||||
public void exportUserRecordList(HttpServletResponse response, UseStorageInfo bean) {
|
||||
List<UseStorageInfo> list = complexQueryService.getUserRecords(bean);
|
||||
ExcelUtil<UseStorageInfo> util = new ExcelUtil<>(UseStorageInfo.class);
|
||||
|
|
@ -153,7 +153,7 @@ public class ComplexQueryController extends BaseController {
|
|||
* @param bean
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--导出在修设备详情")
|
||||
@GetMapping("/exportRepairRecordList")
|
||||
@PostMapping("/exportRepairRecordList")
|
||||
public void exportRepairRecordList(HttpServletResponse response, RepairStorageInfo bean) {
|
||||
List<RepairStorageInfo> list = complexQueryService.getRepairRecordList(bean);
|
||||
ExcelUtil<RepairStorageInfo> util = new ExcelUtil<>(RepairStorageInfo.class);
|
||||
|
|
@ -179,7 +179,7 @@ public class ComplexQueryController extends BaseController {
|
|||
* @param bean
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--导出新购待入库详情")
|
||||
@GetMapping("/exportPurchaseRecordList")
|
||||
@PostMapping("/exportPurchaseRecordList")
|
||||
public void exportPurchaseRecordList(HttpServletResponse response, PurchaseInputInfo bean) {
|
||||
List<PurchaseInputInfo> list = complexQueryService.getPurchaseRecordList(bean);
|
||||
ExcelUtil<PurchaseInputInfo> util = new ExcelUtil<>(PurchaseInputInfo.class);
|
||||
|
|
@ -205,7 +205,7 @@ public class ComplexQueryController extends BaseController {
|
|||
* @param bean
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--导出修饰待入库详情")
|
||||
@GetMapping("/exportRepairInputList")
|
||||
@PostMapping("/exportRepairInputList")
|
||||
public void exportRepairInputList(HttpServletResponse response, RepairInputRecord bean) {
|
||||
List<RepairInputRecord> list = complexQueryService.getRepairInputList(bean);
|
||||
ExcelUtil<RepairInputRecord> util = new ExcelUtil<>(RepairInputRecord.class);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@ public class BmQrBoxInfo extends BaseEntity
|
|||
@ApiModelProperty(value = "状态--DTO请求参数,用作多状态查询拼接")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "状态名称")
|
||||
private String statusName;
|
||||
|
||||
@ApiModelProperty(value = "移交人用户ID,")
|
||||
private Long transferUser;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,10 @@ public class PurchaseInputInfo {
|
|||
|
||||
@ApiModelProperty(value = "新购待入库单号")
|
||||
@Excel(name = "新购待入库单号")
|
||||
private String purchaseCode;
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
private String manageType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class RepairInputRecord {
|
|||
|
||||
@ApiModelProperty(value = "修饰待入库单号")
|
||||
@Excel(name = "修饰待入库单号")
|
||||
private String repairInputCode;
|
||||
private String inputCode;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
|
|
|||
|
|
@ -58,8 +58,11 @@ public class UseStorageInfo {
|
|||
private Date outTime;
|
||||
|
||||
@ApiModelProperty(value = "领料单号")
|
||||
@Excel(name = "领料单号")
|
||||
private String leaseCode;
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
@Excel(name = "工程名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ public interface BmQrBoxMapper {
|
|||
*/
|
||||
int updateBmQrcodeInfoByCode(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 根据二维码QR编码查询绑定的物资信息
|
||||
*/
|
||||
BmQrBoxInfo getMaInfoByQrCode(String qrCode);
|
||||
|
||||
/**
|
||||
* 修改标准箱状态 -- 增加绑定编码时调用
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -88,4 +88,12 @@ public interface ComplexQueryMapper {
|
|||
* @return
|
||||
*/
|
||||
List<PurchaseInputInfo> selectMaCodeByTaskIdAndTypeId(@Param("taskId") Long taskId, @Param("typeId") Integer typeId);
|
||||
|
||||
/**
|
||||
* 查询机具编码
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<StorageInfo> selectMaCodeByTypeId(StorageInfo bean);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,12 @@ public interface BmQrBoxService {
|
|||
*/
|
||||
AjaxResult updateBmQrcodeInfoByCode(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 通过QR_CODE 查询物资信息
|
||||
* @param qrCode 二维码编码
|
||||
*/
|
||||
AjaxResult getMaInfoByQrCode(String qrCode);
|
||||
|
||||
/**
|
||||
* APP - 扫码绑定物资
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.bonus.common.biz.enums.MaMachineStatusEnum;
|
|||
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
|
||||
import com.bonus.common.biz.enums.QrBoxStatusEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
||||
|
|
@ -149,7 +150,11 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
List<BmQrBoxInfo> boxBindList = bmQrBoxMapper.getBoxBindList(boxBindWarehouseDto.getBoxId());
|
||||
boxBindList.removeIf(Objects::isNull);
|
||||
boxBindList.removeIf(item -> item.getMaStatus() == null);
|
||||
boxBindList.removeIf(item -> !item.getMaStatus().equals(MaMachineStatusEnum.NEW_PURCHASE.getStatusName()));
|
||||
boxBindList.removeIf(item ->
|
||||
!item.getMaStatus().equals(MaMachineStatusEnum.NEW_PURCHASE.getStatusName()) &&
|
||||
!item.getMaStatus().equals(MaMachineStatusEnum.REPAIR_TO_STORE.getStatusName()) &&
|
||||
!item.getMaStatus().equals(MaMachineStatusEnum.BACK_TO_STORE.getStatusName())
|
||||
);
|
||||
boxBindList.removeIf(item -> item.getMaTypeId() == null || !Objects.equals(item.getMaTypeId(), boxBindWarehouseDto.getMaTypeId()));
|
||||
|
||||
|
||||
|
|
@ -159,19 +164,16 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "新购任务不存在此物资类型,请确认录入是否正确");
|
||||
}
|
||||
// 更新入库数量
|
||||
purchaseStorageMapper.updateNum(String.valueOf(purchaseDetailId), BigDecimal.valueOf(boxBindList.size()));
|
||||
purchaseStorageMapper.updateNum(purchaseDetailId, BigDecimal.valueOf(boxBindList.size()));
|
||||
// 更新物资类型库存数量
|
||||
purchaseStorageMapper.updateStorageNum(BigDecimal.valueOf(boxBindList.size()), Math.toIntExact(boxBindWarehouseDto.getMaTypeId()));
|
||||
// 更新物资设备状态
|
||||
boxBindList.forEach(item -> {
|
||||
item.setMaStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
|
||||
purchaseStorageMapper.updateMachineByCode(new PurchaseDto()
|
||||
.setMaCode(item.getMaCode())
|
||||
.setTypeId(Math.toIntExact(boxBindWarehouseDto.getMaTypeId()))
|
||||
);
|
||||
purchaseStorageMapper.updateMachineByCode(new PurchaseDto().setMaCode(item.getMaCode()).setTypeId(Math.toIntExact(boxBindWarehouseDto.getMaTypeId())));
|
||||
});
|
||||
// 更新新购验收明细状态
|
||||
purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Math.toIntExact(purchaseDetailId));
|
||||
purchaseStorageMapper.updateInputStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Math.toIntExact(purchaseDetailId));
|
||||
|
||||
// TODO 缺少修改TmTask表状态
|
||||
// ---------------- 返回前端 -------------------------------------
|
||||
|
|
@ -318,6 +320,19 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过QR_CODE 查询物资信息
|
||||
*
|
||||
* @param qrCode 二维码编码
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getMaInfoByQrCode(String qrCode) {
|
||||
if (StringUtils.isBlank(qrCode)) {
|
||||
return AjaxResult.error("二维码编码为空,请完善后重试!");
|
||||
}
|
||||
return AjaxResult.success(bmQrBoxMapper.getMaInfoByQrCode(qrCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP - 扫码绑定物资
|
||||
*
|
||||
|
|
@ -325,9 +340,8 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult addQrcodeBoxBind(BmQrBoxInfo bmQrBoxInfo) {
|
||||
if (bmQrBoxInfo.getBoxId() == null || bmQrBoxInfo.getQrCode() == null) {
|
||||
return AjaxResult.error("标准箱ID或QR编码为空,请完善后重试!");
|
||||
}
|
||||
if (bmQrBoxInfo.getBoxId() == null) {return AjaxResult.error("标准箱ID为空,请完善后重试!");}
|
||||
if (bmQrBoxInfo.getQrCode() == null) {return AjaxResult.error("QR编码为空,请完善后重试!");}
|
||||
|
||||
try {
|
||||
// 物资状态要求是待入库、在库状态
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
|
||||
import com.bonus.material.basic.domain.*;
|
||||
import com.bonus.material.basic.mapper.ComplexQueryMapper;
|
||||
import com.bonus.material.basic.service.ComplexQueryService;
|
||||
|
|
@ -278,6 +280,19 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
}
|
||||
}
|
||||
}
|
||||
// 查询在库具体编码code
|
||||
List<StorageInfo> codeList = complexQueryMapper.selectMaCodeByTypeId(bean);
|
||||
// 1. 创建一个 Set 存储 codeList 中的 typeId 和 maCode 的组合键
|
||||
Set<String> validCodes = codeList.stream()
|
||||
.filter(code -> code.getTypeId() != null && code.getMaCode() != null)
|
||||
.map(code -> code.getTypeId() + "-" + code.getMaCode())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(codeList) && CollectionUtil.isNotEmpty(list)) {
|
||||
list = list.stream()
|
||||
.filter(item -> validCodes.contains(item.getTypeId() + "-" + item.getMaCode()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bean.getKeyWord())) {
|
||||
String keyword = bean.getKeyWord();
|
||||
return list.stream().filter(item -> {
|
||||
|
|
@ -321,32 +336,46 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
public List<PurchaseInputInfo> getPurchaseRecordList(PurchaseInputInfo bean) {
|
||||
List<PurchaseInputInfo> recordList = complexQueryMapper.getPurchaseRecordList(bean);
|
||||
List<PurchaseInputInfo> tempList = new ArrayList<>();
|
||||
|
||||
Iterator<PurchaseInputInfo> iterator = recordList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
PurchaseInputInfo purchaseInputInfo = iterator.next();
|
||||
// 根据任务id和类型id查询未入库编码信息
|
||||
List<PurchaseInputInfo> maCodeList = complexQueryMapper.selectMaCodeByTaskIdAndTypeId(purchaseInputInfo.getTaskId(), bean.getTypeId());
|
||||
if (CollectionUtils.isNotEmpty(maCodeList)) {
|
||||
boolean addedPurchaseInputInfo = false;
|
||||
for (PurchaseInputInfo info : maCodeList) {
|
||||
if (purchaseInputInfo.getInputNum().compareTo(BigDecimal.valueOf(maCodeList.size())) > 0) {
|
||||
purchaseInputInfo.setInputNum(purchaseInputInfo.getInputNum().subtract(BigDecimal.valueOf(maCodeList.size())));
|
||||
String maCode = info.getMaCode();
|
||||
BeanUtils.copyProperties(purchaseInputInfo, info);
|
||||
info.setMaCode(maCode);
|
||||
info.setInputNum(BigDecimal.ONE);
|
||||
tempList.add(info);
|
||||
if (!addedPurchaseInputInfo) {
|
||||
tempList.add(purchaseInputInfo);
|
||||
addedPurchaseInputInfo = true;
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().toString().equals(recordList.get(0).getManageType())) {
|
||||
if (StringUtils.isNotBlank(bean.getKeyWord())) {
|
||||
String keyword = bean.getKeyWord();
|
||||
return recordList.stream().filter(item -> {
|
||||
return (StringUtils.isNotBlank(item.getCode()) && item.getCode().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getTypeName()) && item.getTypeName().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getTypeModelName()) && item.getTypeModelName().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getMaKeeper()) && item.getMaKeeper().contains(keyword));
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return recordList;
|
||||
} else {
|
||||
Iterator<PurchaseInputInfo> iterator = recordList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
PurchaseInputInfo purchaseInputInfo = iterator.next();
|
||||
// 根据任务id和类型id查询未入库编码信息
|
||||
List<PurchaseInputInfo> maCodeList = complexQueryMapper.selectMaCodeByTaskIdAndTypeId(purchaseInputInfo.getTaskId(), bean.getTypeId());
|
||||
if (CollectionUtils.isNotEmpty(maCodeList)) {
|
||||
boolean addedPurchaseInputInfo = false;
|
||||
for (PurchaseInputInfo info : maCodeList) {
|
||||
if (purchaseInputInfo.getInputNum().compareTo(BigDecimal.valueOf(maCodeList.size())) > 0) {
|
||||
purchaseInputInfo.setInputNum(purchaseInputInfo.getInputNum().subtract(BigDecimal.valueOf(maCodeList.size())));
|
||||
String maCode = info.getMaCode();
|
||||
BeanUtils.copyProperties(purchaseInputInfo, info);
|
||||
info.setMaCode(maCode);
|
||||
info.setInputNum(BigDecimal.ONE);
|
||||
tempList.add(info);
|
||||
if (!addedPurchaseInputInfo) {
|
||||
tempList.add(purchaseInputInfo);
|
||||
addedPurchaseInputInfo = true;
|
||||
}
|
||||
} else if (purchaseInputInfo.getInputNum().compareTo(BigDecimal.valueOf(maCodeList.size())) == 0) {
|
||||
String maCode = info.getMaCode();
|
||||
BeanUtils.copyProperties(purchaseInputInfo, info);
|
||||
info.setMaCode(maCode);
|
||||
info.setInputNum(BigDecimal.ONE);
|
||||
tempList.add(info);
|
||||
}
|
||||
}
|
||||
} else if (purchaseInputInfo.getInputNum().compareTo(BigDecimal.valueOf(maCodeList.size())) == 0) {
|
||||
String maCode = info.getMaCode();
|
||||
BeanUtils.copyProperties(purchaseInputInfo, info);
|
||||
info.setMaCode(maCode);
|
||||
info.setInputNum(BigDecimal.ONE);
|
||||
tempList.add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -357,6 +386,7 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
return (StringUtils.isNotBlank(item.getMaCode()) && item.getMaCode().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getTypeName()) && item.getTypeName().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getTypeModelName()) && item.getTypeModelName().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getCode()) && item.getCode().contains(keyword)) ||
|
||||
(StringUtils.isNotBlank(item.getMaKeeper()) && item.getMaKeeper().contains(keyword));
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package com.bonus.material.lease.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
|
|
@ -49,12 +46,10 @@ public class LeaseOutVo {
|
|||
private String holdingTime;
|
||||
|
||||
@ApiModelProperty("试验日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date testTime;
|
||||
private String testTime;
|
||||
|
||||
@ApiModelProperty("下次试验日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date nextTestTime;
|
||||
private String nextTestTime;
|
||||
|
||||
@ApiModelProperty("验收结论")
|
||||
private String checkResult;
|
||||
|
|
|
|||
|
|
@ -375,11 +375,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
String fileName = "施工机具设备出库检验记录表";
|
||||
String projectName = "";
|
||||
String unit = "";
|
||||
List<LeaseOutVo> list = new ArrayList<>();
|
||||
if (leaseApplyRequestVo != null && leaseApplyRequestVo.getLeaseApplyInfo() != null) {
|
||||
projectName ="领用工程:" + leaseApplyRequestVo.getLeaseApplyInfo().getProjectName();
|
||||
projectName ="领用工程:" + leaseApplyRequestVo.getLeaseApplyInfo().getLeaseProject();
|
||||
unit ="使用单位:" + leaseApplyRequestVo.getLeaseApplyInfo().getLeaseUnit();
|
||||
list = leaseApplyRequestVo.getLeaseOutVoList();
|
||||
}
|
||||
List<LeaseOutVo> list = leaseApplyRequestVo.getLeaseOutVoList();
|
||||
expOutExcel(response,list,fileName,projectName,unit);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class PurchaseBindController extends BaseController {
|
|||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("purchase:bind:add")
|
||||
@PostMapping("/bind")
|
||||
public AjaxResult bind(@RequestBody PurchaseDto dto) {
|
||||
public AjaxResult bind(@RequestBody @NotNull(message = "参数不能为空") PurchaseDto dto) {
|
||||
return purchaseBindService.bind(dto);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ public class PurchaseStorageController extends BaseController {
|
|||
|
||||
|
||||
@ApiOperation(value = "查询待绑定编号机具详情")
|
||||
@PreventRepeatSubmit
|
||||
// @RequiresPermissions("purchase:storage:query")
|
||||
@PostMapping("/getMachineById")
|
||||
public AjaxResult getMachineById(@RequestBody PurchaseDto dto) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.purchase.domain.vo;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.functions.Char;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -19,7 +20,7 @@ public class PurchaseVo {
|
|||
private Integer taskId;
|
||||
|
||||
@ApiModelProperty(value = "二级明细id")
|
||||
private String purchaseId;
|
||||
private Long purchaseId;
|
||||
|
||||
@ApiModelProperty(value="typeId")
|
||||
private Integer typeId;
|
||||
|
|
@ -112,6 +113,9 @@ public class PurchaseVo {
|
|||
@ApiModelProperty(value = "二维码路径")
|
||||
private String qrUrl;
|
||||
|
||||
@ApiModelProperty(value = "是否绑定")
|
||||
private Char isBind;
|
||||
|
||||
@ApiModelProperty(value = "异常数量")
|
||||
private BigDecimal exceptionNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ public interface PurchaseBindMapper {
|
|||
*/
|
||||
int add(PurchaseDto purchaseDto);
|
||||
|
||||
int bindMaCodeByQrCode(PurchaseDto purchaseDto);
|
||||
|
||||
/**
|
||||
* 查询二维码code
|
||||
* @param genMonth
|
||||
|
|
@ -80,7 +82,7 @@ public interface PurchaseBindMapper {
|
|||
* @param updatedStatus
|
||||
* @param purchaseId
|
||||
*/
|
||||
int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String purchaseId);
|
||||
int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") Long purchaseId);
|
||||
|
||||
/**
|
||||
* 更新数量
|
||||
|
|
@ -90,6 +92,8 @@ public interface PurchaseBindMapper {
|
|||
*/
|
||||
int updateNum(@Param("dto") PurchaseDto dto, @Param("num") int num);
|
||||
|
||||
int updateStatusWhereNum(@Param("dto") PurchaseDto dto);
|
||||
|
||||
/**
|
||||
* 根据id查询详情
|
||||
* @param purchaseDto
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public interface PurchaseStorageMapper {
|
|||
* @param bindNum
|
||||
* @return
|
||||
*/
|
||||
int updateNum(@Param("id") String purchaseId, @Param("bindNum") BigDecimal bindNum);
|
||||
int updateNum(@Param("id") Long purchaseId, @Param("bindNum") BigDecimal bindNum);
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
|
|
@ -44,6 +44,14 @@ public interface PurchaseStorageMapper {
|
|||
*/
|
||||
int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 更新入库状态
|
||||
* @param updatedStatus 要修改的状态
|
||||
* @param id 要修改的details表id
|
||||
* @return 修改条数
|
||||
*/
|
||||
int updateInputStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 新增机具入库记录
|
||||
* @param dto
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.purchase.config.RemoteConfig;
|
||||
import com.bonus.common.biz.domain.purchase.PurchaseDto;
|
||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||
import com.bonus.material.purchase.mapper.PurchaseBindMapper;
|
||||
import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper;
|
||||
import com.bonus.material.purchase.mapper.PurchaseStorageMapper;
|
||||
import com.bonus.material.purchase.service.IPurchaseBindService;
|
||||
import com.bonus.material.purchase.domain.vo.PurchaseVo;
|
||||
|
|
@ -48,6 +50,9 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
@Resource
|
||||
private PurchaseStorageMapper purchaseStorageMapper;
|
||||
|
||||
@Resource
|
||||
private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有绑定信息
|
||||
|
|
@ -119,7 +124,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
|
||||
/**
|
||||
* 绑定
|
||||
* @param dto
|
||||
* @param dto 绑定物资信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -137,45 +142,45 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
return AjaxResult.error(1114,"设备编码与库中重复,请勿重复添加");
|
||||
}
|
||||
}
|
||||
int result = 0;
|
||||
for (PurchaseDto purchaseDto : dto.getDtoList()) {
|
||||
purchaseDto.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
purchaseDto.setCreateTime(DateUtils.getNowDate());
|
||||
purchaseDto.setTaskId(dto.getTaskId());
|
||||
purchaseDto.setTypeId(dto.getTypeId());
|
||||
purchaseDto.setStatus(0);
|
||||
result += purchaseBindMapper.add(purchaseDto);
|
||||
result += purchaseStorageMapper.insertMachine(purchaseDto);
|
||||
purchaseDto.setCreateBy(SecurityUtils.getUserId().toString()).setCreateTime(DateUtils.getNowDate());
|
||||
purchaseDto.setTaskId(dto.getTaskId()).setTypeId(dto.getTypeId()).setStatus(0);
|
||||
if (purchaseDto.getQrCode() != null) {
|
||||
if (purchaseBindMapper.bindMaCodeByQrCode(purchaseDto) != 1) {
|
||||
return AjaxResult.error(1115,"绑定maCode时SQL执行失败!");
|
||||
}
|
||||
} else {
|
||||
if (dto.getTypeId() != null) {
|
||||
purchaseDto.setTypeId(dto.getTypeId());
|
||||
}
|
||||
purchaseBindMapper.insert(purchaseDto);
|
||||
}
|
||||
if (purchaseStorageMapper.insertMachine(purchaseDto) != 1) {
|
||||
return AjaxResult.error(1116,"插入maMachine时SQL执行失败!");
|
||||
}
|
||||
}
|
||||
//根据前端传参更新绑定数量
|
||||
result += purchaseBindMapper.updateNum(dto, dto.getDtoList().size());
|
||||
// 更新绑定数量,并刷新状态
|
||||
if (purchaseBindMapper.updateNum(dto, dto.getDtoList().size()) < 1) {
|
||||
return AjaxResult.error(1117,"更新绑定数量时SQL执行失败!");
|
||||
} else {
|
||||
purchaseBindMapper.updateStatusWhereNum(dto);
|
||||
}
|
||||
|
||||
//根据任务id和类型id查询状态
|
||||
List<PurchaseVo> voList = purchaseBindMapper.selectPurchaseCheckInfoById(dto);
|
||||
if (CollectionUtils.isNotEmpty(voList)) {
|
||||
for (PurchaseVo purchaseVo : voList) {
|
||||
if (purchaseVo.getBindNum().equals(purchaseVo.getCheckNum())) {
|
||||
if (purchaseVo.getBindNum().compareTo(purchaseVo.getCheckNum()) == 0) {
|
||||
purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_STORE.getStatus(), purchaseVo.getPurchaseId());
|
||||
}
|
||||
if (purchaseVo.getBindNum().compareTo(purchaseVo.getCheckNum()) <0 ) {
|
||||
} else if (purchaseVo.getBindNum().compareTo(purchaseVo.getCheckNum()) < 0) {
|
||||
purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND.getStatus(), purchaseVo.getPurchaseId());
|
||||
} else {
|
||||
// 抛出异常 执行回滚
|
||||
throw new RuntimeException("绑定数量大于验收数量,请重新绑定!");
|
||||
}
|
||||
}
|
||||
}
|
||||
// PurchaseDto purchaseDto = new PurchaseDto();
|
||||
// purchaseDto.setTaskId(dto.getTaskId());
|
||||
// List<PurchaseVo> list = purchaseBindMapper.getDetails(purchaseDto);
|
||||
// Map<Integer, List<Integer>> groupedByIdStatus = list.stream()
|
||||
// .collect(Collectors.groupingBy(
|
||||
// PurchaseVo::getTaskId,
|
||||
// Collectors.mapping(PurchaseVo::getStatus, Collectors.toList())
|
||||
// ));
|
||||
// result += groupedByIdStatus.entrySet().stream()
|
||||
// .mapToInt(entry -> updateTaskStatus(entry.getKey(), entry.getValue()))
|
||||
// .sum();
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("绑定成功");
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
return AjaxResult.success("绑定成功");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -249,7 +254,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
// 二级页面驳回
|
||||
String[] idList = dto.getPurchaseId().split(",");
|
||||
for (String purchaseId : idList) {
|
||||
result += purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus(), purchaseId);
|
||||
result += purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus(), Long.valueOf(purchaseId));
|
||||
}
|
||||
}
|
||||
if (result > 0) {
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -100,10 +97,6 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
public AjaxResult warehouse(PurchaseDto dto) {
|
||||
//内层入库
|
||||
return processByPurchaseIds(dto);
|
||||
/*if (dto.getTaskId() != null) {
|
||||
//外层入库
|
||||
return processByTaskIds(dto);
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -187,7 +180,7 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
details = purchaseBindMapper.getDetails(dto);
|
||||
for (PurchaseVo purchaseVo : details) {
|
||||
if (purchaseVo.getStatus().equals(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) || purchaseVo.getStatus().equals(PurchaseTaskStatusEnum.TO_STORE.getStatus())) {
|
||||
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus(), Integer.parseInt(purchaseVo.getPurchaseId()));
|
||||
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus(), Math.toIntExact(purchaseVo.getPurchaseId()));
|
||||
}
|
||||
}
|
||||
details = purchaseBindMapper.getDetails(dto);
|
||||
|
|
@ -222,7 +215,10 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
} else {
|
||||
//编码入库
|
||||
List<PurchaseVo> purchaseVoList = purchaseBindMapper.selectPurchaseCheckInfoById(purchaseDto);
|
||||
result += purchaseStorageMapper.updateNum(purchaseDto.getPurchaseId(), BigDecimal.valueOf(purchaseDto.getInPutList().size()));
|
||||
if (CollectionUtils.isEmpty(purchaseDto.getInPutList())) {
|
||||
purchaseDto.setInPutList(new ArrayList<>());
|
||||
}
|
||||
result += purchaseStorageMapper.updateNum(Long.valueOf(purchaseDto.getPurchaseId()), BigDecimal.valueOf(purchaseDto.getInPutList().size()));
|
||||
for (PurchaseDto dto : purchaseDto.getInPutList()) {
|
||||
if (CollectionUtils.isNotEmpty(purchaseVoList)) {
|
||||
for (PurchaseVo purchaseVo : purchaseVoList) {
|
||||
|
|
@ -233,13 +229,13 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
}
|
||||
}
|
||||
dto.setTypeId(purchaseDto.getTypeId());
|
||||
result += purchaseStorageMapper.updateMachineByCode(dto);
|
||||
purchaseStorageMapper.updateStorageNum(BigDecimal.ONE, dto.getTypeId());
|
||||
List<PurchaseCheckDetails> list = purchaseBindMapper.getMachineById(purchaseDto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
if (purchaseStorageMapper.updateMachineByCode(dto) < 1) {throw new RuntimeException("入库失败,更新物资入库状态0条");}
|
||||
if (purchaseStorageMapper.updateStorageNum(BigDecimal.ONE, dto.getTypeId()) < 1) {throw new RuntimeException("入库失败,库存增加0");}
|
||||
List<PurchaseCheckDetails> bindMaList = purchaseBindMapper.getMachineById(purchaseDto);
|
||||
if (CollectionUtils.isNotEmpty(bindMaList)) {
|
||||
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.TO_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId()));
|
||||
} else {
|
||||
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId()));
|
||||
result += purchaseStorageMapper.updateInputStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -325,7 +321,7 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
return details.stream()
|
||||
.mapToInt(detail -> {
|
||||
int result = purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getBindNum());
|
||||
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(detail.getPurchaseId()));
|
||||
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Math.toIntExact(detail.getPurchaseId()));
|
||||
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
|
||||
//根据类型id获取设备详情信息
|
||||
//result += purchaseStorageMapper.insertMachine(detail);
|
||||
|
|
|
|||
|
|
@ -562,7 +562,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
List<RepairInputDetails> inputList = new ArrayList<>();
|
||||
for (RepairAuditDetails details : repairAuditDetailsByQuery) {
|
||||
//修改机具状态
|
||||
repairAuditDetailsMapper.updateMachine(details);
|
||||
if (details.getMaId() != null) {
|
||||
repairAuditDetailsMapper.updateMachine(details);
|
||||
}
|
||||
RepairInputDetails inputVo = new RepairInputDetails();
|
||||
BeanUtils.copyProperties(details, inputVo);
|
||||
inputVo.setRepairNum(details.getRepairedNum());
|
||||
|
|
|
|||
|
|
@ -427,14 +427,10 @@ public class RepairServiceImpl implements RepairService {
|
|||
repairDeviceVOList.removeIf(Objects::isNull);
|
||||
|
||||
for (RepairDeviceVO bean : repairDeviceVOList) {
|
||||
if (bean.getManageType() == null) {
|
||||
throw new ServiceException("请选择物资管理方式");
|
||||
}
|
||||
if (bean.getManageType() == null) {throw new ServiceException("请选择物资管理方式");}
|
||||
if (Objects.equals(MaTypeManageTypeEnum.CODE_DEVICE.getTypeId(), bean.getManageType())) {
|
||||
// 物资管理方式--编码管理
|
||||
if (bean.getRepairType() == null) {
|
||||
continue;
|
||||
}
|
||||
if (bean.getRepairType() == null) {continue;}
|
||||
// 根据维修方式,更新维修数量、报废数量
|
||||
switch (bean.getRepairType()) {
|
||||
case INNER_REPAIR: {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bqb.box_code as boxCode,
|
||||
bqb.box_type as boxType,
|
||||
bqb.box_status as status,
|
||||
case bqb.box_status
|
||||
when '0' then '待创建'
|
||||
when '1' then '待录入'
|
||||
when '2' then '待移交'
|
||||
when '3' then '待接收'
|
||||
when '4' then '已接收'
|
||||
when '5' then '移交被驳回'
|
||||
else ''
|
||||
end as statusName,
|
||||
bqb.create_by as createBy,
|
||||
bqb.create_time as createTime,
|
||||
bqb.update_by as updateBy,
|
||||
|
|
@ -128,22 +137,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from bm_qrcode_box
|
||||
where box_id = #{boxId}
|
||||
delete from bm_qrcode_box where box_id = #{boxId}
|
||||
</delete>
|
||||
|
||||
<delete id="unBindQrcodeBox">
|
||||
delete
|
||||
from bm_qrcode_box_bind
|
||||
where id = #{id}
|
||||
delete from bm_qrcode_box_bind where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBoxBind">
|
||||
delete
|
||||
from bm_qrcode_box_bind
|
||||
where box_id = #{boxId}
|
||||
and ma_id = #{maId}
|
||||
delete from bm_qrcode_box_bind where box_id = #{boxId} and ma_id = #{maId}
|
||||
</delete>
|
||||
|
||||
<insert id="addQrcodeBoxBind">
|
||||
|
|
@ -218,4 +220,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bqb.box_code = #{boxCode} AND
|
||||
mt.type_id = #{maTypeId}
|
||||
</select>
|
||||
|
||||
<select id="getMaInfoByQrCode" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
|
||||
select
|
||||
bqi.id, bqi.qr_code, bqi.type_id as maTypeId, bqi.ma_code , mm.ma_id
|
||||
from
|
||||
bm_qrcode_info bqi
|
||||
left join
|
||||
ma_machine mm on bqi.type_id = mm.type_id and bqi.ma_code = mm.ma_code
|
||||
where
|
||||
bqi.del_flag is null or bqi.del_flag = '0'
|
||||
group by
|
||||
bqi.id limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -489,6 +489,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
WHERE IFNULL(pcd.check_num, 0) - IFNULL(pcd.input_num, 0) > 0
|
||||
and pcd.status in (3,4, 13,14)
|
||||
GROUP BY
|
||||
mt.type_id) AS subquery4 ON subquery4.type_id = mt.type_id
|
||||
LEFT JOIN (
|
||||
|
|
@ -552,14 +553,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeId != null">
|
||||
AND bs.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
mt1.type_name like concat('%',#{keyWord},'%') or
|
||||
mt.type_name like concat('%',#{keyWord},'%') or
|
||||
bs.creator like concat('%',#{keyWord},'%') or
|
||||
su.nick_name like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY bs.ma_code, mt.type_id, mt1.type_name, mt.type_name, bs.ma_code,
|
||||
bs.in_num, bs.creator, bs.create_time, tt.CODE, mt.buy_price
|
||||
</select>
|
||||
|
|
@ -571,7 +564,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.buy_price AS buyPrice,
|
||||
sai.num AS usNum,
|
||||
mm.ma_code AS maCode,
|
||||
lai.`code` AS leaseCode,
|
||||
lai.`code` AS code,
|
||||
bp.pro_name AS projectName,
|
||||
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper,
|
||||
lod.create_by AS creator,
|
||||
lod.create_time AS outTime
|
||||
|
|
@ -583,6 +577,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN ( SELECT parent_id, create_time, create_by FROM lease_out_details GROUP BY parent_id, create_by ) AS lod ON lod.parent_id = lai.id
|
||||
WHERE
|
||||
sai.end_time IS NULL
|
||||
|
|
@ -597,7 +593,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mm.ma_code like concat('%',#{keyWord},'%') or
|
||||
lai.`code` like concat('%',#{keyWord},'%') or
|
||||
lod.create_by like concat('%',#{keyWord},'%') or
|
||||
su.nick_name like concat('%',#{keyWord},'%')
|
||||
su.nick_name like concat('%',#{keyWord},'%') or
|
||||
bp.pro_name like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY mm.ma_code,lai.`code`,mt.type_id
|
||||
|
|
@ -648,9 +645,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) AS inputNum,
|
||||
tt.`code` AS purchaseCode,
|
||||
tt.`code` AS code,
|
||||
GROUP_CONCAT( DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ' ) AS maKeeper,
|
||||
pcd.check_time AS checkTime
|
||||
pcd.check_time AS checkTime,
|
||||
mt.manage_type as manageType
|
||||
FROM
|
||||
purchase_check_details pcd
|
||||
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
|
||||
|
|
@ -673,7 +671,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) AS repairInputNum,
|
||||
tt.`code` AS repairInputCode,
|
||||
tt.`code` AS inputCode,
|
||||
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper,
|
||||
GROUP_CONCAT(DISTINCT su2.nick_name ORDER BY su2.nick_name SEPARATOR ', ') AS repairer,
|
||||
rid.create_time as repairInputTime,
|
||||
|
|
@ -723,4 +721,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND pmi.ma_code IS NOT NULL
|
||||
</select>
|
||||
|
||||
<select id="selectMaCodeByTypeId" resultType="com.bonus.material.basic.domain.StorageInfo">
|
||||
SELECT
|
||||
type_id as typeId,
|
||||
ma_code as maCode
|
||||
FROM
|
||||
ma_machine
|
||||
WHERE
|
||||
ma_status = '1' and type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -280,10 +280,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.rated_load AS ratedLoad,
|
||||
mt.test_load AS testLoad,
|
||||
mt.holding_time AS holdingTime,
|
||||
lod.create_time AS testTime,
|
||||
DATE(lod.create_time) AS testTime,
|
||||
pcd.check_result AS checkResult,
|
||||
lad.remark AS remark,
|
||||
DATE_SUB(DATE_ADD(lod.create_time, INTERVAL 1 YEAR), INTERVAL 1 DAY) AS nextTestTime -- 计算 nextTestTime
|
||||
DATE(DATE_SUB(DATE_ADD(lod.create_time, INTERVAL 1 YEAR), INTERVAL 1 DAY)) AS nextTestTime -- 计算 nextTestTime
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id AND mt.del_flag = '0'
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeId != null">
|
||||
type_id,
|
||||
</if>
|
||||
<if test="maCode != null">
|
||||
ma_code,
|
||||
</if>
|
||||
<if test="qrUrl != null">
|
||||
qr_url,
|
||||
</if>
|
||||
|
|
@ -71,6 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeId != null">
|
||||
#{typeId},
|
||||
</if>
|
||||
<if test="maCode != null">
|
||||
#{maCode},
|
||||
</if>
|
||||
<if test="qrUrl != null">
|
||||
#{qrUrl},
|
||||
</if>
|
||||
|
|
@ -88,10 +94,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<update id="updateNum">
|
||||
UPDATE purchase_check_details
|
||||
SET bind_num = COALESCE(bind_num, 0) + COALESCE(#{num}, 0)
|
||||
WHERE task_id = #{dto.taskId}
|
||||
AND type_id = #{dto.typeId}
|
||||
AND #{num} IS NOT NULL
|
||||
SET bind_num = IFNULL(bind_num, 0) + IFNULL(#{num}, 0)
|
||||
WHERE task_id = #{dto.taskId} AND type_id = #{dto.typeId} AND #{num} IS NOT NULL
|
||||
</update>
|
||||
|
||||
<update id="updateStatusWhereNum">
|
||||
UPDATE purchase_check_details
|
||||
SET `status` = IF(IFNULL(check_num, 0) = IFNULL(bind_num, 0), '4', `status`)
|
||||
WHERE task_id = #{dto.taskId} AND type_id = #{dto.typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateStatusById">
|
||||
|
|
@ -175,12 +185,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
pcd.status AS status
|
||||
FROM
|
||||
bm_qrcode_info pm
|
||||
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id
|
||||
AND pm.type_id = pcd.type_id
|
||||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id AND pm.type_id = pcd.type_id
|
||||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
WHERE
|
||||
1=1 and pm.qr_code IS NULL
|
||||
pm.qr_code IS NULL
|
||||
<if test="taskId != null">
|
||||
AND pm.task_id = #{taskId}
|
||||
</if>
|
||||
|
|
@ -313,24 +322,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getMachineById" resultType="com.bonus.material.purchase.domain.PurchaseCheckDetails">
|
||||
SELECT
|
||||
pmi.id as id,
|
||||
pmi.task_id as taskId,
|
||||
pmi.type_id as typeId,
|
||||
pmi.ma_code as maCode
|
||||
pmi.id as id,pmi.task_id as taskId,pmi.type_id as typeId,pmi.ma_code as maCode
|
||||
FROM
|
||||
bm_qrcode_info pmi
|
||||
LEFT JOIN ma_machine mm ON pmi.ma_code = mm.ma_code AND mm.type_id = #{typeId}
|
||||
LEFT JOIN
|
||||
ma_machine mm ON pmi.ma_code = mm.ma_code AND mm.type_id = #{typeId}
|
||||
WHERE
|
||||
pmi.task_id = #{taskId}
|
||||
AND pmi.type_id = #{typeId}
|
||||
AND mm.ma_status = '0'
|
||||
pmi.task_id = #{taskId} AND pmi.type_id = #{typeId} AND (mm.ma_status = '0' or mm.ma_status = '5' or mm.ma_status = '9' )
|
||||
AND pmi.ma_code IS NOT NULL
|
||||
group by
|
||||
pmi.id
|
||||
</select>
|
||||
|
||||
<select id="getTypeByQrcode" resultType="com.bonus.material.purchase.domain.vo.PurchaseVo">
|
||||
SELECT
|
||||
bqi.qr_code as qrCode,
|
||||
bqi.type_id as typeId
|
||||
bqi.qr_code as qrCode, bqi.type_id as typeId, bqi.ma_code as maCode, bqi.task_id as taskId, bqi.is_bind as isBind
|
||||
FROM
|
||||
bm_qrcode_info bqi
|
||||
WHERE
|
||||
|
|
@ -339,32 +345,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectPurchaseCheckDetailsById" resultType="com.bonus.material.purchase.domain.vo.PurchaseVo">
|
||||
SELECT
|
||||
pm.task_id AS taskId,
|
||||
pcd.id AS purchaseId,
|
||||
mt1.type_name AS materialName,
|
||||
mt.type_name AS materialModel,
|
||||
pm.ma_code AS maCode,
|
||||
pm.create_by AS createBy,
|
||||
pm.create_time AS createTime,
|
||||
pm.type_id AS typeId,
|
||||
pm.out_fac_code AS outFacCode,
|
||||
pcd.production_time AS productDate,
|
||||
pm.qr_code AS qrCode,
|
||||
pm.qr_url AS qrUrl,
|
||||
pcd.check_num AS purchaseNum,
|
||||
pcd.check_num AS checkNum,
|
||||
pcd.bind_num AS bindNum,
|
||||
pcd.status AS status
|
||||
pm.task_id AS taskId,
|
||||
pcd.id AS purchaseId,
|
||||
mt1.type_name AS materialName,
|
||||
mt.type_name AS materialModel,
|
||||
pm.ma_code AS maCode,
|
||||
pm.create_by AS createBy,
|
||||
pm.create_time AS createTime,
|
||||
pm.type_id AS typeId,
|
||||
pm.out_fac_code AS outFacCode,
|
||||
pcd.production_time AS productDate,
|
||||
pm.qr_code AS qrCode,
|
||||
pm.qr_url AS qrUrl,
|
||||
pcd.check_num AS purchaseNum,
|
||||
pcd.check_num AS checkNum,
|
||||
pcd.bind_num AS bindNum,
|
||||
pcd.status AS status
|
||||
FROM
|
||||
bm_qrcode_info pm
|
||||
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id
|
||||
AND pm.type_id = pcd.type_id
|
||||
bm_qrcode_info pm
|
||||
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id AND pm.type_id = pcd.type_id
|
||||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
WHERE
|
||||
1=1 and pm.qr_code IS NOT NULL
|
||||
<if test="purchaseId != null">
|
||||
AND pcd.id = #{purchaseId}
|
||||
</if>
|
||||
pm.qr_code IS NOT NULL
|
||||
<if test="purchaseId != null">
|
||||
AND pcd.id = #{purchaseId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="bindMaCodeByQrCode">
|
||||
update bm_qrcode_info set ma_code = #{maCode}, is_bind = 1
|
||||
where
|
||||
qr_code = #{qrCode}
|
||||
and status != '1'
|
||||
and is_bind != '1'
|
||||
and ma_code is null
|
||||
and del_flag = '0'
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="bindNum != null">bind_num = #{bindNum},</if>
|
||||
<if test="checkResult != null">check_result = #{checkResult},</if>
|
||||
<if test="supplierId != null">supplier_id = #{supplierId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="status != null">`status` = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="productionTime != null">production_time = #{productionTime},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
|
|
|
|||
|
|
@ -28,32 +28,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<update id="updateNum">
|
||||
UPDATE purchase_check_details
|
||||
SET input_num = COALESCE(input_num, 0) + #{bindNum},
|
||||
input_time = now()
|
||||
WHERE
|
||||
id = #{id}
|
||||
SET input_num = ifnull(input_num, 0) + ifnull(#{bindNum},0),input_time = now()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStatusById">
|
||||
UPDATE purchase_check_details
|
||||
SET `status` = #{updatedStatus}
|
||||
WHERE
|
||||
id = #{id}
|
||||
SET `status` = #{updatedStatus}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateInputStatusById">
|
||||
UPDATE purchase_check_details SET `status` = if(bind_num = input_num, #{updatedStatus}, `status`) WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStorageNum">
|
||||
UPDATE ma_type
|
||||
SET storage_num = #{inputNum} + IFNULL(storage_num, 0)
|
||||
WHERE
|
||||
type_id = #{typeId}
|
||||
UPDATE ma_type SET storage_num = ifnull(#{inputNum},0) + ifnull(storage_num, 0) WHERE type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateMachineByCode">
|
||||
UPDATE ma_machine
|
||||
SET ma_status = 1
|
||||
WHERE
|
||||
ma_code = #{maCode}
|
||||
and type_id = #{typeId}
|
||||
UPDATE ma_machine SET ma_status = 1 WHERE ma_code = #{maCode} and type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<select id="selectAll" resultType="com.bonus.material.purchase.domain.vo.PurchaseVo">
|
||||
|
|
|
|||
|
|
@ -510,13 +510,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<update id="updateMachine">
|
||||
UPDATE ma_machine
|
||||
SET ma_status = '5'
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="maId != null">
|
||||
and ma_id = #{maId}
|
||||
</if>
|
||||
UPDATE ma_machine SET ma_status = '5' WHERE ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<select id="getPartDetailsByTaskId" resultType="com.bonus.material.repair.domain.RepairPart">
|
||||
|
|
|
|||
|
|
@ -62,29 +62,25 @@
|
|||
|
||||
<update id="updateRepairedNumAndStatus">
|
||||
update repair_apply_details
|
||||
set repaired_num = #{repairNum},
|
||||
status = #{status},
|
||||
repairer = #{repairer},
|
||||
update_by = #{userId},
|
||||
update_time = now()
|
||||
where id = #{id}
|
||||
set repaired_num = ifnull(repaired_num,0) + #{repairNum},
|
||||
status = #{status},repairer = #{repairer},update_by = #{userId},update_time = now()
|
||||
where
|
||||
id = #{id}
|
||||
and (ifnull(repaired_num,0) + #{repairNum}) <= repair_num
|
||||
</update>
|
||||
|
||||
<update id="updateRepairedNumTwo">
|
||||
update repair_apply_details
|
||||
set repaired_num = #{repairNum},
|
||||
update_by = #{userId},
|
||||
update_time = now()
|
||||
set repaired_num = ifnull(repaired_num,0) + #{repairNum},update_by = #{userId},update_time = now()
|
||||
where id = #{id}
|
||||
and (ifnull(repaired_num,0) + #{repairNum}) <= repair_num
|
||||
</update>
|
||||
|
||||
<update id="updateRepairedNumTwoAndStatus">
|
||||
update repair_apply_details
|
||||
set repaired_num = #{repairNum},
|
||||
status = #{status},
|
||||
update_by = #{userId},
|
||||
update_time = now()
|
||||
set repaired_num = #{repairNum},status = #{status},update_by = #{userId},update_time = now()
|
||||
where id = #{id}
|
||||
and (ifnull(repaired_num,0) + #{repairNum}) <= repair_num
|
||||
</update>
|
||||
|
||||
<update id="updateScrapNum">
|
||||
|
|
|
|||
Loading…
Reference in New Issue