工机具类型管理绑定多个库管员时修改报错问题修复

This commit is contained in:
15856 2024-06-27 16:19:49 +08:00
parent 5f68d7194a
commit 7810dd99ae
30 changed files with 711 additions and 40 deletions

View File

@ -93,6 +93,6 @@ public interface RemoteUserService
* @param urgentProcessingUser
* @return
*/
@PostMapping("/urgentProcessingUser")
public AjaxResult urgentProcessingUser(@RequestBody UrgentProcessingUser urgentProcessingUser);
@PostMapping("/user/processingUser")
public R<List<SysUser>> processingUser(@RequestBody UrgentProcessingUser urgentProcessingUser);
}

View File

@ -1,5 +1,7 @@
package com.bonus.sgzb.system.api.factory;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.system.api.domain.UrgentProcessingUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
@ -8,9 +10,12 @@ import com.bonus.sgzb.common.core.domain.R;
import com.bonus.sgzb.system.api.RemoteUserService;
import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.api.model.LoginUser;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import static com.bonus.sgzb.common.core.web.domain.AjaxResult.success;
/**
* 用户服务降级处理
*
@ -61,6 +66,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
public R<List<SysUser>> getUserList(SysUser sysUser, String source) {
return R.fail("获取用户失败:" + throwable.getMessage());
}
@Override
public R<List<SysUser>> processingUser(UrgentProcessingUser urgentProcessingUser){
return R.fail("获取用户失败:" + throwable.getMessage());
}
};
}
}

View File

@ -17,5 +17,13 @@ public class TaskTypeConstants {
*/
public static final String WX = "WX";
/**
* 退料任务
*/
public static final String T= "T";
private TaskTypeConstants() {
throw new IllegalStateException("Utility class");
}
}

View File

@ -28,9 +28,39 @@ public enum TaskStatusEnum {
COMPLETE("35", "完成"),
/**
* 维修进行中
* 退料任务--待退料审核
*/
REPAIRING("43", "维修进行中"),
RETURNED_MATERIALS_AWAITING_REVIEW("37", "待退料审核"),
/**
* 退料任务--退料已审核
*/
MATERIAL_RETURN_APPROVED("38", "退料已审核"),
/**
* 退料任务--退料核查中
*/
MATERIAL_RETURN_VERIFICATION_PROGRESS("39", "退料核查中"),
/**
* 退料任务--退料完成
*/
MATERIAL_RETURN_COMPLETED("40", "退料完成"),
/**
* 维修任务--维修待进行
*/
REPAIR_PENDING("42", "维修待进行"),
/**
* 维修任务--维修进行中
*/
MAINTENANCE_PROGRESS("43", "维修进行中"),
/**
* 维修任务--维修完成
*/
REPAIR_COMPLETED("44", "维修完成"),
/**
* 待报废任务--待审核
@ -43,7 +73,7 @@ public enum TaskStatusEnum {
/**
* 待报废任务--已通过
*/
PASSED("122", "通过"),
PASSED("122", "完成"),
/**
* 待报废任务--已驳回
*/

View File

@ -22,6 +22,7 @@ public class SgzbBaseApplication
public static void main(String[] args)
{
SpringApplication.run(SgzbBaseApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 基础管理模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +

View File

@ -3,6 +3,7 @@ package com.bonus.sgzb.app.controller;
import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.service.*;
import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.text.Convert;
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
import com.bonus.sgzb.common.core.utils.ServletUtils;
@ -39,8 +40,8 @@ public class BackReceiveController extends BaseController {
* @return AjaxResult对象
*/
@Log(title = "退料接收列表", businessType = BusinessType.QUERY)
@GetMapping("getbackReceiveList")
public AjaxResult getbackReceiveList(BackApplyInfo record) {
@GetMapping("/getbackReceiveList")
public AjaxResult getBackReceiveList(BackApplyInfo record) {
try {
if (record.getFlag() == 0) {
List<BackApplyInfo> list = backReceiveService.getbackReceiveList(record);
@ -94,12 +95,14 @@ public class BackReceiveController extends BaseController {
* @return AjaxResult对象
*/
@Log(title = "退料接收明细-web", businessType = BusinessType.QUERY)
@PostMapping("receiveViewWeb")
@PostMapping("/receiveViewWeb")
public AjaxResult receiveViewWeb(@RequestBody BackApplyInfo record) {
try {
startPage();
//startPage();
List<BackApplyInfo> list = backReceiveService.receiveView(record);
return success(getDataTable(list));
Integer pageIndex = cn.hutool.core.convert.Convert.toInt(record.getPageNum(), 1);
Integer pageSize = cn.hutool.core.convert.Convert.toInt(record.getPageSize(), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -133,7 +136,7 @@ public class BackReceiveController extends BaseController {
* @return AjaxResult对象
*/
@Log(title = "退料接收-编码退料", businessType = BusinessType.INSERT)
@PostMapping("setCodeBack")
@PostMapping("/setCodeBack")
public AjaxResult setCodeBack(@RequestBody BackApplyInfo record) {
try {
int res = backReceiveService.setCodeBack(record);
@ -157,7 +160,7 @@ public class BackReceiveController extends BaseController {
* @return AjaxResult对象
*/
@Log(title = "退料接收撤回")
@PostMapping("revoke")
@PostMapping("/revoke")
public AjaxResult revoke(@RequestBody BackApplyInfo record) {
int res = backReceiveService.revoke(record);
if (res > 0) {
@ -191,7 +194,7 @@ public class BackReceiveController extends BaseController {
}
@Log(title = "退料接收-结束任务", businessType = BusinessType.MATERIAL)
@PostMapping("endBack")
@PostMapping("/endBack")
public AjaxResult endBack(@RequestBody BackApplyInfo record) {
try {
int res = backReceiveService.endBack(record);
@ -239,7 +242,7 @@ public class BackReceiveController extends BaseController {
}
@Log(title = "编码接收机具查询-web", businessType = BusinessType.INSERT)
@GetMapping("getBackMachine")
@GetMapping("/getBackMachine")
public AjaxResult getBackMachine(TmTask task) {
try {
startPage();
@ -250,6 +253,18 @@ public class BackReceiveController extends BaseController {
}
}
@Log(title = "编码接收机具查询-预报废驳回", businessType = BusinessType.INSERT)
@GetMapping("/getScrapBackMachine")
public AjaxResult getScrapBackMachine(TmTask task) {
try {
startPage();
List<TmTask> list = backReceiveService.getScrapBackMachine(task);
return AjaxResult.success(getDataTable(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Log(title = "查询退料接收记录-web", businessType = BusinessType.INSERT)
@GetMapping("getRecord")
public AjaxResult getRecord(TmTask task) {
@ -289,7 +304,7 @@ public class BackReceiveController extends BaseController {
}
@Log(title = "退料接收记录(编码接收)-web", businessType = BusinessType.INSERT)
@PostMapping("backReceiveRecordWebPt")
@PostMapping("/backReceiveRecordWebPt")
public AjaxResult backReceiveRecordWebPt(@RequestBody BackApplyInfo record) {
try {
List<BackApplyInfo> list = backReceiveService.backReceiveRecordWebPt(record);

View File

@ -6,6 +6,7 @@ import cn.hutool.core.util.PhoneUtil;
import com.bonus.sgzb.app.domain.*;
import com.bonus.sgzb.app.service.*;
import com.bonus.sgzb.base.service.ITypeService;
import com.bonus.sgzb.common.core.domain.R;
import com.bonus.sgzb.common.core.enums.TaskStatusEnum;
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
import com.bonus.sgzb.common.core.utils.ServletUtils;
@ -77,7 +78,7 @@ public class TmTaskController extends BaseController {
* @return 结果
*/
@Log(title = "宁夏领料审核通过", businessType = BusinessType.UPDATE)
@PostMapping("auditLeaseByCompany")
@PostMapping("/auditLeaseByCompany")
public AjaxResult auditLeaseByCompany(@RequestBody TmTask task) {
return toAjax(tmTaskService.updateLeaseTaskAuditInfo(task));
}
@ -175,7 +176,7 @@ public class TmTaskController extends BaseController {
* @return 结果
*/
@Log(title = "往来单位提交领料申请", businessType = BusinessType.INSERT)
@PostMapping("submitLeaseApply")
@PostMapping("/submitLeaseApply")
@Transactional
public AjaxResult submitLeaseApply(@RequestBody TmTask task) {
if (StringUtils.isNull(task)) {
@ -285,9 +286,8 @@ public class TmTaskController extends BaseController {
urgentProcessingUser.setTaskStatus(TaskStatusEnum.STAY_INTERNAL_AUDIT.getInfo());
break;
}
AjaxResult ajaxResult = remoteUserService.urgentProcessingUser(urgentProcessingUser);
if (ajaxResult.isSuccess()) {
List<SysUser> userList = (List<SysUser>) ajaxResult.get("data");
List<SysUser> userList = remoteUserService.processingUser(urgentProcessingUser).getData();
if (userList.size()>0) {
String message ="尊敬的用户,宁夏智慧仓储管理系统提醒您:您有一个领料单号为:"+ code +"的领料申请待处理,请及时查看";
if (CollectionUtils.isNotEmpty(userList)) {
for (SysUser sysUser : userList) {
@ -391,7 +391,7 @@ public class TmTaskController extends BaseController {
* @return 列表
*/
@Log(title = "查询机具领料申请列表", businessType = BusinessType.QUERY)
@GetMapping(value = "getLeaseAuditListAll")
@GetMapping(value = "/getLeaseAuditListAll")
public AjaxResult getLeaseAuditListAll(TmTask task, Integer souceBy) {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
@ -415,7 +415,7 @@ public class TmTaskController extends BaseController {
* @return 列表
*/
@Log(title = "宁夏查询机具领料管理列表", businessType = BusinessType.QUERY)
@GetMapping(value = "getLeaseManageListAll")
@GetMapping(value = "/getLeaseManageListAll")
public AjaxResult getLeaseManageListAll(TmTask task, Integer souceBy) {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.app.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
@ -213,4 +214,19 @@ public class BackApplyInfo {
* 图片地址
*/
private String fileUrl;
/** 数据来源(1预报废2,退料申请) */
@ApiModelProperty(value = "数据来源(1预报废2,退料申请)")
private Integer backSource;
/** 预报废单号*/
private String forecastWasteCode;
/**页数 */
private Integer pageNum;
/** 条数 *
*
*/
private Integer pageSize;
}

View File

@ -204,4 +204,6 @@ public interface BackReceiveMapper {
List<BackApplyInfo> getCtList(BackApplyInfo record);
List<BackApplyInfo> backReceiveRecordWebPt(BackApplyInfo record);
List<TmTask> getScrapBackMachine(TmTask task);
}

View File

@ -99,4 +99,6 @@ public interface BackReceiveService {
List<BackApplyInfo> backReceiveRecordWeb(BackApplyInfo record);
List<BackApplyInfo> backReceiveRecordWebPt(BackApplyInfo record);
List<TmTask> getScrapBackMachine(TmTask task);
}

View File

@ -248,9 +248,8 @@ public class TmTaskServiceImpl implements TmTaskService {
urgentProcessingUser.setTaskStatus(TaskStatusEnum.STAY_INTERNAL_AUDIT.getInfo());
break;
}
AjaxResult ajaxResult = remoteUserService.urgentProcessingUser(urgentProcessingUser);
if (ajaxResult.isSuccess()) {
List<SysUser> userList = (List<SysUser>) ajaxResult.get("data");
List<SysUser> userList =remoteUserService.processingUser(urgentProcessingUser).getData();
if (userList.size()>0) {
log.info("查询到待发送短信人员信息为:{}", userList);
String message ="尊敬的用户,宁夏智慧仓储管理系统提醒您:您有一个领料单号为:"+ record.getCode() +"的领料申请待处理,请及时查看";
if (CollectionUtils.isNotEmpty(userList)) {

View File

@ -142,4 +142,15 @@ public class RepairTask {
@ApiModelProperty(value = "导出选中列表")
private List<Long> dataCondition;
/**
* 数据来源(1预报废2,退料)
*/
@ApiModelProperty(value = "数据来源(1预报废2,退料)")
private Integer backSource;
/** 预报废单号*/
private String forecastWasteCode;
/** 驳回原因 */
private String remark;
}

View File

@ -637,6 +637,7 @@
tt.task_status AS taskStatus,
sd.`name` AS taskName,
tta.agreement_id AS agreementId,
tt1.code as forecastWasteCode,
GROUP_CONCAT( DISTINCT mt2.type_id ) AS typeId,
GROUP_CONCAT( bai.company_id ) AS companyId,
GROUP_CONCAT(bad.id) as badId,
@ -655,6 +656,7 @@
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN sys_dic sd ON sd.id = tt.task_status
LEFT JOIN tm_task tt1 on tt1.task_id = bai.parent_id
WHERE
tt.task_status IN ( 37, 38, 39, 40 )
<if test="keyWord != null and keyWord != ''">
@ -672,6 +674,9 @@
<if test="taskStatus != null and taskStatus != ''">
and tt.task_status = #{taskStatus}
</if>
<if test="backSource != null and backSource != ''">
and bai.back_source =#{backSource}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND bai.back_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
@ -730,6 +735,7 @@
<if test="modelId != null and modelId != ''">
and mt.type_id = #{modelId}
</if>
order by bad.create_time
</select>
<select id="selectTaskNumByMonthWx" resultType="java.lang.Integer">
@ -751,7 +757,7 @@
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
WHERE
parent_id=#{parentId}
bcd.parent_id=#{parentId}
and bcd.back_status='1'
</select>
@ -771,7 +777,7 @@
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
WHERE
parent_id=#{parentId}
bcd.parent_id=#{parentId}
and bcd.back_status='2'
</select>
@ -794,7 +800,7 @@
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
WHERE
parent_id=#{parentId}
bcd.parent_id=#{parentId}
and bcd.back_status='3'
</select>
@ -926,7 +932,7 @@
LEFT JOIN back_apply_info bai ON bai.id = bcd.parent_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
WHERE
parent_id = #{parentId}
bcd.parent_id = #{parentId}
GROUP By bcd.type_id,bcd.ma_id
</select>
<select id="getBackMachine" resultType="com.bonus.sgzb.app.domain.TmTask">
@ -1062,5 +1068,28 @@
ORDER BY
bcd.create_time DESC
</select>
<select id="getScrapBackMachine" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.type_id AS typeId,
mm.ma_code AS maCode,
mm.ma_id AS maId,
sd.NAME AS maStatus
FROM
ma_type mt
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm ON mt.type_id = mm.type_id
LEFT JOIN slt_agreement_info sai ON sai.ma_id = mm.ma_id
LEFT JOIN sys_dic sd ON sd.id = mm.ma_status
WHERE
mm.ma_status = '16'
AND mt.type_id = #{typeId}
AND sai.`type_id` = #{typeId}
AND sai.agreement_id = #{agreementId}
<if test="maCode != null and maCode !=''">
AND mm.ma_code like concat('%', #{maCode}, '%')
</if>
</select>
</mapper>

View File

@ -71,6 +71,7 @@
<select id="getRepairTaskList" resultType="com.bonus.sgzb.base.domain.RepairTask">
SELECT
rd.task_id,
rd.remark,
tt.CODE AS repairCode,
bui.unit_name AS backUnit,
bpi.lot_name AS backPro,
@ -80,6 +81,7 @@
sd.name AS repairStatus,
tt.task_status AS repairStatusCode,
tt.company_id AS companyId,
tt1.code AS forecastWasteCode,
GROUP_CONCAT(DISTINCT rd.company_id) as companyIds,
GROUP_CONCAT(DISTINCT mt2.type_name) as type
FROM
@ -94,6 +96,8 @@
LEFT JOIN bm_project_lot bpi ON bai2.project_id = bpi.lot_id and bpi.status = '0' and bpi.del_flag = '0'
left join sys_user su on rd.create_by = su.user_id
left join sys_dic sd on sd.id = tt.task_status
LEFT JOIN scrap_apply_details sad ON rd.back_id = sad.id
LEFT JOIN tm_task tt1 ON tt1.task_id = sad.task_id
where 1=1
<if test="keyword != null and keyword != ''">
AND (locate(#{keyword}, su.nick_name) > 0
@ -114,6 +118,9 @@
<if test="repairStatus != null and repairStatus != ''">
AND tt.task_status = #{repairStatus}
</if>
<if test="backSource != null and backSource != ''">
AND rd.back_source = #{backSource}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND tt.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>

View File

@ -254,4 +254,11 @@ public class BackApplyInfo extends BaseEntity {
/** 创建者 */
@ApiModelProperty(value = "创建者Id")
private String userId;
/** 数据来源(1预报废2,退料申请) */
@ApiModelProperty(value = "数据来源(1预报废2,退料申请)")
private Integer backSource;
/** 预报废单号*/
private String forecastWasteCode;
}

View File

@ -88,4 +88,10 @@ public class RepairTaskDetails {
private Long createBy;
private Long backId;
/**
* 数据来源(1预报废2,退料)
*/
@ApiModelProperty(value = "数据来源(1预报废2,退料)")
private Integer backSource;
}

View File

@ -0,0 +1,77 @@
package com.bonus.sgzb.material.domain.po;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class BackApplyDetailsPo extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 详情ID */
@ApiModelProperty(value = "详情ID")
private Integer id;
/** 退料单号 */
@ApiModelProperty(value = "退料单号")
private String code;
/**
* 任务ID
*/
@ApiModelProperty(value = "任务ID")
private Integer parentId;
/**
* 规格ID
*/
@ApiModelProperty(value = "规格ID")
private Integer typeId;
/**
* 退料数
*/
@ApiModelProperty(value = "退料数")
private BigDecimal preNum;
/**
* 审批数量
*/
@ApiModelProperty(value = "审批数量")
private BigDecimal auditNum;
/**
* 状态待审批进行中已出库
*/
@ApiModelProperty(value = "状态(待审批,进行中,已出库)")
private String status;
/** 创建者 */
@ApiModelProperty(value = "创建者")
private String createBy;
/** 创建时间 */
@ApiModelProperty(value = "创建时间")
private Date createTime;
/** 更新者 */
@ApiModelProperty(value = "更新者")
private String updateBy;
/** 更新时间 */
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/** 备注 */
@ApiModelProperty(value = "备注")
private String remark;
/** 数据所属组织 */
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
}

View File

@ -0,0 +1,86 @@
package com.bonus.sgzb.material.domain.po;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class RepairApplyDetailsPo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
/** 任务ID */
@Excel(name = "任务ID")
@ApiModelProperty(value = "任务ID")
private Long taskId;
/** 机具ID */
@Excel(name = "机具ID")
@ApiModelProperty(value = "机具ID")
private Long maId;
/** 规格ID */
@Excel(name = "规格ID")
@ApiModelProperty(value = "规格ID")
private Long typeId;
/** 维修总量 */
@Excel(name = "维修总量")
@ApiModelProperty(value = "维修总量")
private BigDecimal repairNum;
/** 维修数量 */
@Excel(name = "维修数量")
@ApiModelProperty(value = "维修数量")
private BigDecimal repairedNum;
/** 报废数量 */
@Excel(name = "报废数量")
@ApiModelProperty(value = "报废数量")
private BigDecimal scrapNum;
/** '0未完成1已完成 */
@Excel(name = "'0未完成1已完成")
@ApiModelProperty(value = "0未完成1已完成")
private String status;
/** 创建者 */
@ApiModelProperty(value = "创建者")
private String createBy;
/** 创建时间 */
@ApiModelProperty(value = "创建时间")
private Date createTime;
/** 更新者 */
@ApiModelProperty(value = "更新者")
private String updateBy;
/** 更新时间 */
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/** 备注*/
@ApiModelProperty(value = "备注")
private String remark;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
/** 退料ID*/
@ApiModelProperty(value = "退料ID")
private Integer backId;
/** 维修人*/
@ApiModelProperty(value = "维修人")
private String repairer;
}

View File

@ -2,7 +2,10 @@ package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.BackApplyDto;
import com.bonus.sgzb.material.domain.BackApplyInfo;
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
import com.bonus.sgzb.material.domain.TypeTreeNode;
import com.bonus.sgzb.material.domain.po.BackApplyDetailsPo;
import com.bonus.sgzb.material.domain.po.BackApplyInfoPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -146,4 +149,12 @@ public interface BackApplyMapper {
List<Integer> getTaskIdByIdAll(BackApplyDto dto);
void updateTmTaskAll(BackApplyDto dto);
BackApplyInfo getBackApplyInfoById(Long parentId);
void insertBackApplyInfo(BackApplyInfoPo backApplyInfoPo);
BackApplyDetailsPo getBackApplyDetailsByParentId(ScrapApplyDetails scrapApplyDetail);
void insertBackApplyDetails(BackApplyDetailsPo backApplyDetailsPoNew);
}

View File

@ -50,4 +50,7 @@ public interface SltAgreementInfoMapper {
int updateApply(SltAgreementApply apply);
int updateMaStatus(SltAgreementInfo agreementInfo);
void updateSltAgreementInfoStatus(SltAgreementInfo sltAgreementInfo);
}

View File

@ -21,6 +21,7 @@ import com.bonus.sgzb.material.vo.RepairAuditDetailsVO;
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import com.bonus.sgzb.material.vo.ScrapAudit;
import com.bonus.sgzb.system.api.domain.SysFile;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -294,7 +295,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
scrapApplyDetails.setCompanyId((long) companyId);
scrapApplyDetails.setAuditRemark(bean.getScrapReason());
//根据fileIds获取所有的图片地址
if (bean.getFileIds()!=null){
if (StringUtils.isNotEmpty(bean.getFileIds())){
String[] fileIsList = bean.getFileIds().split(",");
StringBuffer fileUrl = new StringBuffer();
for (int i = 0; i < fileIsList.length; i++) {

View File

@ -8,6 +8,7 @@ import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.bean.BeanUtil;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
import com.bonus.sgzb.common.core.constant.TaskTypeConstants;
import com.bonus.sgzb.common.core.enums.ReviewStatusEnum;
import com.bonus.sgzb.common.core.enums.ScrapSourceEnum;
@ -18,17 +19,16 @@ import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringHelper;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.domain.po.BackApplyDetailsPo;
import com.bonus.sgzb.material.domain.po.BackApplyInfoPo;
import com.bonus.sgzb.material.exception.ExceptionDict;
import com.bonus.sgzb.material.mapper.*;
import com.bonus.sgzb.material.service.IScrapApplyDetailsService;
import com.bonus.sgzb.material.vo.ForecastWasteExcel;
import com.bonus.sgzb.material.vo.GlobalContants;
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import com.bonus.sgzb.material.vo.ScrapAudit;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.security.SecurityUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -58,6 +58,16 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
@Resource
private ScrapAuditorSetMapper scrapAuditorSetMapper;
@Resource
private BackApplyMapper backApplyMapper;
@Resource
private RepairAuditDetailsMapper repairAuditDetailsMapper;
@Resource
private SltAgreementInfoMapper sltAgreementInfoMapper;
/**
* 查询报废任务详细scrap_apply_details
*
@ -134,7 +144,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
scrapApplyDetails.setAuditTime(new Date());
scrapApplyDetailsMapper.updateScrapApplyDetails(scrapApplyDetails);
}
//根据任务id查看是否还有未审核的设备
//根据任务id查所有的设备
List<ScrapApplyDetails> getScrapApplyDetailList = scrapApplyDetailsMapper.selectScrapDetailsByTaskId(taskId);
if (scrapApplyDetailList.size()==0){
return BigDecimal.ROUND_UP;
@ -148,7 +158,14 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.UNDER_REVIEW.getCode()));
//当全部审核以后判断是否有被驳回的装备
} else if (!statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode()) &&statusList.contains(ReviewStatusEnum.REJECTED.getCode())) {
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.REJECTED.getCode()));
//完成订单中包含驳回和通过的审核结果通过的去预报废列表驳回的根据来源回到来源处生成一个新的任务
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.PASSED.getCode()));
//判断驳回任务中是否包含审核通的单子
if (statusList.contains(ReviewStatusEnum.PASSED.getCode())){
createScrapTask(taskId);
}
//驳回回到来源
returnSource(getScrapApplyDetailList,taskId);
//TODO 对审核驳回的单子进行处理的业务待确认
}else {
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.PASSED.getCode()));
@ -161,6 +178,118 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
return BigDecimal.ROUND_DOWN;
}
private void returnSource(List<ScrapApplyDetails> getScrapApplyDetailList,Long taskId) {
log.info("ScrapApplyDetailsServiceImpl returnSource begin");
TmTask task = taskMapper.selectTmTaskByTaskId(taskId);
if (task == null) {
throw new ServiceException(ExceptionDict.TASK_IS_EMPTY_MSG, ExceptionDict.TASK_IS_EMPTY);
}
// 查询协议表
TmTaskAgreement tmTaskAgreement = agreementMapper.selectTmTaskAgreementByTaskId(taskId);
//获取该任务下预报废审核驳回的装备信息
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
scrapApplyDetails.setTaskId(taskId);
scrapApplyDetails.setStatus(ReviewStatusEnum.REJECTED.getCode());
//获取从退料过来的数据
scrapApplyDetails.setScrapSource(ScrapSourceEnum.MATERIAL_RETURN.getCode().toString());
List<ScrapApplyDetails> backList = scrapApplyDetailsMapper.selectScrapAuditList(scrapApplyDetails);
//获取从维修过来的数据
scrapApplyDetails.setScrapSource(ScrapSourceEnum.MAINTENANCE_COST.getCode().toString());
List<ScrapApplyDetails> repairList = scrapApplyDetailsMapper.selectScrapAuditList(scrapApplyDetails);
//获取生成的任务id
int companyId = task.getCompanyId() == null ? 0 : task.getCompanyId();
if (backList.size()>0){
//生成编号
String taskCode = purchaseCodeRule(TaskTypeConstants.T, Integer.valueOf(TaskTypeEnum.MATERIAL_RETURN_TASK.getCode()));
Integer taskStatus = Integer.valueOf(TaskStatusEnum.MATERIAL_RETURN_APPROVED.getCode());
Integer taskType = Integer.valueOf(TaskTypeEnum.MATERIAL_RETURN_TASK.getCode());
long backTaskId = genTask(taskCode, taskType, taskStatus, tmTaskAgreement, companyId);
// 保存到退料任务表
backApplyInfo(backList,backTaskId,taskCode,tmTaskAgreement.getAgreementId());
}
if (repairList.size()>0){
//生成编号
String taskCode = purchaseCodeRule(TaskTypeConstants.WX, Integer.valueOf(TaskTypeEnum.MAINTENANCE_TASK.getCode()));
Integer taskStatus = Integer.valueOf(TaskStatusEnum.MAINTENANCE_PROGRESS.getCode());
Integer taskType = Integer.valueOf(TaskTypeEnum.MAINTENANCE_TASK.getCode());
long backTaskId = genTask(taskCode, taskType, taskStatus, tmTaskAgreement, companyId);
//保存到维修任务表
repairApplyDetails(repairList,backTaskId);
}
log.info("ScrapApplyDetailsServiceImpl returnSource end");
}
private void repairApplyDetails(List<ScrapApplyDetails> backList, Long backTaskId) {
log.info("ScrapApplyDetailsServiceImpl repairApplyDetails begin");
//根据parentId获取审核任务详情
RepairAuditDetails repairAuditDetails = repairAuditDetailsMapper.selectRepairAuditDetailsById(backList.get(0).getParentId());
RepairTaskDetails repairTaskDetails = new RepairTaskDetails();
for (ScrapApplyDetails ScrapApplyDetails : backList) {
repairTaskDetails.setTaskId(backTaskId.toString());
repairTaskDetails.setMaId(ScrapApplyDetails.getMaId());
repairTaskDetails.setTypeId(ScrapApplyDetails.getTypeId());
repairTaskDetails.setRepairNum(ScrapApplyDetails.getScrapNum().intValue());
repairTaskDetails.setCreateBy(Long.valueOf(ScrapApplyDetails.getCreateBy()));
repairTaskDetails.setRemark(ScrapApplyDetails.getAuditRemark());
repairTaskDetails.setCompanyId(ScrapApplyDetails.getCompanyId());
repairTaskDetails.setBackId(ScrapApplyDetails.getId());
repairTaskDetails.setBackSource(BigDecimal.ROUND_DOWN);
repairAuditDetailsMapper.insertRepairDetails(repairTaskDetails);
}
log.info("ScrapApplyDetailsServiceImpl repairApplyDetails end");
}
private void backApplyInfo(List<ScrapApplyDetails> backList, Long backTaskId, String taskCode, Long agreementId) {
log.info("ScrapApplyDetailsServiceImpl backApplyInfo begin");
//根据parentId获取退料任务详情
BackApplyInfo backApplyInfo = backApplyMapper.getBackApplyInfoById(backList.get(0).getParentId());
BackApplyInfoPo backApplyInfoPo = new BackApplyInfoPo();
backApplyInfoPo.setCode(taskCode);
backApplyInfoPo.setBackPerson(backApplyInfo.getBackPerson());
backApplyInfoPo.setTaskId(backTaskId.intValue());
backApplyInfoPo.setPhone(backApplyInfo.getPhone());
backApplyInfoPo.setBackTime(backApplyInfo.getBackTime());
backApplyInfoPo.setCreateBy(backApplyInfoPo.getCreateBy());
backApplyInfoPo.setBackSource(BigDecimal.ROUND_DOWN);
backApplyInfoPo.setParentId(backList.get(0).getTaskId().intValue());
backApplyMapper.insertBackApplyInfo(backApplyInfoPo);
BackApplyDetailsPo backApplyDetailsPoNew = new BackApplyDetailsPo();
for (ScrapApplyDetails scrapApplyDetail: backList) {
//根据退料任务和机具类型获取退料详情
BackApplyDetailsPo backApplyDetailsPo = backApplyMapper.getBackApplyDetailsByParentId(scrapApplyDetail);
backApplyDetailsPoNew.setCode(taskCode);
backApplyDetailsPoNew.setParentId(backApplyInfoPo.getId().intValue());
backApplyDetailsPoNew.setTypeId(backApplyDetailsPo.getTypeId());
backApplyDetailsPoNew.setPreNum(scrapApplyDetail.getScrapNum());
backApplyDetailsPoNew.setAuditNum(scrapApplyDetail.getScrapNum());
backApplyDetailsPoNew.setStatus("0");
backApplyDetailsPoNew.setCreateBy(backApplyDetailsPo.getCreateBy());
backApplyDetailsPoNew.setCompanyId(backApplyDetailsPo.getCompanyId());
backApplyDetailsPoNew.setRemark(scrapApplyDetail.getAuditRemark());
backApplyMapper.insertBackApplyDetails(backApplyDetailsPoNew);
//修改协议表的状态
SltAgreementInfo sltAgreementInfo = new SltAgreementInfo();
sltAgreementInfo.setAgreementId(agreementId.toString());
sltAgreementInfo.setTypeId(backApplyDetailsPo.getTypeId().toString());
sltAgreementInfoMapper.updateSltAgreementInfoStatus(sltAgreementInfo);
//机具状态变为在用
if (scrapApplyDetail.getMaId() != null){
SltAgreementInfo agreementInfo = new SltAgreementInfo();
agreementInfo.setMaId(scrapApplyDetail.getMaId().toString());
agreementInfo.setStatus("16");
sltAgreementInfoMapper.updateMaStatus(agreementInfo);
}
}
log.info("ScrapApplyDetailsServiceImpl backApplyInfo end");
}
/**
* 提交报废任务
* @param scrapAudit 包含废弃任务审计信息的对象

View File

@ -101,6 +101,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
List<SltAgreementInfo> loseList = getLoseList(infos);
for (SltAgreementInfo agreementInfo : loseList){
if (agreementInfo.getMaId() != null && agreementInfo.getMaId().isEmpty()){
agreementInfo.setStatus("103");
sltAgreementInfoMapper.updateMaStatus(agreementInfo);
}
}

View File

@ -299,6 +299,167 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
NOW()
)
</insert>
<insert id="insertBackApplyInfo" parameterType="com.bonus.sgzb.material.domain.po.BackApplyInfoPo" useGeneratedKeys="true" keyProperty="id">
insert into back_apply_info
(
<if test="code != null">
code,
</if>
<if test="taskId != null">
task_id,
</if>
<if test="backPerson != null and backPerson != ''">
back_person,
</if>
<if test="backTime != null and backTime != ''">
back_time,
</if>
<if test="phone != null and phone != ''">
phone,
</if>
<if test="directAuditBy != null">
direct_audit_by,
</if>
<if test="directAuditTime != null and directAuditTime != ''">
direct_audit_time,
</if>
<if test="directAuditRemark != null">
direct_audit_remark,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="status != null and status != ''">
status,
</if>
<if test="backSource != null and backSource != ''">
back_source,
</if>
<if test="parentId != null and parentId != ''">
parent_id,
</if>
create_time
) values (
<if test="code != null">
#{code},
</if>
<if test="taskId != null">
#{taskId},
</if>
<if test="backPerson != null and backPerson != ''">
#{backPerson},
</if>
<if test="backTime != null and backTime != ''">
#{backTime},
</if>
<if test="phone != null and phone != ''">
#{phone},
</if>
<if test="directAuditBy != null">
#{directAuditBy},
</if>
<if test="directAuditTime != null and directAuditTime != ''">
#{directAuditTime},
</if>
<if test="directAuditRemark != null">
#{directAuditRemark},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
<if test="status != null and status != ''">
#{status},
</if>
<if test="backSource != null and backSource != ''">
#{backSource},
</if>
<if test="parentId != null and parentId != ''">
#{parentId},
</if>
NOW()
)
</insert>
<insert id="insertBackApplyDetails">
insert into back_apply_details
(
<if test="parentId != null">
parent_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="preNum != null">
pre_num,
</if>
status,
<if test="createBy != null and createBy != ''">
create_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="auditNum != null">
audit_num,
</if>
create_time
)
values (
<if test="parentId != null">
#{parentId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="preNum != null">
#{preNum},
</if>
'0',
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
NOW(),
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
<if test="auditNum != null">
#{auditNum},
</if>
NOW()
)
</insert>
<update id="setModify">
update back_apply_details
@ -463,6 +624,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="time != null and time != ''">
and bai.back_time =#{time}
</if>
<if test="backSource != null and backSource != ''">
and bai.back_source =#{backSource}
</if>
GROUP BY bai.task_id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
ORDER BY bai.create_time desc
</select>
@ -763,6 +927,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bad.id as detailsId,
bad.pre_num AS num,
bad.audit_num AS auditNum,
bad.remark AS remark,
IFNULL( aa.num, 0 ) AS useNum
FROM
back_apply_details bad
@ -811,6 +976,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bagi.agreement_code as agreementCode,
tt.task_status as taskStatus,
tta.agreement_id as agreementId,
tt1.code as forecastWasteCode,
GROUP_CONCAT(bai.company_id) as companyId,
GROUP_CONCAT(DISTINCT mt2.type_id) as typeId,
GROUP_CONCAT(mt2.type_name) AS typeName,
@ -826,6 +992,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user us on us.user_id=bai.create_by
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
LEFT JOIN tm_task tt1 on tt1.task_id = bai.parent_id
WHERE
1=1
<if test="keyWord != null and keyWord != ''">
@ -851,6 +1018,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="time != null and time != ''">
and bai.back_time =#{time}
</if>
<if test="backSource != null and backSource != ''">
and bai.back_source =#{backSource}
</if>
GROUP BY bai.task_id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
<if test="typeId != null and typeId != ''">
HAVING FIND_IN_SET(#{typeId}, typeId) > 0
@ -878,5 +1048,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(SELECT * FROM back_apply_info bai2 WHERE bai2.id = #{id}) dd
on bai1.task_id = dd.task_id
</select>
<select id="getBackApplyInfoById" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
select * from back_apply_info where id = #{parentId}
</select>
<select id="getBackApplyDetailsByParentId" resultType="com.bonus.sgzb.material.domain.po.BackApplyDetailsPo">
select * from back_apply_details
<where>
<if test="parentId != null and parentId != ''">
and parent_id = #{parentId}
</if>
<if test="typeId != null and typeId != ''">
and type_id = #{typeId}
</if>
</where>
</select>
</mapper>

View File

@ -150,6 +150,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="backId != null">
back_id,
</if>
<if test="remark != null">
remark,
</if>
<if test="backSource != null">
back_source,
</if>
create_time
)
values (
@ -181,6 +187,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="backId != null">
#{backId},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="backSource != null">
#{backSource},
</if>
NOW()
)
</insert>

View File

@ -299,6 +299,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">
AND sad.status = #{status}
</if>
<if test="scrapSource != null and scrapSource != ''">
AND sad.scrap_source = #{scrapSource}
</if>
order by sad.create_time desc
</select>

View File

@ -82,9 +82,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="updateMaStatus">
update ma_machine
set ma_status = '103'
set ma_status =#{status}
where ma_id = #{maId}
</update>
<update id="updateSltAgreementInfoStatus">
update slt_agreement_info
set status = '0'
where agreement_id = #{agreementId}
and type_id = #{typeId}
</update>
<select id="getSltAgreementInfo" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
bui.unit_id,bui.unit_name , bp.lot_id as projectId , bp.lot_name as projectName,

View File

@ -386,7 +386,19 @@ public class SysUserController extends BaseController {
@ApiOperation(value = "获取催办用户信息")
@PostMapping("/urgentProcessingUser")
public AjaxResult urgentProcessingUser(@RequestBody UrgentProcessingUser urgentProcessingUser) {
return userService.urgentProcessingUser(urgentProcessingUser);
return success(userService.urgentProcessingUser(urgentProcessingUser));
}
/**
* 通过任务状态获取下一级审批人的信息
*
* @param urgentProcessingUser
* @return
*/
@ApiOperation(value = "获取催办用户信息")
@PostMapping("/processingUser")
public R<List<SysUser>> processingUser(@RequestBody UrgentProcessingUser urgentProcessingUser) {
return R.ok(userService.urgentProcessingUser(urgentProcessingUser));
}
}

View File

@ -222,5 +222,5 @@ public interface ISysUserService
* @param urgentProcessingUser
* @return
*/
AjaxResult urgentProcessingUser(UrgentProcessingUser urgentProcessingUser);
List<SysUser> urgentProcessingUser(UrgentProcessingUser urgentProcessingUser);
}

View File

@ -559,7 +559,7 @@ public class SysUserServiceImpl implements ISysUserService {
* @return
*/
@Override
public AjaxResult urgentProcessingUser(UrgentProcessingUser urgentProcessingUser) {
public List<SysUser> urgentProcessingUser(UrgentProcessingUser urgentProcessingUser) {
log.info("ToDoServiceImpl urgentProcessingUser {} begin" ,urgentProcessingUser);
// 验证是否为空
if (urgentProcessingUser == null || urgentProcessingUser.getTaskStatus() == null) {
@ -575,7 +575,7 @@ public class SysUserServiceImpl implements ISysUserService {
break;
}
log.info("ToDoServiceImpl urgentProcessingUser end !");
return success(userList);
return userList;
}
/**