app联调代码提交
This commit is contained in:
parent
a8d0461e37
commit
c2aaa44f1b
|
|
@ -69,7 +69,7 @@ public class LeaseOutDetailsController extends BaseController {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return AjaxResult.success("绑定成功");
|
return AjaxResult.success("绑定成功");
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("编号已存在,绑定失败");
|
return AjaxResult.error("二维码已绑定或编号已存在,绑定失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public interface BackReceiveMapper {
|
||||||
* @param taskType
|
* @param taskType
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
String selectTaskNumByMonthWx(@Param("date") Date date, @Param("taskType") Integer taskType);
|
Integer selectTaskNumByMonthWx(@Param("date") Date date, @Param("taskType") Integer taskType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加维修任务
|
* 添加维修任务
|
||||||
|
|
|
||||||
|
|
@ -144,77 +144,77 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int endBack(BackApplyInfo record) {
|
public int endBack(BackApplyInfo record) {
|
||||||
int res;
|
int res;
|
||||||
try {
|
// try {
|
||||||
int taskId = record.getTaskId();
|
int taskId = record.getTaskId();
|
||||||
//先判断是否已经完成退料了
|
//先判断是否已经完成退料了
|
||||||
int taskStatus = selectTaskStatus(taskId);
|
int taskStatus = selectTaskStatus(taskId);
|
||||||
if (taskStatus == 0) {
|
if (taskStatus == 0) {
|
||||||
throw new RuntimeException("该退料单已完成退料");
|
throw new RuntimeException("该退料单已完成退料");
|
||||||
}
|
}
|
||||||
//修改任务状态
|
//修改任务状态
|
||||||
res = updateTaskStatus(taskId, 40);
|
res = updateTaskStatus(taskId, 40);
|
||||||
|
if (res == 0) {
|
||||||
|
throw new RuntimeException("tm_task修改状态");
|
||||||
|
}
|
||||||
|
//更加退料接收的数据创建下一步流程
|
||||||
|
//合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态
|
||||||
|
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
|
||||||
|
if (hgList != null && hgList.size() > 0) {
|
||||||
|
res = insertIad(hgList);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException("tm_task修改状态");
|
throw new RuntimeException("input_apply_details");
|
||||||
}
|
}
|
||||||
//更加退料接收的数据创建下一步流程
|
// 如果是成套的机具,成套机具的库存也要添加
|
||||||
//合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态
|
List<BackApplyInfo> ctList = backReceiveMapper.getCtList(record);
|
||||||
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
|
if (ctList.size() > 0) {
|
||||||
if (hgList != null && hgList.size() > 0) {
|
for (BackApplyInfo backApplyInfo : ctList) {
|
||||||
res = insertIad(hgList);
|
if ("2".equals(backApplyInfo.getManageType())) {
|
||||||
if (res == 0) {
|
backReceiveMapper.updateMt(backApplyInfo);
|
||||||
throw new RuntimeException("input_apply_details");
|
|
||||||
}
|
|
||||||
// 如果是成套的机具,成套机具的库存也要添加
|
|
||||||
List<BackApplyInfo> ctList = backReceiveMapper.getCtList(record);
|
|
||||||
if (ctList.size() > 0) {
|
|
||||||
for (BackApplyInfo backApplyInfo : ctList) {
|
|
||||||
if ("2".equals(backApplyInfo.getManageType())) {
|
|
||||||
backReceiveMapper.updateMt(backApplyInfo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = updateMt(hgList);
|
|
||||||
if (res == 0) {
|
|
||||||
throw new RuntimeException("ma_type");
|
|
||||||
}
|
|
||||||
res = updateMaStatus(hgList);
|
|
||||||
if (res == 0) {
|
|
||||||
throw new RuntimeException("ma_machines");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//维修的创建维修任务,插入任务协议表
|
res = updateMt(hgList);
|
||||||
List<BackApplyInfo> wxList = backReceiveMapper.getWxList(record);
|
if (res == 0) {
|
||||||
if (wxList != null && wxList.size() > 0) {
|
throw new RuntimeException("ma_type");
|
||||||
//插入任务表tm_task
|
|
||||||
int newTaskId = insertTt(wxList, 41, record.getCreateBy());
|
|
||||||
//插入协议任务表tm_task_agreement
|
|
||||||
res = insertTta(newTaskId, wxList);
|
|
||||||
//插入维修记录表repair_apply_details
|
|
||||||
res = insertRad(newTaskId, wxList);
|
|
||||||
}
|
}
|
||||||
//待报废的创建报废任务,插入任务协议表
|
res = updateMaStatus(hgList);
|
||||||
|
if (res == 0) {
|
||||||
List<BackApplyInfo> bfList = backReceiveMapper.getBfList(record);
|
throw new RuntimeException("ma_machines");
|
||||||
if (bfList != null && bfList.size() > 0) {
|
|
||||||
//插入任务表tm_task
|
|
||||||
int newTaskId = insertTt(bfList, 57, record.getCreateBy());
|
|
||||||
//插入协议任务表tm_task_agreement
|
|
||||||
res = insertTta(newTaskId, bfList);
|
|
||||||
//插入维修记录表scrap_apply_details
|
|
||||||
res = insertSad(newTaskId, bfList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BackApplyInfo> allList = backReceiveMapper.getAllList(record);
|
|
||||||
if (allList != null && allList.size() > 0) {
|
|
||||||
res = updateSlt(record, allList);
|
|
||||||
if (res == 0) {
|
|
||||||
throw new RuntimeException("该机具未被领料使用");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
//维修的创建维修任务,插入任务协议表
|
||||||
|
List<BackApplyInfo> wxList = backReceiveMapper.getWxList(record);
|
||||||
|
if (wxList != null && wxList.size() > 0) {
|
||||||
|
//插入任务表tm_task
|
||||||
|
int newTaskId = insertTt(wxList, 41, record.getCreateBy());
|
||||||
|
//插入协议任务表tm_task_agreement
|
||||||
|
res = insertTta(newTaskId, wxList);
|
||||||
|
//插入维修记录表repair_apply_details
|
||||||
|
res = insertRad(newTaskId, wxList);
|
||||||
|
}
|
||||||
|
//待报废的创建报废任务,插入任务协议表
|
||||||
|
|
||||||
|
List<BackApplyInfo> bfList = backReceiveMapper.getBfList(record);
|
||||||
|
if (bfList != null && bfList.size() > 0) {
|
||||||
|
//插入任务表tm_task
|
||||||
|
int newTaskId = insertTt(bfList, 57, record.getCreateBy());
|
||||||
|
//插入协议任务表tm_task_agreement
|
||||||
|
res = insertTta(newTaskId, bfList);
|
||||||
|
//插入维修记录表scrap_apply_details
|
||||||
|
res = insertSad(newTaskId, bfList);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<BackApplyInfo> allList = backReceiveMapper.getAllList(record);
|
||||||
|
if (allList != null && allList.size() > 0) {
|
||||||
|
res = updateSlt(record, allList);
|
||||||
|
if (res == 0) {
|
||||||
|
throw new RuntimeException("该机具未被领料使用");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException(e.getMessage());
|
||||||
|
// }
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -498,16 +498,17 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||||
Date nowDate = DateUtils.getNowDate();
|
Date nowDate = DateUtils.getNowDate();
|
||||||
String format = dateFormat.format(nowDate);
|
String format = dateFormat.format(nowDate);
|
||||||
String taskNum = backReceiveMapper.selectTaskNumByMonthWx(nowDate, taskType);
|
Integer taskNum = backReceiveMapper.selectTaskNumByMonthWx(nowDate, taskType);
|
||||||
if (StringHelper.isNotEmpty(taskNum)) {
|
String taskNumStr = "";
|
||||||
|
if (taskNum != null) {
|
||||||
// 将字符串转换为整数
|
// 将字符串转换为整数
|
||||||
int num = Integer.parseInt(taskNum);
|
// int num = Integer.parseInt(taskNum);
|
||||||
// 执行加一操作
|
// 执行加一操作
|
||||||
num++;
|
taskNum++;
|
||||||
// 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0
|
// 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0
|
||||||
taskNum = String.format("%04d", num);
|
taskNumStr = String.format("%04d", taskNum);
|
||||||
} else {
|
} else {
|
||||||
taskNum = "0001";
|
taskNumStr = "0001";
|
||||||
}
|
}
|
||||||
String code = "";
|
String code = "";
|
||||||
if (GlobalConstants.INT_41 == taskType) {
|
if (GlobalConstants.INT_41 == taskType) {
|
||||||
|
|
@ -516,7 +517,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
if (GlobalConstants.INT_57 == taskType) {
|
if (GlobalConstants.INT_57 == taskType) {
|
||||||
code = "BF";
|
code = "BF";
|
||||||
}
|
}
|
||||||
code = code + format + "-" + taskNum;
|
code = code + format + "-" + taskNumStr;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
||||||
return AjaxResult.error("领料出库失败,机具库存不足");
|
return AjaxResult.error("领料出库失败,机具库存不足");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("您已提交,请勿重复点击");
|
return AjaxResult.error("已领数量大于预领数量或该机具未在库");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
||||||
|
|
@ -415,56 +415,27 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="materialList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
<select id="materialList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||||||
SELECT subquery1.type_id as typeId,subquery1.company_id as companyId,
|
SELECT
|
||||||
subquery1.typeName typeCode,
|
mt.type_id,
|
||||||
subquery1.typeNames as typeName,
|
mt.type_name as typeCode,
|
||||||
subquery1.out_num - COALESCE(subquery2.audit_num, 0) AS num
|
mt.parent_id,
|
||||||
FROM (
|
mt.unit_name,
|
||||||
-- 第一个查询作为子查询
|
mt.company_id,
|
||||||
SELECT mt.type_id,mt.company_id,
|
mt2.type_name,
|
||||||
mt.type_name as typeName,
|
SUM(CASE WHEN sai.agreement_id = #{agreementId} AND sai.status = '0' THEN sai.num ELSE 0 END) AS num,
|
||||||
mt2.type_name AS typeNames,
|
mt.level
|
||||||
SUM(lod.out_num) as out_num
|
FROM
|
||||||
FROM lease_apply_info lai
|
ma_type mt
|
||||||
LEFT JOIN tm_task_agreement tta on lai.task_id = tta.task_id
|
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||||
LEFT JOIN lease_out_details lod on lod.parent_id = lai.id
|
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
|
||||||
LEFT JOIN tm_task tt on tt.task_id = tta.task_id
|
WHERE
|
||||||
LEFT JOIN ma_type mt on lod.type_id=mt.type_id
|
EXISTS (
|
||||||
LEFT JOIN ma_type mt1 ON mt1.type_id = lod.type_id
|
SELECT 1
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
FROM slt_agreement_info sai2
|
||||||
WHERE tta.agreement_id = #{agreementId}
|
WHERE sai2.type_id = mt.type_id AND sai2.agreement_id = #{agreementId} AND sai2.status = '0'
|
||||||
and tt.task_type = '29'
|
)
|
||||||
and mt.`level`='4'
|
GROUP BY
|
||||||
<if test="keyWord != null and keyWord != ''">
|
mt.type_id
|
||||||
and (mt.type_name like concat('%', #{keyWord}, '%') or
|
|
||||||
mt2.type_name like concat('%', #{keyWord}, '%'))
|
|
||||||
</if>
|
|
||||||
GROUP BY mt.type_id
|
|
||||||
) AS subquery1
|
|
||||||
LEFT JOIN
|
|
||||||
(
|
|
||||||
-- 第二个查询作为子查询
|
|
||||||
SELECT mt.type_id,mt.company_id,
|
|
||||||
mt.type_name,
|
|
||||||
mt2.type_name AS typeNames,
|
|
||||||
SUM(bad.audit_num) as audit_num
|
|
||||||
FROM back_apply_info bai
|
|
||||||
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
|
|
||||||
LEFT JOIN back_apply_details bad on bad.parent_id = bai.id
|
|
||||||
LEFT JOIN tm_task_agreement tta on tta.task_id = tt.task_id
|
|
||||||
LEFT JOIN ma_type mt on mt.type_id = bad.type_id
|
|
||||||
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id
|
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
|
||||||
WHERE tta.agreement_id = #{agreementId}
|
|
||||||
and tt.task_type = '36'
|
|
||||||
and mt.`level`='4'
|
|
||||||
<if test="keyWord != null and keyWord != ''">
|
|
||||||
and (mt.type_name like concat('%', #{keyWord}, '%') or
|
|
||||||
mt2.type_name like concat('%', #{keyWord}, '%'))
|
|
||||||
</if>
|
|
||||||
GROUP BY mt.type_id
|
|
||||||
) AS subquery2
|
|
||||||
ON subquery1.type_id = subquery2.type_id
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="view" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
<select id="view" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||||||
|
|
|
||||||
|
|
@ -784,7 +784,8 @@
|
||||||
mm.ma_code as maCode,
|
mm.ma_code as maCode,
|
||||||
mt.type_name as typeCode,
|
mt.type_name as typeCode,
|
||||||
mt2.type_name as typeName,
|
mt2.type_name as typeName,
|
||||||
sd.`name` as sdStatus
|
sd.`name` as sdStatus,
|
||||||
|
sd.id as sdId
|
||||||
FROM
|
FROM
|
||||||
ma_machine mm
|
ma_machine mm
|
||||||
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
||||||
|
|
|
||||||
|
|
@ -965,27 +965,29 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="getLeaseDetailByParentId" resultType="com.bonus.sgzb.app.domain.TmTask">
|
<select id="getLeaseDetailByParentId" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||||
SELECT
|
SELECT
|
||||||
lai.task_id as taskId,
|
lai.task_id as taskId,
|
||||||
lad.id as id,
|
lad.id as id,
|
||||||
lad.parennt_id as parentId,
|
lad.parennt_id as parentId,
|
||||||
lad.pre_num - ifnull(lad.al_num,0) as outNum,
|
lad.pre_num - ifnull(lad.al_num,0) as outNum,
|
||||||
lad.pre_num as preCountNum,
|
lad.pre_num as preCountNum,
|
||||||
ifnull(lad.al_num,0) as alNum,
|
ifnull(lad.al_num,0) as alNum,
|
||||||
mt2.type_name as typeName,
|
mt2.type_name as typeName,
|
||||||
mt.type_name as typeModelName,
|
mt.type_name as typeModelName,
|
||||||
mt.manage_type as manageType,
|
mt.manage_type as manageType,
|
||||||
mt.num as num,
|
mt.num as num,
|
||||||
su.user_name as userName,
|
su.user_name as userName,
|
||||||
lad.type_id as typeId
|
mm.ma_code as maCode,
|
||||||
|
lad.type_id as typeId
|
||||||
FROM
|
FROM
|
||||||
lease_apply_details lad
|
lease_apply_details lad
|
||||||
LEFT JOIN lease_apply_info lai on lad.parennt_id = lai.id
|
LEFT JOIN lease_apply_info lai on lad.parennt_id = lai.id
|
||||||
LEFT JOIN ma_type mt on lad.type_id = mt.type_id
|
LEFT JOIN ma_type mt on lad.type_id = mt.type_id
|
||||||
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||||
LEFT JOIN ma_type_keeper mtk on lad.type_id = mtk.type_id
|
LEFT JOIN ma_machine mm on mt.type_id = mm.type_id
|
||||||
LEFT JOIN sys_user su on mtk.user_id = su.user_id
|
LEFT JOIN ma_type_keeper mtk on lad.type_id = mtk.type_id
|
||||||
|
LEFT JOIN sys_user su on mtk.user_id = su.user_id
|
||||||
WHERE
|
WHERE
|
||||||
lad.parennt_id = #{id}
|
lad.parennt_id = #{id}
|
||||||
<if test="userId != 1">
|
<if test="userId != 1">
|
||||||
and mtk.user_id = #{userId}
|
and mtk.user_id = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
|
|
@ -353,6 +353,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE a.parentId is not null
|
WHERE a.parentId is not null
|
||||||
</select>
|
</select>
|
||||||
<select id="getMaMachineByMaTypeAndMaCode" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
|
<select id="getMaMachineByMaTypeAndMaCode" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
|
||||||
select * from ma_machine where qr_code = #{qrCode}
|
select * from ma_machine where qr_code = #{qrCode} or ma_code = #{maCode}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue