退料审核驳回提交逻辑修改
This commit is contained in:
parent
1f36650c1c
commit
4f3975f06d
|
|
@ -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.security.utils.SecurityUtils;
|
||||
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.service.BackApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -39,6 +40,9 @@ public class BackApplyController extends BaseController {
|
|||
@Autowired
|
||||
private BackApplyService backApplyService;
|
||||
|
||||
@Autowired
|
||||
private BackApplyMapper backApplyMapper;
|
||||
|
||||
/**
|
||||
* 获取退料审核列表
|
||||
*/
|
||||
|
|
@ -56,7 +60,7 @@ public class BackApplyController extends BaseController {
|
|||
List<BackApplyInfo> list = backApplyService.getBackAuditList(bean);
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
||||
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);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退料审核详情
|
||||
*/
|
||||
|
|
@ -159,7 +164,6 @@ public class BackApplyController extends BaseController {
|
|||
bean.setTaskStatus("37");
|
||||
// 创建任务
|
||||
boolean addTaskResult = backApplyService.insertSelective(bean) > 0;
|
||||
|
||||
if (addTaskResult && bean.getTaskId() != null) {
|
||||
//任务协议表(tm_task_agreement)
|
||||
Boolean addTaskAgreementRes = backApplyService.insertTaskAgreement(bean) > 0;
|
||||
|
|
@ -227,6 +231,93 @@ public class BackApplyController extends BaseController {
|
|||
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.del(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)")
|
||||
@Log(title = "退料审核列表-审核(web)", businessType = BusinessType.UPDATE)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class WorkSiteDirectManageController extends BaseController {
|
|||
return AjaxResult.success("保存成功");
|
||||
}
|
||||
|
||||
/*@ApiOperation(value = "通过")
|
||||
/* @ApiOperation(value = "通过")
|
||||
@PostMapping("/pass")
|
||||
public AjaxResult pass(@RequestBody DirectApplyInfoDetails directApplyInfoDetails) {
|
||||
if (directApplyInfoDetails.getDirectApplyInfos() != null) {
|
||||
|
|
|
|||
|
|
@ -150,6 +150,8 @@ public class BackApplyInfo extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "单位id")
|
||||
private Integer unitId;
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String unitNames;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "协议id")
|
||||
|
|
|
|||
|
|
@ -124,4 +124,6 @@ public interface BackApplyMapper {
|
|||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> exportList(BackApplyInfo bean);
|
||||
|
||||
int updateTmTaskBytaskId(BackApplyInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,6 +279,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
bai.id = #{id}
|
||||
</update>
|
||||
<update id="updateTmTaskBytaskId">
|
||||
UPDATE tm_task tt
|
||||
SET tt.task_status = #{taskStatus}
|
||||
WHERE
|
||||
tt.task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<delete id="del">
|
||||
DELETE
|
||||
|
|
@ -662,15 +668,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bai.back_time as backTime,
|
||||
lot.lot_name AS lotName,
|
||||
lot.lot_id as proId,
|
||||
bad.company_id as companyId,
|
||||
bad.create_by as createBy,
|
||||
lot.pro_id as projectId,
|
||||
lot.lot_name as proName,
|
||||
unit.unit_name AS unitName,
|
||||
unit.unit_id AS unitId,
|
||||
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,
|
||||
mt2.type_name AS typeName,
|
||||
bagi.agreement_code as agreementCode,
|
||||
bagi.agreement_id as agreementId,
|
||||
bai.`status` as `status`,
|
||||
bad.id as detailsId,
|
||||
bad.pre_num AS num
|
||||
|
|
|
|||
Loading…
Reference in New Issue