fix:1、修改模具出库,模具入库,维修项目,维修单,点检任务模具为模具组。2、添加设备台账及模具组维修单list接口。3、修改上下模相关接口

main
HuangHuiKang 2 weeks ago
parent 30c071de31
commit ce82871a5f

@ -61,6 +61,9 @@ public class MoldBrandRespVO {
@ExcelProperty("当前设备") @ExcelProperty("当前设备")
private String deviceName; private String deviceName;
@Schema(description = "子模数", example = "0")
private Long childMoldCount;
@Schema(description = "产品ID列表") @Schema(description = "产品ID列表")
private List<Long> productIds; private List<Long> productIds;
@ -105,4 +108,8 @@ public class MoldBrandRespVO {
@Schema(description = "二维码", example = "") @Schema(description = "二维码", example = "")
private String qrCodeUrl; private String qrCodeUrl;
@Schema(description = "打印模板", example = "")
private String templateJson;
} }

@ -16,10 +16,7 @@ import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
@ -199,4 +196,6 @@ public interface MoldBrandService {
List<MoldBrandTreeRespVO> getMoldBrandTree(); List<MoldBrandTreeRespVO> getMoldBrandTree();
void regenerateCode(Long id, String code) throws UnsupportedEncodingException; void regenerateCode(Long id, String code) throws UnsupportedEncodingException;
List<MoldBrandDO> validMoldList(Set<Long> longs);
} }

@ -252,6 +252,9 @@ public class MoldBrandServiceImpl implements MoldBrandService {
return Collections.emptyList(); return Collections.emptyList();
} }
String template = moldMapper.selectPrintTemplate();
Map<Long, Long> childMoldCountMap = getChildMoldCountMap(convertSet(list, MoldBrandDO::getId));
List<MoldBrandProductDO> relations = moldBrandProductMapper.selectListByBrandIds(convertSet(list, MoldBrandDO::getId)); List<MoldBrandProductDO> relations = moldBrandProductMapper.selectListByBrandIds(convertSet(list, MoldBrandDO::getId));
Map<Long, List<MoldBrandProductDO>> relationMap = relations.stream() Map<Long, List<MoldBrandProductDO>> relationMap = relations.stream()
.collect(Collectors.groupingBy(MoldBrandProductDO::getBrandId)); .collect(Collectors.groupingBy(MoldBrandProductDO::getBrandId));
@ -264,6 +267,8 @@ public class MoldBrandServiceImpl implements MoldBrandService {
} }
String qrcodeUrl = qrcodeService.selectQrcodeUrlByIdAndCode(QrcodeBizTypeEnum.MOLD.getCode(),item.getId(),item.getCode()); String qrcodeUrl = qrcodeService.selectQrcodeUrlByIdAndCode(QrcodeBizTypeEnum.MOLD.getCode(),item.getId(),item.getCode());
item.setQrCodeUrl(qrcodeUrl); item.setQrCodeUrl(qrcodeUrl);
item.setChildMoldCount(childMoldCountMap.getOrDefault(item.getId(), 0L));
item.setTemplateJson(template);
MapUtils.findAndThen(map, item.getProductId(), MapUtils.findAndThen(map, item.getProductId(),
product -> item.setProductName(product.getName())); product -> item.setProductName(product.getName()));
@ -303,6 +308,21 @@ public class MoldBrandServiceImpl implements MoldBrandService {
}); });
} }
private Map<Long, Long> getChildMoldCountMap(Collection<Long> brandIds) {
if (CollUtil.isEmpty(brandIds)) {
return Collections.emptyMap();
}
List<MoldDO> moldList = moldMapper.selectList(new LambdaQueryWrapperX<MoldDO>()
.in(MoldDO::getBrandId, brandIds)
.select(MoldDO::getBrandId));
if (CollUtil.isEmpty(moldList)) {
return Collections.emptyMap();
}
return moldList.stream()
.filter(mold -> mold.getBrandId() != null)
.collect(Collectors.groupingBy(MoldDO::getBrandId, Collectors.counting()));
}
private Map<Long, MoldOperateSimpleDO> getLatestOperateMapByBrandIds(Collection<Long> brandIds) { private Map<Long, MoldOperateSimpleDO> getLatestOperateMapByBrandIds(Collection<Long> brandIds) {
if (CollUtil.isEmpty(brandIds)) { if (CollUtil.isEmpty(brandIds)) {
return Collections.emptyMap(); return Collections.emptyMap();
@ -740,6 +760,14 @@ public class MoldBrandServiceImpl implements MoldBrandService {
} }
@Override
public List<MoldBrandDO> validMoldList(Set<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return Collections.emptyList();
}
return moldBrandMapper.selectBatchIds(ids);
}
/** /**
* *
*/ */

@ -5,9 +5,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.common.controller.admin.mold.vo.MoldSaveReqVO; import cn.iocoder.yudao.module.common.controller.admin.mold.vo.MoldSaveReqVO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
@ -18,6 +20,7 @@ import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpStockMapper;
import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO; import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus; import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum; import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService;
import cn.iocoder.yudao.module.erp.service.mold.MoldService; import cn.iocoder.yudao.module.erp.service.mold.MoldService;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService; import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
@ -66,8 +69,8 @@ public class ErpStockInServiceImpl implements ErpStockInService {
private ErpSupplierService supplierService; private ErpSupplierService supplierService;
@Resource @Resource
private ErpStockRecordService stockRecordService; private ErpStockRecordService stockRecordService;
@Resource
private MoldBrandService moldBrandService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -195,15 +198,18 @@ public class ErpStockInServiceImpl implements ErpStockInService {
private List<ErpStockInItemDO> validateStockInItems(List<ErpStockInSaveReqVO.Item> list,String outType) { private List<ErpStockInItemDO> validateStockInItems(List<ErpStockInSaveReqVO.Item> list,String outType) {
if (Objects.equals(outType, "模具入库")) { if (Objects.equals(outType, "模具入库")) {
// 1.1 校验模具存在 // 1.1 校验模具存在
List<MoldDO> moldList = moldService.validMoldList( // List<MoldDO> moldList = moldService.validMoldList(
// convertSet(list, ErpStockInSaveReqVO.Item::getProductId));
// Map<Long, MoldDO> moldMap = convertMap(moldList, MoldDO::getId);
List<MoldBrandDO> moldList = moldBrandService.validMoldList(
convertSet(list, ErpStockInSaveReqVO.Item::getProductId)); convertSet(list, ErpStockInSaveReqVO.Item::getProductId));
Map<Long, MoldDO> moldMap = convertMap(moldList, MoldDO::getId); Map<Long, MoldBrandDO> moldMap = convertMap(moldList, MoldBrandDO::getId);
// 1.2 校验仓库存在 // 1.2 校验仓库存在
// warehouseService.validWarehouseList(convertSet( // warehouseService.validWarehouseList(convertSet(
// list, ErpStockInSaveReqVO.Item::getWarehouseId)); // list, ErpStockInSaveReqVO.Item::getWarehouseId));
// 2. 转化为 ErpStockInItemDO 列表 // 2. 转化为 ErpStockInItemDO 列表
return convertList(list, o -> BeanUtils.toBean(o, ErpStockInItemDO.class, item -> item return convertList(list, o -> BeanUtils.toBean(o, ErpStockInItemDO.class, item -> item
.setProductUnitId(moldMap.get(item.getProductId()).getUnitId()) // .setProductUnitId(moldMap.get(item.getProductId()).getUnitId())
.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount())))); .setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount()))));
} else { } else {

@ -5,6 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.common.controller.admin.mold.vo.MoldSaveReqVO; import cn.iocoder.yudao.module.common.controller.admin.mold.vo.MoldSaveReqVO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO;
@ -18,6 +20,7 @@ import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpStockOutMapper;
import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO; import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus; import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum; import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService;
import cn.iocoder.yudao.module.erp.service.mold.MoldService; import cn.iocoder.yudao.module.erp.service.mold.MoldService;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService; import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
@ -59,7 +62,8 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
private ErpProductService productService; private ErpProductService productService;
@Resource @Resource
private MoldService moldService; private MoldService moldService;
@Resource
private MoldBrandService moldBrandService;
@Resource @Resource
private ErpWarehouseService warehouseService; private ErpWarehouseService warehouseService;
@Resource @Resource
@ -181,14 +185,14 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
private List<ErpStockOutItemDO> validateStockOutItems(List<ErpStockOutSaveReqVO.Item> list,String outType) { private List<ErpStockOutItemDO> validateStockOutItems(List<ErpStockOutSaveReqVO.Item> list,String outType) {
if (Objects.equals(outType, "模具出库")) { if (Objects.equals(outType, "模具出库")) {
// 1.1 校验模具存在 // 1.1 校验模具存在
List<MoldDO> moldList = moldService.validMoldList( List<MoldBrandDO> moldList = moldBrandService.validMoldList(
convertSet(list, ErpStockOutSaveReqVO.Item::getProductId)); convertSet(list, ErpStockOutSaveReqVO.Item::getProductId));
Map<Long, MoldDO> moldMap = convertMap(moldList, MoldDO::getId); Map<Long, MoldBrandDO> moldMap = convertMap(moldList, MoldBrandDO::getId);
// 1.2 校验仓库存在 // 1.2 校验仓库存在
// warehouseService.validWarehouseList(convertSet(list, ErpStockOutSaveReqVO.Item::getWarehouseId)); // warehouseService.validWarehouseList(convertSet(list, ErpStockOutSaveReqVO.Item::getWarehouseId));
// 2. 转化为 ErpStockOutItemDO 列表 // 2. 转化为 ErpStockOutItemDO 列表
return convertList(list, o -> BeanUtils.toBean(o, ErpStockOutItemDO.class, item -> item return convertList(list, o -> BeanUtils.toBean(o, ErpStockOutItemDO.class, item -> item
.setProductUnitId(moldMap.get(item.getProductId()).getUnitId()) // .setProductUnitId(moldMap.get(item.getProductId()).getUnitId())
.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount())))); .setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount()))));
} else { } else {
// 1.1 校验产品存在 // 1.1 校验产品存在

@ -95,6 +95,16 @@ public class DvRepairController {
return success(buildCreatorName(dvRepairRespVOPageResult)); return success(buildCreatorName(dvRepairRespVOPageResult));
} }
@GetMapping("/list")
@Operation(summary = "获得设备维修记录列表")
@PreAuthorize("@ss.hasPermission('mes:dv-repair:query')")
public CommonResult<List<DvRepairRespVO>> getDvRepairList(@Valid DvRepairPageReqVO pageReqVO) {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DvRepairDO> list = dvRepairService.getDvRepairPage(pageReqVO).getList();
List<DvRepairRespVO> dvRepairRespVOList = BeanUtils.toBean(list, DvRepairRespVO.class);
return success(buildCreatorName(dvRepairRespVOList));
}
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出设备维修记录 Excel") @Operation(summary = "导出设备维修记录 Excel")
@PreAuthorize("@ss.hasPermission('mes:dv-repair:export')") @PreAuthorize("@ss.hasPermission('mes:dv-repair:export')")
@ -228,4 +238,23 @@ public class DvRepairController {
return dvSubjectRespVOPageResult; return dvSubjectRespVOPageResult;
} }
private List<DvRepairRespVO> buildCreatorName(List<DvRepairRespVO> dvRepairRespVOList) {
for (DvRepairRespVO dvRepairRespVO : dvRepairRespVOList) {
if (dvRepairRespVO.getAcceptedBy() != null) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(dvRepairRespVO.getAcceptedBy()));
if (user != null) {
dvRepairRespVO.setAcceptedBy("(" + user.getUsername() + ")" + user.getNickname());
}
}
if (dvRepairRespVO.getConfirmBy() != null) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(dvRepairRespVO.getConfirmBy()));
if (user != null) {
dvRepairRespVO.setConfirmBy("(" + user.getUsername() + ")" + user.getNickname());
}
}
}
return dvRepairRespVOList;
}
} }

@ -75,43 +75,43 @@ public class MoldOperateController {
@Operation(summary = "创建模具上下模") @Operation(summary = "创建模具上下模")
@PreAuthorize("@ss.hasPermission('mes:mold-operate:create')") @PreAuthorize("@ss.hasPermission('mes:mold-operate:create')")
public CommonResult<Long> createMoldOperate(@Valid @RequestBody MoldOperateSaveReqVO createReqVO) { public CommonResult<Long> createMoldOperate(@Valid @RequestBody MoldOperateSaveReqVO createReqVO) {
createReqVO.setUserId(getLoginUserId()); // createReqVO.setUserId(getLoginUserId());
if (createReqVO.getOperateTime() == null) { // if (createReqVO.getOperateTime() == null) {
createReqVO.setOperateTime(LocalDateTime.now()); // createReqVO.setOperateTime(LocalDateTime.now());
} // }
//
if (Objects.equals(createReqVO.getOperateType(), "1")) { // if (Objects.equals(createReqVO.getOperateType(), "1")) {
DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(createReqVO.getDeviceId()); // DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(createReqVO.getDeviceId());
List<Long> idList = Arrays.stream(createReqVO.getMoldId().split(",")) // List<Long> idList = Arrays.stream(createReqVO.getMoldId().split(","))
.map(String::trim) // .map(String::trim)
.map(Long::valueOf) // .map(Long::valueOf)
.collect(Collectors.toList()); // .collect(Collectors.toList());
for (Long id : idList) { // for (Long id : idList) {
MoldDO moldDO = moldService.getMold(id); // MoldDO moldDO = moldService.getMold(id);
moldDO.setMachineId(createReqVO.getDeviceId()); // moldDO.setMachineId(createReqVO.getDeviceId());
moldDO.setMachineName(deviceLedger.getDeviceName()); // moldDO.setMachineName(deviceLedger.getDeviceName());
moldDO.setStatus(0); // moldDO.setStatus(0);
moldService.updateMold(BeanUtils.toBean(moldDO, MoldSaveReqVO.class)); // moldService.updateMold(BeanUtils.toBean(moldDO, MoldSaveReqVO.class));
} // }
deviceLedger.setMoldId(createReqVO.getMoldId()); // deviceLedger.setMoldId(createReqVO.getMoldId());
deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedger, DeviceLedgerSaveReqVO.class)); // deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedger, DeviceLedgerSaveReqVO.class));
} else { // } else {
List<Long> lowerMoldId = Arrays.stream(createReqVO.getLowerMoldId().split(",")) // List<Long> lowerMoldId = Arrays.stream(createReqVO.getLowerMoldId().split(","))
.map(String::trim) // .map(String::trim)
.map(Long::valueOf) // .map(Long::valueOf)
.collect(Collectors.toList()); // .collect(Collectors.toList());
for (Long id : lowerMoldId) { // for (Long id : lowerMoldId) {
MoldDO moldDO = moldService.getMold(id); // MoldDO moldDO = moldService.getMold(id);
moldDO.setMachineId(0L); // moldDO.setMachineId(0L);
moldDO.setMachineName(""); // moldDO.setMachineName("");
moldDO.setStatus(3); // moldDO.setStatus(3);
moldService.updateMold(BeanUtils.toBean(moldDO, MoldSaveReqVO.class)); // moldService.updateMold(BeanUtils.toBean(moldDO, MoldSaveReqVO.class));
} // }
//
DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(createReqVO.getDeviceId()); // DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(createReqVO.getDeviceId());
deviceLedger.setMoldId(createReqVO.getMoldId()); // deviceLedger.setMoldId(createReqVO.getMoldId());
deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedger, DeviceLedgerSaveReqVO.class)); // deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedger, DeviceLedgerSaveReqVO.class));
} // }
return success(moldOperateService.createMoldOperate(createReqVO)); return success(moldOperateService.createMoldOperate(createReqVO));
} }
@ -119,10 +119,7 @@ public class MoldOperateController {
@Operation(summary = "更新模具上下模") @Operation(summary = "更新模具上下模")
@PreAuthorize("@ss.hasPermission('mes:mold-operate:update')") @PreAuthorize("@ss.hasPermission('mes:mold-operate:update')")
public CommonResult<Boolean> updateMoldOperate(@Valid @RequestBody MoldOperateSaveReqVO updateReqVO) { public CommonResult<Boolean> updateMoldOperate(@Valid @RequestBody MoldOperateSaveReqVO updateReqVO) {
updateReqVO.setUserId(getLoginUserId()); //
if (updateReqVO.getOperateTime() == null) {
updateReqVO.setOperateTime(LocalDateTime.now());
}
moldOperateService.updateMoldOperate(updateReqVO); moldOperateService.updateMoldOperate(updateReqVO);
return success(true); return success(true);
} }
@ -156,8 +153,8 @@ public class MoldOperateController {
Set<Long> creatorIds = new HashSet<>(); Set<Long> creatorIds = new HashSet<>();
Set<Long> operateUserIds = new HashSet<>(); Set<Long> operateUserIds = new HashSet<>();
for (MoldOperateDO item : pageResult.getList()) { for (MoldOperateDO item : pageResult.getList()) {
if (item.getUserId() != null) { if (item.getOperatorId() != null) {
operateUserIds.add(item.getUserId()); operateUserIds.add(item.getOperatorId());
} }
if (StringUtils.hasText(item.getCreator())) { if (StringUtils.hasText(item.getCreator())) {
creatorIds.add(Long.valueOf(item.getCreator())); creatorIds.add(Long.valueOf(item.getCreator()));
@ -170,7 +167,7 @@ public class MoldOperateController {
if (StringUtils.hasText(item.getCreator())) { if (StringUtils.hasText(item.getCreator())) {
MapUtils.findAndThen(creatorMap, Long.valueOf(item.getCreator()), user -> item.setCreatorName(user.getNickname())); MapUtils.findAndThen(creatorMap, Long.valueOf(item.getCreator()), user -> item.setCreatorName(user.getNickname()));
} }
MapUtils.findAndThen(operateUserMap, item.getUserId(), user -> item.setUserName(user.getNickname())); MapUtils.findAndThen(operateUserMap, item.getOperatorId(), user -> item.setOperatorName(user.getNickname()));
})); }));
} }
@ -185,13 +182,13 @@ public class MoldOperateController {
Set<Long> operateUserIds = new HashSet<>(); Set<Long> operateUserIds = new HashSet<>();
for (MoldOperateDO item : list) { for (MoldOperateDO item : list) {
if (item.getUserId() != null) { if (item.getOperatorId() != null) {
operateUserIds.add(item.getUserId()); operateUserIds.add(item.getOperatorId());
} }
} }
Map<Long, AdminUserRespDTO> operateUserMap = adminUserApi.getUserMap(operateUserIds); Map<Long, AdminUserRespDTO> operateUserMap = adminUserApi.getUserMap(operateUserIds);
List<MoldOperateRespVO> respVOList = BeanUtils.toBean(list, MoldOperateRespVO.class, List<MoldOperateRespVO> respVOList = BeanUtils.toBean(list, MoldOperateRespVO.class,
item -> MapUtils.findAndThen(operateUserMap, item.getUserId(), user -> item.setUserName(user.getNickname()))); item -> MapUtils.findAndThen(operateUserMap, item.getOperatorId(), user -> item.setOperatorName(user.getNickname())));
ExcelUtils.write(response, "模具上下模.xls", "数据", MoldOperateRespVO.class, respVOList); ExcelUtils.write(response, "模具上下模.xls", "数据", MoldOperateRespVO.class, respVOList);
} }
@ -221,9 +218,9 @@ public class MoldOperateController {
if (respVO == null) { if (respVO == null) {
return; return;
} }
if (respVO.getUserId() != null) { if (respVO.getOperatorId() != null) {
MapUtils.findAndThen(adminUserApi.getUserMap(Collections.singleton(respVO.getUserId())), MapUtils.findAndThen(adminUserApi.getUserMap(Collections.singleton(respVO.getOperatorId())),
respVO.getUserId(), user -> respVO.setUserName(user.getNickname())); respVO.getOperatorId(), user -> respVO.setOperatorName(user.getNickname()));
} }
if (StringUtils.hasText(respVO.getCreator())) { if (StringUtils.hasText(respVO.getCreator())) {
Long creatorId = Long.valueOf(respVO.getCreator()); Long creatorId = Long.valueOf(respVO.getCreator());

@ -37,7 +37,7 @@ public class MoldOperatePageReqVO extends PageParam {
private String deviceName; private String deviceName;
@Schema(description = "操作人id", example = "1") @Schema(description = "操作人id", example = "1")
private Long userId; private Long operatorId;
@Schema(description = "操作时间") @Schema(description = "操作时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

@ -46,11 +46,11 @@ public class MoldOperateRespVO {
private LocalDateTime operateTime; private LocalDateTime operateTime;
@Schema(description = "操作人id", example = "1") @Schema(description = "操作人id", example = "1")
private Long userId; private Long operatorId;
@Schema(description = "操作人名称", example = "芋道") @Schema(description = "操作人名称", example = "芋道")
@ExcelProperty("操作人") @ExcelProperty("操作人")
private String userName; private String operatorName;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
@ExcelProperty("备注") @ExcelProperty("备注")

@ -14,10 +14,10 @@ public class MoldOperateSaveReqVO {
private Long id; private Long id;
@Schema(description = "操作类型", example = "2") @Schema(description = "操作类型", example = "2")
private String operateType; private Integer operateType;
@Schema(description = "关联模具id", example = "23041") @Schema(description = "关联模具id", example = "23041")
private String moldId; private Integer moldId;
@Schema(description = "关联设备id", example = "5057") @Schema(description = "关联设备id", example = "5057")
private Long deviceId; private Long deviceId;
@ -41,6 +41,6 @@ public class MoldOperateSaveReqVO {
private LocalDateTime operateTime; private LocalDateTime operateTime;
@Schema(description = "操作人id", example = "1") @Schema(description = "操作人id", example = "1")
private Long userId; private Long operatorId;
} }

@ -96,6 +96,16 @@ public class MoldRepairController {
return success(buildCreatorName(moldRepairRespVOPageResult)); return success(buildCreatorName(moldRepairRespVOPageResult));
} }
@GetMapping("/list")
@Operation(summary = "获得模具维修记录列表")
@PreAuthorize("@ss.hasPermission('mes:mold-repair:query')")
public CommonResult<List<MoldRepairRespVO>> getMoldRepairList(@Valid MoldRepairPageReqVO pageReqVO) {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MoldRepairDO> list = moldRepairService.getMoldRepairPage(pageReqVO).getList();
List<MoldRepairRespVO> moldRepairRespVOList = BeanUtils.toBean(list, MoldRepairRespVO.class);
return success(buildCreatorName(moldRepairRespVOList));
}
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出模具维修记录 Excel") @Operation(summary = "导出模具维修记录 Excel")
@PreAuthorize("@ss.hasPermission('mes:mold-repair:export')") @PreAuthorize("@ss.hasPermission('mes:mold-repair:export')")
@ -222,4 +232,23 @@ public class MoldRepairController {
return moldSubjectRespVOPageResult; return moldSubjectRespVOPageResult;
} }
private List<MoldRepairRespVO> buildCreatorName(List<MoldRepairRespVO> moldRepairRespVOList) {
for (MoldRepairRespVO moldRepairRespVO : moldRepairRespVOList) {
if (moldRepairRespVO.getAcceptedBy() != null) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(moldRepairRespVO.getAcceptedBy()));
if (user != null) {
moldRepairRespVO.setAcceptedBy("(" + user.getUsername() + ")" + user.getNickname());
}
}
if (moldRepairRespVO.getConfirmBy() != null) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(moldRepairRespVO.getConfirmBy()));
if (user != null) {
moldRepairRespVO.setConfirmBy("(" + user.getUsername() + ")" + user.getNickname());
}
}
}
return moldRepairRespVOList;
}
} }

@ -71,7 +71,7 @@ public class MoldOperateDO extends BaseDO {
/** /**
* id * id
*/ */
private Long userId; private Long operatorId;
} }

@ -26,7 +26,7 @@ public interface MoldOperateMapper extends BaseMapperX<MoldOperateDO> {
.eqIfPresent(MoldOperateDO::getLineId, reqVO.getLineId()) .eqIfPresent(MoldOperateDO::getLineId, reqVO.getLineId())
.likeIfPresent(MoldOperateDO::getLineName, reqVO.getLineName()) .likeIfPresent(MoldOperateDO::getLineName, reqVO.getLineName())
.likeIfPresent(MoldOperateDO::getDeviceName, reqVO.getDeviceName()) .likeIfPresent(MoldOperateDO::getDeviceName, reqVO.getDeviceName())
.eqIfPresent(MoldOperateDO::getUserId, reqVO.getUserId()) .eqIfPresent(MoldOperateDO::getOperatorId, reqVO.getOperatorId())
.betweenIfPresent(MoldOperateDO::getOperateTime, reqVO.getOperateTime()) .betweenIfPresent(MoldOperateDO::getOperateTime, reqVO.getOperateTime())
.eqIfPresent(MoldOperateDO::getRemark, reqVO.getRemark()) .eqIfPresent(MoldOperateDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MoldOperateDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(MoldOperateDO::getCreateTime, reqVO.getCreateTime())

@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan.SubjectMoldPlanDO; import cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan.SubjectMoldPlanDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan.vo.*; import cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan.vo.*;
@ -29,7 +28,9 @@ public interface SubjectMoldPlanMapper extends BaseMapperX<SubjectMoldPlanDO> {
* *
* @param planId ID * @param planId ID
*/ */
@Delete("DELETE FROM besure.mes_subject_mold_plan WHERE plan_id = #{planId}") default void deleteByPlanId(Long planId) {
void deleteByPlanId(Long planId); delete(new LambdaQueryWrapperX<SubjectMoldPlanDO>()
.eq(SubjectMoldPlanDO::getPlanId, planId));
}
} }

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.mes.service.moldoperate; package cn.iocoder.yudao.module.mes.service.moldoperate;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldMapper; import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldMapper;
import cn.iocoder.yudao.module.common.enums.MoldBrandStatusEnum;
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO; import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO; import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper; import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
@ -10,6 +13,7 @@ import jodd.util.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.*; import java.util.*;
@ -46,46 +50,30 @@ public class MoldOperateServiceImpl implements MoldOperateService {
@Resource @Resource
private MoldMapper moldMapper; private MoldMapper moldMapper;
@Resource
private MoldBrandMapper moldBrandMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Long createMoldOperate(MoldOperateSaveReqVO createReqVO) { public Long createMoldOperate(MoldOperateSaveReqVO createReqVO) {
// 插入 // 插入
MoldOperateDO moldOperate = BeanUtils.toBean(createReqVO, MoldOperateDO.class); MoldOperateDO moldOperate = BeanUtils.toBean(createReqVO, MoldOperateDO.class);
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(createReqVO.getDeviceId()); DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(createReqVO.getDeviceId());
fillDeviceAndLineInfo(moldOperate, deviceLedgerDO); fillDeviceAndLineInfo(moldOperate, deviceLedgerDO,createReqVO.getLineId());
List<Long> idList;
if (createReqVO.getLowerMoldId()!=null){
idList = Arrays.stream(createReqVO.getLowerMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
}else {
idList = Arrays.stream(createReqVO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
}
if (!idList.isEmpty()) { MoldBrandDO moldDO = moldBrandMapper.selectById(createReqVO.getMoldId());
StringBuilder moldNameBuilder = new StringBuilder();
for (Long id : idList) {
MoldDO moldDO = moldMapper.selectById(id);
if (moldDO != null && StringUtil.isNotBlank(moldDO.getName())) { if (moldDO != null && StringUtil.isNotBlank(moldDO.getName())) {
if (moldNameBuilder.length() > 0) { moldOperate.setMoldName(moldDO.getName());
moldNameBuilder.append(",");
} }
moldNameBuilder.append(moldDO.getName()); moldOperateMapper.insert(moldOperate);
} //修改模具组状态
} if (createReqVO.getOperateType() == 1){
moldOperate.setMoldName(moldNameBuilder.toString()); moldDO.setStatus(MoldBrandStatusEnum.ON_MACHINE.getStatus());
}else { }else {
moldOperate.setMoldName(""); moldDO.setStatus(MoldBrandStatusEnum.ON_MACHINE.getStatus());
} }
moldBrandMapper.updateById(moldDO);
moldOperateMapper.insert(moldOperate);
// 返回 // 返回
return moldOperate.getId(); return moldOperate.getId();
} }
@ -99,27 +87,16 @@ public class MoldOperateServiceImpl implements MoldOperateService {
MoldOperateDO updateObj = BeanUtils.toBean(updateReqVO, MoldOperateDO.class); MoldOperateDO updateObj = BeanUtils.toBean(updateReqVO, MoldOperateDO.class);
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(updateReqVO.getDeviceId()); DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(updateReqVO.getDeviceId());
fillDeviceAndLineInfo(updateObj, deviceLedgerDO); fillDeviceAndLineInfo(updateObj, deviceLedgerDO,updateReqVO.getLineId());
List<Long> idList = Arrays.stream(updateReqVO.getMoldId().split(",")) // List<Long> idList = Arrays.stream(updateReqVO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格 // .map(String::trim) // 去除可能存在的空格
.map(Long::valueOf) // .map(Long::valueOf)
.collect(Collectors.toList()); // .collect(Collectors.toList());
if (!idList.isEmpty()) { MoldBrandDO moldDO = moldBrandMapper.selectById(updateReqVO.getMoldId());
StringBuilder moldNameBuilder = new StringBuilder();
for (Long id : idList) {
MoldDO moldDO = moldMapper.selectById(id);
if (moldDO != null && StringUtil.isNotBlank(moldDO.getName())) { if (moldDO != null && StringUtil.isNotBlank(moldDO.getName())) {
if (moldNameBuilder.length() > 0) { updateObj.setMoldName(moldDO.getName());
moldNameBuilder.append(",");
}
moldNameBuilder.append(moldDO.getName());
}
}
updateObj.setMoldName(moldNameBuilder.toString());
} else {
updateObj.setMoldName("");
} }
moldOperateMapper.updateById(updateObj); moldOperateMapper.updateById(updateObj);
@ -174,17 +151,14 @@ public class MoldOperateServiceImpl implements MoldOperateService {
return moldDOList; return moldDOList;
} }
private void fillDeviceAndLineInfo(MoldOperateDO moldOperate, DeviceLedgerDO deviceLedgerDO) { private void fillDeviceAndLineInfo(MoldOperateDO moldOperate, DeviceLedgerDO deviceLedgerDO,Long lineId) {
if (deviceLedgerDO == null) { if (deviceLedgerDO == null) {
return; return;
} }
moldOperate.setDeviceId(deviceLedgerDO.getId()); moldOperate.setDeviceId(deviceLedgerDO.getId());
moldOperate.setDeviceName(deviceLedgerDO.getDeviceName()); moldOperate.setDeviceName(deviceLedgerDO.getDeviceName());
if (deviceLedgerDO.getDeviceLine() == null) { moldOperate.setLineId(lineId);
return; OrganizationDO organizationDO = organizationMapper.selectById(lineId);
}
moldOperate.setLineId(deviceLedgerDO.getDeviceLine().longValue());
OrganizationDO organizationDO = organizationMapper.selectById(deviceLedgerDO.getDeviceLine().longValue());
if (organizationDO != null) { if (organizationDO != null) {
moldOperate.setLineName(organizationDO.getName()); moldOperate.setLineName(organizationDO.getName());
} }

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.mes.service.moldtaskmanagement; package cn.iocoder.yudao.module.mes.service.moldtaskmanagement;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldMapper; import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldMapper;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO; import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO; import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO;
@ -58,6 +60,8 @@ public class MoldTaskManagementServiceImpl implements MoldTaskManagementService
@Resource @Resource
private MoldMapper moldMapper; private MoldMapper moldMapper;
@Resource
private MoldBrandMapper moldBrandMapper;
@Resource @Resource
private MoldPlanMaintenanceMapper moldplanMaintenanceMapper; private MoldPlanMaintenanceMapper moldplanMaintenanceMapper;
@ -179,7 +183,7 @@ public PageResult<MoldTaskManagementDO> getMoldTaskManagementPage(MoldTaskManage
for (Long moldId : idList) { for (Long moldId : idList) {
MoldTicketManagementDO moldticketManagementDO = new MoldTicketManagementDO(); MoldTicketManagementDO moldticketManagementDO = new MoldTicketManagementDO();
MoldDO moldDO = moldMapper.selectById(moldId); MoldBrandDO moldDO = moldBrandMapper.selectById(moldId);
moldticketManagementDO.setTaskId(moldtaskManagementDO.getId()); moldticketManagementDO.setTaskId(moldtaskManagementDO.getId());
moldticketManagementDO.setPlanNo(generatePrefixedOrderNo()); moldticketManagementDO.setPlanNo(generatePrefixedOrderNo());
moldticketManagementDO.setPlanId(moldtaskManagementDO.getProjectForm()); moldticketManagementDO.setPlanId(moldtaskManagementDO.getProjectForm());

Loading…
Cancel
Save