退料申请表数据问题修改

This commit is contained in:
liang.chao 2024-03-16 18:44:04 +08:00
parent 270d3ae2f8
commit e31aaad942
6 changed files with 97 additions and 78 deletions

View File

@ -360,6 +360,7 @@ public class TmTaskController extends BaseController {
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, leaseAuditList));
}
/**
* 查询机具领料管理列表
*
@ -427,53 +428,13 @@ public class TmTaskController extends BaseController {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
}
if (StringUtils.isNotBlank(role)) {
if (role.contains(STRING_ADMIN)) {
//如果是管理员可以看到所有的审核列表
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditListByAdmin(task);
return AjaxResult.success(getDataTable(leaseAuditList));
}
String[] split = role.split(",");
for (String s : split) {
if ("kg".equals(s)) {
//如果是库管员只能看到自己的审核列表
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditListForApp(task);
List<TmTask> list = new ArrayList<>();
for (int i = 0; i < leaseAuditList.size(); i++) {
List<LeaseApplyInfo> leaseApplyInfoList = leaseAuditList.get(i).getLeaseApplyInfoList();
if (leaseApplyInfoList != null) {
for (int j = 0; j < leaseApplyInfoList.size(); j++) {
List<LeaseApplyDetails> leaseApplyDetails = leaseApplyInfoList.get(j).getLeaseApplyDetails();
if (leaseApplyDetails != null) {
for (int k = 0; k < leaseApplyDetails.size(); k++) {
if (leaseApplyDetails.get(k).getUserId() == null || leaseApplyDetails.get(k).getUserId() == 0) {
leaseApplyDetails.get(k).setCount(0);
} else {
leaseApplyDetails.get(k).setCount(1);
}
}
}
}
List<LeaseApplyDetails> leaseApplyDetails = leaseAuditList.get(i).getLeaseApplyInfoList().get(0).getLeaseApplyDetails();
if (leaseApplyDetails != null) {
List<LeaseApplyDetails> list1 = new ArrayList<>();
for (int l = 0; l < leaseApplyDetails.size(); l++) {
if (leaseApplyDetails.get(l).getCount() == 1) {
list1.add(leaseApplyDetails.get(l));
TmTask tmTask = leaseAuditList.get(i);
tmTask.getLeaseApplyInfoList().get(0).setLeaseApplyDetails(list1);
list.add(tmTask);
}
}
}
}
}
return AjaxResult.success(getDataTable(list));
}
}
if (SecurityUtils.getLoginUser() != null) {
Long userid = SecurityUtils.getLoginUser().getUserid();
task.setUserId(String.valueOf(userid));
}
List<TmTask> leaseAuditList = new ArrayList<>();
List<TmTask> leaseAuditList = tmTaskService.getLeaseOutListByUser(task);
return AjaxResult.success(getDataTable(leaseAuditList));
}
@ -491,6 +452,10 @@ public class TmTaskController extends BaseController {
return AjaxResult.error("参数错误");
}
startPage();
if (SecurityUtils.getLoginUser() != null) {
Long userid = SecurityUtils.getLoginUser().getUserid();
task.setUserId(String.valueOf(userid));
}
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditListByOne(task);
return AjaxResult.success(getDataTable(leaseAuditList));
}

View File

@ -31,6 +31,8 @@ public class TmTask implements Serializable {
*/
@ApiModelProperty(value="任务ID")
private Long taskId;
private Long parentId;
private Integer outNum;
/**
* 任务类型(定义数据字典)
@ -51,6 +53,11 @@ public class TmTask implements Serializable {
*/
@ApiModelProperty(value="预领料合计数")
private int preCountNum;
/**
* 预领料合计数
*/
@ApiModelProperty(value="已出库数量")
private int alNum;
/**
* 编号
@ -231,6 +238,14 @@ public class TmTask implements Serializable {
@ApiModelProperty(value="领用类型0 短期租赁 1长期领用")
private String leaseType;
private String userId;
private String typeName;
private String typeModelName;
private String manageType;
private String typeId;
}

View File

@ -110,4 +110,8 @@ public interface TmTaskMapper {
Integer getKgByMaType(Integer typeId);
List<LeaseApplyDetails> getLeaseApplyDetailsCq(@Param("record") LeaseApplyInfo leaseApplyInfo);
List<TmTask> getLeaseOutListByUser(TmTask task);
List<TmTask> getLeaseDetailByParentId(TmTask record);
}

View File

@ -87,4 +87,6 @@ public interface TmTaskService{
List<TmTask> getLeaseAuditManageListCq(TmTask task);
List<TmTask> getLeaseListAllCq(TmTask task);
List<TmTask> getLeaseOutListByUser(TmTask task);
}

View File

@ -206,38 +206,7 @@ public class TmTaskServiceImpl implements TmTaskService {
*/
@Override
public List<TmTask> getLeaseAuditListByOne(TmTask record) {
List<TmTask> tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
for (TmTask tmTask : tmTaskList) {
int count = 0;
if (tmTask != null) {
// 去查询任务分单表
List<LeaseApplyInfo> auditListByLeaseInfo = tmTaskMapper.getAuditListByLeaseInfo(tmTask);
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
if (leaseApplyDetail != null) {
// 统计预领数量
count += leaseApplyDetail.getPreNum();
}
}
// 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
}
}
}
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
}
// 塞入预领的合计数量
tmTask.setPreCountNum(count);
}
}
List<TmTask> tmTaskList = tmTaskMapper.getLeaseDetailByParentId(record);
return tmTaskList;
}
@ -382,6 +351,11 @@ public class TmTaskServiceImpl implements TmTaskService {
return tmTaskList;
}
@Override
public List<TmTask> getLeaseOutListByUser(TmTask task) {
return tmTaskMapper.getLeaseOutListByUser(task);
}
/**
* 获取领料申请列表

View File

@ -882,6 +882,65 @@
GROUP BY
lad.id
</select>
<select id="getLeaseOutListByUser" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
tt.*,
lai.id AS id,
bpl.lot_id AS proId,
bpl.lot_name AS proName,
bui.unit_id AS unitId,
bui.unit_name AS unitName,
lai.lease_person AS leasePerson,
lai.phone AS leasePhone,
tt.create_by AS applyFor,
d.`name` AS taskName,
lai.lease_type AS leaseType,
d.id AS examineStatusId,
bai.agreement_code AS agreementCode,
tt.create_time AS createTimes,
sum(lad.pre_num) as preCountNum,
sum(lad.al_num) as alNum,
tt.update_time AS updateTimes
from
lease_apply_info lai
LEFT JOIN tm_task tt on lai.task_id = tt.task_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
LEFT JOIN tm_task_agreement tta ON lai.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN lease_apply_details lad on lai.id = lad.parennt_id
LEFT JOIN ma_type_keeper mtk on lad.type_id = mtk.type_id
WHERE tt.task_status in(33,34,35)
<if test="userId != '1'">
and mtk.user_id = #{userId}
</if>
GROUP BY lai.id
ORDER BY tt.task_status
</select>
<select id="getLeaseDetailByParentId" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
lai.task_id as taskId,
lad.id as id,
lad.parennt_id as parentId,
lad.pre_num - ifnull(lad.al_num,0) as outNum,
lad.pre_num as preCountNum,
mt2.type_name as typeName,
mt.type_name as typeModelName,
mt.manage_type as manageType,
lad.type_id as typeId
FROM
lease_apply_details lad
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 mt2 on mt.parent_id = mt2.type_id
LEFT JOIN ma_type_keeper mtk on lad.type_id = mtk.type_id
WHERE
lad.parennt_id = #{id}
<if test="userId != '1'">
and mtk.user_id = #{userId}
</if>
</select>
</mapper>