Merge remote-tracking branch 'origin/master'

This commit is contained in:
jjLv 2024-11-13 16:49:42 +08:00
commit 3258c5d8f3
20 changed files with 356 additions and 234 deletions

View File

@ -0,0 +1,39 @@
package com.bonus.common.biz.enums;
import lombok.Getter;
/**
* 新购待入库 0
* 在库 1
* 在用 2
* 退料检修 3
* 检修待审核 4
* 修试后待入库 5
* 退料待报废 6
* 维修待报废 7
* 已报废审核 8
* 退料待入库 9
* 报废待审核 10
*/
@Getter
public enum MaMachineStatusEnum {
NEW_PURCHASE(0, "新购待入库"),
IN_STORE(1, "在库"),
IN_USE(2, "在用"),
BACK_REPAIR(3, "退料检修"),
REPAIR_TO_AUDIT(4, "检修待审核"),
REPAIR_TO_STORE(5, "修试后待入库"),
BACK_TO_SCRAP(6, "退料待报废"),
REPAIR_TO_SCRAP(7, "维修待报废"),
SCRAP_AUDIT(8, "已报废审核"),
BACK_TO_STORE(9, "退料待入库"),
SCRAP_TO_AUDIT(10, "报废待审核");
private final Integer status;
private final String statusName;
MaMachineStatusEnum(Integer status, String statusName) {
this.status = status;
this.statusName = statusName;
}
}

View File

@ -14,7 +14,9 @@ public enum PurchaseTaskStatusEnum {
IN_STORE(19, "已入库"),
TASK_TO_START(20, "入库待开始"),
TASK_IN_PROGRESS(21, "入库进行中"),
TASK_FINISHED(22, "入库已完成");
TASK_FINISHED(22, "入库已完成"),
LEASE_TASK_NO_PUBLISHED(0, "领料任务--未发布"),
LEASE_TASK_PUBLISHED(1, "领料任务--已发布");
private final Integer status;
private final String statusName;

View File

@ -12,9 +12,9 @@ import com.bonus.material.lease.service.ILeaseApplyInfoService;
import com.bonus.material.task.domain.vo.TmTaskRequestVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.List;
@ -29,7 +29,8 @@ import java.util.List;
@RestController
@RequestMapping("/lease_apply_info")
public class LeaseApplyInfoController extends BaseController {
@Autowired
@Resource
private ILeaseApplyInfoService leaseApplyInfoService;
/**
@ -54,7 +55,7 @@ public class LeaseApplyInfoController extends BaseController {
@PostMapping("/export")
public void export(HttpServletResponse response, LeaseApplyInfo leaseApplyInfo) {
List<LeaseApplyInfo> list = leaseApplyInfoService.selectLeaseApplyInfoList(leaseApplyInfo);
ExcelUtil<LeaseApplyInfo> util = new ExcelUtil<LeaseApplyInfo>(LeaseApplyInfo.class);
ExcelUtil<LeaseApplyInfo> util = new ExcelUtil<>(LeaseApplyInfo.class);
util.exportExcel(response, list, "领料任务数据");
}
@ -64,7 +65,7 @@ public class LeaseApplyInfoController extends BaseController {
@ApiOperation(value = "获取领料任务详细信息")
//@RequiresPermissions("lease:info:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") @NotNull(message = "领料任务ID不能为空") Long id) {
public AjaxResult getInfo(@NotNull(message = "领料任务ID不能为空") @PathVariable("id") Long id) {
return success(leaseApplyInfoService.selectLeaseApplyInfoById(id));
}
@ -76,7 +77,7 @@ public class LeaseApplyInfoController extends BaseController {
//@RequiresPermissions("lease:info:add")
@SysLog(title = "领料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务")
@PostMapping
public AjaxResult add(@RequestBody TmTaskRequestVo tmTaskRequestVo) {
public AjaxResult add(@NotNull(message = "领料任务不能为空") @RequestBody TmTaskRequestVo tmTaskRequestVo) {
try {
return leaseApplyInfoService.insertLeaseApplyInfo(tmTaskRequestVo);
} catch (Exception e) {
@ -92,7 +93,7 @@ public class LeaseApplyInfoController extends BaseController {
//@RequiresPermissions("lease:info:edit")
@SysLog(title = "领料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料任务")
@PutMapping
public AjaxResult edit(@RequestBody TmTaskRequestVo tmTaskRequestVo) {
public AjaxResult edit(@RequestBody @NotNull TmTaskRequestVo tmTaskRequestVo) {
try {
return toAjax(leaseApplyInfoService.updateLeaseApplyInfo(tmTaskRequestVo));
} catch (Exception e) {
@ -100,6 +101,18 @@ public class LeaseApplyInfoController extends BaseController {
}
}
/**
* 领料任务发布
*/
@ApiOperation(value = "领料任务发布")
@PreventRepeatSubmit
@SysLog(title = "领料任务发布", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->发布领料任务")
@PostMapping("/publish")
public AjaxResult publish(@RequestBody @NotNull(message = "任务信息不能为空") LeaseApplyInfo leaseApplyInfo) {
return leaseApplyInfoService.publish(leaseApplyInfo);
}
/**
* 删除领料任务
*/

View File

@ -61,8 +61,21 @@ public class LeaseApplyDetails extends BaseEntity {
@ApiModelProperty(value = "已领数量")
private Long alNum;
/**
* 此数量是剩余需要出库的数量preNum - alNum
*/
@ApiModelProperty(value = "剩余最大出库数量")
private Integer outNum;
/**
* 装备管理方式(0编号 1计数)
*/
@ApiModelProperty(name = "装备管理方式")
@Excel(name = "装备管理方式", readConverterExp = "0=编号,1=计数")
private int manageType;
/** 状态0待审批1进行中2已出库 */
@Excel(name = "状态", readConverterExp = "0=待审批1进行中2已出库")
@Excel(name = "状态", readConverterExp = "0=待审批,1=进行中,2=已出库")
private String status;
/** 数据所属组织 */

View File

@ -117,7 +117,7 @@ public class LeaseApplyInfo extends BaseEntity {
private Long directId;
/** 0工程1长期 */
@Excel(name = "0工程1长期")
@Excel(name = "领用类型",readConverterExp = "0=工程,1=长期")
@ApiModelProperty(value = "0工程1长期")
private String leaseType;
@ -137,12 +137,14 @@ public class LeaseApplyInfo extends BaseEntity {
List<LeaseApplyDetails> leaseApplyDetails;
@ApiModelProperty(value = "租赁工程")
@Excel(name = "领料工程")
private String leaseProject;
@ApiModelProperty(value = "租赁工程id")
private Integer leaseProjectId;
@ApiModelProperty(value = "租赁单位")
@Excel(name = "领料单位")
private String leaseUnit;
@ApiModelProperty(value = "租赁单位id")
@ -152,6 +154,7 @@ public class LeaseApplyInfo extends BaseEntity {
private Long agreementId;
@ApiModelProperty(value = "协议号")
@Excel(name = "协议号")
private String agreementCode;
}

View File

@ -16,7 +16,7 @@ public interface LeaseApplyInfoMapper {
* @param id 领料任务主键
* @return 领料任务
*/
public LeaseApplyInfo selectLeaseApplyInfoById(Long id);
LeaseApplyInfo selectLeaseApplyInfoById(Long id);
/**
* 查询领料任务列表
@ -24,7 +24,7 @@ public interface LeaseApplyInfoMapper {
* @param leaseApplyInfo 领料任务
* @return 领料任务集合
*/
public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo);
List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo);
/**
* 新增领料任务
@ -32,7 +32,7 @@ public interface LeaseApplyInfoMapper {
* @param leaseApplyInfo 领料任务
* @return 结果
*/
public int insertLeaseApplyInfo(LeaseApplyInfo leaseApplyInfo);
int insertLeaseApplyInfo(LeaseApplyInfo leaseApplyInfo);
/**
* 修改领料任务
@ -40,7 +40,7 @@ public interface LeaseApplyInfoMapper {
* @param leaseApplyInfo 领料任务
* @return 结果
*/
public int updateLeaseApplyInfo(LeaseApplyInfo leaseApplyInfo);
int updateLeaseApplyInfo(LeaseApplyInfo leaseApplyInfo);
/**
* 删除领料任务
@ -48,7 +48,7 @@ public interface LeaseApplyInfoMapper {
* @param id 领料任务主键
* @return 结果
*/
public int deleteLeaseApplyInfoById(Long id);
int deleteLeaseApplyInfoById(Long id);
/**
* 批量删除领料任务
@ -56,5 +56,5 @@ public interface LeaseApplyInfoMapper {
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteLeaseApplyInfoByIds(Long[] ids);
int deleteLeaseApplyInfoByIds(Long[] ids);
}

View File

@ -38,6 +38,11 @@ public interface ILeaseApplyInfoService {
*/
AjaxResult insertLeaseApplyInfo(TmTaskRequestVo leaseApplyRequestVo);
/**
* 发布任务
*/
AjaxResult publish(LeaseApplyInfo leaseApplyInfo);
/**
* 修改领料任务
*

View File

@ -18,7 +18,7 @@ public interface ILeaseOutDetailsService {
* @param id 领料出库详细主键
* @return 领料出库详细
*/
public LeaseOutDetails selectLeaseOutDetailsById(Long id);
LeaseOutDetails selectLeaseOutDetailsById(Long id);
/**
* 查询领料出库详细列表
@ -26,7 +26,7 @@ public interface ILeaseOutDetailsService {
* @param leaseOutDetails 领料出库详细
* @return 领料出库详细集合
*/
public List<LeaseOutDetails> selectLeaseOutDetailsList(LeaseOutDetails leaseOutDetails);
List<LeaseOutDetails> selectLeaseOutDetailsList(LeaseOutDetails leaseOutDetails);
/**
* 新增领料出库详细
@ -34,7 +34,7 @@ public interface ILeaseOutDetailsService {
* @param leaseOutDetailsList 领料出库详细
* @return 结果
*/
public AjaxResult insertLeaseOutDetails(List<LeaseOutDetails> leaseOutDetailsList);
AjaxResult insertLeaseOutDetails(List<LeaseOutDetails> leaseOutDetailsList);
/**
* 修改领料出库详细
@ -42,7 +42,7 @@ public interface ILeaseOutDetailsService {
* @param leaseOutDetails 领料出库详细
* @return 结果
*/
public int updateLeaseOutDetails(LeaseOutDetails leaseOutDetails);
int updateLeaseOutDetails(LeaseOutDetails leaseOutDetails);
/**
* 批量删除领料出库详细
@ -50,7 +50,7 @@ public interface ILeaseOutDetailsService {
* @param ids 需要删除的领料出库详细主键集合
* @return 结果
*/
public int deleteLeaseOutDetailsByIds(Long[] ids);
int deleteLeaseOutDetailsByIds(Long[] ids);
/**
* 删除领料出库详细信息
@ -58,5 +58,5 @@ public interface ILeaseOutDetailsService {
* @param id 领料出库详细主键
* @return 结果
*/
public int deleteLeaseOutDetailsById(Long id);
int deleteLeaseOutDetailsById(Long id);
}

View File

@ -3,6 +3,7 @@ package com.bonus.material.lease.service.impl;
import java.util.List;
import java.util.Optional;
import cn.hutool.core.collection.CollectionUtil;
import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
import com.bonus.common.biz.enums.TmTaskTypeEnum;
@ -18,12 +19,12 @@ import com.bonus.material.task.domain.TmTaskAgreement;
import com.bonus.material.task.domain.vo.TmTaskRequestVo;
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
import com.bonus.material.task.mapper.TmTaskMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
import com.bonus.material.lease.domain.LeaseApplyInfo;
import com.bonus.material.lease.service.ILeaseApplyInfoService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
@ -36,10 +37,11 @@ import javax.annotation.Resource;
*/
@Service
public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Autowired
@Resource
private LeaseApplyInfoMapper leaseApplyInfoMapper;
@Autowired
@Resource
private LeaseApplyDetailsMapper leaseApplyDetailsMapper;
@Resource
@ -48,7 +50,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Resource
TmTaskAgreementMapper tmTaskAgreementMapper;
/**
* 查询领料任务
*
@ -101,6 +102,9 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
if (tmTaskRequestVo.getLeaseApplyInfo() == null) {
return AjaxResult.error("请先填写领料任务信息");
}
if (CollectionUtil.isEmpty(tmTaskRequestVo.getLeaseApplyDetailsList())) {
return AjaxResult.error("请先添加领料任务物资明细");
}
tmTaskRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate());
tmTaskRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername());
try {
@ -131,6 +135,42 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
}
/**
* 发布任务
*
* @param leaseApplyInfo 领料任务info
*/
@Override
@Transactional
public AjaxResult publish(LeaseApplyInfo leaseApplyInfo) {
if (leaseApplyInfo.getId() == null) {
return AjaxResult.error("ID为空,请完善后重新发布!");
}
if (leaseApplyInfo.getTaskId() == null) {
return AjaxResult.error("任务ID为空,请完善后重新发布!");
}
leaseApplyInfo.setUpdateTime(DateUtils.getNowDate());
leaseApplyInfo.setStatus(String.valueOf(PurchaseTaskStatusEnum.LEASE_TASK_PUBLISHED.getStatus()));
try {
int result = leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo);
if (result > 0) {
// 同步修改tm_task任务状态
TmTask tmTask = new TmTask();
tmTask.setTaskId(leaseApplyInfo.getTaskId());
tmTask.setStatus(String.valueOf(PurchaseTaskStatusEnum.LEASE_TASK_PUBLISHED.getStatus()));
tmTaskMapper.updateTmTask(tmTask);
return AjaxResult.success("发布成功");
}
return AjaxResult.error("发布失败");
} catch (DataAccessException e) {
// 抛出异常回滚数据
throw new RuntimeException();
} catch (Exception e) {
return AjaxResult.error("发布失败:" + e.getMessage());
}
}
private AjaxResult insertPurchaseCheckDetails(List<LeaseApplyDetails> leaseApplyDetailsList, Long taskId) {
if (!CollectionUtils.isEmpty(leaseApplyDetailsList)) {
for (LeaseApplyDetails details : leaseApplyDetailsList) {
@ -168,16 +208,32 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/
@Override
public boolean updateLeaseApplyInfo(TmTaskRequestVo tmTaskRequestVo) {
tmTaskRequestVo.getLeaseApplyInfo().setUpdateTime(DateUtils.getNowDate());
tmTaskRequestVo.getLeaseApplyInfo().setUpdateBy(SecurityUtils.getUsername());
try {
Long[] ids = new Long[]{tmTaskRequestVo.getLeaseApplyInfo().getId()};
leaseApplyDetailsMapper.deleteLeaseApplyDetailsByParentIds(ids);
insertPurchaseCheckDetails(tmTaskRequestVo.getLeaseApplyDetailsList(), tmTaskRequestVo.getLeaseApplyInfo().getTaskId());
leaseApplyInfoMapper.updateLeaseApplyInfo(tmTaskRequestVo.getLeaseApplyInfo());
return true;
// 提取到局部变量中减少重复代码
LeaseApplyInfo leaseApplyInfo = tmTaskRequestVo.getLeaseApplyInfo();
if (leaseApplyInfo != null && leaseApplyInfo.getId() != null) {
leaseApplyInfo.setUpdateTime(DateUtils.getNowDate());
leaseApplyInfo.setUpdateBy(SecurityUtils.getUsername());
// 去除创建一个新的数组对象直接复用
Long[] ids = {leaseApplyInfo.getId()};
if (CollectionUtil.isNotEmpty(tmTaskRequestVo.getLeaseApplyDetailsList())) {
// 业务逻辑代码
leaseApplyDetailsMapper.deleteLeaseApplyDetailsByParentIds(ids);
insertPurchaseCheckDetails(tmTaskRequestVo.getLeaseApplyDetailsList(), leaseApplyInfo.getTaskId());
}
// 修改外层info
leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo);
return true;
}
return false;
} catch (DataAccessException dae) {
throw new ServiceException("数据访问异常: " + dae.getMessage());
} catch (IllegalArgumentException iae) {
throw new ServiceException("非法参数异常: " + iae.getMessage());
} catch (Exception e) {
throw new ServiceException("错误信息描述");
throw new ServiceException("未知异常: " + e.getMessage());
}
}

View File

@ -127,25 +127,25 @@ public class TmTaskController extends BaseController {
* @param souceBy app为1 web为0
* @return 列表
*/
@ApiOperation(value = "查询机具领料申请列表")
@PreventRepeatSubmit
@RequiresPermissions("task:task:query")
@SysLog(title = "任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->查询机具领料申请列表")
@GetMapping(value = "getLeaseAuditListAll")
public AjaxResult getLeaseAuditListAll(TmTaskRequestVo task, Integer souceBy) {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
}
List<TmTaskRequestVo> leaseAuditList;
if (souceBy != null && souceBy == 1) {
leaseAuditList = tmTaskService.getLeaseAuditList(task);
return AjaxResult.success(leaseAuditList);
} else {
startPage();
leaseAuditList = tmTaskService.getLeaseAuditList(task);
return AjaxResult.success(getDataTable(leaseAuditList));
}
}
// @ApiOperation(value = "查询机具领料申请列表")
// @PreventRepeatSubmit
// @RequiresPermissions("task:task:query")
// @SysLog(title = "任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->查询机具领料申请列表")
// @GetMapping(value = "getLeaseAuditListAll")
// public AjaxResult getLeaseAuditListAll(TmTaskRequestVo task, Integer souceBy) {
// if (StringUtils.isNull(task)) {
// return AjaxResult.error("参数错误");
// }
// List<TmTaskRequestVo> leaseAuditList;
// if (souceBy != null && souceBy == 1) {
// leaseAuditList = tmTaskService.getLeaseAuditList(task);
// return AjaxResult.success(leaseAuditList);
// } else {
// startPage();
// leaseAuditList = tmTaskService.getLeaseAuditList(task);
// return AjaxResult.success(getDataTable(leaseAuditList));
// }
// }
}

View File

@ -89,12 +89,6 @@ public class TmTaskRequestVo extends BaseEntity {
@ApiModelProperty(value = "关键字")
private String keyWord;
/**
* 领料任务实体集合
*/
@ApiModelProperty(value = "领料任务实体集合")
private List<LeaseApplyInfo> leaseApplyInfoList;
@ApiModelProperty(value = "领料任务汇总")
private LeaseApplyInfo leaseApplyInfo;

View File

@ -10,13 +10,14 @@ import com.bonus.material.task.domain.TmTaskAgreement;
* @date 2024-10-16
*/
public interface TmTaskAgreementMapper {
/**
* 查询任务
*
* @param taskId 任务主键
* @return 任务
*/
public TmTaskAgreement selectTmTaskAgreementByTaskId(Long taskId);
TmTaskAgreement selectTmTaskAgreementByTaskId(Long taskId);
/**
* 查询任务列表
@ -24,7 +25,7 @@ public interface TmTaskAgreementMapper {
* @param tmTaskAgreement 任务
* @return 任务集合
*/
public List<TmTaskAgreement> selectTmTaskAgreementList(TmTaskAgreement tmTaskAgreement);
List<TmTaskAgreement> selectTmTaskAgreementList(TmTaskAgreement tmTaskAgreement);
/**
* 新增任务
@ -32,7 +33,7 @@ public interface TmTaskAgreementMapper {
* @param tmTaskAgreement 任务
* @return 结果
*/
public int insertTmTaskAgreement(TmTaskAgreement tmTaskAgreement);
int insertTmTaskAgreement(TmTaskAgreement tmTaskAgreement);
/**
* 修改任务
@ -40,7 +41,7 @@ public interface TmTaskAgreementMapper {
* @param tmTaskAgreement 任务
* @return 结果
*/
public int updateTmTaskAgreement(TmTaskAgreement tmTaskAgreement);
int updateTmTaskAgreement(TmTaskAgreement tmTaskAgreement);
/**
* 删除任务
@ -48,7 +49,7 @@ public interface TmTaskAgreementMapper {
* @param taskId 任务主键
* @return 结果
*/
public int deleteTmTaskAgreementByTaskId(Long taskId);
int deleteTmTaskAgreementByTaskId(Long taskId);
/**
* 批量删除任务
@ -56,5 +57,5 @@ public interface TmTaskAgreementMapper {
* @param taskIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteTmTaskAgreementByTaskIds(Long[] taskIds);
int deleteTmTaskAgreementByTaskIds(Long[] taskIds);
}

View File

@ -89,11 +89,11 @@ public interface TmTaskMapper {
int deleteTmTaskByPurchaseIds(Long[] ids);
List<TmTaskRequestVo> getAuditListByLeaseTmTask(@Param("record") TmTaskRequestVo tmTaskRequestVo);
List<TmTaskRequestVo> getAuditListByLeaseTmTaskByPeople(@Param("record") TmTaskRequestVo tmTaskRequestVo);
List<LeaseApplyInfo> getAuditListByLeaseInfo(@Param("record") TmTaskRequestVo record);
List<LeaseApplyDetails> getLeaseApplyDetails(@Param("record") LeaseApplyInfo record);
// List<TmTaskRequestVo> getAuditListByLeaseTmTask(@Param("record") TmTaskRequestVo tmTaskRequestVo);
//
// List<TmTaskRequestVo> getAuditListByLeaseTmTaskByPeople(@Param("record") TmTaskRequestVo tmTaskRequestVo);
//
// List<LeaseApplyInfo> getAuditListByLeaseInfo(@Param("record") TmTaskRequestVo record);
//
// List<LeaseApplyDetails> getLeaseApplyDetails(@Param("record") LeaseApplyInfo record);
}

View File

@ -59,5 +59,7 @@ public interface ITmTaskService {
*/
public int deleteTmTaskByTaskId(Long taskId);
List<TmTaskRequestVo> getLeaseAuditList(TmTaskRequestVo tmTask);
// List<TmTaskRequestVo> getLeaseAuditList(TmTaskRequestVo tmTask);
}

View File

@ -106,49 +106,50 @@ public class TmTaskServiceImpl implements ITmTaskService {
/**
* 获取单个申请列表
*/
@Override
public List<TmTaskRequestVo> getLeaseAuditList(TmTaskRequestVo tmTaskRequestVo) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<TmTaskRequestVo> tmTaskList;
if (roles.contains(MaterialConstants.STRING_ADMIN)) {
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(tmTaskRequestVo);
} else {
String username = SecurityUtils.getLoginUser().getUsername();
tmTaskRequestVo.setCreateBy(username);
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(tmTaskRequestVo);
}
for (TmTaskRequestVo 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 && leaseApplyDetail.getPreNum() != null) {
// 统计预领数量
count += leaseApplyDetail.getPreNum();
}
}
// 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
}
}
}
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
tmTask.setRemark(auditListByLeaseInfo.get(0).getRemark());
}
// 塞入预领的合计数量
tmTask.setPreCountNum(count);
}
}
// @Override
// public List<TmTaskRequestVo> getLeaseAuditList(TmTaskRequestVo tmTaskRequestVo) {
// Set<String> roles = SecurityUtils.getLoginUser().getRoles();
// List<TmTaskRequestVo> tmTaskList;
// if (roles.contains(MaterialConstants.STRING_ADMIN)) {
// tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(tmTaskRequestVo);
// } else {
// String username = SecurityUtils.getLoginUser().getUsername();
// tmTaskRequestVo.setCreateBy(username);
// tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(tmTaskRequestVo);
// }
// for (TmTaskRequestVo 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 && leaseApplyDetail.getPreNum() != null) {
// // 统计预领数量
// count += leaseApplyDetail.getPreNum();
// }
// }
// // 塞入领料任务详情的集合中
// leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
// }
// }
// }
// // 存入领料任务实体集合
// tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
// tmTask.setRemark(auditListByLeaseInfo.get(0).getRemark());
// }
// // 塞入预领的合计数量
// tmTask.setPreCountNum(count);
// }
// }
// return tmTaskList;
// }
return tmTaskList;
}
}

View File

@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
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)
WHERE mm.ma_code is not null and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
WHERE mt.del_flag = '0'
<if test="level!=null and level!=''">

View File

@ -31,6 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectLeaseApplyDetailsVo">
select
lad.id, lad.parent_id, mt.type_id, mt.type_name, mt2.type_name as ma_type_name, mt.storage_num,
mt.manage_type as manageType,
(lad.pre_num - IF(lad.al_num IS NULL,'0',lad.al_num)) AS outNum,
lad.pre_num, lad.audit_num, lad.al_num, lad.status, mt.unit_name,
lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id
from

View File

@ -154,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
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)
WHERE mm.ma_code is not null and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
WHERE mt.del_flag = '0' and mt.type_id = #{typeId}
</select>

View File

@ -458,7 +458,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select DISTINCT m.type_id, m.type_name, m.parent_id, m.unit_id, m.unit_name, m.manage_type,
m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num,
mpi.prop_name, m.del_flag, m.create_by, m.create_time,
m.del_flag, m.create_by, m.create_time,
m.remark,m.type_id id , m.type_name label,
CASE m.manage_type
WHEN 0 THEN
@ -467,8 +467,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(m.storage_num, 0)
END as storage_num
from ma_type m
left join ma_prop_set mps on m.type_id = mps.type_id and mps.`status`='0' and mps.del_flag='0'
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id and mpi.`status`='0' and mpi.del_flag='0'
left join (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
@ -476,7 +474,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
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)
WHERE mm.ma_code is not null and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id
<where>
m.del_flag = '0'

View File

@ -129,127 +129,120 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</delete>
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.material.task.domain.vo.TmTaskRequestVo">
SELECT DISTINCT
tt.task_id as taskId, tt.task_type as taskType, tt.task_status as taskStatus, tt.status, tt.code,
su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpl.pro_id as proId,bpl.pro_name as projectName,
bui.unit_id as unitId,bui.unit_name as unitName,
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,
lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes
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 bpl ON bpl.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id
WHERE
tt.task_type = 2 and tt.status = '1'
<if test="record.taskId != null and record.taskId != '' ">
AND tt.task_id = #{record.taskId}
</if>
<!-- <select id="getAuditListByLeaseTmTask" resultType="com.bonus.material.task.domain.vo.TmTaskRequestVo">-->
<!-- SELECT DISTINCT-->
<!-- tt.task_id as taskId, tt.task_type as taskType, tt.task_status as taskStatus, tt.status, tt.code,-->
<!-- su.phonenumber AS phoneNumber, sd.dept_name as deptName,-->
<!-- bpl.pro_id as proId,bpl.pro_name as projectName,-->
<!-- bui.unit_id as unitId,bui.unit_name as unitName,-->
<!-- lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,-->
<!-- lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,-->
<!-- bai.agreement_code as agreementCode,-->
<!-- tt.create_time as createTimes, tt.update_time as updateTimes-->
<!-- 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 bpl ON bpl.pro_id = bai.project_id-->
<!-- LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id-->
<!-- LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id-->
<!-- WHERE-->
<!-- tt.task_type = 2 and tt.status = '1'-->
<!-- <if test="record.taskId != null and record.taskId != '' ">-->
<!-- AND tt.task_id = #{record.taskId}-->
<!-- </if>-->
<if test="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">
AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')
</if>
<!-- <if test="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">-->
<!-- AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')-->
<!-- </if>-->
<if test="record.unitId != null and record.unitId != ''">
AND bui.unit_id = #{record.unitId}
</if>
<!-- <if test="record.unitId != null and record.unitId != ''">-->
<!-- AND bui.unit_id = #{record.unitId}-->
<!-- </if>-->
<if test="record.projectId != null and record.projectId != ''">
AND bpl.pro_id = #{record.projectId}
</if>
<!-- <if test="record.projectId != null and record.projectId != ''">-->
<!-- AND bpl.pro_id = #{record.projectId}-->
<!-- </if>-->
<if test="record.keyWord != null and record.keyWord != ''">
AND (bai.agreement_code like concat('%', #{record.keyWord}, '%') or
tt.code like concat('%', #{record.keyWord}, '%'))
</if>
GROUP BY tt.task_id
ORDER BY tt.update_time DESC
</select>
<!-- <if test="record.keyWord != null and record.keyWord != ''">-->
<!-- AND (bai.agreement_code like concat('%', #{record.keyWord}, '%') or-->
<!-- tt.code like concat('%', #{record.keyWord}, '%'))-->
<!-- </if>-->
<!-- GROUP BY tt.task_id-->
<!-- ORDER BY tt.update_time DESC-->
<!-- </select>-->
<select id="getAuditListByLeaseTmTaskByPeople" resultType="com.bonus.material.task.domain.vo.TmTaskRequestVo">
SELECT DISTINCT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpl.pro_id as proId,bpl.pro_name as projectName,
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,lai.estimate_lease_time as estimateLeaseTime,
-- case when d.id = '31' then lai.company_audit_remark
-- when d.id = '32' then lai.dept_audit_remark
-- when d.id = '33' then lai.direct_audit_remark
-- when d.id = '98' then lai.company_audit_remark
-- when d.id = '99' then lai.dept_audit_remark
-- when d.id = '100' then lai.direct_audit_remark
-- end examineStatus ,
-- d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes
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 bpl ON bpl.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id
-- LEFT JOIN sys_dic d ON d.id = tt.task_status
WHERE
tt.task_type = 2 and tt.status = '1' and tt.create_by = #{record.createBy}
<if test="record.taskId != null and record.taskId != '' ">
AND tt.task_id = #{record.taskId}
</if>
<!-- <select id="getAuditListByLeaseTmTaskByPeople" resultType="com.bonus.material.task.domain.vo.TmTaskRequestVo">-->
<!-- SELECT DISTINCT-->
<!-- tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,-->
<!-- bpl.pro_id as proId,bpl.pro_name as projectName,-->
<!-- bui.unit_id as unitId,bui.unit_name as unitName,-->
<!-- lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,-->
<!-- lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,-->
<!-- bai.agreement_code as agreementCode,-->
<!-- tt.create_time as createTimes, tt.update_time as updateTimes-->
<!-- 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 bpl ON bpl.pro_id = bai.project_id-->
<!-- LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id-->
<!-- LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id-->
<!-- WHERE-->
<!-- tt.task_type = 2 and tt.status = '1' and tt.create_by = #{record.createBy}-->
<!-- <if test="record.taskId != null and record.taskId != '' ">-->
<!-- AND tt.task_id = #{record.taskId}-->
<!-- </if>-->
<if test="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">
AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')
</if>
<!-- <if test="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">-->
<!-- AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')-->
<!-- </if>-->
<if test="record.unitId != null and record.unitId != ''">
AND bui.unit_id = #{record.unitId}
</if>
<!-- <if test="record.unitId != null and record.unitId != ''">-->
<!-- AND bui.unit_id = #{record.unitId}-->
<!-- </if>-->
<if test="record.projectId != null and record.projectId != ''">
AND bpl.pro_id = #{record.projectId}
</if>
<!-- <if test="record.projectId != null and record.projectId != ''">-->
<!-- AND bpl.pro_id = #{record.projectId}-->
<!-- </if>-->
<if test="record.keyWord != null and record.keyWord != ''">
AND (bai.agreement_code like concat('%', #{record.keyWord}, '%') or
tt.code like concat('%', #{record.keyWord}, '%'))
</if>
GROUP BY tt.task_id
ORDER BY tt.update_time DESC
</select>
<!-- <if test="record.keyWord != null and record.keyWord != ''">-->
<!-- AND (bai.agreement_code like concat('%', #{record.keyWord}, '%') or-->
<!-- tt.code like concat('%', #{record.keyWord}, '%'))-->
<!-- </if>-->
<!-- GROUP BY tt.task_id-->
<!-- ORDER BY tt.update_time DESC-->
<!-- </select>-->
<select id="getAuditListByLeaseInfo" resultType="com.bonus.material.lease.domain.LeaseApplyInfo">
SELECT
lai.*
FROM
lease_apply_info lai
WHERE
lai.task_id = #{record.taskId} AND lai.`code` = #{record.code}
</select>
<!-- <select id="getAuditListByLeaseInfo" resultType="com.bonus.material.lease.domain.LeaseApplyInfo">-->
<!-- SELECT-->
<!-- lai.id, lai.code, lai.task_id as taskId, lai.lease_person as leasePerson, lai.phone, lai.type,-->
<!-- lai.create_by as createBy, lai.create_time as createTime, lai.remark, lai.company_id as companyId,-->
<!-- lai.status, lai.direct_id as directId, lai.lease_type as leaseType, lai.estimate_lease_time as estimateLeaseTime,-->
<!-- lai.cost_bearing_party as costBearingParty-->
<!-- FROM-->
<!-- lease_apply_info lai-->
<!-- WHERE-->
<!-- lai.task_id = #{record.taskId} AND lai.`code` = #{record.code}-->
<!-- </select>-->
<select id="getLeaseApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
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.storage_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
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ma_machine mm ON lad.type_id = mm.type_id
WHERE
lad.parent_id = #{record.id} AND lad.company_id = #{record.companyId}
GROUP BY
lad.id
</select>
<!-- <select id="getLeaseApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">-->
<!-- 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.storage_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-->
<!-- LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id-->
<!-- LEFT JOIN ma_machine mm ON lad.type_id = mm.type_id-->
<!-- WHERE-->
<!-- lad.parent_id = #{record.taskId}-->
<!-- GROUP BY-->
<!-- lad.id-->
<!-- </select>-->
</mapper>