领用出库
This commit is contained in:
parent
5f67ecde62
commit
53ac43dcb2
|
|
@ -194,4 +194,15 @@ public class DevChangeController extends BaseController {
|
|||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核出库
|
||||
* @param csDeviceInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "审核出库")
|
||||
@PostMapping("/approve")
|
||||
public AjaxResult approve(@RequestBody CsDeviceInfo csDeviceInfo) {
|
||||
return service.approve(csDeviceInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.bonus.material.devchange.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -42,13 +44,14 @@ public class CsDeviceDetails {
|
|||
private String devCode;
|
||||
|
||||
@ApiModelProperty(value = "当前库存")
|
||||
private Integer storageNum;
|
||||
private BigDecimal storageNum;
|
||||
|
||||
@ApiModelProperty(value = "申请数量")
|
||||
private Integer num;
|
||||
private BigDecimal num = BigDecimal.ZERO;
|
||||
|
||||
@ApiModelProperty(value = "使用到期日期")
|
||||
private String useTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date useTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.bonus.material.devchange.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -39,7 +42,8 @@ public class CsDeviceInfo {
|
|||
private String proCounty;
|
||||
|
||||
@ApiModelProperty(value = "使用到期日期")
|
||||
private String useTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date useTime;
|
||||
|
||||
@ApiModelProperty(value = "领用单号")
|
||||
private String code;
|
||||
|
|
@ -51,6 +55,8 @@ public class CsDeviceInfo {
|
|||
private String leaseType;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
|
|
@ -66,9 +72,9 @@ public class CsDeviceInfo {
|
|||
private Integer devNum;
|
||||
|
||||
@ApiModelProperty(value = "申请工具数量")
|
||||
private Integer toolNum;
|
||||
private BigDecimal toolNum;
|
||||
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
@ApiModelProperty(value = "任务状态 0审核中 1已通过 2已驳回")
|
||||
private String taskStatus;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
|
|
@ -76,4 +82,11 @@ public class CsDeviceInfo {
|
|||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
private String changeStatus;
|
||||
|
||||
/**
|
||||
* 变更前单位
|
||||
*/
|
||||
private String changeUnit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,4 +214,25 @@ public interface DevChangeMapper {
|
|||
* @return
|
||||
*/
|
||||
List<CsDeviceInfo> getList(CsDeviceInfo dto);
|
||||
|
||||
/**
|
||||
* 审批
|
||||
* @param csDeviceInfo
|
||||
* @return
|
||||
*/
|
||||
int approve(CsDeviceInfo csDeviceInfo);
|
||||
|
||||
/**
|
||||
* 获取装备类型
|
||||
* @param csDeviceDetails
|
||||
* @return
|
||||
*/
|
||||
CsDeviceDetails getTypeMaDevInfo(CsDeviceDetails csDeviceDetails);
|
||||
|
||||
/**
|
||||
* 获取工具类型
|
||||
* @param csDeviceDetails
|
||||
* @return
|
||||
*/
|
||||
CsDeviceDetails getTypeToolInfo(CsDeviceDetails csDeviceDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,4 +101,11 @@ public interface DevChangeService {
|
|||
* @return
|
||||
*/
|
||||
List<CsDeviceInfo> getList(CsDeviceInfo dto);
|
||||
|
||||
/**
|
||||
* 审批
|
||||
* @param csDeviceInfo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult approve(CsDeviceInfo csDeviceInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,13 +228,14 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
if (csDeviceVo == null || csDeviceVo.getDevInfo() == null || CollectionUtils.isEmpty(csDeviceVo.getDevDetailsList())) {
|
||||
return AjaxResult.error("请选择需要添加的设备");
|
||||
}
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||
// 获取申请编号
|
||||
int thisMonthMaxOrder = mapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TypeEnums.TM_TASK_LEASE.getTaskTypeId());
|
||||
String code = genderTaskCode(thisMonthMaxOrder);
|
||||
CsDeviceInfo devInfo = csDeviceVo.getDevInfo();
|
||||
devInfo.setCode(code);
|
||||
devInfo.setCreateBy(userId.toString());
|
||||
devInfo.setCreateBy(nickName);
|
||||
devInfo.setTaskStatus("0");
|
||||
// 添加主任务
|
||||
int num = mapper.addChangeInfoNew(devInfo);
|
||||
if (num < 1) {
|
||||
|
|
@ -242,7 +243,7 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
}
|
||||
csDeviceVo.getDevDetailsList().forEach(devDetails -> {
|
||||
devDetails.setChangeId(devInfo.getId());
|
||||
devDetails.setCreateBy(userId.toString());
|
||||
devDetails.setCreateBy(nickName);
|
||||
devDetails.setCreateTime(DateUtils.getNowDate());
|
||||
});
|
||||
// 添加设备详情
|
||||
|
|
@ -251,7 +252,8 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
throw new RuntimeException("添加设备详情失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error("添加失败");
|
||||
}
|
||||
return AjaxResult.success("添加成功");
|
||||
}
|
||||
|
|
@ -268,8 +270,8 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
|| CollectionUtils.isEmpty(csDeviceVo.getDevDetailsList())) {
|
||||
return AjaxResult.error("请选择需要修改的设备");
|
||||
}
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
csDeviceVo.getDevInfo().setUpdateBy(userId.toString());
|
||||
String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||
csDeviceVo.getDevInfo().setUpdateBy(nickName);
|
||||
// 修改主任务
|
||||
int num = mapper.updateCsDevInfo(csDeviceVo.getDevInfo());
|
||||
if (num < 1) {
|
||||
|
|
@ -282,13 +284,18 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
}
|
||||
csDeviceVo.getDevDetailsList().forEach(devDetails -> {
|
||||
devDetails.setChangeId(csDeviceVo.getDevInfo().getId());
|
||||
devDetails.setUpdateBy(userId.toString());
|
||||
devDetails.setCreateBy(userId.toString());
|
||||
devDetails.setUpdateBy(nickName);
|
||||
devDetails.setCreateBy(nickName);
|
||||
devDetails.setCreateTime(DateUtils.getNowDate());
|
||||
devDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
});
|
||||
num = mapper.addDetails(csDeviceVo.getDevDetailsList());
|
||||
if (num < 1) {
|
||||
throw new RuntimeException("添加设备详情失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
|
|
@ -305,6 +312,27 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
CsDeviceInfo devInfo = mapper.getDevInfoById(dto);
|
||||
// 根据id查询设备详情表数据
|
||||
List<CsDeviceDetails> devDetailsList = mapper.getDevDetailsById(dto);
|
||||
if (CollectionUtils.isNotEmpty(devDetailsList)) {
|
||||
// 根据devType去查询装备或工具详情
|
||||
for (CsDeviceDetails csDeviceDetails : devDetailsList) {
|
||||
CsDeviceDetails devDetails = new CsDeviceDetails();
|
||||
if (StringUtils.isNotBlank(csDeviceDetails.getDevType()) && "1".equals(csDeviceDetails.getDevType())) {
|
||||
devDetails = mapper.getTypeMaDevInfo(csDeviceDetails);
|
||||
} else if (StringUtils.isNotBlank(csDeviceDetails.getDevType()) && "2".equals(csDeviceDetails.getDevType())) {
|
||||
devDetails = mapper.getTypeToolInfo(csDeviceDetails);
|
||||
}
|
||||
if (devDetails != null) {
|
||||
csDeviceDetails.setCategory(StringUtils.isNotBlank(devDetails.getCategory()) ? devDetails.getCategory() : "");
|
||||
csDeviceDetails.setTypeName(StringUtils.isNotBlank(devDetails.getTypeName()) ? devDetails.getTypeName() : "");
|
||||
csDeviceDetails.setTypeModelName(StringUtils.isNotBlank(devDetails.getTypeModelName()) ? devDetails.getTypeModelName() : "");
|
||||
csDeviceDetails.setManageType(StringUtils.isNotBlank(devDetails.getManageType()) ? devDetails.getManageType() : "");
|
||||
csDeviceDetails.setDevCode(StringUtils.isNotBlank(devDetails.getDevCode()) ? devDetails.getDevCode() : "");
|
||||
csDeviceDetails.setStorageNum(devDetails.getStorageNum());
|
||||
// 用于编辑显示数据是否选中(前端根据typeId和id结合判断)
|
||||
csDeviceDetails.setId(devDetails.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
csDeviceVo.setDevInfo(devInfo);
|
||||
csDeviceVo.setDevDetailsList(devDetailsList);
|
||||
return csDeviceVo;
|
||||
|
|
@ -330,7 +358,8 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
throw new RuntimeException("删除设备详情失败");
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
|
|
@ -345,6 +374,18 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
return mapper.getList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核出库
|
||||
* @param csDeviceInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult approve(CsDeviceInfo csDeviceInfo) {
|
||||
csDeviceInfo.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString());
|
||||
int num = mapper.approve(csDeviceInfo);
|
||||
return num > 0 ? AjaxResult.success("审核成功") : AjaxResult.error("审核失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成任务编号
|
||||
* @param thisMonthMaxOrder
|
||||
|
|
|
|||
|
|
@ -234,7 +234,8 @@
|
|||
</select>
|
||||
|
||||
<select id="getDevDetailsInfo" resultType="com.bonus.material.devchange.domain.CsDeviceDetails">
|
||||
SELECT CASE
|
||||
SELECT
|
||||
CASE
|
||||
WHEN mt.level = 1 THEN mt.type_name
|
||||
WHEN mt.level = 2 THEN CONCAT(mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 3 THEN CONCAT(mt2.type_name, '>', mt1.type_name, '>', mt.type_name)
|
||||
|
|
@ -252,7 +253,8 @@
|
|||
mdi.code AS devCode,
|
||||
1 AS storageNum,
|
||||
1 AS devType,
|
||||
mdi.type_id AS typeId
|
||||
mdi.type_id AS typeId,
|
||||
mdi.ma_id AS id
|
||||
FROM ma_dev_info mdi
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
|
|
@ -261,7 +263,18 @@
|
|||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
LEFT JOIN ma_type mt5 ON mt4.parent_id = mt5.type_id
|
||||
<where>
|
||||
mdi.is_active = '1'
|
||||
mdi.is_active = '1' and mdi.ma_status = 1
|
||||
<!-- 过滤待审核设备-->
|
||||
AND mdi.code NOT IN (
|
||||
SELECT
|
||||
cdc.dev_code
|
||||
FROM
|
||||
cs_device_change_details cdc
|
||||
LEFT JOIN cs_device_change cd ON cdc.change_id = cd.id
|
||||
WHERE
|
||||
cdc.dev_code is not null
|
||||
AND cdc.del_flag = '0'
|
||||
AND cdc.dev_type = '1')
|
||||
<if test="typeName!=null and typeName!=''">
|
||||
AND mdi.device_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
|
|
@ -282,7 +295,8 @@
|
|||
IFNULL(tl.tool_code,'/') as devCode,
|
||||
tl.available_num as storageNum,
|
||||
2 as devType,
|
||||
tl.type_id as typeId
|
||||
tl.type_id as typeId,
|
||||
tl.id as id
|
||||
FROM tool_ledger tl
|
||||
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
||||
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
|
|
@ -290,6 +304,18 @@
|
|||
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
LEFT JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
<where>
|
||||
tl.status = '0'
|
||||
<!-- 过滤已申请设备-->
|
||||
AND IFNULL(tl.tool_code,'/') NOT IN (
|
||||
SELECT
|
||||
cdc.dev_code
|
||||
FROM
|
||||
cs_device_change_details cdc
|
||||
LEFT JOIN cs_device_change cd ON cdc.change_id = cd.id
|
||||
WHERE
|
||||
cdc.dev_code is not null
|
||||
AND cdc.del_flag = '0'
|
||||
AND cdc.dev_type = '2')
|
||||
<if test="typeName!=null and typeName!=''">
|
||||
AND tt1.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
|
|
@ -307,7 +333,7 @@
|
|||
where
|
||||
month(create_time) = #{month} and year(create_time) = #{year}
|
||||
<if test="taskType != null and taskType !=''">
|
||||
and task_type = #{taskType}
|
||||
and type = #{taskType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
@ -331,57 +357,14 @@
|
|||
</select>
|
||||
|
||||
<select id="getDevDetailsById" resultType="com.bonus.material.devchange.domain.CsDeviceDetails">
|
||||
SELECT CASE
|
||||
WHEN mt.level = 1 THEN mt.type_name
|
||||
WHEN mt.level = 2 THEN CONCAT(mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 3 THEN CONCAT(mt2.type_name, '>', mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 4 THEN CONCAT(mt3.type_name, '>', mt2.type_name, '>', mt1.type_name, '>',
|
||||
mt.type_name)
|
||||
WHEN mt.level = 5 THEN CONCAT(mt4.type_name, '>', mt3.type_name, '>', mt2.type_name, '>',
|
||||
mt1.type_name,'>', mt.type_name)
|
||||
WHEN mt.level = 6 THEN CONCAT(mt5.type_name, '>', mt4.type_name, '>', mt3.type_name, '>',
|
||||
mt2.type_name,'>', mt1.type_name, '>', mt.type_name)
|
||||
ELSE mt.type_name
|
||||
END AS category,
|
||||
mdi.device_name AS typeName,
|
||||
mdi.item_type_model AS typeModelName,
|
||||
mdi.manage_type AS manageType,
|
||||
mdi.code AS devCode,
|
||||
1 AS storageNum,
|
||||
1 AS devType,
|
||||
mdi.type_id AS typeId
|
||||
cd.num AS num,
|
||||
cd.use_time AS useTime
|
||||
FROM cs_device_change_details cd
|
||||
LEFT JOIN ma_dev_info mdi ON mdi.type_id = cd.dev_type_id
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
LEFT JOIN ma_type mt5 ON mt4.parent_id = mt5.type_id
|
||||
where cd.change_id = #{id} and cd.dev_type = '1' and cd.del_flag = '0'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT CONCAT(tt4.type_name, '>', tt3.type_name, '>', tt2.type_name) as category,
|
||||
tt1.type_name as typeName,
|
||||
tt.type_name as typeModelName,
|
||||
tl.manage_mode as manageType,
|
||||
IFNULL(tl.tool_code,'/') as devCode,
|
||||
tl.available_num as storageNum,
|
||||
2 as devType,
|
||||
tl.type_id as typeId,
|
||||
cd.num as num,
|
||||
cd.use_time as useTime
|
||||
FROM cs_device_change_details cd
|
||||
LEFT JOIN tool_ledger tl ON tl.type_id = cd.dev_type_id
|
||||
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
||||
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
LEFT JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
LEFT JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
where cd.change_id = #{id} and cd.dev_type = '2' and cd.del_flag = '0'
|
||||
SELECT
|
||||
dev_code AS devCode,
|
||||
dev_type AS devType,
|
||||
dev_type_id AS typeId,
|
||||
num AS num,
|
||||
use_time AS useTime
|
||||
FROM cs_device_change_details
|
||||
where change_id = #{id} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="getList" resultType="com.bonus.material.devchange.domain.CsDeviceInfo">
|
||||
|
|
@ -400,16 +383,27 @@
|
|||
cd.use_time AS useTime,
|
||||
cd.CODE AS CODE,
|
||||
cd.review_status AS taskStatus,
|
||||
su.nick_name AS createBy,
|
||||
cd.create_user AS createBy,
|
||||
cd.create_time AS createTime,
|
||||
SUM(IF( cdc.dev_type = '1', cdc.num, 0 )) AS devNum,
|
||||
SUM(IF( cdc.dev_type = '2', cdc.num, 0 )) AS toolNum
|
||||
FROM
|
||||
cs_device_change cd
|
||||
LEFT JOIN cs_device_change_details cdc ON cd.id = cdc.change_id
|
||||
LEFT JOIN sys_user su ON cd.create_user = su.user_id
|
||||
LEFT JOIN cs_device_change_details cdc ON cd.id = cdc.change_id
|
||||
WHERE
|
||||
cdc.del_flag = '0'
|
||||
cdc.del_flag = '0' and cd.type = '2'
|
||||
<if test="taskStatus != null and taskStatus != ''">
|
||||
and cd.review_status = #{taskStatus}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND cd.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
and cd.pro_name = #{proName}
|
||||
</if>
|
||||
<if test="proCode != null and proCode != ''">
|
||||
and cd.pro_code = #{proCode}
|
||||
</if>
|
||||
GROUP BY
|
||||
cd.id
|
||||
ORDER BY
|
||||
|
|
@ -417,13 +411,73 @@
|
|||
DESC
|
||||
</select>
|
||||
|
||||
<select id="getTypeMaDevInfo" resultType="com.bonus.material.devchange.domain.CsDeviceDetails">
|
||||
SELECT
|
||||
CASE
|
||||
WHEN mt.level = 1 THEN mt.type_name
|
||||
WHEN mt.level = 2 THEN CONCAT(mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 3 THEN CONCAT(mt2.type_name, '>', mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 4 THEN CONCAT(mt3.type_name, '>', mt2.type_name, '>', mt1.type_name, '>',
|
||||
mt.type_name)
|
||||
WHEN mt.level = 5 THEN CONCAT(mt4.type_name, '>', mt3.type_name, '>', mt2.type_name, '>',
|
||||
mt1.type_name,'>', mt.type_name)
|
||||
WHEN mt.level = 6 THEN CONCAT(mt5.type_name, '>', mt4.type_name, '>', mt3.type_name, '>',
|
||||
mt2.type_name,'>', mt1.type_name, '>', mt.type_name)
|
||||
ELSE mt.type_name
|
||||
END AS category,
|
||||
mdi.device_name AS typeName,
|
||||
mdi.item_type_model AS typeModelName,
|
||||
mdi.manage_type AS manageType,
|
||||
mdi.code AS devCode,
|
||||
1 AS storageNum,
|
||||
1 AS devType,
|
||||
mdi.type_id AS typeId,
|
||||
mdi.ma_id AS id
|
||||
FROM ma_dev_info mdi
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
LEFT JOIN ma_type mt5 ON mt4.parent_id = mt5.type_id
|
||||
where
|
||||
mdi.is_active = '1' and mdi.type_id = #{typeId}
|
||||
<if test="devCode != null and devCode != ''">
|
||||
and mdi.code = #{devCode}
|
||||
</if>
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="getTypeToolInfo" resultType="com.bonus.material.devchange.domain.CsDeviceDetails">
|
||||
SELECT CONCAT(tt4.type_name, '>', tt3.type_name, '>', tt2.type_name) as category,
|
||||
tt1.type_name as typeName,
|
||||
tt.type_name as typeModelName,
|
||||
tl.manage_mode as manageType,
|
||||
IFNULL(tl.tool_code,'/') as devCode,
|
||||
tl.available_num as storageNum,
|
||||
2 as devType,
|
||||
tl.type_id as typeId,
|
||||
tl.id as id
|
||||
FROM tool_ledger tl
|
||||
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
||||
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
LEFT JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
LEFT JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
where
|
||||
tl.type_id = #{typeId}
|
||||
<if test="devCode != null and devCode != ''">
|
||||
and tl.tool_code = #{devCode}
|
||||
</if>
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="addChangeInfoNew" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into cs_device_change(change_status, type, lease_type, pro_code, pro_name,
|
||||
pro_type, voltage_level, use_unit, pro_province, pro_city,
|
||||
pro_county, create_time, create_user, del_flag, change_unit, code, use_time)
|
||||
pro_county, create_time, create_user, del_flag, change_unit, code, use_time,review_status)
|
||||
values ( #{changeStatus}, #{type}, #{leaseType}, #{proCode}, #{proName}, #{proType},
|
||||
#{voltageLevel}, #{useUnit}, #{proProvince}, #{proCity}, #{proCounty},
|
||||
now(), #{createUser}, 0, #{changeUnit}, #{code}, #{useTime})
|
||||
now(), #{createBy}, 0, #{changeUnit}, #{code}, #{useTime}, #{taskStatus})
|
||||
</insert>
|
||||
|
||||
<insert id="addDetails">
|
||||
|
|
@ -463,7 +517,7 @@
|
|||
<if test="proCounty != null and proCounty != ''">
|
||||
pro_county = #{proCounty},
|
||||
</if>
|
||||
<if test="useTime != null and useTime != ''">
|
||||
<if test="useTime != null">
|
||||
use_time = #{useTime},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
|
|
@ -474,6 +528,20 @@
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="approve">
|
||||
update cs_device_change
|
||||
<set>
|
||||
<if test="taskStatus != null and taskStatus != ''">
|
||||
review_status = #{taskStatus},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
review_by = #{updateBy},
|
||||
</if>
|
||||
review_time = NOW()
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteChangeDetails">
|
||||
update cs_device_change_details set del_flag = '1' where change_id = #{id}
|
||||
</delete>
|
||||
|
|
|
|||
Loading…
Reference in New Issue