Compare commits

...

2 Commits

@ -53,7 +53,8 @@ public class ErpProductController {
public CommonResult<Long> createProduct(@Valid @RequestBody ProductSaveReqVO createReqVO) {
ErpProductPageReqVO productPageReqVO = new ErpProductPageReqVO();
productPageReqVO.setName(createReqVO.getName());
if (!productMapper.selectProductExist(productPageReqVO).getList().isEmpty()) {
productPageReqVO.setStandard(createReqVO.getStandard());
if (productMapper.selectProductExist(productPageReqVO)) {
return error(400,"名称+规格不能重复");
}
productPageReqVO = new ErpProductPageReqVO();
@ -68,6 +69,17 @@ public class ErpProductController {
@Operation(summary = "更新产品")
//@PreAuthorize("@ss.hasPermission('erp:product:update')")
public CommonResult<Boolean> updateProduct(@Valid @RequestBody ProductSaveReqVO updateReqVO) {
ErpProductPageReqVO productPageReqVO = new ErpProductPageReqVO();
productPageReqVO.setName(updateReqVO.getName());
productPageReqVO.setStandard(updateReqVO.getStandard());
if (productMapper.selectProductExist(productPageReqVO)) {
return error(400,"名称+规格不能重复");
}
productPageReqVO = new ErpProductPageReqVO();
productPageReqVO.setCode(updateReqVO.getBarCode());
if (!productMapper.selectProductCodeExist(productPageReqVO).getList().isEmpty()) {
return error(400,"编码不能重复");
}
productService.updateProduct(updateReqVO);
return success(true);
}

@ -6,8 +6,10 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Collection;
@ -36,11 +38,16 @@ public interface ErpProductMapper extends BaseMapperX<ErpProductDO> {
.orderByAsc(ErpProductDO::getId));
}
default PageResult<ErpProductDO> selectProductExist(ErpProductPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpProductDO>()
.eqIfPresent(ErpProductDO::getName, reqVO.getName())
.eqIfPresent(ErpProductDO::getStandard, reqVO.getStandard())
.orderByAsc(ErpProductDO::getId));
default Boolean selectProductExist(ErpProductPageReqVO reqVO) {
LambdaQueryWrapperX<ErpProductDO> queryWrapper = (LambdaQueryWrapperX<ErpProductDO>) new LambdaQueryWrapperX<ErpProductDO>()
.orderByAsc(ErpProductDO::getId);
if (StringUtils.hasText(reqVO.getName()) && StringUtils.hasText(reqVO.getStandard())) {
// 组合查询name 和 standard 必须同时匹配
queryWrapper.eq(ErpProductDO::getName, reqVO.getName())
.eq(ErpProductDO::getStandard, reqVO.getStandard());
return !selectPage(reqVO, queryWrapper).getList().isEmpty();
}
return false;
}
default Long selectCountByCategoryId(Long categoryId) {

@ -120,4 +120,6 @@ public class DeviceRespVO {
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime collectionTime;
@Schema(description = "关联组织", example = "1")
private Long org;
}

@ -95,6 +95,14 @@ public class RecipeDeviceAttributeController {
return success(pageResult);
}
@GetMapping("/list")
@Operation(summary = "查询配方配置列表")
public CommonResult<PageResult<RecipeDeviceAttributePageRespDTO>> list(RecipeDeviceAttributePageReqVO reqVO) {
// 替换为关联查询方法
PageResult<RecipeDeviceAttributePageRespDTO> pageResult = recipeDeviceAttributeService.selectPageWithAttribute(reqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出配方配置(关联采集设备模型-点位管理) Excel")
@PreAuthorize("@ss.hasPermission('iot:recipe-device-attribute:export')")

@ -24,7 +24,7 @@ public class RecipePlanDetailSaveReqVO {
@NotNull(message = "关联配方关联iot_recipe表的id不能为空")
private Long recipeId;
@Schema(description = "关联计划关联mes_plan表的id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28398")
@Schema(description = "关联计划关联mes_plan表的id", example = "28398")
// @NotNull(message = "关联计划关联mes_plan表的id不能为空")
private Long planId;

@ -97,6 +97,8 @@ public interface DeviceMapper extends BaseMapperX<DeviceDO> {
IPage<LineDeviceRespVO> lineDevicePage(Page<LineDeviceRespVO> page, @Param("pageReqVO") LineDeviceRequestVO pageReqVO);
String lineDeviceLedgerPage(@Param("id") Long id);
List<LineDeviceRespVO> lineDeviceList(@Param("pageReqVO") LineDeviceRequestVO pageReqVO);

@ -110,6 +110,7 @@ public class DeviceServiceImpl implements DeviceService {
@Override
@Transactional(rollbackFor = Exception.class)
public DeviceDO createDevice(DeviceSaveReqVO createReqVO) {
@ -303,10 +304,7 @@ public class DeviceServiceImpl implements DeviceService {
deviceRespVO.setOperatingStatus(DeviceStatusEnum.OFFLINE.getName());
}
}
return deviceRespVOPageResult;
}
@ -611,21 +609,30 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public PageResult<LineDeviceRespVO> lineDevicePage(LineDeviceRequestVO pageReqVO) {
Page<LineDeviceRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
// Page<LineDeviceRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
IPage<LineDeviceRespVO> lineDeviceRespVO = deviceMapper.lineDevicePage(page,pageReqVO);
List<LineDeviceRespVO> records = lineDeviceRespVO.getRecords();
for (LineDeviceRespVO record : records) {
Map<String, Object> latestDeviceData = tdengineService.getLatestDeviceData(record.getDeviceId());
// IPage<LineDeviceRespVO> lineDeviceRespVO = deviceMapper.lineDevicePage(page,pageReqVO);
PageResult<DeviceRespVO> pageResult = getDevicePage(BeanUtils.toBean(pageReqVO, DevicePageReqVO.class));
List<LineDeviceRespVO> list = new ArrayList<>();
for (DeviceRespVO record : pageResult.getList()) {
LineDeviceRespVO lineDeviceRespVO = new LineDeviceRespVO();
lineDeviceRespVO.setDeviceCode(record.getDeviceCode());
lineDeviceRespVO.setDeviceName(record.getDeviceName());
lineDeviceRespVO.setStatus(record.getStatus());
lineDeviceRespVO.setCollectionTime(String.valueOf(record.getCollectionTime()));
lineDeviceRespVO.setId(record.getId());
Map<String, Object> latestDeviceData = tdengineService.getLatestDeviceData(record.getId());
if(latestDeviceData != null) {
record.setCollectionTime((String) latestDeviceData.get("timestamp"));
lineDeviceRespVO.setCollectionTime((String) latestDeviceData.get("timestamp"));
}
lineDeviceRespVO.setLineName(deviceMapper.lineDeviceLedgerPage(record.getId()));
list.add(lineDeviceRespVO);
}
PageResult<LineDeviceRespVO> lineDeviceRespVOPageResult = new PageResult<>(lineDeviceRespVO.getRecords(), lineDeviceRespVO.getTotal());
return lineDeviceRespVOPageResult;
if (list.isEmpty()) {
return PageResult.empty(); // 返回空Page
}
return new PageResult<>(list, pageResult.getTotal());
}

@ -15,18 +15,18 @@ import com.fasterxml.jackson.core.JsonProcessingException;
*/
public interface RecipeDeviceAttributeService {
/**
* -
*
* @param createReqVO
/*
-
@param createReqVO
* @return
*/
// Long createRecipeDeviceAttribute(@Valid RecipeDeviceAttributeSaveReqVO createReqVO);
/**
* -
*
* @param updateReqVO
/*
-
@param updateReqVO
*/
// void updateRecipeDeviceAttribute(@Valid RecipeDeviceAttributeSaveReqVO updateReqVO);

@ -58,6 +58,14 @@
order by mo.id desc
</select>
<select id="lineDeviceLedgerPage" resultType="java.lang.String">
SELECT mo.workshop
FROM mes_device_ledger mo
WHERE mo.deleted = 0
and dv_id = #{id}
LIMIT 1
</select>
<select id="getDeviceOperationalStatus"
resultType="cn.iocoder.yudao.module.iot.controller.admin.device.vo.DeviceOperationStatusRespVO">
SELECT

@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo.DeviceLedgerRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectPageReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectRespVO;
@ -186,4 +187,11 @@ public class MoldSubjectController {
return dictData;
}
@GetMapping("/getAllList")
@Operation(summary = "获得模具维保项目列表")
public CommonResult<List<MoldSubjectDO>> getMoldSubjectAllList() {
List<MoldSubjectDO> doList = moldSubjectService.getAllList();
return success(doList);
}
}

@ -7,6 +7,9 @@ import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProduc
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.mysql.mold.MoldMapper;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.DeviceRespVO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.DeviceSaveReqVO;
import cn.iocoder.yudao.module.iot.service.device.DeviceService;
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
@ -84,6 +87,9 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
@Resource
private DeviceTypeMapper deviceTypeMapper;
@Resource
private DeviceService deviceService;
@Override
public Long createDeviceLedger(DeviceLedgerSaveReqVO createReqVO) {
@ -95,6 +101,12 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
// 创建台账
deviceLedgerMapper.insert(deviceLedger);
// 数采设备设置
// if (deviceLedger.getWorkshop() != null) {
// DeviceRespVO deviceRespVO = deviceService.getDevice(Long.valueOf(createReqVO.getWorkshop()));
// deviceRespVO.setOrg(Long.valueOf(deviceLedger.getWorkshop()));
// deviceService.updateDevice(BeanUtils.toBean(deviceRespVO, DeviceSaveReqVO.class));
// }
// 返回
return deviceLedger.getId();
}
@ -120,7 +132,6 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
if (count > 0) {
throw exception(DEVICE_LEDGER_EXISTS);
}
// 更新
DeviceLedgerDO updateObj = BeanUtils.toBean(updateReqVO, DeviceLedgerDO.class);
deviceLedgerMapper.updateById(updateObj);

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mes.service.moldsubject;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectPageReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectSaveReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
@ -53,4 +54,6 @@ public interface MoldSubjectService {
*/
PageResult<MoldSubjectDO> getMoldSubjectPage(MoldSubjectPageReqVO pageReqVO);
List<MoldSubjectDO> getAllList();
}

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.mes.service.moldsubject;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectPageReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectSaveReqVO;
@ -98,4 +99,9 @@ public class MoldSubjectServiceImpl implements MoldSubjectService {
return moldSubjectMapper.selectPage(pageReqVO);
}
@Override
public List<MoldSubjectDO> getAllList() {
return moldSubjectMapper.selectList();
}
}
Loading…
Cancel
Save