5号库改造

This commit is contained in:
hayu 2026-01-14 09:59:27 +08:00
parent 03232682f8
commit 7eb024869a
3 changed files with 30 additions and 1 deletions

View File

@ -156,6 +156,8 @@ public class ScrapApplyDetailsController extends BaseController {
public AjaxResult getTotalList(ScrapApplyDetails scrapApplyDetails) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
Long deptId = typeService.getUserDeptId();
scrapApplyDetails.setCompanyId(deptId);
List<ScrapTotalListVo> list = scrapApplyDetailsService.selectTotalScrapApplyDetailsList(scrapApplyDetails);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
@ -171,6 +173,8 @@ public class ScrapApplyDetailsController extends BaseController {
public AjaxResult getScrapList(ScrapApplyDetails scrapApplyDetails) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
Long deptId = typeService.getUserDeptId();
scrapApplyDetails.setCompanyId(deptId);
List<ScrapTotalListVo> list = scrapApplyDetailsService.getScrapList(scrapApplyDetails);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
@ -202,6 +206,8 @@ public class ScrapApplyDetailsController extends BaseController {
public AjaxResult getScrapDetailsList(ScrapApplyDetails scrapApplyDetails) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
Long deptId = typeService.getUserDeptId();
scrapApplyDetails.setCompanyId(deptId);
List<ScrapDetailsListVo> list = scrapApplyDetailsService.getScrapDetailsList(scrapApplyDetails);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
@ -215,6 +221,8 @@ public class ScrapApplyDetailsController extends BaseController {
//@RequiresPermissions("scrap:details:export")
@PostMapping("/exportScrapDetailsList")
public void exportScrapDetailsList(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
Long deptId = typeService.getUserDeptId();
scrapApplyDetails.setCompanyId(deptId);
List<ScrapDetailsListVo> list = scrapApplyDetailsService.getScrapDetailsList(scrapApplyDetails);
ExcelUtil<ScrapDetailsListVo> util = new ExcelUtil<>(ScrapDetailsListVo.class);
util.exportExcel(response, list, "报废台账明细数据");
@ -229,6 +237,8 @@ public class ScrapApplyDetailsController extends BaseController {
// @RequiresPermissions("scrap:details:list")
@GetMapping("/getTotalPrice")
public AjaxResult getTotalPrice(ScrapApplyDetails scrapApplyDetails) {
Long deptId = typeService.getUserDeptId();
scrapApplyDetails.setCompanyId(deptId);
ScrapTotalListVo list = scrapApplyDetailsService.getTotalPrice(scrapApplyDetails);
return AjaxResult.success(list);
}
@ -344,6 +354,8 @@ public class ScrapApplyDetailsController extends BaseController {
@PostMapping
public AjaxResult add(@RequestBody ScrapApplyDetails scrapApplyDetails) {
try {
Long deptId = typeService.getUserDeptId();
scrapApplyDetails.setCompanyId(deptId);
return toAjax(scrapApplyDetailsService.insertScrapApplyDetails(scrapApplyDetails));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());

View File

@ -277,6 +277,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
@Transactional(rollbackFor = Exception.class)
public AjaxResult reject(ScrapApplyDetails scrapApplyDetails) {
// TODO: 报废审核二级页面驳回
Long deptId = typeService.getUserDeptId();
int result = 0;
if (scrapApplyDetails != null) {
if (CollectionUtils.isNotEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
@ -297,6 +298,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
applyDetails.setStatus(MaMachineStatusEnum.BACK_REPAIR.getStatus().toString());
result += scrapApplyDetailsMapper.updateMaStatus(applyDetails);
}
applyDetails.setCompanyId(deptId);
result += insertWxTask(applyDetails);
}
if (result > 0) {
@ -330,6 +332,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
applyDetails1.setCreateTime(DateUtils.getNowDate());
applyDetails1.setBackId(backId);
applyDetails1.setNewTaskId(newTaskId);
applyDetails1.setCompanyId(deptId);
result += insertWxTask(applyDetails1);
}
}
@ -415,6 +418,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult ledgerReject(ScrapApplyDetails scrapApplyDetails) {
Long deptId = typeService.getUserDeptId();
if (scrapApplyDetails == null || CollectionUtils.isEmpty(scrapApplyDetails.getIdList()) || CollectionUtils.isEmpty(scrapApplyDetails.getTaskIdList())) {
return AjaxResult.error("参数为空");
}
@ -449,6 +453,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
if (CollectionUtils.isNotEmpty(scrapApplyDetailsList)) {
for (ScrapApplyDetails applyDetails : scrapApplyDetailsList) {
if (idList.contains(applyDetails.getId())) {
applyDetails.setCompanyId(deptId);
applyDetails.setLedgerStatus(ScrapTaskStatusEnum.SCRAP_TASK_TO_REJECT.getStatus().toString());
applyDetails.setLedgerBy(SecurityUtils.getLoginUser().getUserid());
applyDetails.setLedgerTime(DateUtils.getNowDate());
@ -502,6 +507,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
* @return
*/
private Long insertScrapTtReject() {
Long deptId = typeService.getUserDeptId();
Long newTask = null;
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId());
// 生成盘点报废单号
@ -510,6 +516,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
null,thisMonthMaxOrder + 1, code);
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
tmTask.setCompanyId(deptId);
// 插入任务
int taskId = taskMapper.insertTmTask(tmTask);
// 如果插入成功且返回的 taskId 大于 0
@ -1039,6 +1046,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
* @return
*/
private Long insertTt(Long preTaskId) {
Long deptId = typeService.getUserDeptId();
Long newTask = null;
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId());
// 生成维修单号
@ -1048,6 +1056,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
tmTask.setPreTaskId(preTaskId);
tmTask.setCompanyId(deptId);
// 插入任务
int taskId = taskMapper.insertTmTask(tmTask);
// 如果插入成功且返回的 taskId 大于 0
@ -1077,6 +1086,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
* @return
*/
private int insertTta(Long newTaskId, ScrapApplyDetails scrapApplyDetails) {
Long deptId = typeService.getUserDeptId();
int res;
Long agreementId = null;
if (CollectionUtils.isNotEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
@ -1087,6 +1097,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(newTaskId, agreementId);
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
tmTaskAgreement.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
tmTaskAgreement.setCompanyId(deptId);
res = taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
return res;
}

View File

@ -426,6 +426,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="month != null and month != ''">
<![CDATA[AND DATE_FORMAT( sad.create_time, '%Y-%m' ) = #{month}]]>
</if>
<if test="companyId!=null">
and sad.company_id = #{companyId}
</if>
GROUP BY
sad.type_id,
sad.scrap_type,
@ -521,7 +524,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN tm_task tt on tt.task_id =sad.task_id
WHERE sad.`status` = '1' and sad.ledger_status = '1'
<if test="companyId != null"> and tt.company_id =#{companyId}</if>
<if test="companyId != null"> and sad.company_id =#{companyId}</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[
AND DATE_FORMAT( sad.create_time, '%Y-%m' ) BETWEEN DATE_FORMAT(#{startTime}, '%Y-%m') AND DATE_FORMAT(#{endTime}, '%Y-%m')
@ -562,6 +565,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND DATE_FORMAT( sad.ledger_time, '%Y-%m-%d' ) BETWEEN DATE_FORMAT(#{startTime}, '%Y-%m-%d') AND DATE_FORMAT(#{endTime}, '%Y-%m-%d')
]]>
</if>
<if test="companyId!=null">
and sad.company_id = #{companyId}
</if>
GROUP BY
sad.type_id,
sad.scrap_type,