Merge branch 'dev' of http://192.168.0.56:3000/bonus/devicesmgt into dev
This commit is contained in:
commit
f88d224f0a
|
|
@ -13,6 +13,7 @@ import com.bonus.sgzb.common.log.annotation.Log;
|
||||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
|
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
||||||
import com.bonus.sgzb.material.mapper.TaskMapper;
|
import com.bonus.sgzb.material.mapper.TaskMapper;
|
||||||
import com.bonus.sgzb.material.service.BackApplyService;
|
import com.bonus.sgzb.material.service.BackApplyService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -39,6 +40,9 @@ public class BackApplyController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BackApplyService backApplyService;
|
private BackApplyService backApplyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BackApplyMapper backApplyMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取退料审核列表
|
* 获取退料审核列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -56,7 +60,7 @@ public class BackApplyController extends BaseController {
|
||||||
List<BackApplyInfo> list = backApplyService.getBackAuditList(bean);
|
List<BackApplyInfo> list = backApplyService.getBackAuditList(bean);
|
||||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
||||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
||||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -99,6 +103,7 @@ public class BackApplyController extends BaseController {
|
||||||
List<BackApplyInfo> list = backApplyService.getViewByApply(bean);
|
List<BackApplyInfo> list = backApplyService.getViewByApply(bean);
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退料审核详情
|
* 退料审核详情
|
||||||
*/
|
*/
|
||||||
|
|
@ -159,7 +164,6 @@ public class BackApplyController extends BaseController {
|
||||||
bean.setTaskStatus("37");
|
bean.setTaskStatus("37");
|
||||||
// 创建任务
|
// 创建任务
|
||||||
boolean addTaskResult = backApplyService.insertSelective(bean) > 0;
|
boolean addTaskResult = backApplyService.insertSelective(bean) > 0;
|
||||||
|
|
||||||
if (addTaskResult && bean.getTaskId() != null) {
|
if (addTaskResult && bean.getTaskId() != null) {
|
||||||
//任务协议表(tm_task_agreement)
|
//任务协议表(tm_task_agreement)
|
||||||
Boolean addTaskAgreementRes = backApplyService.insertTaskAgreement(bean) > 0;
|
Boolean addTaskAgreementRes = backApplyService.insertTaskAgreement(bean) > 0;
|
||||||
|
|
@ -227,6 +231,93 @@ public class BackApplyController extends BaseController {
|
||||||
return AjaxResult.success("退料任务创建成功");
|
return AjaxResult.success("退料任务创建成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log(title = "退料申请提交", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/submitRefuseBackApply")
|
||||||
|
public AjaxResult submitRefuseBackApply(@RequestBody BackApplyInfo bean) {
|
||||||
|
boolean addLeaseTaskResult = false;
|
||||||
|
Long backApplyInfoId = 0L;
|
||||||
|
if (StringUtils.isNull(bean)) {
|
||||||
|
return AjaxResult.error("参数错误");
|
||||||
|
}
|
||||||
|
//先删除tm_task、tm_task_agreement、back_apply_details、back_apply_info
|
||||||
|
backApplyService.delApply(bean);
|
||||||
|
try {
|
||||||
|
//生成退料编码
|
||||||
|
String code = backApplyService.genderBackCode();
|
||||||
|
if (StringUtils.isEmpty(code)) {
|
||||||
|
return AjaxResult.error("后台退料编号生成异常,请重试!");
|
||||||
|
}
|
||||||
|
bean.setCode(code);
|
||||||
|
bean.setTaskType(36);
|
||||||
|
bean.setTaskStatus("37");
|
||||||
|
boolean addTaskResult = backApplyService.insertSelective(bean) > 0;
|
||||||
|
// 创建任务
|
||||||
|
if (addTaskResult && bean.getTaskId() != null) {
|
||||||
|
//任务协议表(tm_task_agreement)
|
||||||
|
Boolean addTaskAgreementRes = backApplyService.insertTaskAgreement(bean) > 0;
|
||||||
|
if (addTaskAgreementRes && bean.getBackApplyInfo() != null) {
|
||||||
|
if (CollUtil.isEmpty(bean.getBackApplyDetails())) {
|
||||||
|
return AjaxResult.error("退料设备明细为空,请重新选择后上传!");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNull(bean.getBackApplyInfo())) {
|
||||||
|
return AjaxResult.error("退料任务信息为空,请重新选择后上传!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer taskId = bean.getTaskId();
|
||||||
|
// 根据设备所属分公司拆分集合
|
||||||
|
List<List<BackApplyInfo>> backApplyInfoList = CollUtil.groupByField(bean.getBackApplyDetails(), "companyId");
|
||||||
|
// 判断拆分后的集合内是否有数据
|
||||||
|
if (CollUtil.isNotEmpty(backApplyInfoList)) {
|
||||||
|
// 对拆分后的集合进行each遍历
|
||||||
|
for (List<BackApplyInfo> leaseApplyDetailsList : backApplyInfoList) {
|
||||||
|
BackApplyInfo backApplyInfo1 = leaseApplyDetailsList.get(0);
|
||||||
|
// 对领料任务表的对象做数据处理
|
||||||
|
BackApplyInfo backApplyInfo = bean.getBackApplyInfo();
|
||||||
|
/* 创建领料单号*/
|
||||||
|
backApplyInfo.setCode(code);
|
||||||
|
/*设置任务ID*/
|
||||||
|
backApplyInfo.setTaskId(taskId);
|
||||||
|
/*设置设备所属分公司,用于交给哪家审核*/
|
||||||
|
backApplyInfo.setCompanyId(backApplyInfo1.getCompanyId());
|
||||||
|
// 创建领料任务,返回领料任务编号
|
||||||
|
addLeaseTaskResult = backApplyService.insertBackApply(backApplyInfo) > 0;
|
||||||
|
// 领料任务编号
|
||||||
|
backApplyInfoId = backApplyInfo.getId();
|
||||||
|
|
||||||
|
// 领料任务创建完成,进行领料任务明细插入
|
||||||
|
if (addLeaseTaskResult) {
|
||||||
|
if (StringUtils.isNotNull(backApplyInfoId)) {
|
||||||
|
for (BackApplyInfo leaseApplyDetails : leaseApplyDetailsList) {
|
||||||
|
/* 设置领料任务ID*/
|
||||||
|
leaseApplyDetails.setId(backApplyInfoId);
|
||||||
|
// 插入领料任务明细
|
||||||
|
boolean addLeaseTaskDetailsResult = backApplyService.upload(leaseApplyDetails) > 0;
|
||||||
|
if (!addLeaseTaskDetailsResult) {
|
||||||
|
return AjaxResult.error("退料任务创建成功,但退料任务明细插入失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("退料任务编号为空");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建退料任务失败,或退料明细为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败,缺少数据");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("创建任务失败," + e.getCause().toString() + "," + e.getMessage());
|
||||||
|
}
|
||||||
|
return AjaxResult.success("退料任务创建成功");
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("退料审核-审核(web)")
|
@ApiOperation("退料审核-审核(web)")
|
||||||
@Log(title = "退料审核列表-审核(web)", businessType = BusinessType.UPDATE)
|
@Log(title = "退料审核列表-审核(web)", businessType = BusinessType.UPDATE)
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public class WorkSiteDirectManageController extends BaseController {
|
||||||
return AjaxResult.success("保存成功");
|
return AjaxResult.success("保存成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@ApiOperation(value = "通过")
|
/* @ApiOperation(value = "通过")
|
||||||
@PostMapping("/pass")
|
@PostMapping("/pass")
|
||||||
public AjaxResult pass(@RequestBody DirectApplyInfoDetails directApplyInfoDetails) {
|
public AjaxResult pass(@RequestBody DirectApplyInfoDetails directApplyInfoDetails) {
|
||||||
if (directApplyInfoDetails.getDirectApplyInfos() != null) {
|
if (directApplyInfoDetails.getDirectApplyInfos() != null) {
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,8 @@ public class BackApplyInfo extends BaseEntity {
|
||||||
|
|
||||||
@ApiModelProperty(value = "单位id")
|
@ApiModelProperty(value = "单位id")
|
||||||
private Integer unitId;
|
private Integer unitId;
|
||||||
|
@ApiModelProperty(value = "计量单位")
|
||||||
|
private String unitNames;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "协议id")
|
@ApiModelProperty(value = "协议id")
|
||||||
|
|
|
||||||
|
|
@ -124,4 +124,8 @@ public interface BackApplyMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BackApplyInfo> exportList(BackApplyInfo bean);
|
List<BackApplyInfo> exportList(BackApplyInfo bean);
|
||||||
|
|
||||||
|
int updateTmTaskBytaskId(BackApplyInfo bean);
|
||||||
|
|
||||||
|
int delApply(BackApplyInfo bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,4 +113,6 @@ public interface BackApplyService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BackApplyInfo> exportList(BackApplyInfo bean);
|
List<BackApplyInfo> exportList(BackApplyInfo bean);
|
||||||
|
|
||||||
|
int delApply(BackApplyInfo bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -322,4 +322,9 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
return backApplyMapper.exportList(bean);
|
return backApplyMapper.exportList(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delApply(BackApplyInfo bean) {
|
||||||
|
return backApplyMapper.delApply(bean);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE
|
WHERE
|
||||||
bai.id = #{id}
|
bai.id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateTmTaskBytaskId">
|
||||||
|
UPDATE tm_task tt
|
||||||
|
SET tt.task_status = #{taskStatus}
|
||||||
|
WHERE
|
||||||
|
tt.task_id = #{taskId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="del">
|
<delete id="del">
|
||||||
DELETE
|
DELETE
|
||||||
|
|
@ -298,6 +304,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
FROM back_apply_info
|
FROM back_apply_info
|
||||||
WHERE id = #{id};
|
WHERE id = #{id};
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="delApply">
|
||||||
|
DELETE
|
||||||
|
FROM tm_task_agreement
|
||||||
|
WHERE task_id IN (SELECT task_id FROM back_apply_info WHERE id = #{id});
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM tm_task
|
||||||
|
WHERE task_id IN (SELECT task_id FROM back_apply_info WHERE id = #{id});
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM back_apply_details
|
||||||
|
WHERE parent_id IN
|
||||||
|
(select id FROM back_apply_info
|
||||||
|
WHERE task_id in (SELECT task_id FROM back_apply_info WHERE id = #{id}));
|
||||||
|
|
||||||
|
DELETE bai1
|
||||||
|
FROM back_apply_info bai1
|
||||||
|
JOIN (
|
||||||
|
SELECT task_id
|
||||||
|
FROM back_apply_info
|
||||||
|
WHERE id = #{id}) bai2 ON bai1.task_id = bai2.task_id;
|
||||||
|
|
||||||
|
</delete>
|
||||||
|
|
||||||
<select id="getBackApplyList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
<select id="getBackApplyList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -662,15 +691,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bai.back_time as backTime,
|
bai.back_time as backTime,
|
||||||
lot.lot_name AS lotName,
|
lot.lot_name AS lotName,
|
||||||
lot.lot_id as proId,
|
lot.lot_id as proId,
|
||||||
|
bad.company_id as companyId,
|
||||||
|
bad.create_by as createBy,
|
||||||
lot.pro_id as projectId,
|
lot.pro_id as projectId,
|
||||||
lot.lot_name as proName,
|
lot.lot_name as proName,
|
||||||
unit.unit_name AS unitName,
|
unit.unit_name AS unitName,
|
||||||
unit.unit_id AS unitId,
|
unit.unit_id AS unitId,
|
||||||
mt.type_name typeCode,
|
mt.type_name typeCode,
|
||||||
mt.num,
|
mt.type_id as typeId,
|
||||||
|
mt.unit_name as unitNames,
|
||||||
|
tt.task_id as taskId,
|
||||||
case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,
|
case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,
|
||||||
mt2.type_name AS typeName,
|
mt2.type_name AS typeName,
|
||||||
bagi.agreement_code as agreementCode,
|
bagi.agreement_code as agreementCode,
|
||||||
|
bagi.agreement_id as agreementId,
|
||||||
bai.`status` as `status`,
|
bai.`status` as `status`,
|
||||||
bad.id as detailsId,
|
bad.id as detailsId,
|
||||||
bad.pre_num AS num
|
bad.pre_num AS num
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue