Commit 7a09d36d authored by renchao's avatar renchao

生产工序业务修改

parent d1943580
......@@ -65,17 +65,17 @@ public class TProcessesBlastdesignHoleController {
}
/**
* 根据uid删除炮孔设计
*
* @param tProcessesBlastdesignHoleQuery
* @return
*/
@ApiOperation(value = "根据uid删除炮孔设计")
@RequestMapping(value = "/deleteByUid", method = RequestMethod.POST)
public R deleteByUid(@RequestBody TProcessesBlastdesignHoleQuery tProcessesBlastdesignHoleQuery) {
return itProcessesBlastdesignHoleService.deleteByUid(tProcessesBlastdesignHoleQuery);
}
// /**
// * 根据uid删除炮孔设计
// *
// * @param tProcessesBlastdesignHoleQuery
// * @return
// */
// @ApiOperation(value = "根据uid删除炮孔设计")
// @RequestMapping(value = "/deleteByUid", method = RequestMethod.POST)
// public R deleteByUid(@RequestBody TProcessesBlastdesignHoleQuery tProcessesBlastdesignHoleQuery) {
// return itProcessesBlastdesignHoleService.deleteByUid(tProcessesBlastdesignHoleQuery);
// }
/**
......
......@@ -3,16 +3,20 @@ package cn.wise.sc.acquisition.business.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
*
* </p>
*
* @author renchao
......@@ -24,38 +28,14 @@ import lombok.experimental.Accessors;
@TableName("T_Processes_Blast")
public class TProcessesBlast implements Serializable {
private static final long serialVersionUID=1L;
private static final long serialVersionUID = 1L;
/**
* ID号
*/
@TableId(value = "Uid", type = IdType.ASSIGN_UUID)
@TableId("Uid")
private String Uid;
/**
* 采区名称
*/
@TableField("StopeName")
private String StopeName;
/**
* 平台名称
*/
@TableField("StepName")
private String StepName;
/**
* 爆区名称
*/
@TableField("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@TableField("HoleID")
private String HoleID;
/**
* 爆破人员
......@@ -99,11 +79,6 @@ public class TProcessesBlast implements Serializable {
@TableField("Tabulator")
private String Tabulator;
/**
* 实测孔深(m)
*/
@TableField("Depth")
private Double Depth;
@TableField("Bz")
private String Bz;
......
......@@ -33,38 +33,9 @@ public class TProcessesDrilling implements Serializable {
/**
* ID号
*/
@TableId(value = "Uid", type = IdType.ASSIGN_UUID)
@TableId("Uid")
private String Uid;
/**
* 采区名称
*/
@TableField("StopeName")
private String StopeName;
/**
* 平台名称
*/
@TableField("StepName")
private String StepName;
/**
* 爆区名称
*/
@TableField("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@TableField("HoleID")
private String HoleID;
/**
* 穿孔日期
*/
@TableField("DrillingDate")
private LocalDateTime DrillingDate;
/**
* 项目经理
......
......@@ -6,11 +6,8 @@
<!-- 表和实体字段对照关系, 类似RestultMap -->
<sql id="TProcessesBlastColumns">
a.Uid,
a.StopeName,
a.StepName,
a.BlastAreaName,
a.HoleID,
a.BlastDate,
a.BlastPeople,
a.CheckHoleDate,
a.CheckHolePeople,
......@@ -23,30 +20,40 @@
</sql>
<sql id="TProcessesBlastdesignColumns">
b.StopeName,
b.StepName,
b.BlastAreaName,
b.BlastHoleID AS HoleID,
b.HoleBlastVolume,
b.depth AS DesignDepth,<!-- 设计孔深,将爆破工序里的depth去掉,用设计炮孔里的替代 -->
</sql>
<sql id="TProcessesDrillingColumns">
c.BlastDate,
c.Depth,
</sql>
<sql id="TProcessesBlastdesignHoleJoins">
left join T_Processes_BlastDesign_Hole b on a.HoleID = b.BlastHoleID
left join T_Processes_Drilling c on a.HoleID = c.HoleID
<sql id="TProcessesDrillingJoins">
left join T_Processes_Drilling c on a.Uid = c.Uid
</sql>
<sql id="TProcessesBlastDesignHoleJoins">
left join T_Processes_BlastDesign_Hole b on c.Uid = b.BlastHoleID
</sql>
<!-- 获取所有getPage列表 -->
<select id="getPage" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesBlastVo">
SELECT
a.Uid,
a.HoleID,
b.BlastHoleID AS HoleID,
b.HoleBlastVolume,
b.depth AS DesignDepth,
c.Depth
FROM T_Processes_Blast a
<include refid="TProcessesBlastdesignHoleJoins"/>
<include refid="TProcessesDrillingJoins"/>
<include refid="TProcessesBlastDesignHoleJoins"/>
<where>
${ew.sqlSegment}
</where>
......@@ -60,7 +67,8 @@
<include refid="TProcessesDrillingColumns"/>
<include refid="TProcessesBlastColumns"/>
FROM T_Processes_Blast a
<include refid="TProcessesBlastdesignHoleJoins"/>
<include refid="TProcessesDrillingJoins"/>
<include refid="TProcessesBlastDesignHoleJoins"/>
<where>
${ew.sqlSegment}
</where>
......
......@@ -28,13 +28,9 @@
b.DesignDate,
</sql>
<sql id="TProcessesDrillingColumns">
d.DrillingDate,
</sql>
<sql id="TProcessesBlastdesignHoleJoins">
left join T_Processes_BlastDesign_Volume b on a.StopeName=b.StopeName and a.StepName=b.StepName and a.BlastAreaName=b.BlastAreaName
left join T_Processes_Drilling d on a.BlastHoleID = d.HoleID
</sql>
<!-- 获取所有getPage列表 -->
......@@ -52,8 +48,7 @@
a.y,
a.z,
a.StepHeight,
b.BlastVolume,
d.DrillingDate
b.BlastVolume
FROM T_Processes_BlastDesign_Hole a
<include refid="TProcessesBlastdesignHoleJoins"/>
<where>
......
......@@ -6,11 +6,6 @@
<!-- 表和实体字段对照关系, 类似RestultMap -->
<sql id="TProcessesDrillingColumns">
a.Uid,
a.StopeName,
a.StepName,
a.BlastAreaName,
a.HoleID,
a.DrillingDate,
a.Manager,
a.Supervisor,
a.TechDepart,
......@@ -37,7 +32,13 @@
a.Tag
</sql>
<sql id="TProcessesDiggingHoleColumns">
<sql id="TProcessesBlastDesignHoleColumns">
b.StopeName,
b.StepName,
b.BlastAreaName,
b.BlastHoleID AS HoleId,
b.DrillingDate,
b.Depth AS DesignDepth,
b.RowSpace AS DesignRowSpace,
b.HoleSpace AS DesignHoleSpace,
......@@ -53,26 +54,30 @@
d.DesignDate,
</sql>
<sql id="TProcessesDrillingJoins">
left join T_Processes_BlastDesign_Hole b on a.HoleID = b.BlastHoleID
left join T_Processes_BlastDesign_Volume d on a.StopeName=d.StopeName and a.StepName=d.StepName and a.BlastAreaName=d.BlastAreaName
<sql id="TProcessesBlastDesignHoleJoins">
left join T_Processes_BlastDesign_Hole b on a.Uid = b.Uid
</sql>
<sql id="TProcessesBlastDesignVolumeJoins">
left join T_Processes_BlastDesign_Volume d on b.StopeName=d.StopeName and b.StepName=d.StepName and b.BlastAreaName=d.BlastAreaName
</sql>
<!-- 获取所有getPage列表 -->
<select id="getPage" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesDrillingVo">
SELECT
a.Uid,
a.HoleID,
a.Depth,
a.RowSpace,
a.HoleSpace,
a.HoleBlastVolume,
b.BlastHoleID AS HoleId,
b.Depth AS DesignDepth,
b.RowSpace AS DesignRowSpace,
b.HoleSpace AS DesignHoleSpace,
b.StepHeight
FROM T_Processes_Drilling a
<include refid="TProcessesDrillingJoins"/>
<include refid="TProcessesBlastDesignHoleJoins"/>
<include refid="TProcessesBlastDesignVolumeJoins"/>
<where>
${ew.sqlSegment}
</where>
......@@ -82,11 +87,12 @@
<!-- 获取所有getPage列表 -->
<select id="getByQuery" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesDrillingVo">
SELECT
<include refid="TProcessesDiggingHoleColumns"/>
<include refid="TProcessesBlastDesignHoleColumns"/>
<include refid="TProcessesBlastdesignVolumeColumns"/>
<include refid="TProcessesDrillingColumns"/>
FROM T_Processes_Drilling a
<include refid="TProcessesDrillingJoins"/>
<include refid="TProcessesBlastDesignHoleJoins"/>
<include refid="TProcessesBlastDesignVolumeJoins"/>
<where>
${ew.sqlSegment}
</where>
......@@ -97,6 +103,7 @@
SELECT
sum(${condition})
FROM T_Processes_Drilling a
<include refid="TProcessesBlastDesignHoleJoins"/>
<where>
${ew.sqlSegment}
</where>
......
......@@ -24,35 +24,6 @@ public class TProcessesBlastQuery {
@ApiModelProperty("Uid")
private String Uid;
/**
* 采区名称
*/
@ApiModelProperty("StopeName")
private String StopeName;
/**
* 平台名称
*/
@ApiModelProperty("StepName")
private String StepName;
/**
* 爆区名称
*/
@ApiModelProperty("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@ApiModelProperty("HoleID")
private String HoleID;
/**
* 爆破日期
*/
@ApiModelProperty("BlastDate")
private LocalDateTime BlastDate;
/**
* 爆破人员
......@@ -117,12 +88,48 @@ public class TProcessesBlastQuery {
@ApiModelProperty("设计孔深")
private Double DesignDepth;
//表连接字段 炮孔设计表
/**
* 采区名称
*/
@ApiModelProperty("StopeName")
private String StopeName;
/**
* 平台名称
*/
@ApiModelProperty("StepName")
private String StepName;
/**
* 爆区名称
*/
@ApiModelProperty("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@ApiModelProperty("HoleID")
private String HoleID;
/**
* 单孔爆破量 来自 TProcessesBlastdesignHole
*/
@ApiModelProperty("单孔爆破量")
private Double HoleBlastVolume;
//表连接字段,穿孔工序表
/**
* 爆破日期
*/
@ApiModelProperty("BlastDate")
private LocalDateTime BlastDate;
//以下为业务增加字段
/**
* 炮孔编号 修改新的时候会用的
......
......@@ -25,35 +25,6 @@ public class TProcessesDrillingQuery {
@ApiModelProperty("Uid")
private String Uid;
/**
* 采区名称
*/
@ApiModelProperty("StopeName")
private String StopeName;
/**
* 平台名称
*/
@ApiModelProperty("StepName")
private String StepName;
/**
* 爆区名称
*/
@ApiModelProperty("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@ApiModelProperty("HoleID")
private String HoleID;
/**
* 穿孔日期
*/
@ApiModelProperty("DrillingDate")
private LocalDateTime DrillingDate;
/**
* 项目经理
......@@ -201,6 +172,35 @@ public class TProcessesDrillingQuery {
//以下是增加字段 需要表连接的字段 炮孔设计
/**
* 采区名称
*/
@ApiModelProperty("StopeName")
private String StopeName;
/**
* 平台名称
*/
@ApiModelProperty("StepName")
private String StepName;
/**
* 爆区名称
*/
@ApiModelProperty("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@ApiModelProperty("HoleID")
private String HoleID;
/**
* 穿孔日期
*/
@ApiModelProperty("DrillingDate")
private LocalDateTime DrillingDate;
@ApiModelProperty("孔深(m)")
private Double DesignDepth;
......
......@@ -25,35 +25,8 @@ public class TProcessesBlastVo {
@ApiModelProperty("Uid")
private String Uid;
/**
* 采区名称
*/
@ApiModelProperty("StopeName")
private String StopeName;
/**
* 平台名称
*/
@ApiModelProperty("StepName")
private String StepName;
/**
* 爆区名称
*/
@ApiModelProperty("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@ApiModelProperty("HoleID")
private String HoleID;
/**
* 爆破日期
*/
@ApiModelProperty("BlastDate")
private LocalDateTime BlastDate;
/**
* 爆破人员
......@@ -128,4 +101,35 @@ public class TProcessesBlastVo {
*/
@ApiModelProperty("单孔爆破量")
private Double HoleBlastVolume;
/**
* 采区名称
*/
@ApiModelProperty("StopeName")
private String StopeName;
/**
* 平台名称
*/
@ApiModelProperty("StepName")
private String StepName;
/**
* 爆区名称
*/
@ApiModelProperty("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@ApiModelProperty("HoleID")
private String HoleID;
/**
* 爆破日期
*/
@ApiModelProperty("BlastDate")
private LocalDateTime BlastDate;
}
......@@ -25,36 +25,6 @@ public class TProcessesDrillingVo {
@ApiModelProperty("Uid")
private String Uid;
/**
* 采区名称
*/
@ApiModelProperty("StopeName")
private String StopeName;
/**
* 平台名称
*/
@ApiModelProperty("StepName")
private String StepName;
/**
* 爆区名称
*/
@ApiModelProperty("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@ApiModelProperty("HoleID")
private String HoleID;
/**
* 穿孔日期
*/
@ApiModelProperty("DrillingDate")
private LocalDateTime DrillingDate;
/**
* 项目经理
*/
......@@ -201,6 +171,35 @@ public class TProcessesDrillingVo {
//以下是增加字段 需要表连接的字段 炮孔设计
/**
* 采区名称
*/
@ApiModelProperty("StopeName")
private String StopeName;
/**
* 平台名称
*/
@ApiModelProperty("StepName")
private String StepName;
/**
* 爆区名称
*/
@ApiModelProperty("BlastAreaName")
private String BlastAreaName;
/**
* 炮孔编号
*/
@ApiModelProperty("HoleID")
private String HoleID;
/**
* 穿孔日期
*/
@ApiModelProperty("DrillingDate")
private LocalDateTime DrillingDate;
@ApiModelProperty("孔深(m)")
private Double DesignDepth;
......
......@@ -20,11 +20,8 @@ public interface ITProcessesBlastService extends IService<TProcessesBlast> {
R updateByUid(TProcessesBlastQuery query);
R updateByHoleId(TProcessesBlastQuery query);
R insertTProcessesBlast(TProcessesBlastQuery query);
R getByUid(TProcessesBlastQuery query);
R getByHoleId(TProcessesBlastQuery query);
}
......@@ -24,10 +24,8 @@ public interface ITProcessesDrillingService extends IService<TProcessesDrilling>
R updateHoleBlastVolume(TProcessesDrillingQuery query);
R updateByHoleId(TProcessesDrillingQuery query);
R getByUid(TProcessesDrillingQuery query);
R getByHoleId(TProcessesDrillingQuery query);
}
......@@ -56,12 +56,7 @@ public class TProcessesBlastServiceImpl extends ServiceImpl<TProcessesBlastMappe
Page<TProcessesBlast> page = new Page<>(query.getPageNum(), query.getPageSize());
//条件封装
QueryWrapper<TProcessesBlast> queryWrapper = new QueryWrapper<>();
queryWrapper.select(
ProjectEnum.TProcessesBlast.DEPTH.getLabel(),
ProjectEnum.TProcessesBlast.DESIGN_DEPTH.getLabel(),
ProjectEnum.TProcessesBlast.HOLE_ID.getLabel(),
ProjectEnum.TProcessesBlast.HOLE_BLAST_VOLUME.getLabel()
);
//如果设计时间不为空 因为涉及到表连接,需要创建字段别名
if (tProcessesBlastQuery.getBlastDate() != null) {
StringBuilder stringBuilder = new StringBuilder();
......@@ -89,7 +84,7 @@ public class TProcessesBlastServiceImpl extends ServiceImpl<TProcessesBlastMappe
}
//不能修改炮孔编号
if (StringUtils.isNotBlank(query.getHoleID())) {
return R.failed("爆破设计中->不能修改炮孔编号");
return R.failed("爆破设计中->请到炮孔设计中修改炮孔编号");
}
//条件封装
BeanUtilsNewCopy.copyPropertiesIgnoreNull(query, temp);
......@@ -97,15 +92,16 @@ public class TProcessesBlastServiceImpl extends ServiceImpl<TProcessesBlastMappe
if (StringUtils.isNotBlank(query.getStepName())
|| StringUtils.isNotBlank(query.getBlastAreaName())
|| StringUtils.isNotBlank(query.getStopeName())) {
return R.failed("爆破设计中->请到炮孔设计中修改爆区名称,采区名称,平台名称");
//判断矿山爆区表是否存在数据 不存在不能修改
//query里不一定StopeName,StepName,BlastAreaName都有,需要从temp中拿query没有的,
// 所以将query有的更新到temp中,再把temp中的复制到tMineStopeQuery
TMineStopeQuery tMineStopeQuery = new TMineStopeQuery();
BeanUtils.copyProperties(temp, tMineStopeQuery);
R volume = itMineStopeService.getByQuery(tMineStopeQuery);
if (volume.getData() == null) {
return R.failed("爆破设计中->矿山爆区表数据不存在,StopeName,StepName,BlastAreaName");
}
// TMineStopeQuery tMineStopeQuery = new TMineStopeQuery();
// BeanUtils.copyProperties(temp, tMineStopeQuery);
// R volume = itMineStopeService.getByQuery(tMineStopeQuery);
// if (volume.getData() == null) {
// return R.failed("爆破设计中->矿山爆区表数据不存在,StopeName,StepName,BlastAreaName");
// }
}
//判断是否修改设计孔深 和 单孔爆破量
if (query.getDesignDepth() != null || query.getHoleBlastVolume() != null) {
......@@ -143,55 +139,16 @@ public class TProcessesBlastServiceImpl extends ServiceImpl<TProcessesBlastMappe
}
}
@Override
public R updateByHoleId(TProcessesBlastQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotNull(query.getHoleID());
//判断数据是否存在
QueryWrapper<TProcessesBlast> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(ProjectEnum.TProcessesBlast.HOLE_ID.getLabel(), query.getHoleID());
TProcessesBlast temp = baseMapper.selectOne(queryWrapper);
if (temp == null) {
return R.failed("爆破设计中->爆破设计中数据不存在:HOLE_ID: " + query.getHoleID());
}
//判断是否将炮孔编号修改为新的炮孔编号 如果是,直接修改,不能调用基础方法,避免循环
if (StringUtils.isNotBlank(query.getNewHoleID())) {
temp.setHoleID(query.getNewHoleID());
int update = baseMapper.updateById(temp);
if (update > 0) {
return R.ok("爆破设计中->修改成功");
} else {
return R.failed("爆破设计中->修改失败");
}
}
//条件封装
query.setUid(temp.getUid());
//调用基础方法修改
return updateByUid(query);
}
@Override
public R insertTProcessesBlast(TProcessesBlastQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getStopeName());
Rcode.NOT_PARAM.assertNotEmpty(query.getStepName());
Rcode.NOT_PARAM.assertNotEmpty(query.getBlastAreaName());
Rcode.NOT_PARAM.assertNotEmpty(query.getHoleID());
//uid自动生成 不能手动设置
if (query.getUid() != null) {
return R.failed("爆破设计中->uid自动生成 不能手动设置");
}
//判断炮孔编号是否已经存在
if (StringUtils.isNotBlank(query.getHoleID())) {
R r = getByHoleId(query);
if (r.getData() != null) {
return R.failed("爆破设计中->炮孔编号已存在: HoleID:" + query.getHoleID());
}
}
//条件封装
TProcessesBlast tProcessesDrilling = new TProcessesBlast();
BeanUtils.copyProperties(query, tProcessesDrilling);
......@@ -219,17 +176,5 @@ public class TProcessesBlastServiceImpl extends ServiceImpl<TProcessesBlastMappe
return R.ok(baseMapper.getByQuery(queryWrapper));
}
@Override
public R getByHoleId(TProcessesBlastQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getHoleID());
QueryWrapper<TProcessesBlast> queryWrapper = new QueryWrapper<>();
StringBuilder holeId = new StringBuilder();
holeId.append(ProjectEnum.TableAlias.A.getLabel()).append(ProjectEnum.TProcessesBlast.HOLE_ID.getLabel());
queryWrapper.eq(holeId.toString(), query.getHoleID());
//查询并且返回
return R.ok(baseMapper.getByQuery(queryWrapper));
}
}
......@@ -96,18 +96,18 @@ public class TProcessesBlastdesignHoleServiceImpl extends ServiceImpl<TProcesses
}
//修改穿孔工序炮孔编号
TProcessesDrillingQuery tProcessesDrillingQuery = new TProcessesDrillingQuery();
tProcessesDrillingQuery.setHoleID(temp.getBlastHoleID());
tProcessesDrillingQuery.setUid(temp.getUid());
tProcessesDrillingQuery.setNewHoleID(query.getBlastHoleID());
R r1 = itProcessesDrillingService.updateByHoleId(tProcessesDrillingQuery);
R r1 = itProcessesDrillingService.updateByUid(tProcessesDrillingQuery);
if (r1.getCode() != 0) {
log.error("炮孔设计中->修改穿孔工序炮孔编号失败:{}", JSON.toJSONString(tProcessesDrillingQuery));
return R.failed(r1.getMsg());
}
//修改爆破设计炮孔编号
TProcessesBlastQuery tProcessesBlastQuery = new TProcessesBlastQuery();
tProcessesBlastQuery.setHoleID(temp.getBlastHoleID());
tProcessesBlastQuery.setUid(temp.getUid());
tProcessesBlastQuery.setNewHoleID(query.getBlastHoleID());
R r2 = itProcessesBlastService.updateByHoleId(tProcessesBlastQuery);
R r2 = itProcessesBlastService.updateByUid(tProcessesBlastQuery);
if (r2.getCode() != 0) {
log.error("炮孔设计中->修改爆破设计炮孔编号失败:{}", JSON.toJSONString(tProcessesBlastQuery));
return R.failed(r2.getMsg());
......@@ -156,7 +156,7 @@ public class TProcessesBlastdesignHoleServiceImpl extends ServiceImpl<TProcesses
//如果修改了台阶高度,需要通知爆破设计重新计算设计区爆破量
if (query.getStepHeight() != null) {
TProcessesDrillingQuery tProcessesDrillingQuery = new TProcessesDrillingQuery();
tProcessesDrillingQuery.setHoleID(temp.getBlastHoleID());
tProcessesDrillingQuery.setUid(temp.getUid());
tProcessesDrillingQuery.setStepHeight(query.getStepHeight());
itProcessesDrillingService.updateHoleBlastVolume(tProcessesDrillingQuery);
}
......@@ -273,12 +273,12 @@ public class TProcessesBlastdesignHoleServiceImpl extends ServiceImpl<TProcesses
log.info(JSON.toJSONString(tProcessesBlastdesignHole));
int insert = baseMapper.insert(tProcessesBlastdesignHole);
if (insert > 0) {
R r = getByBlastHoleID(query);
TProcessesBlastdesignHole hole = (TProcessesBlastdesignHole) r.getData();
//增加一条穿孔工序
TProcessesDrillingQuery tProcessesDrillingQuery = new TProcessesDrillingQuery();
tProcessesDrillingQuery.setStepName(tProcessesBlastdesignHole.getStepName());
tProcessesDrillingQuery.setStopeName(tProcessesBlastdesignHole.getStopeName());
tProcessesDrillingQuery.setBlastAreaName(tProcessesBlastdesignHole.getBlastAreaName());
tProcessesDrillingQuery.setHoleID(query.getBlastHoleID());
tProcessesBlastdesignHole.setUid(hole.getUid());
tProcessesDrillingQuery.setTag(DateUtil.timeToStr(LocalDateTime.now(), DateUtil.FORMAT_TO_SECOND));
R r1 = itProcessesDrillingService.insertTProcessesDrilling(tProcessesDrillingQuery);
if (r1.getCode() != 0) {
......@@ -288,10 +288,7 @@ public class TProcessesBlastdesignHoleServiceImpl extends ServiceImpl<TProcesses
//增加一条爆破工序
TProcessesBlastQuery tProcessesBlastQuery = new TProcessesBlastQuery();
tProcessesBlastQuery.setStepName(tProcessesBlastdesignHole.getStepName());
tProcessesBlastQuery.setStopeName(tProcessesBlastdesignHole.getStopeName());
tProcessesBlastQuery.setBlastAreaName(tProcessesBlastdesignHole.getBlastAreaName());
tProcessesBlastQuery.setHoleID(query.getBlastHoleID());
tProcessesBlastQuery.setUid(hole.getUid());
tProcessesBlastQuery.setTag(DateUtil.timeToStr(LocalDateTime.now(), DateUtil.FORMAT_TO_SECOND));
R r2 = itProcessesBlastService.insertTProcessesBlast(tProcessesBlastQuery);
if (r2.getCode() != 0) {
......
......@@ -58,12 +58,15 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin
Page<TProcessesDrilling> page = new Page<>(query.getPageNum(), query.getPageSize());
//条件封装
QueryWrapper<TProcessesDrilling> queryWrapper = new QueryWrapper<>();
StringBuffer drillingDate = new StringBuffer()
.append(ProjectEnum.TableAlias.B.getLabel())
.append(ProjectEnum.TProcessesDrilling.DRILLING_DATE.getLabel());
//如果设计时间不为空 因为涉及到表连接,需要创建字段别名
if (tProcessesDrillingQuery.getDrillingDate() != null) {
//前端传来的时间可能为2021-04-05 17:37:33.000, 需要查询 2021-04-05 00:00:00 到 2021-04-05 23:59:59 的数据 故作处理
queryWrapper
.ge(ProjectEnum.TProcessesDrilling.DRILLING_DATE.getLabel(), DateUtil.getBeginTimeStr(tProcessesDrillingQuery.getDrillingDate()))
.le(ProjectEnum.TProcessesDrilling.DRILLING_DATE.getLabel(), DateUtil.getEndTimeStr(tProcessesDrillingQuery.getDrillingDate()));
.ge(drillingDate.toString(), DateUtil.getBeginTimeStr(tProcessesDrillingQuery.getDrillingDate()))
.le(drillingDate.toString(), DateUtil.getEndTimeStr(tProcessesDrillingQuery.getDrillingDate()));
}
//查询分页数据
......@@ -75,9 +78,6 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin
Double depthSum = baseMapper.getSumByCondition(depth.toString(), queryWrapper);
//查询,今日合计孔深
StringBuffer drillingDate = new StringBuffer()
.append(ProjectEnum.TableAlias.A.getLabel())
.append(ProjectEnum.TProcessesDrilling.DRILLING_DATE.getLabel());
//初始化QueryWrapper
LocalDateTime now = LocalDateTime.now();
queryWrapper = new QueryWrapper<>();
......@@ -104,21 +104,7 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getStopeName());
Rcode.NOT_PARAM.assertNotEmpty(query.getStepName());
Rcode.NOT_PARAM.assertNotEmpty(query.getBlastAreaName());
Rcode.NOT_PARAM.assertNotEmpty(query.getHoleID());
//uid自动生成 不能手动设置
if (query.getUid() != null) {
return R.failed("穿孔工序中->uid自动生成 不能手动设置");
}
//判断炮孔编号是否已经存在
if (StringUtils.isNotBlank(query.getHoleID())) {
R r = getByHoleId(query);
if (r.getData() != null) {
return R.failed("穿孔工序中->炮孔编号已存在: HoleID:" + query.getHoleID());
}
}
//条件封装
TProcessesDrilling tProcessesDrilling = new TProcessesDrilling();
BeanUtils.copyProperties(query, tProcessesDrilling);
......@@ -154,28 +140,30 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin
if (StringUtils.isNotBlank(query.getStepName())
|| StringUtils.isNotBlank(query.getBlastAreaName())
|| StringUtils.isNotBlank(query.getStopeName())) {
return R.failed("穿孔工序中->请到炮孔设计中修改爆区名称,采区名称,平台名称");
//判断矿山爆区表是否存在数据 不存在不能修改
//query里不一定StopeName,StepName,BlastAreaName都有,需要从temp中拿query没有的,
// 所以将query有的更新到temp中,再把temp中的复制到tMineStopeQuery
TMineStopeQuery tMineStopeQuery = new TMineStopeQuery();
BeanUtils.copyProperties(temp, tMineStopeQuery);
R volume = itMineStopeService.getByQuery(tMineStopeQuery);
if (volume.getData() == null) {
return R.failed("穿孔工序中->矿山爆区表数据不存在,StopeName,StepName,BlastAreaName");
}
// TMineStopeQuery tMineStopeQuery = new TMineStopeQuery();
// BeanUtils.copyProperties(temp, tMineStopeQuery);
// R volume = itMineStopeService.getByQuery(tMineStopeQuery);
// if (volume.getData() == null) {
// return R.failed("穿孔工序中->矿山爆区表数据不存在,StopeName,StepName,BlastAreaName");
// }
}
//判断是否修改设计爆区爆破量 设计爆区爆破量(m3) TAT
if (query.getBlastVolume() != null) {
TProcessesBlastdesignVolumeQuery tProcessesBlastdesignVolumeQuery = new TProcessesBlastdesignHoleQuery();
tProcessesBlastdesignVolumeQuery.setStopeName(temp.getStopeName());
tProcessesBlastdesignVolumeQuery.setStepName(temp.getStepName());
tProcessesBlastdesignVolumeQuery.setBlastAreaName(temp.getBlastAreaName());
tProcessesBlastdesignVolumeQuery.setBlastVolume(query.getBlastVolume());
R r = itProcessesBlastdesignVolumeService.updateByQuery(tProcessesBlastdesignVolumeQuery);
if (r.getCode() != 0) {
log.info("穿孔工序中->修改设计爆区爆破量失败:{}", JSON.toJSONString(tProcessesBlastdesignVolumeQuery));
return R.failed(r.getMsg());
}
return R.failed("穿孔工序中->请到炮孔设计中修改设计爆区爆破量");
// TProcessesBlastdesignVolumeQuery tProcessesBlastdesignVolumeQuery = new TProcessesBlastdesignHoleQuery();
// tProcessesBlastdesignVolumeQuery.setStopeName(temp.getStopeName());
// tProcessesBlastdesignVolumeQuery.setStepName(temp.getStepName());
// tProcessesBlastdesignVolumeQuery.setBlastAreaName(temp.getBlastAreaName());
// tProcessesBlastdesignVolumeQuery.setBlastVolume(query.getBlastVolume());
// R r = itProcessesBlastdesignVolumeService.updateByQuery(tProcessesBlastdesignVolumeQuery);
// if (r.getCode() != 0) {
// log.info("穿孔工序中->修改设计爆区爆破量失败:{}", JSON.toJSONString(tProcessesBlastdesignVolumeQuery));
// return R.failed(r.getMsg());
// }
}
//判断是否修改炮孔设计
if (query.getDesignDepth() != null
......@@ -208,15 +196,15 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin
//计算单孔爆破量
//先获取炮孔设计数据台阶高度
TProcessesBlastdesignHoleQuery holeQuery = new TProcessesBlastdesignHoleQuery();
holeQuery.setBlastHoleID(temp.getHoleID());
R r = itProcessesBlastdesignHoleService.getByBlastHoleID(holeQuery);
holeQuery.setUid(temp.getUid());
R r = itProcessesBlastdesignHoleService.getByUid(holeQuery);
//不为空计算单孔爆破量
if (r.getData() != null) {
TProcessesBlastdesignHole data = (TProcessesBlastdesignHole) r.getData();
Double volume = calculateHoleBlastVolume(temp.getHoleSpace(), temp.getRowSpace(), data.getStepHeight());
temp.setHoleBlastVolume(volume);
} else {
log.info("穿孔工序中->计算单孔爆破量时,获取炮孔设计为空,炮孔编号:{}", temp.getHoleID());
log.info("穿孔工序中->计算单孔爆破量时,获取炮孔设计为空,炮孔编号:{}", temp.getUid());
}
}
......@@ -233,47 +221,16 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin
}
@Override
public R updateByHoleId(TProcessesDrillingQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotNull(query.getHoleID());
//判断数据是否存在
QueryWrapper<TProcessesDrilling> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(ProjectEnum.TProcessesDrilling.HOLE_ID.getLabel(), query.getHoleID());
TProcessesDrilling temp = baseMapper.selectOne(queryWrapper);
if (temp == null) {
return R.failed("穿孔工序中->数据不存在:HOLE_ID: " + query.getHoleID());
}
//判断是否将炮孔编号修改为新的炮孔编号 如果是,直接修改,不能调用基础方法,避免循环
if (StringUtils.isNotBlank(query.getNewHoleID())) {
temp.setHoleID(query.getNewHoleID());
int update = baseMapper.updateById(temp);
if (update > 0) {
return R.ok("穿孔工序中->修改成功");
} else {
return R.failed("穿孔工序中->修改失败");
}
}
//条件封装
query.setUid(temp.getUid());
//调用基础方法修改
return updateByUid(query);
}
@Override
public R updateHoleBlastVolume(TProcessesDrillingQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotNull(query.getHoleID());
Rcode.NOT_PARAM.assertNotNull(query.getUid());
Rcode.NOT_PARAM.assertNotNull(query.getStepHeight());
//判断数据是否存在
QueryWrapper<TProcessesDrilling> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(ProjectEnum.TProcessesBlast.HOLE_ID.getLabel(), query.getHoleID());
queryWrapper.eq(ProjectEnum.TProcessesBlast.UID.getLabel(), query.getUid());
TProcessesDrilling temp = baseMapper.selectOne(queryWrapper);
if (temp == null) {
return R.failed("穿孔工序中->数据不存在:HOLE_ID: " + query.getHoleID());
......@@ -306,22 +263,6 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin
}
@Override
public R getByHoleId(TProcessesDrillingQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getHoleID());
//查询并且返回
QueryWrapper<TProcessesDrilling> queryWrapper = new QueryWrapper<>();
StringBuilder holeId = new StringBuilder();
holeId.append(ProjectEnum.TableAlias.A.getLabel()).append(ProjectEnum.TProcessesDrilling.HOLE_ID.getLabel());
queryWrapper.eq(holeId.toString(), query.getHoleID());
//查询并且返回
return R.ok(baseMapper.getByQuery(queryWrapper));
}
/**
* 计算并设值 单孔爆破量(m3)=孔距*排距*台阶高度
*/
......
......@@ -6,11 +6,8 @@
<!-- 表和实体字段对照关系, 类似RestultMap -->
<sql id="TProcessesBlastColumns">
a.Uid,
a.StopeName,
a.StepName,
a.BlastAreaName,
a.HoleID,
a.BlastDate,
a.BlastPeople,
a.CheckHoleDate,
a.CheckHolePeople,
......@@ -23,30 +20,40 @@
</sql>
<sql id="TProcessesBlastdesignColumns">
b.StopeName,
b.StepName,
b.BlastAreaName,
b.BlastHoleID AS HoleID,
b.HoleBlastVolume,
b.depth AS DesignDepth,<!-- 设计孔深,将爆破工序里的depth去掉,用设计炮孔里的替代 -->
</sql>
<sql id="TProcessesDrillingColumns">
c.BlastDate,
c.Depth,
</sql>
<sql id="TProcessesBlastdesignHoleJoins">
left join T_Processes_BlastDesign_Hole b on a.HoleID = b.BlastHoleID
left join T_Processes_Drilling c on a.HoleID = c.HoleID
<sql id="TProcessesDrillingJoins">
left join T_Processes_Drilling c on a.Uid = c.Uid
</sql>
<sql id="TProcessesBlastDesignHoleJoins">
left join T_Processes_BlastDesign_Hole b on c.Uid = b.BlastHoleID
</sql>
<!-- 获取所有getPage列表 -->
<select id="getPage" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesBlastVo">
SELECT
a.Uid,
a.HoleID,
b.BlastHoleID AS HoleID,
b.HoleBlastVolume,
b.depth AS DesignDepth,
c.Depth
FROM T_Processes_Blast a
<include refid="TProcessesBlastdesignHoleJoins"/>
<include refid="TProcessesDrillingJoins"/>
<include refid="TProcessesBlastDesignHoleJoins"/>
<where>
${ew.sqlSegment}
</where>
......@@ -60,7 +67,8 @@
<include refid="TProcessesDrillingColumns"/>
<include refid="TProcessesBlastColumns"/>
FROM T_Processes_Blast a
<include refid="TProcessesBlastdesignHoleJoins"/>
<include refid="TProcessesDrillingJoins"/>
<include refid="TProcessesBlastDesignHoleJoins"/>
<where>
${ew.sqlSegment}
</where>
......
......@@ -28,13 +28,9 @@
b.DesignDate,
</sql>
<sql id="TProcessesDrillingColumns">
d.DrillingDate,
</sql>
<sql id="TProcessesBlastdesignHoleJoins">
left join T_Processes_BlastDesign_Volume b on a.StopeName=b.StopeName and a.StepName=b.StepName and a.BlastAreaName=b.BlastAreaName
left join T_Processes_Drilling d on a.BlastHoleID = d.HoleID
</sql>
<!-- 获取所有getPage列表 -->
......@@ -52,8 +48,7 @@
a.y,
a.z,
a.StepHeight,
b.BlastVolume,
d.DrillingDate
b.BlastVolume
FROM T_Processes_BlastDesign_Hole a
<include refid="TProcessesBlastdesignHoleJoins"/>
<where>
......
......@@ -6,11 +6,6 @@
<!-- 表和实体字段对照关系, 类似RestultMap -->
<sql id="TProcessesDrillingColumns">
a.Uid,
a.StopeName,
a.StepName,
a.BlastAreaName,
a.HoleID,
a.DrillingDate,
a.Manager,
a.Supervisor,
a.TechDepart,
......@@ -37,7 +32,13 @@
a.Tag
</sql>
<sql id="TProcessesDiggingHoleColumns">
<sql id="TProcessesBlastDesignHoleColumns">
b.StopeName,
b.StepName,
b.BlastAreaName,
b.BlastHoleID AS HoleId,
b.DrillingDate,
b.Depth AS DesignDepth,
b.RowSpace AS DesignRowSpace,
b.HoleSpace AS DesignHoleSpace,
......@@ -53,26 +54,30 @@
d.DesignDate,
</sql>
<sql id="TProcessesDrillingJoins">
left join T_Processes_BlastDesign_Hole b on a.HoleID = b.BlastHoleID
left join T_Processes_BlastDesign_Volume d on a.StopeName=d.StopeName and a.StepName=d.StepName and a.BlastAreaName=d.BlastAreaName
<sql id="TProcessesBlastDesignHoleJoins">
left join T_Processes_BlastDesign_Hole b on a.Uid = b.Uid
</sql>
<sql id="TProcessesBlastDesignVolumeJoins">
left join T_Processes_BlastDesign_Volume d on b.StopeName=d.StopeName and b.StepName=d.StepName and b.BlastAreaName=d.BlastAreaName
</sql>
<!-- 获取所有getPage列表 -->
<select id="getPage" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesDrillingVo">
SELECT
a.Uid,
a.HoleID,
a.Depth,
a.RowSpace,
a.HoleSpace,
a.HoleBlastVolume,
b.BlastHoleID AS HoleId,
b.Depth AS DesignDepth,
b.RowSpace AS DesignRowSpace,
b.HoleSpace AS DesignHoleSpace,
b.StepHeight
FROM T_Processes_Drilling a
<include refid="TProcessesDrillingJoins"/>
<include refid="TProcessesBlastDesignHoleJoins"/>
<include refid="TProcessesBlastDesignVolumeJoins"/>
<where>
${ew.sqlSegment}
</where>
......@@ -82,11 +87,12 @@
<!-- 获取所有getPage列表 -->
<select id="getByQuery" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesDrillingVo">
SELECT
<include refid="TProcessesDiggingHoleColumns"/>
<include refid="TProcessesBlastDesignHoleColumns"/>
<include refid="TProcessesBlastdesignVolumeColumns"/>
<include refid="TProcessesDrillingColumns"/>
FROM T_Processes_Drilling a
<include refid="TProcessesDrillingJoins"/>
<include refid="TProcessesBlastDesignHoleJoins"/>
<include refid="TProcessesBlastDesignVolumeJoins"/>
<where>
${ew.sqlSegment}
</where>
......@@ -97,6 +103,7 @@
SELECT
sum(${condition})
FROM T_Processes_Drilling a
<include refid="TProcessesBlastDesignHoleJoins"/>
<where>
${ew.sqlSegment}
</where>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment