|
@@ -13,6 +13,7 @@ import com.ruoyi.common.annotation.DataSource;
|
|
|
import com.ruoyi.common.enums.DataSourceType;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.aspectj.weaver.ast.Var;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.Assert;
|
|
@@ -74,6 +75,11 @@ public class SysMeConfigService extends ServiceImpl<SysMeConfigMapper, SysMeConf
|
|
|
String cutrecordNo = boy.getTblMachineNo();
|
|
|
Long count = cutpieceMapper.selectCount(new LambdaQueryWrapper<Cutpiece>().eq(Cutpiece::getTblMachineNo, cutrecordNo));
|
|
|
Assert.isTrue(count > 0, "500-机器编号不存在");
|
|
|
+ //通过编码去查询配置表防止出现重复机器编号
|
|
|
+ LambdaQueryWrapper<SysMeConfig> wr = new LambdaQueryWrapper<>();
|
|
|
+ wr.eq(SysMeConfig::getTblMachineNo, cutrecordNo);
|
|
|
+ Long aLong = sysMeConfigMapper.selectCount(wr);
|
|
|
+ Assert.isTrue(aLong == 0, "500-机器编号已存在");
|
|
|
//新增数据
|
|
|
boy.setCreateTime(new Date());
|
|
|
sysMeConfigMapper.insert(boy);
|
|
@@ -81,6 +87,7 @@ public class SysMeConfigService extends ServiceImpl<SysMeConfigMapper, SysMeConf
|
|
|
|
|
|
/**
|
|
|
* 修改数据
|
|
|
+ *
|
|
|
* @param boy
|
|
|
*/
|
|
|
public void updateBoy(SysMeConfig boy) {
|
|
@@ -95,6 +102,23 @@ public class SysMeConfigService extends ServiceImpl<SysMeConfigMapper, SysMeConf
|
|
|
sysMeConfigMapper.updateById(boy);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据id删除数据
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ */
|
|
|
+ public void delete(Long[] ids) {
|
|
|
+ //遍历ids 判断数据是否存在
|
|
|
+ for (Long id : ids) {
|
|
|
+ SysMeConfig sysMeConfig = sysMeConfigMapper.selectById(id);
|
|
|
+ Assert.isTrue(sysMeConfig != null, "500-数据不存在");
|
|
|
+ //删除数据
|
|
|
+ sysMeConfigMapper.deleteById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 新增数据时校验数据
|
|
|
*
|
|
@@ -103,7 +127,8 @@ public class SysMeConfigService extends ServiceImpl<SysMeConfigMapper, SysMeConf
|
|
|
private void check(SysMeConfig boy) {
|
|
|
Assert.isTrue(StringUtils.isNotBlank(boy.getTblMachineNo()), "500-机器编号不能为空");
|
|
|
Assert.isTrue(boy.getCapacity() != null && boy.getCapacity() > 0, "500-产能不能为空");
|
|
|
- Assert.isTrue(boy.getConfiTime()!=null, "500-上班时间不能为空");
|
|
|
+ Assert.isTrue(boy.getConfiTime() != null, "500-上班时间不能为空");
|
|
|
+ Assert.isTrue(StringUtils.isNotBlank(boy.getMachineName()), "500-机器名称不能为空");
|
|
|
}
|
|
|
|
|
|
|