退料出库代码提交

This commit is contained in:
liang.chao 2024-03-27 18:15:32 +08:00
parent 562e35a952
commit 0f4ae97bad
10 changed files with 415 additions and 114 deletions

View File

@ -2,10 +2,7 @@ package com.bonus.sgzb.app.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
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.app.domain.TmTaskDto;
import com.bonus.sgzb.app.domain.*;
import com.bonus.sgzb.app.service.LeaseApplyDetailsService;
import com.bonus.sgzb.app.service.LeaseApplyInfoService;
import com.bonus.sgzb.app.service.LeaseUserBookService;
@ -89,6 +86,7 @@ public class TmTaskController extends BaseController {
/**
* 领料审核驳回分公司分管机具分公司统一接口
*
* @param task 任务信息
* @return
*/
@ -157,6 +155,7 @@ public class TmTaskController extends BaseController {
/**
* 往来单位提交工程领用机具信息
*
* @return 结果
*/
@Log(title = "往来单位提交领料申请", businessType = BusinessType.INSERT)
@ -426,43 +425,46 @@ public class TmTaskController extends BaseController {
} else {
//领料管理导出
List<TmTask> leaseAuditManageList = tmTaskService.getLeaseAuditManageList(task);
List<TmTaskDto> tmTaskDtos = Convert.toList(TmTaskDto.class, leaseAuditManageList);
ExcelUtil<TmTaskDto> util = new ExcelUtil<TmTaskDto>(TmTaskDto.class);
List<TmTaskVo> tmTaskDtos = Convert.toList(TmTaskVo.class, leaseAuditManageList);
ExcelUtil<TmTaskVo> util = new ExcelUtil<TmTaskVo>(TmTaskVo.class);
util.exportExcel(response, tmTaskDtos, "领料管理数据");
}
}
/**
* 查询机具领料出库列表 - app
* 查询机具领料出库列表
*
* @param task 筛选条件
* @return 列表
*/
@Log(title = "查询机具领料出库列表- app", businessType = BusinessType.QUERY)
@Log(title = "查询机具领料出库列表- app/web", businessType = BusinessType.QUERY)
@GetMapping(value = "getLeaseAuditList")
public AjaxResult getLeaseAuditList(TmTask task) {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
}
if (SecurityUtils.getLoginUser() != null) {
Long userid = SecurityUtils.getLoginUser().getUserid();
task.setUserId(String.valueOf(userid));
}
if (task.getFlag() == 1) {
startPage();
List<TmTask> leaseAuditList = tmTaskService.getLeaseOutListByUser(task);
return AjaxResult.success(getDataTable(leaseAuditList));
} else {
List<TmTask> leaseAuditList = tmTaskService.getLeaseOutListByUser(task);
return AjaxResult.success(getDataTable(leaseAuditList));
}
}
/**
* 查询单个领料出库详情 - app
* 查询单个领料出库详情
*
* @param task 筛选条件
* @return 列表
*/
@Log(title = "查询单个领料出库详情- app", businessType = BusinessType.QUERY)
@Log(title = "查询单个领料出库详情- app/web", businessType = BusinessType.QUERY)
@GetMapping(value = "getLeaseAuditListDetail")
public AjaxResult getLeaseAuditListDetail(TmTask task) {
if (StringUtils.isNull(task)) {
@ -477,6 +479,26 @@ public class TmTaskController extends BaseController {
return AjaxResult.success(getDataTable(leaseAuditList));
}
/**
* 导出领料出库列表
*
* @param task 筛选条件
* @return 列表
*/
@Log(title = "导出领料出库列表", businessType = BusinessType.QUERY)
@PostMapping(value = "export")
public void export(HttpServletResponse response, TmTask task) {
if (SecurityUtils.getLoginUser() != null) {
Long userid = SecurityUtils.getLoginUser().getUserid();
task.setUserId(String.valueOf(userid));
}
List<TmTask> leaseAuditList = tmTaskService.getLeaseOutListByUser(task);
List<TmTaskDto> tmTaskDtos = Convert.toList(TmTaskDto.class, leaseAuditList);
ExcelUtil<TmTaskDto> util = new ExcelUtil<TmTaskDto>(TmTaskDto.class);
util.exportExcel(response, tmTaskDtos, "领料出库数据");
}
/**
* 修改任务信息
*/

View File

@ -53,12 +53,12 @@ public class TmTask implements Serializable {
* 预领料合计数
*/
@ApiModelProperty(value="预领料合计数")
private int preCountNum;
private Integer preCountNum;
/**
* 预领料合计数
*/
@ApiModelProperty(value="已出库数量")
private int alNum;
private Integer alNum;
/**
* 编号
@ -96,7 +96,7 @@ public class TmTask implements Serializable {
* 工程id
*/
@ApiModelProperty(value="工程id")
private int proId;
private Integer proId;
/**
* 创建时间
@ -240,6 +240,7 @@ public class TmTask implements Serializable {
@ApiModelProperty(value="领用类型0 短期租赁 1长期领用")
private String leaseType;
private String userId;
private String userName;
private String typeName;
private String typeModelName;

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.app.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -12,6 +13,7 @@ import java.util.List;
/**
* Description: 任务表tm_task
*
* @Author 阮世耀
* @Create 2023/12/13 15:14
* @Version 1.0
@ -29,6 +31,8 @@ public class TmTaskDto implements Serializable {
*/
@ApiModelProperty(value = "任务ID")
private Long taskId;
private Long parentId;
private Integer outNum;
/**
* 任务类型(定义数据字典)
@ -42,16 +46,25 @@ public class TmTaskDto implements Serializable {
@ApiModelProperty(value = "任务状态(数据字典)")
private Integer taskStatus;
private Integer flag;
/**
* 预领料合计数
*/
@ApiModelProperty(value = "预领料合计数")
@Excel(name = "申请数量", sort = 4)
private int preCountNum;
/**
* 预领料合计数
*/
@ApiModelProperty(value = "已出库数量")
@Excel(name = "已出库数量", sort = 6)
private int alNum;
/**
* 编号
*/
@ApiModelProperty(value="编号")
@ApiModelProperty(value = "领料单")
@Excel(name = "领料单号", sort = 1)
private String code;
@ -77,15 +90,22 @@ public class TmTaskDto implements Serializable {
* 工程名称
*/
@ApiModelProperty(value = "工程名称")
@Excel(name = "领料工程",sort = 3)
@Excel(name = "领料申请工程", sort = 3)
private String proName;
/**
* 工程id
*/
@ApiModelProperty(value = "工程id")
private int proId;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "申请时间", sort = 5)
private Date createTime;
/**
@ -106,7 +126,6 @@ public class TmTaskDto implements Serializable {
* 备注
*/
@ApiModelProperty(value = "备注")
@Excel(name = "备注",sort = 11)
private String remark;
/**
@ -152,7 +171,7 @@ public class TmTaskDto implements Serializable {
@ApiModelProperty(value = "往来单位id")
private Long unitId;
@ApiModelProperty(value = "往来单位")
@Excel(name = "领料单位",sort = 2)
@Excel(name = "领料申请单位", sort = 2)
private String unitName;
@ApiModelProperty(value = "工程id")
@ -168,23 +187,19 @@ public class TmTaskDto implements Serializable {
@ApiModelProperty(value = "协议编号")
@Excel(name = "协议号",sort = 4)
private String agreementCode;
@ApiModelProperty(value = "领料人")
@Excel(name = "领料人",sort = 5)
private String leasePerson;
@ApiModelProperty(value = "领料人手机号")
@Excel(name = "联系电话",sort = 6)
private String leasePhone;
@ApiModelProperty(value = "申请人")
@Excel(name = "申请人",sort = 7)
private String applyFor;
@ApiModelProperty(value = "任务状态")
@Excel(name = "任务状态",sort = 9)
@Excel(name = "出库状态", sort = 7)
private String taskName;
@ApiModelProperty(value = "审批状态id")
@ -194,7 +209,6 @@ public class TmTaskDto implements Serializable {
private String examineStatus;
@ApiModelProperty(value = "创建时间")
@Excel(name = "申请时间",sort = 8)
private String createTimes;
@ApiModelProperty(value = "更新时间")
@ -218,4 +232,17 @@ public class TmTaskDto implements Serializable {
@ApiModelProperty(value = "分管审批备注")
private String deptAuditRemark;
@ApiModelProperty(value = "领用类型0 短期租赁 1长期领用")
private String leaseType;
private String userId;
private String typeName;
private String typeModelName;
private String manageType;
private String typeId;
@ApiModelProperty(value = "预计领料时间(重庆)")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date estimateLeaseTime;
}

View File

@ -0,0 +1,217 @@
package com.bonus.sgzb.app.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author梁超
* @date2024/3/27 - 16:13
*/
@Data
public class TmTaskVo implements Serializable {
private static final long serialVersionUID = -4135112109792782142L;
private String id;
/**
* 任务ID
*/
@ApiModelProperty(value="任务ID")
private Long taskId;
/**
* 任务类型(定义数据字典)
*/
@ApiModelProperty(value="任务类型(数据字典)")
private Integer taskType;
/**
* 任务状态(定义数据字典)
*/
@ApiModelProperty(value="任务状态(数据字典)")
private Integer taskStatus;
/**
* 预领料合计数
*/
@ApiModelProperty(value="预领料合计数")
private int preCountNum;
/**
* 编号
*/
@ApiModelProperty(value="编号")
@Excel(name = "领料单号",sort = 1)
private String code;
/**
* 创建者
*/
@ApiModelProperty(value="创建者")
private String createBy;
/**
* 申请人手机号码
*/
@ApiModelProperty(value="手机号")
private String phoneNumber;
/**
* 部门名称 单位名称
*/
@ApiModelProperty(value="部门/单位名称")
private String deptName;
/**
* 工程名称
*/
@ApiModelProperty(value="工程名称")
@Excel(name = "领料工程",sort = 3)
private String proName;
/**
* 创建时间
*/
@ApiModelProperty(value="创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 更新者
*/
@ApiModelProperty(value="更新者")
private String updateBy;
/**
* 更新时间
*/
@ApiModelProperty(value="更新时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
/**
* 备注
*/
@ApiModelProperty(value="备注")
@Excel(name = "备注",sort = 11)
private String remark;
/**
* 数据所属组织
*/
@ApiModelProperty(value="数据所属组织")
private Integer companyId;
/**
* 领料任务实体
*/
@ApiModelProperty(value="领料任务实体")
private LeaseApplyInfo leaseApplyInfo;
/**
* 领料任务实体集合
*/
@ApiModelProperty(value="领料任务实体集合")
private List<LeaseApplyInfo> leaseApplyInfoList;
/**
* 领料任务详情集合
*/
@ApiModelProperty(value="领料任务详情集合")
private List<LeaseApplyDetails> leaseApplyDetails;
@ApiModelProperty(value="协议id")
private Integer agreementId;
@ApiModelProperty(value="退料人")
private String backPerson;
@ApiModelProperty(value="退料人联系电话")
private String phone;
@ApiModelProperty(value="退料申请时间")
private String backTime;
@ApiModelProperty(value="退料审核人 机具分公司审批人")
private String directAuditBy;
@ApiModelProperty(value="退料审核时间 机具分公司审批时间")
private String directAuditTime;
@ApiModelProperty(value="退料审核备注 机具分公司审批备注")
private String directAuditRemark;
@ApiModelProperty(value="往来单位id")
private Long unitId;
@ApiModelProperty(value="往来单位")
@Excel(name = "领料单位",sort = 2)
private String unitName;
@ApiModelProperty(value="工程id")
private Long projectId;
@ApiModelProperty(value="关键字")
private String keyWord;
@ApiModelProperty(value="开始时间")
private String startTime;
@ApiModelProperty(value="结束时间")
private String endTime;
@ApiModelProperty(value="类型")
private Integer types;
@ApiModelProperty(value="协议编号")
@Excel(name = "协议号",sort = 4)
private String agreementCode;
@ApiModelProperty(value="领料人")
@Excel(name = "领料人",sort = 5)
private String leasePerson;
@ApiModelProperty(value="领料人手机号")
@Excel(name = "联系电话",sort = 6)
private String leasePhone;
@ApiModelProperty(value="申请人")
@Excel(name = "申请人",sort = 7)
private String applyFor;
@ApiModelProperty(value="任务状态")
@Excel(name = "任务状态",sort = 9)
private String taskName;
@ApiModelProperty(value="审批状态id")
private String examineStatusId;
@ApiModelProperty(value="审批状态的备注")
private String examineStatus;
@ApiModelProperty(value="创建时间")
@Excel(name = "申请时间",sort = 8)
private String createTimes;
@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

@ -860,7 +860,7 @@
SELECT
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, (lad.pre_num - IF(lad.al_num IS NULL,'0',lad.al_num)) AS outNum,mm.ma_code as maCode
IFNULL(mt.num,0) AS num, (lad.pre_num - IF(lad.al_num IS NULL,'0',lad.al_num)) AS outNum,mm.ma_code as maCode
FROM
lease_apply_details lad
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
@ -919,6 +919,18 @@
<if test="userId != 1">
and mtk.user_id = #{userId}
</if>
<if test="code != null and code != ''">
and tt.code like concat('%', #{code}, '%')
</if>
<if test="unitId != null">
and bui.unit_id = #{unitId}
</if>
<if test="proId != null">
and bpl.lot_id = #{proId}
</if>
<if test="taskStatus != null">
and tt.task_status = #{taskStatus}
</if>
GROUP BY lai.id
ORDER BY tt.task_status,tt.create_time
</select>
@ -929,9 +941,11 @@
lad.parennt_id as parentId,
lad.pre_num - ifnull(lad.al_num,0) as outNum,
lad.pre_num as preCountNum,
lad.al_num as alNum,
mt2.type_name as typeName,
mt.type_name as typeModelName,
mt.manage_type as manageType,
su.user_name as userName,
lad.type_id as typeId
FROM
lease_apply_details lad
@ -939,12 +953,11 @@
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
LEFT JOIN sys_user su on mtk.user_id = su.user_id
WHERE
lad.parennt_id = #{id}
<if test="userId != 1">
and mtk.user_id = #{userId}
</if>
</select>
</mapper>

View File

@ -1,6 +1,8 @@
package com.bonus.sgzb.material.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.unit.DataUnit;
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
@ -125,7 +127,7 @@ public class WorkSiteDirectManageController extends BaseController {
if (directApplyInfo != null) {
directApplyInfo.setStatus("2");
directApplyInfo.setAuditor(SecurityUtils.getLoginUser().getUsername());
directApplyInfo.setAuditTime(new Date().toString());
directApplyInfo.setAuditTime(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
workSiteDirectManageService.refuseDirectApplyInfo(directApplyInfo);
} else {
return AjaxResult.error("参数为空,审核失败");

View File

@ -153,5 +153,9 @@ public class LeaseApplyInfo implements Serializable {
@ApiModelProperty(value="审批状态id")
private String examineStatusId;
@ApiModelProperty(value="状态")
private String status;
@ApiModelProperty(value="领用类型")
private String leaseType;
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.material.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.bonus.sgzb.base.api.domain.*;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
@ -142,7 +143,8 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
leaseApplyInfo.setTaskId(Integer.valueOf(taskId)); // 设置任务ID
leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); // 设置设备所属分公司,用于交给哪家审核
leaseApplyInfo.setType("2"); // 设置审批层级先固定2层后期根据接口传入Type区分来源设定
leaseApplyInfo.setStatus("1"); //设置为分公司审核通过
leaseApplyInfo.setLeaseType("0"); //设置为工程租赁
// 创建领料任务返回领料任务编号
boolean addLeaseTaskResult = workSiteDirectManageMapper.insertSelective(leaseApplyInfo) > 0;
// 领料任务创建完成进行领料任务明细插入
@ -579,6 +581,7 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
return res;
}
task.setCode(lcode);
task.setTaskStatus(35);
// 创建领料任务tm_task
res = insertTmTask(task);
if (res == 0) {
@ -600,7 +603,7 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
DirectApplyInfo directApplyInfos = getDirectApplyInfoById(directApplyInfoDetails.getId());
directApplyInfos.setStatus("1");
directApplyInfos.setAuditor(SecurityUtils.getLoginUser().getUsername());
directApplyInfos.setAuditTime(new Date().toString());
directApplyInfos.setAuditTime(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
res = refuseDirectApplyInfo(directApplyInfos);
} else {
return res;

View File

@ -148,6 +148,12 @@
<if test="companyId != null">
company_id,
</if>
<if test="status != null and status != ''">
status,
</if>
<if test="leaseType != null and leaseType != ''">
lease_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">
@ -201,6 +207,12 @@
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
<if test="status != null and status != ''">
#{status,jdbcType=VARCHAR},
</if>
<if test="leaseType != null and leaseType != ''">
#{leaseType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
@ -400,7 +412,7 @@
and bpl.lot_id = #{lotId}
</if>
<if test="unitId != null and unitId != ''">
and bui.unitId = #{unitId}
and bui.unit_id = #{unitId}
</if>
<if test="backMan != null and backMan != ''">
and dai.back_man like concat('%', #{backMan}, '%')