库管员联调

This commit is contained in:
mashuai 2025-03-10 13:55:20 +08:00
parent c0602ec45f
commit 9fd3d09005
8 changed files with 123 additions and 3 deletions

View File

@ -618,13 +618,25 @@ public class TmTaskController extends BaseController {
@Log(title = "重庆获取领料管理-详情列表", businessType = BusinessType.QUERY)
@GetMapping("/getLeaseListAllCq")
@RequiresPermissions(value = {"picking:auditing:view", "picking:auditing:list"}, logical = Logical.OR)
public TableDataInfo getLeaseListAllCq(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId) {
public TableDataInfo getLeaseListAllCq(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId,
@RequestParam(value = "maTypeUserId", required = false, defaultValue = "") String maTypeUserId) {
TmTask task = new TmTask();
task.setTaskId(Long.parseLong(taskId));
task.setMaTypeUserId(maTypeUserId);
List<TmTask> leaseAuditList = tmTaskService.getLeaseListAllCq(task);
return getDataTable(leaseAuditList);
}
/**
* 查询库管员下拉信息
* @param leaseApplyDetails
* @return
*/
@GetMapping("/getMaTypeKeepList")
public AjaxResult getMaTypeKeepList(LeaseApplyDetails leaseApplyDetails) {
return tmTaskService.getMaTypeKeepList(leaseApplyDetails);
}
@Log(title = "获取领料申请-查看/编辑列表", businessType = BusinessType.QUERY)
@GetMapping("/getLeaseApplyListAll")
public TableDataInfo getLeaseApplyListAll(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId) {

View File

@ -37,6 +37,9 @@ public class LeaseApplyDetails implements Serializable {
@ApiModelProperty(value = "任务ID")
private Integer parenntId;
@ApiModelProperty(value = "任务ID")
private Long taskId;
/**
* 规格ID
*/
@ -168,6 +171,12 @@ public class LeaseApplyDetails implements Serializable {
@ApiModelProperty(value = "库管员id")
private Integer userId;
@ApiModelProperty(value = "库管员id字符串考虑后面一个设备可能多个库管员")
private String maTypeUserId;
@ApiModelProperty(value = "库管员名称")
private String maTypeUserName;
/**
* 实时库存
*/

View File

@ -319,4 +319,10 @@ public class TmTask implements Serializable {
* */
@ApiModelProperty(value = "以大代小id")
private long replaceTypeId;
@ApiModelProperty(value = "库管员id字符串")
private String maTypeUserId;
@ApiModelProperty(value = "库管员名称")
private String maTypeUserName;
}

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.app.service;
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
import com.bonus.sgzb.app.domain.LeaseApplyInfo;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.base.api.domain.MaMachine;
@ -114,4 +115,11 @@ public interface TmTaskService{
String selectTaskNumByMonths(@Param("date") Date nowDate, @Param("taskType") Integer taskType);
AjaxResult pushToIntelligentProject(List<TmTask> tmTasks);
/**
* 查询库管员下拉信息
* @param leaseApplyDetails
* @return
*/
AjaxResult getMaTypeKeepList(LeaseApplyDetails leaseApplyDetails);
}

View File

@ -535,6 +535,7 @@ public class TmTaskServiceImpl implements TmTaskService {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetailsCq(leaseApplyInfo);
List<LeaseApplyDetails> arrayList = new ArrayList<>();
if (leaseApplyDetails.size() > 0) {
//查询同规格下预出库量
if(leaseApplyDetails != null){
@ -542,6 +543,16 @@ public class TmTaskServiceImpl implements TmTaskService {
LeaseApplyDetails needDetails = tmTaskMapper.getApplyNeedDetailsCq(detail);
detail.setOutNum(needDetails.getOutNum());
if (StringUtils.isNotBlank(task.getMaTypeUserId())) {
if (StringUtils.isNotBlank(detail.getMaTypeUserId())) {
// 将detail.getMaTypeUserId()转换为集合
String[] maTypeUserIds = detail.getMaTypeUserId().split(",");
// 判断maTypeUserIds如果不包含task.getMaTypeUserId(),直接从leaseApplyDetails中移除
if (Arrays.asList(maTypeUserIds).contains(task.getMaTypeUserId())) {
arrayList.add(detail);
}
}
}
}
}
@ -557,7 +568,12 @@ public class TmTaskServiceImpl implements TmTaskService {
}
leaseApplyDetail.setMaTypeDetails(machineParts);
}*/
listLeaseDetails.addAll(leaseApplyDetails);
if (!CollectionUtils.isEmpty(arrayList)) {
listLeaseDetails.addAll(arrayList);
} else {
listLeaseDetails.addAll(leaseApplyDetails);
}
}
}
}
@ -1425,6 +1441,47 @@ public class TmTaskServiceImpl implements TmTaskService {
return AjaxResult.success("推送成功!");
}
/**
* 查询库管员下拉信息
* @param leaseApplyDetails
* @return
*/
@Override
public AjaxResult getMaTypeKeepList(LeaseApplyDetails leaseApplyDetails) {
if (leaseApplyDetails == null || leaseApplyDetails.getTaskId() == null) {
return AjaxResult.error("参数错误!");
}
List<LeaseApplyDetails> detailsArrayList = new ArrayList<>();
TmTask tmTask = new TmTask();
tmTask.setTaskId(leaseApplyDetails.getTaskId());
List<LeaseApplyInfo> leaseApplyInfoList = tmTaskMapper.getLeaseListByLeaseInfo(tmTask);
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> list = tmTaskMapper.getLeaseApplyDetailsCq(leaseApplyInfo);
if (!CollectionUtils.isEmpty(list)) {
for (LeaseApplyDetails applyDetails : list) {
List<LeaseApplyDetails> maTypeKeepList = leaseRecordMapper.getMaTypeKeepList(applyDetails);
if (!CollectionUtils.isEmpty(maTypeKeepList)) {
LeaseApplyDetails details = maTypeKeepList.get(0);
if (!CollectionUtils.isEmpty(detailsArrayList)) {
// 将detailsArrayList中的maTypeUserId收集新集合中
List<String> userIdList = detailsArrayList.stream().map(LeaseApplyDetails::getMaTypeUserId).collect(Collectors.toList());
if (!userIdList.contains(details.getMaTypeUserId())) {
detailsArrayList.add(details);
}
} else {
detailsArrayList.add(details);
}
}
}
}
}
}
return AjaxResult.success(detailsArrayList);
}
/* public static void main(String[] args) {
String aa = "A101";
System.out.println(aa.charAt(0));

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
@ -37,4 +38,11 @@ public interface LeaseRecordMapper {
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") MaType ma);
void updateLeaseRecord(LeaseRecord leaseRecord);
/**
* 查询库管员下拉信息
* @param leaseApplyDetails
* @return
*/
List<LeaseApplyDetails> getMaTypeKeepList(LeaseApplyDetails leaseApplyDetails);
}

View File

@ -999,7 +999,9 @@
ELSE
IFNULL(mt.num, 0)
END as num,
(lad.pre_num - IF(lad.al_num IS NULL,'0',lad.al_num)) AS outNum,subquery0.ma_code as maCode
(lad.pre_num - IF(lad.al_num IS NULL,'0',lad.al_num)) AS outNum,subquery0.ma_code as maCode,
a.userId as maTypeUserId,
a.userName as maTypeUserName
FROM
lease_apply_details lad
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
@ -1014,6 +1016,8 @@
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (15)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN (SELECT GROUP_CONCAT(mtk.user_id) as userId, type_id as typeId, GROUP_CONCAT(su.nick_name) as userName from ma_type_keeper mtk
LEFT JOIN sys_user su on mtk.user_id = su.user_id GROUP BY type_id) a ON a.typeId = lad.type_id
WHERE
lad.parennt_id = #{record.id}
GROUP BY

View File

@ -112,4 +112,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where type_id = #{typeId} and del_flag = 0
</select>
<select id="getMaTypeKeepList" resultType="com.bonus.sgzb.app.domain.LeaseApplyDetails">
SELECT
mtk.user_id AS maTypeUserId,
su.nick_name AS maTypeUserName
FROM
ma_type_keeper mtk
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
WHERE
su.nick_name IS NOT NULL
AND
mtk.type_id = #{typeId}
GROUP BY
mtk.user_id,
su.nick_name;
</select>
</mapper>