工机具管理-库管员配置;维修班配置

This commit is contained in:
sliang 2023-12-23 18:32:23 +08:00
parent aba4aeb58f
commit 3718c45b4d
7 changed files with 162 additions and 26 deletions

View File

@ -123,4 +123,16 @@ public class LeaseApplyDetails implements Serializable {
@ApiModelProperty(value = "装备管理方式")
private int manageType;
/**
* 装备管理方式(0编号 1计数)
*/
@ApiModelProperty(value = "装备管理方式名称")
private String manageTypeName;
/**
* 实时库存
*/
@ApiModelProperty(value = "实时库存")
private Double num;
}

View File

@ -137,11 +137,11 @@ public class TmTask implements Serializable {
private String phone;
@ApiModelProperty(value="退料申请时间")
private String backTime;
@ApiModelProperty(value="退料审核人")
@ApiModelProperty(value="退料审核人 机具分公司审批人")
private String directAuditBy;
@ApiModelProperty(value="退料审核时间")
@ApiModelProperty(value="退料审核时间 机具分公司审批时间")
private String directAuditTime;
@ApiModelProperty(value="退料审核备注")
@ApiModelProperty(value="退料审核备注 机具分公司审批备注")
private String directAuditRemark;
@ApiModelProperty(value="往来单位id")
@ -179,7 +179,7 @@ public class TmTask implements Serializable {
@ApiModelProperty(value="审批状态id")
private String examineStatusId;
@ApiModelProperty(value="审批状态")
@ApiModelProperty(value="审批状态的备注")
private String examineStatus;
@ApiModelProperty(value="创建时间")
@ -187,4 +187,24 @@ public class TmTask implements Serializable {
@ApiModelProperty(value="更新时间")
private String updateTimes;
@ApiModelProperty(value="公司审批人")
private String companyAuditBy;
@ApiModelProperty(value="公司审批时间")
private String companyAuditTime;
@ApiModelProperty(value="公司审批备注")
private String companyAuditRemark;
@ApiModelProperty(value="分管审批人")
private String deptAuditBy;
@ApiModelProperty(value="分管审批时间")
private String deptAuditTime;
@ApiModelProperty(value="分管审批备注")
private String deptAuditRemark;
}

View File

@ -7,6 +7,7 @@ import com.bonus.sgzb.app.service.TmTaskService;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.StringHelper;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
/**
* 任务表(tm_task)表控制层
@ -278,17 +280,55 @@ public class TmTaskController extends BaseController {
if (CollUtil.isEmpty(task.getLeaseApplyInfoList())){
return AjaxResult.error("任务表修改完成,但领料任务明细为空,执行失败!");
}
// 修改任务关联的协议
tmTaskService.updateAgreementByTask(task);
// 根据参数判断是否需要修改工程与往来单位
if (StringUtils.isNotNull(task.getProjectId()) && StringUtils.isNotNull(task.getUnitId())) {
Integer agreementId = tmTaskService.getAgreementIdByUnit(task);
if (StringUtils.isNotNull(agreementId)) {
task.setAgreementId(agreementId);
tmTaskService.updateAgreementByTask(task); // 修改任务关联的协议
//修改领料任务表信息
//先判断 目前数据库有几个公司
List<LeaseApplyInfo> list = tmTaskService.getListSome(task.getTaskId());
LeaseApplyInfo infoAdd = new LeaseApplyInfo();
if(list.size()<2){
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.groupByField(task.getLeaseApplyDetails(), "companyId");
String companyId="";
for (List<LeaseApplyDetails> leaseApplyDetailsList : deviceByCompanyList) {
companyId = leaseApplyDetailsList.get(0).getCompanyId() + "@" ;
}
LeaseApplyInfo info = new LeaseApplyInfo();
infoAdd.setTaskId(task.getTaskId().intValue());
infoAdd.setCode(task.getLeaseApplyInfoList().get(0).getCode());
infoAdd.setLeasePerson(task.getLeaseApplyInfoList().get(0).getLeasePerson());
infoAdd.setPhone(task.getLeaseApplyInfoList().get(0).getPhone());
infoAdd.setRemark(task.getLeaseApplyInfoList().get(0).getRemark());
infoAdd.setType(task.getLeaseApplyInfoList().get(0).getType());
if(companyId.contains("101")){
info.setId(101);
info.setTaskId(task.getTaskId().intValue());
LeaseApplyInfo bean = tmTaskService.getListSomeol(info);
if(bean==null){
infoAdd.setCompanyId(101);
leaseApplyInfoService.genderLeaseCode(infoAdd);
}
}else if(companyId.contains("102")){
info.setId(102);
info.setTaskId(task.getTaskId().intValue());
LeaseApplyInfo bean = tmTaskService.getListSomeol(info);
if(bean==null){
infoAdd.setCompanyId(102);
leaseApplyInfoService.genderLeaseCode(infoAdd);
}
}
}
LeaseApplyInfo bean = new LeaseApplyInfo();
bean.setTaskId(task.getTaskId().intValue());
bean.setLeasePerson(task.getLeaseApplyInfo().getLeasePerson());
bean.setPhone(task.getLeaseApplyInfo().getPhone());
bean.setRemark(task.getLeaseApplyInfo().getRemark());
tmTaskService.updateLeaseInfo(bean);
for (LeaseApplyInfo leaseApplyInfo : task.getLeaseApplyInfoList()) {
if (leaseApplyInfo == null || leaseApplyInfo.getId() == null) {
continue;
}

View File

@ -82,10 +82,12 @@ public interface TmTaskMapper {
TmTask getLeaseListTmTask(TmTask task);
LeaseApplyInfo getLeaseListByLeaseInfo(TmTask task);
Integer getAgreementIdByUnit(TmTask task);
List<LeaseApplyInfo> getLeaseListByLeaseInfo(TmTask task);
// LeaseApplyInfo getLeaseListByLeaseInfo(TmTask task);
void updateLeaseInfo(LeaseApplyInfo task);
List<LeaseApplyInfo> getListSome(Long taskId);
LeaseApplyInfo getListSomeol(LeaseApplyInfo info);
}

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.app.service;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import org.apache.ibatis.annotations.Param;
@ -58,4 +59,11 @@ public interface TmTaskService{
int insertAgreement(TmTask record);
List<TmTask> getLeaseListAll(TmTask task);
void updateLeaseInfo(LeaseApplyInfo task);
List<LeaseApplyInfo> getListSome(Long taskId);
LeaseApplyInfo getListSomeol(LeaseApplyInfo info);
}

View File

@ -245,18 +245,36 @@ public class TmTaskServiceImpl implements TmTaskService{
if(tmTask != null){
List<LeaseApplyInfo> leaseApplyInfoList = tmTaskMapper.getLeaseListByLeaseInfo(task);
tmTask.setLeaseApplyInfoList(leaseApplyInfoList);
List<LeaseApplyDetails> listLeaseDetails = new ArrayList<>();
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
// 塞入领料任务详情的集合中
tmTask.setLeaseApplyDetails(leaseApplyDetails);
listLeaseDetails.addAll(leaseApplyDetails);
}
}
}
// 塞入领料任务详情的集合中
tmTask.setLeaseApplyDetails(listLeaseDetails);
}
tmTaskList.add(tmTask);
return tmTaskList;
}
}
@Override
public void updateLeaseInfo(LeaseApplyInfo task) {
tmTaskMapper.updateLeaseInfo(task);
}
@Override
public List<LeaseApplyInfo> getListSome(Long taskId) {
return tmTaskMapper.getListSome(taskId);
}
@Override
public LeaseApplyInfo getListSomeol(LeaseApplyInfo info) {
return tmTaskMapper.getListSomeol(info);
}
}

View File

@ -496,6 +496,7 @@
<if test="record.keyWord != null and record.keyWord != ''">
AND bai.agreement_code like concat('%', #{record.keyWord}, '%')
</if>
ORDER BY tt.update_time DESC
</select>
<select id="getAuditListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
@ -509,7 +510,9 @@
<select id="getLeaseApplyDetails" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails">
SELECT
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName,mt.unit_name as unitName, mt.manage_type as manageType
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName,mt.unit_name as unitName, mt.manage_type as manageType,
case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,
mt.num
FROM
lease_apply_details lad
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
@ -524,24 +527,42 @@
<select id="getLeaseListTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT
SELECT DISTINCT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpi.pro_id as proId, bpi.pro_id as projectId,bpi.pro_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
tt.create_by as applyFor,d.`name` as taskName,
su2.user_name as companyAuditBy,
lai.company_audit_time as companyAuditTime,
lai.company_audit_remark as companyAuditRemark,
su3.user_name as deptAuditBy,
lai.dept_audit_time as deptAuditTime,
lai.dept_audit_remark as deptAuditRemark,
su4.user_name as directAuditBy,
lai.direct_audit_time as directAuditTime,
lai.direct_audit_remark as directAuditRemark,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes,
bai.agreement_id as agreementId
FROM
FROM
tm_task tt
LEFT JOIN sys_user su ON tt.create_by = su.user_name
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_info bpi ON bpi.pro_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
LEFT JOIN sys_user su ON tt.create_by = su.user_name
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_info bpi ON bpi.pro_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id
LEFT JOIN sys_user su2 ON lai.company_audit_by = su2.user_id
LEFT JOIN sys_user su3 ON lai.dept_audit_by = su3.user_id
LEFT JOIN sys_user su4 ON lai.direct_audit_by = su4.user_id
WHERE tt.task_id = #{taskId}
</select>
@ -606,9 +627,24 @@
parennt_id = #{record.parenntId}
</update>
<update id="updateLeaseInfo">
UPDATE lease_apply_info SET lease_person = #{leasePerson}, phone = #{phone}, remark = #{remark}
WHERE task_id = #{taskId}
</update>
<select id="getAgreementIdByUnit" resultType="java.lang.Integer">
select agreement_id from bm_agreement_info
where unit_id = #{unitId} and project_id = #{projectId}
</select>
<select id="getListSome" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
SELECT * FROM `lease_apply_info`
WHERE task_id = #{taskId} AND `status` ='1'
</select>
<select id="getListSomeol" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
SELECT * FROM `lease_apply_info`
WHERE task_id = #{taskId} AND `status` ='1' and company_id = #{id}
</select>
</mapper>