Compare commits

..

No commits in common. '09a2c8458c9e5a888e233ab59d8ddbc68c575afc' and '92feeb7f84bd4ec7a998c3d84dba105a028ff68c' have entirely different histories.

@ -99,8 +99,6 @@ public interface ErpProductMapper extends BaseMapperX<ErpProductDO> {
return selectList(new LambdaQueryWrapperX<ErpProductDO>().in(ErpProductDO::getName, names));
}
List<ErpProductDO> selectListByIdsWithDeleted(@Param("ids") Collection<Long> ids);
List<ProductRelationRespVO> selectDevicesByProductId(@Param("productId") Long productId);
List<ProductRelationRespVO> selectMoldsByProductId(@Param("productId") Long productId);

@ -349,7 +349,7 @@ public class ErpProductServiceImpl implements ErpProductService {
if (CollUtil.isEmpty(ids)) {
return Collections.emptyList();
}
List<ErpProductDO> list = productMapper.selectListByIdsWithDeleted(ids);
List<ErpProductDO> list = productMapper.selectBatchIds(ids);
return buildProductVOList(list);
}
@ -376,9 +376,6 @@ public class ErpProductServiceImpl implements ErpProductService {
subCategory -> product.setSubCategoryName(subCategory.getName()));
MapUtils.findAndThen(unitMap, product.getUnitId(),
unit -> product.setUnitName(unit.getName()));
if (Boolean.TRUE.equals(product.getDeleted())) {
product.setName(product.getName() + "(已被删除)");
}
});
}
@ -542,4 +539,4 @@ public class ErpProductServiceImpl implements ErpProductService {
return productDO;
}
}
}

@ -8,17 +8,6 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectListByIdsWithDeleted" resultType="cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO">
SELECT id, name, bar_code, category_id, sub_category_id, sub_category_name, unit_id,
status, standard, remark, expiry_day, weight, purchase_price, sale_price,
min_price, safety_number, create_time, update_time, creator, updater, deleted
FROM erp_product
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectDevicesByProductId"
resultType="cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductRelationRespVO">
SELECT DISTINCT
@ -50,4 +39,4 @@
</select>
</mapper>
</mapper>

@ -115,7 +115,6 @@ public interface ErrorCodeConstants {
ErrorCode DV_REPAIR_LINE_NOT_EXISTS = new ErrorCode(5_0088, "设备维修子表记录不存在");
ErrorCode DV_REPAIR_LINE_ID_NOT_EXISTS = new ErrorCode(5_0088, "设备维修子表记录Id为空");
//====================================== 检验记录相关 5_0090=================================================
ErrorCode ZJ_TYPE_NOT_EXISTS = new ErrorCode(5_0090, "检验类型不存在");
ErrorCode ZJ_TYPE_CODE_EXISTS = new ErrorCode(5_0090, "检验类型编码已存在");
@ -126,6 +125,7 @@ public interface ErrorCodeConstants {
ErrorCode ZJ_TASK_NOT_EXISTS = new ErrorCode(5_0094, "检验任务不存在");
ErrorCode ZJ_TASK_CODE_EXISTS = new ErrorCode(5_0094, "检验任务单号已存在");
ErrorCode ZJ_TASK_RESULTS_NOT_EXISTS = new ErrorCode(5_0095, "检验任务-检验结果不存在");
ErrorCode GOVIEW_NOT_EXISTS = new ErrorCode(5_0100, "可视化大屏不存在");

@ -22,11 +22,6 @@ public class BomDetailRespVO {
@Schema(description = "原料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17312")
@ExcelProperty("原料ID")
private Long productId;
@Schema(description = "原料编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
@ExcelProperty("原料编码")
private String productCode;
@Schema(description = "原料", requiredMode = Schema.RequiredMode.REQUIRED, example = "2336")
@ExcelProperty("原料")
private String productName;

@ -144,7 +144,7 @@ public class DeviceLedgerController {
})
.collect(Collectors.toSet());
Map<Long, OrganizationDO> organizationMap = organizationService.getMapWithDeleted(workshopIds);
Map<Long, OrganizationDO> organizationMap = organizationService.getMap(workshopIds);
// 4. 设置 workshopName
for (DeviceLedgerDO item : pageResult.getList()) {
@ -153,11 +153,7 @@ public class DeviceLedgerController {
Long workshopId = Long.parseLong(item.getWorkshop().trim());
OrganizationDO org = organizationMap.get(workshopId);
if (org != null) {
String workshopName = org.getName();
if (Boolean.TRUE.equals(org.getDeleted())) {
workshopName += "(已被删除)";
}
item.setWorkshopName(workshopName);
item.setWorkshopName(org.getName());
}
} catch (NumberFormatException e) {
}

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.mes.controller.admin.zjschema;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService;
import cn.iocoder.yudao.module.mes.controller.admin.zjitem.vo.ZjItemRespVO;
@ -56,8 +55,6 @@ public class ZjSchemaController {
private ZjTypeService zjTypeService;
@Resource
private ErpProductUnitService productUnitService;
@Resource
private ErpProductService erpProductService;
@PostMapping("/create")
@Operation(summary = "创建检验方案")
@ -89,7 +86,7 @@ public class ZjSchemaController {
@PreAuthorize("@ss.hasPermission('mes:zj-schema:query')")
public CommonResult<ZjSchemaRespVO> getZjSchema(@RequestParam("id") Long id) {
ZjSchemaDO zjSchema = zjSchemaService.getZjSchema(id);
return success(buildZjSchemaRespVO(zjSchema));
return success(BeanUtils.toBean(zjSchema, ZjSchemaRespVO.class));
}
@GetMapping("/page")
@ -97,17 +94,14 @@ public class ZjSchemaController {
@PreAuthorize("@ss.hasPermission('mes:zj-schema:query')")
public CommonResult<PageResult<ZjSchemaRespVO>> getZjSchemaPage(@Valid ZjSchemaPageReqVO pageReqVO) {
PageResult<ZjSchemaDO> pageResult = zjSchemaService.getZjSchemaPage(pageReqVO);
List<ZjSchemaRespVO> list = pageResult.getList().stream()
.map(this::buildZjSchemaRespVO)
.collect(Collectors.toList());
return success(new PageResult<>(list, pageResult.getTotal()));
return success(BeanUtils.toBean(pageResult, ZjSchemaRespVO.class));
}
@GetMapping("/list")
@Operation(summary = "获得检验方案列表")
@PreAuthorize("@ss.hasPermission('mes:zj-schema:query')")
public CommonResult<List<ZjSchemaDO>> getZjSchemaList(@RequestParam(value = "productId", required = false) Long productId) {
List<ZjSchemaDO> zjSchemaDOList = zjSchemaService.getZjSchemaList(productId);
public CommonResult<List<ZjSchemaDO>> getZjSchemaList() {
List<ZjSchemaDO> zjSchemaDOList = zjSchemaService.getZjSchemaList();
return success(zjSchemaDOList);
}
@ -188,30 +182,4 @@ public class ZjSchemaController {
}
});
}
private ZjSchemaRespVO buildZjSchemaRespVO(ZjSchemaDO zjSchema) {
if (zjSchema == null) {
return null;
}
ZjSchemaRespVO respVO = BeanUtils.toBean(zjSchema, ZjSchemaRespVO.class);
List<Long> productIds = parseIds(zjSchema.getProduct());
respVO.setProductIds(productIds);
if (CollUtil.isNotEmpty(productIds)) {
respVO.setProducts(erpProductService.getProductVOList(productIds));
} else {
respVO.setProducts(Collections.emptyList());
}
return respVO;
}
private List<Long> parseIds(String ids) {
if (ids == null || ids.trim().isEmpty()) {
return Collections.emptyList();
}
return Arrays.stream(ids.split(","))
.map(String::trim)
.filter(str -> !str.isEmpty())
.map(Long::valueOf)
.collect(Collectors.toList());
}
}
}

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.mes.controller.admin.zjschema.vo;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
@ -46,15 +45,9 @@ public class ZjSchemaRespVO {
// @ExcelProperty("关联项目")
private String item;
@Schema(description = "关联产品 ID 列表", example = "[1,2,3]")
private List<Long> productIds;
@Schema(description = "关联产品列表")
private List<ErpProductRespVO> products;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@ColumnWidth(20)
private LocalDateTime createTime;
}
}

@ -33,7 +33,4 @@ public class ZjSchemaSaveReqVO {
@Schema(description = "关联项目")
private String item;
@Schema(description = "关联产品 ID 列表", example = "[1,2,3]")
private List<Long> productIds;
}
}

@ -15,7 +15,7 @@ public class ZjTaskSaveReqVO {
private Long id;
@Schema(description = "单号", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotEmpty(message = "单号不能为空")
@NotEmpty(message = "单号不能为空")
private String code;
@Schema(description = "名称", example = "王五")
@ -41,7 +41,7 @@ public class ZjTaskSaveReqVO {
private String ticket;
@Schema(description = "工序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
// @NotEmpty(message = "工序不能为空")
@NotEmpty(message = "工序不能为空")
private String orgType;
@Schema(description = "负责人id", example = "6442")

@ -52,9 +52,4 @@ public class ZjSchemaDO extends BaseDO {
*/
private String item;
/**
* erp_product.id
*/
private String product;
}
}

@ -8,7 +8,6 @@ import cn.iocoder.yudao.module.mes.controller.admin.organization.vo.Organization
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
@ -72,7 +71,4 @@ public interface OrganizationMapper extends BaseMapperX<OrganizationDO> {
return selectList(OrganizationDO::getId, outIds);
}
List<OrganizationDO> selectListWithDeleted(@Param("ids") Collection<Long> ids);
}

@ -10,7 +10,6 @@ import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjschema.ZjSchemaDO;
import com.alibaba.excel.util.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import cn.iocoder.yudao.module.mes.controller.admin.zjschema.vo.*;
/**
@ -57,6 +56,4 @@ public interface ZjSchemaMapper extends BaseMapperX<ZjSchemaDO> {
.orderByAsc(ZjSchemaDO::getId));
}
List<ZjSchemaDO> selectListByProductId(@Param("productId") Long productId);
}
}

@ -113,8 +113,4 @@ public interface ZjTaskMapper extends BaseMapperX<ZjTaskDO> {
@Param("status") Integer status,
@Param("cancelReason") String cancelReason);
ZjTaskDO selectByNo(@Param("code") String code);
}

@ -219,13 +219,7 @@ public class BomServiceImpl implements BomService {
return BeanUtils.toBean(list, BomDetailRespVO.class, item -> {
MapUtils.findAndThen(map, item.getProductId(),
product -> {
item.setProductName(product.getName());
item.setProductCode(product.getBarCode());
}
);
product -> item.setProductName(product.getName()));
MapUtils.findAndThen(unitMap, item.getUnitId(),
unit -> item.setUnitName(unit.getName()));
});

@ -6,7 +6,10 @@ import cn.iocoder.yudao.module.mes.controller.admin.organization.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
import javax.validation.Valid;
import java.util.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
@ -78,8 +81,6 @@ public interface OrganizationService {
OrganizationRespVO getOrganizationVO(Long id);
Map<Long, OrganizationDO> getMapWithDeleted(Set<Long> workshopIds);
// List<DeviceParametersDTO> getDeviceParametersByOrganizationId(Long id);
}

@ -762,11 +762,6 @@ public class OrganizationServiceImpl implements OrganizationService {
return respVO;
}
@Override
public Map<Long, OrganizationDO> getMapWithDeleted(Set<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return new HashMap<>();
}
return CollectionUtils.convertMap(organizationMapper.selectListWithDeleted(ids), OrganizationDO::getId);
}
}

@ -55,6 +55,4 @@ public interface ZjSchemaService {
List<ZjSchemaDO> getZjSchemaList();
List<ZjSchemaDO> getZjSchemaList(Long productId);
}
}

@ -1,14 +1,16 @@
package cn.iocoder.yudao.module.mes.service.zjschema;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjitem.ZjItemDO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.mes.controller.admin.zjschema.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjschema.ZjSchemaDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.dal.mysql.zjschema.ZjSchemaMapper;
@ -30,17 +32,19 @@ public class ZjSchemaServiceImpl implements ZjSchemaService {
@Override
public Long createZjSchema(ZjSchemaSaveReqVO createReqVO) {
// 插入
ZjSchemaDO zjSchema = BeanUtils.toBean(createReqVO, ZjSchemaDO.class);
zjSchema.setProduct(joinProductIds(createReqVO.getProductIds()));
zjSchemaMapper.insert(zjSchema);
// 返回
return zjSchema.getId();
}
@Override
public void updateZjSchema(ZjSchemaSaveReqVO updateReqVO) {
// 校验存在
validateZjSchemaExists(updateReqVO.getId());
// 更新
ZjSchemaDO updateObj = BeanUtils.toBean(updateReqVO, ZjSchemaDO.class);
updateObj.setProduct(joinProductIds(updateReqVO.getProductIds()));
zjSchemaMapper.updateById(updateObj);
}
@ -73,23 +77,4 @@ public class ZjSchemaServiceImpl implements ZjSchemaService {
return zjSchemaMapper.selectList();
}
@Override
public List<ZjSchemaDO> getZjSchemaList(Long productId) {
if (productId == null) {
return zjSchemaMapper.selectList();
}
List<ZjSchemaDO> list = zjSchemaMapper.selectListByProductId(productId);
return list == null || list.isEmpty() ? zjSchemaMapper.selectList() : list;
}
private String joinProductIds(List<Long> productIds) {
if (productIds == null || productIds.isEmpty()) {
return null;
}
return productIds.stream().filter(Objects::nonNull)
.map(String::valueOf)
.distinct()
.collect(Collectors.joining(","));
}
}
}

@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.erp.controller.admin.autocode.util.AutoCodeUtil;
import cn.iocoder.yudao.module.mes.controller.admin.feedingrecord.vo.FeedingRecordRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.TicketManagementBatchUpdateReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
@ -19,7 +18,6 @@ import cn.iocoder.yudao.module.mes.dal.mysql.zjschema.ZjSchemaMapper;
import cn.iocoder.yudao.module.mes.dal.mysql.zjtaskresults.ZjTaskResultsMapper;
import cn.iocoder.yudao.module.mes.service.plan.PlanService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.poi.util.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -68,8 +66,6 @@ public class ZjTaskServiceImpl implements ZjTaskService {
@Resource
private PlanService planService;
@Resource
private AutoCodeUtil autoCodeUtil;
@Override
@Transactional(rollbackFor = Exception.class)
@ -78,14 +74,6 @@ public class ZjTaskServiceImpl implements ZjTaskService {
validateCodeOnly(createReqVO.getCode());
// 插入
ZjTaskDO zjTask = BeanUtils.toBean(createReqVO, ZjTaskDO.class);
if (!StringUtils.hasText(createReqVO.getCode())) {
zjTask.setCode(autoCodeUtil.genSerialCode("INSPECTION_CODE_GENERATE",null));
} else {
if (zjTaskMapper.selectByNo(createReqVO.getCode()) != null) {
throw exception(ZJ_TASK_CODE_EXISTS);
}
}
zjTaskMapper.insert(zjTask);

@ -8,13 +8,5 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectListWithDeleted" resultType="cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO">
SELECT *
FROM mes_organization
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

@ -9,15 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectListByProductId" resultType="cn.iocoder.yudao.module.mes.dal.dataobject.zjschema.ZjSchemaDO">
SELECT id, type, name, remark, sample_method, val, item, product,
create_time, update_time, creator, updater, deleted
FROM mes_zj_schema
WHERE deleted = 0
AND product IS NOT NULL
AND product != ''
AND FIND_IN_SET(#{productId}, product)
ORDER BY id DESC
</select>
</mapper>
</mapper>

@ -19,12 +19,4 @@
#{id}
</foreach>
</update>
<select id="selectByNo" resultType="cn.iocoder.yudao.module.mes.dal.dataobject.zjtask.ZjTaskDO">
SELECT *
FROM zj_task
WHERE code = #{code}
LIMIT 1
</select>
</mapper>
Loading…
Cancel
Save