预报废退料审核提交和禅道bug修改提交

This commit is contained in:
liang.chao 2024-07-05 16:55:48 +08:00
parent b25ca75270
commit 249b1c1240
24 changed files with 1388 additions and 114 deletions

View File

@ -31,6 +31,7 @@ public enum TaskTypeEnum {
*维修任务
*/
MAINTENANCE_TASK(41, "维修任务"),
MAINTENANCE_IN_PROGRESS(43, "维修进行中"),
/**
*维修审核

View File

@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import static com.bonus.sgzb.common.core.constant.Constants.PAGE_NUM;
@ -33,6 +34,7 @@ public class BackReceiveController extends BaseController {
@Resource
private BackReceiveService backReceiveService;
/**
* 退料接收列表
*
@ -50,7 +52,7 @@ public class BackReceiveController extends BaseController {
List<BackApplyInfo> list = backReceiveService.getbackReceiveList(record);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
} catch (Exception e) {
throw new RuntimeException(e);
@ -98,7 +100,6 @@ public class BackReceiveController extends BaseController {
@PostMapping("/receiveViewWeb")
public AjaxResult receiveViewWeb(@RequestBody BackApplyInfo record) {
try {
//startPage();
List<BackApplyInfo> list = backReceiveService.receiveView(record);
Integer pageIndex = cn.hutool.core.convert.Convert.toInt(record.getPageNum(), 1);
Integer pageSize = cn.hutool.core.convert.Convert.toInt(record.getPageSize(), 10);
@ -108,6 +109,24 @@ public class BackReceiveController extends BaseController {
}
}
/**
* 校验退料接收数量是否全部处理
*
* @param record 查询条件
* @return AjaxResult对象
*/
@Log(title = "退料接收明细-web", businessType = BusinessType.QUERY)
@PostMapping("/getReceiveViewWebNum")
public AjaxResult getReceiveViewWebNum(@RequestBody BackApplyInfo record) {
List<BackApplyInfo> list = backReceiveService.receiveView(record);
for (BackApplyInfo backApplyInfo : list) {
if (Integer.valueOf(backApplyInfo.getNum()) > 0) {
return AjaxResult.success(0);
}
}
return AjaxResult.success(1);
}
/**
* 数量退料--管理方式为1的
*
@ -297,7 +316,7 @@ public class BackReceiveController extends BaseController {
List<BackApplyInfo> list = backReceiveService.backReceiveRecordWeb(record);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} catch (Exception e) {
throw new RuntimeException(e);
}

View File

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

View File

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

View File

@ -65,7 +65,8 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Override
public List<BackApplyInfo> receiveView(BackApplyInfo record) {
List<BackApplyInfo> backApplyInfoList = backReceiveMapper.receiveView(record);
int count1 = 0;
//重庆成套设备处理宁夏不用
/* int count1 = 0;
int count2 = 0;
for (BackApplyInfo backApplyInfo : backApplyInfoList) {
if ("2".equals(backApplyInfo.getManageType())) {
@ -89,7 +90,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
backApplyInfo.setPartNum((int) Double.parseDouble(backApplyInfo.getPreNum()));
}
}
}
}*/
return backApplyInfoList;
}

View File

@ -106,7 +106,7 @@ public class MaWholeSetController extends BaseController {
*/
@ApiOperation("领料申请查询成套抱杆设备")
@GetMapping("/selectListByWholeTypeName")
public AjaxResult selectListByWholeTypeName(String wholeTypeName) {
public AjaxResult selectListByWholeTypeName(MaWholeSetDto wholeTypeName) {
List<LeaseApplyDetails> list = maWholeSetService.selectListByWholeTypeName(wholeTypeName);
return AjaxResult.success(list);
}

View File

@ -27,15 +27,14 @@ import java.util.List;
/**
* 新购--综合服务中心
*
*
* @author bonus
* @date 2023-12-10
*/
@RestController
@Api(value = "新购--综合服务中心")
@RequestMapping("/purchaseCheckServiceCenter")
public class PurchaseCheckServiceCenterController extends BaseController
{
public class PurchaseCheckServiceCenterController extends BaseController {
@Autowired
private PurchaseCheckServiceCenterService purchaseCheckServiceCenterService;
@ -44,19 +43,23 @@ public class PurchaseCheckServiceCenterController extends BaseController
*/
@ApiOperation("查询新购入库任务列表")
@GetMapping("/putInList")
public TableDataInfo putInList(PurchaseCheckInfo purchaseCheckInfo)
{
startPage();
return getDataTable(purchaseCheckServiceCenterService.selectPutInListList(purchaseCheckInfo));
public AjaxResult putInList(PurchaseCheckInfo purchaseCheckInfo) {
if (purchaseCheckInfo.getFlag() == 1) {
//app传1
return AjaxResult.success(purchaseCheckServiceCenterService.selectPutInListList(purchaseCheckInfo));
} else {
startPage();
return AjaxResult.success(getDataTable(purchaseCheckServiceCenterService.selectPutInListList(purchaseCheckInfo)));
}
}
/**
* 获取新购验收编号管理详细信息
*/
@ApiOperation(value = "新购入库清单明细")
@GetMapping(value = "/putinDetails")
public TableDataInfo putinDetails(PurchaseMacodeInfo purchaseMacodeInfo)
{
public TableDataInfo putinDetails(PurchaseMacodeInfo purchaseMacodeInfo) {
startPage();
return getDataTable(purchaseCheckServiceCenterService.selectPutinDetails(purchaseMacodeInfo));
}
@ -66,7 +69,7 @@ public class PurchaseCheckServiceCenterController extends BaseController
*/
@ApiOperation(value = "综合服务中心审核")
@PutMapping("/manageStatus")
public AjaxResult modifyManageStatus(@RequestBody MaInputVO maInputVO){
public AjaxResult modifyManageStatus(@RequestBody MaInputVO maInputVO) {
try {
return purchaseCheckServiceCenterService.modifyManageStatus(maInputVO);
} catch (Exception e) {
@ -83,8 +86,7 @@ public class PurchaseCheckServiceCenterController extends BaseController
@ApiOperation("导出新购工机具入库")
@Log(title = "导出新购工机具入库", businessType = BusinessType.EXPORT)
@PostMapping("/putInExport")
public void putInExport(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo)
{
public void putInExport(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
List<PurchaseInput> list = purchaseCheckServiceCenterService.putInExportList(purchaseCheckInfo);
ExcelUtil<PurchaseInput> util = new ExcelUtil<PurchaseInput>(PurchaseInput.class);
util.exportExcel(response, list, "新购工机具入库");

View File

@ -2,12 +2,14 @@ package com.bonus.sgzb.material.controller;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.convert.Convert;
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
import com.bonus.sgzb.common.core.utils.ServletUtils;
import com.bonus.sgzb.common.core.web.page.TableSupport;
import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.service.IScrapApplyDetailsService;
import com.bonus.sgzb.material.vo.*;
@ -77,7 +79,6 @@ public class ScrapApplyDetailsController extends BaseController {
}
/**
* 查看报废任务详细列表
*/
@ -89,6 +90,128 @@ public class ScrapApplyDetailsController extends BaseController {
return getDataTable(list);
}
/**
* 查看报废任务-驳回退料列表
*/
@ApiOperation("查看报废任务详细列表")
@GetMapping("/getScrapRefuseList")
public TableDataInfo getScrapRefuseList(ScrapApplyDetails scrapApplyDetails) {
startPage();
List<ScrapApplyDetails> list = scrapApplyDetailsService.getScrapRefuseList(scrapApplyDetails);
return getDataTable(list);
}
/**
* 完成退料时查看是否都退料完成
*/
@ApiOperation("完成退料时,查看是否都退料完成")
@GetMapping("/getScrapRefuseIsSuc")
public AjaxResult getScrapRefuseIsSuc(ScrapApplyDetails scrapApplyDetails) {
List<ScrapApplyDetails> list = scrapApplyDetailsService.getScrapRefuseIsSuc(scrapApplyDetails);
if (list.size() != 0) {
for (ScrapApplyDetails applyDetails : list) {
if (applyDetails.getNum() != 0) {
// 存在未退料
return AjaxResult.success(0);
}
}
List<ScrapApplyDetails> collect = list.stream().filter(t -> t.getBackStatus() == 3).collect(Collectors.toList());
if (collect.size() > 0) {
//全部退料但存在报废机具
return AjaxResult.success(1);
}
}
//全部退料不存在报废机具
return AjaxResult.success(2);
}
/**
* 预报废列表-驳回退料编辑按钮查看编码设备
*/
@ApiOperation("预报废列表-驳回退料编辑按钮查看(编码设备)")
@GetMapping("/getScrapRefuseMaCodeList")
public TableDataInfo getScrapRefuseMaCodeList(ScrapApplyDetails scrapApplyDetails) {
startPage();
List<ScrapApplyDetails> list = scrapApplyDetailsService.getScrapRefuseMaCodeList(scrapApplyDetails);
return getDataTable(list);
}
/**
* @param record 查询条件
* @return AjaxResult对象
*/
@Log(title = "退料接收-数量退料/编码退料", businessType = BusinessType.INSERT)
@PostMapping("setNumOrCodeBack")
public AjaxResult setNumOrCodeBack(@RequestBody BackApplyInfo record) {
try {
if (record.getFlag() == 0) {
int res = scrapApplyDetailsService.setNumBack(record);
if (res > 0) {
return AjaxResult.success("接收成功");
} else {
return AjaxResult.error("接收失败");
}
} else {
int res = scrapApplyDetailsService.setCodeBack(record);
if (res > 0) {
return AjaxResult.success("接收成功");
} else if (res == -1) {
return AjaxResult.error("该编码已接收");
} else if (res == -2) {
return AjaxResult.error("已超出退料数量!!");
} else {
return AjaxResult.error("接收失败");
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 退料接收撤回
*
* @return AjaxResult对象
*/
@Log(title = "退料接收-撤回")
@PostMapping("/revoke")
public AjaxResult revoke(@RequestBody BackApplyInfo record) {
int res = scrapApplyDetailsService.revoke(record);
if (res > 0) {
return AjaxResult.success("撤回成功");
} else {
return AjaxResult.error("撤回失败");
}
}
@Log(title = "预报废列表-退料接收记录-web数量设备", businessType = BusinessType.INSERT)
@PostMapping("scrapReceiveRecordWeb")
public AjaxResult scrapReceiveRecordWeb(@RequestBody BackApplyInfo record) {
try {
List<BackApplyInfo> list = scrapApplyDetailsService.scrapReceiveRecordWeb(record);
Integer pageIndex = com.bonus.sgzb.common.core.text.Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = com.bonus.sgzb.common.core.text.Convert.toInt(ServletUtils.getParameter(TableSupport.PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Log(title = "预报废列表-退料接收记录-web编码设备", businessType = BusinessType.INSERT)
@PostMapping("scrapReceiveRecordWebPt")
public AjaxResult scrapReceiveRecordWebPt(@RequestBody BackApplyInfo record) {
try {
List<BackApplyInfo> list = scrapApplyDetailsService.backReceiveRecordWebPt(record);
Integer pageIndex = com.bonus.sgzb.common.core.text.Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = com.bonus.sgzb.common.core.text.Convert.toInt(ServletUtils.getParameter(TableSupport.PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 查看报废任务详细列表-app
*/
@ -108,6 +231,15 @@ public class ScrapApplyDetailsController extends BaseController {
public AjaxResult audit(@RequestBody ScrapAudit scrapAudit) throws Exception {
return toAjax(scrapApplyDetailsService.auditScrap(scrapAudit));
}
/**
* 报废任务审核
*/
@ApiOperation("预报废列表-完成退料")
@Log(title = "报废任务审核", businessType = BusinessType.UPDATE)
@PostMapping("/endBack")
public AjaxResult endBack(@RequestBody ScrapAudit scrapAudit) {
return toAjax(scrapApplyDetailsService.endback(scrapAudit));
}
/**
* 查看报废明细
@ -149,6 +281,7 @@ public class ScrapApplyDetailsController extends BaseController {
List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.getScrapApplyList(scrapApplyDetails);
return getDataTable(list);
}
/**
* 查询预报废任务列表-App
*/
@ -201,8 +334,6 @@ public class ScrapApplyDetailsController extends BaseController {
}
/**
* 报废任务审核----宁夏
*/
@ -239,6 +370,7 @@ public class ScrapApplyDetailsController extends BaseController {
public AjaxResult obtainDisposal(@RequestBody List<TmTask> tmTaskList) {
return toAjax(scrapApplyDetailsService.obtainDisposal(tmTaskList));
}
/**
* 导出报废任务列表
*/

View File

@ -24,6 +24,19 @@ public class BackApplyInfo extends BaseEntity {
@ApiModelProperty(value="工程id")
private Long projectId;
/**
* 合格数量
*/
private Integer hgNum;
/**
* 维修数量
*/
private Integer wxNum;
/**
* 报废数量
*/
private Integer bfNum;
/**
* 任务ID
*/
@ -44,6 +57,9 @@ public class BackApplyInfo extends BaseEntity {
private String ids;
private String applyStatus;
/** 报废原因 */
@ApiModelProperty(value = "报废原因")
private String scrapReason;
/**
* 装备管理方式(0编号 1计数)
*/
@ -57,10 +73,19 @@ public class BackApplyInfo extends BaseEntity {
private Integer maId;
/**
* 报废0自然报废1人为报废
*/
private Integer scrapType;
/**
* 退料状态
*/
private String backStatus;
/**
* 报废图片地址
*/
private String fileUrl;
/**
* 退料数量

View File

@ -44,6 +44,14 @@ public class PurchaseCheckInfo extends BaseEntity
@Excel(name = "到货日期")
private String arrivalTime;
public Integer getFlag() {
return flag;
}
public void setFlag(Integer flag) {
this.flag = flag;
}
/** 采购员名称 */
@ApiModelProperty(value = "采购员名称")
@Excel(name = "采购员")
@ -53,6 +61,8 @@ public class PurchaseCheckInfo extends BaseEntity
@ApiModelProperty(value = "采购员")
private Long purchaser;
private Integer flag;
/** 采购机具设备名称 */
@ApiModelProperty(value = "采购机具设备")
@Excel(name = "机具类型名称")

View File

@ -30,6 +30,9 @@ public class ScrapApplyDetails extends BaseEntity
/** 任务ID */
@ApiModelProperty(value = "任务ID")
private Long taskId;
/** 管理方式(0编号 1计数) */
@ApiModelProperty(value = "管理方式(0编号 1计数)")
private Integer manageType;
/**
* 审核状态
@ -96,12 +99,17 @@ public class ScrapApplyDetails extends BaseEntity
@ApiModelProperty(value = "规格型号")
private String specificationType;
@ApiModelProperty(value = "退料数量数量")
private Integer preNum;
@ApiModelProperty(value = "待退料数量")
private Integer num;
@ApiModelProperty(value = "机具类型名称")
private String machineTypeName;
@ApiModelProperty(value = "机具编号")
private String maCode;
private String maStatus;
private String buyPrice;
/**
@ -135,6 +143,9 @@ public class ScrapApplyDetails extends BaseEntity
/** 当前记录起始索引 */
private Integer pageNum;
/** 退料状态(1合格2维修3待报废) */
private Integer backStatus;
/** 每页显示记录数 */
private Integer pageSize;

View File

@ -25,7 +25,7 @@ public interface MaWholeSetMapper {
* @param wholeTypeName
* @return
*/
int selectByWholeTypeName(String wholeTypeName);
int selectByWholeTypeName(MaWholeSetDto wholeTypeName);
/**
* 查询整套抱杆管理
@ -76,5 +76,5 @@ public interface MaWholeSetMapper {
*/
List<TreeSelectId> selectId(@Param("typeId") List<Integer> typeId);
List<LeaseApplyDetails> selectListByWholeTypeName(String wholeTypeName);
List<LeaseApplyDetails> selectListByWholeTypeName(MaWholeSetDto wholeTypeName);
}

View File

@ -5,22 +5,24 @@ import com.bonus.sgzb.material.domain.RepairAuditDetails;
import com.bonus.sgzb.material.domain.RepairRecord;
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import com.bonus.sgzb.material.vo.ScrapAudit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 报废任务详细scrap_apply_detailsMapper接口
*
*
* @author bonus
* @date 2023-12-15
*/
@Mapper
public interface ScrapApplyDetailsMapper
{
public interface ScrapApplyDetailsMapper {
/**
* 查询报废任务详细scrap_apply_details
*
*
* @param id 报废任务详细scrap_apply_details主键
* @return 报废任务详细scrap_apply_details
*/
@ -28,7 +30,7 @@ public interface ScrapApplyDetailsMapper
/**
* 查询报废任务详细scrap_apply_details列表
*
*
* @param scrapApplyDetails 报废任务详细scrap_apply_details
* @return 报废任务详细scrap_apply_details集合
*/
@ -36,7 +38,7 @@ public interface ScrapApplyDetailsMapper
/**
* 新增报废任务详细scrap_apply_details
*
*
* @param scrapApplyDetails 报废任务详细scrap_apply_details
* @return 结果
*/
@ -44,7 +46,7 @@ public interface ScrapApplyDetailsMapper
/**
* 修改报废任务详细scrap_apply_details
*
*
* @param scrapApplyDetails 报废任务详细scrap_apply_details
* @return 结果
*/
@ -52,7 +54,7 @@ public interface ScrapApplyDetailsMapper
/**
* 删除报废任务详细scrap_apply_details
*
*
* @param id 报废任务详细scrap_apply_details主键
* @return 结果
*/
@ -60,91 +62,103 @@ public interface ScrapApplyDetailsMapper
/**
* 批量删除报废任务详细scrap_apply_details
*
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScrapApplyDetailsByIds(Long[] ids);
/**
*查询ScrapApplyDetails
* 查询ScrapApplyDetails
*
* @param scrapApplyDetails
* @return
*/
List<ScrapApplyDetails> selectScrapAuditList(ScrapApplyDetails scrapApplyDetails);
/**
*查询ScrapApplyDetails
* 查询ScrapApplyDetails
*
* @param taskId
* @return
*/
List<ScrapApplyDetails> selectScrapDetailsByTaskId(Long taskId);
/**
*修改
* 修改
*
* @param maId
* @return
*/
int updateMachine(Long maId);
/**
*查询
* 查询
*
* @param taskId
* @return
*/
String selectTypeNameByTaskId(Long taskId);
/**
*导出
* 导出
*
* @param bean
* @return
*/
List<ScrapApplyDetailsVO> exportScrapApplyDetailsList(ScrapApplyDetails bean);
/**
*查询
* 查询
*
* @param taskId
* @return
*/
List<ScrapApplyDetails> selectnotScrapByTaskId(Long taskId);
/**
*添加
* 添加
*
* @param bean
* @return
*/
int addBackDetails(ScrapApplyDetails bean);
/**
*查询
* 查询
*
* @param parentId
* @return
*/
BackApplyInfo getBackApplyInfo(int parentId);
/**
*添加
* 添加
*
* @param backApplyInfo
* @return
*/
int addBackInfo(BackApplyInfo backApplyInfo);
/**
*查询RepairAuditDetails
* 查询RepairAuditDetails
*
* @param parentId
* @return
*/
RepairAuditDetails getRepairAudit(Long parentId);
/**
*添加
* 添加
*
* @param details
* @return
*/
int addRepaieAudit(RepairAuditDetails details);
/**
*修改
* 修改
*
* @param bean
* @return
*/
@ -162,10 +176,54 @@ public interface ScrapApplyDetailsMapper
/**
* 查询预报废申请列表
*
* @param scrapApplyDetails 包含预报废申请详情的实体对象用于筛选申请列表的条件
* @return
*/
List<ScrapApplyDetailsVO> getScrapApplyList(ScrapApplyDetails scrapApplyDetails);
List<ScrapApplyDetailsVO> scrapTaskReviewList(ScrapApplyDetails scrapApplyDetails);
List<ScrapApplyDetails> getScrapRefuseList(ScrapApplyDetails scrapApplyDetails);
List<ScrapApplyDetails> getScrapRefuseMaCodeList(ScrapApplyDetails scrapApplyDetails);
int insertCheckDetails(BackApplyInfo backApplyInfo);
int updateMaStatus(@Param("maId") int maId, @Param("maStatus") String maStatus);
int selectNumByTypeId(@Param("parentId") Integer parentId, @Param("typeId") String typeId);
int selectCodeByMaIdAndTaskId(@Param("maId") Integer maId, @Param("taskId") Integer taskId);
List<Integer> getMaId(BackApplyInfo record);
int deleteCheckDetails(BackApplyInfo record);
BackApplyInfo scrapReceiveRecordWeb(BackApplyInfo record);
BackApplyInfo scrapReceiveRecordWebPt(BackApplyInfo record);
List<ScrapApplyDetails> getScrapRefuseIsSuc(ScrapApplyDetails scrapApplyDetails);
int selectTaskStatus(long taskId);
List<BackApplyInfo> getHgList(ScrapAudit scrapAudit);
int insertIad(BackApplyInfo bi);
int updateMt(BackApplyInfo bi);
List<BackApplyInfo> getWxList(ScrapAudit scrapAudit);
int insertTta(@Param("taskId") int taskId,@Param("agreementId") Integer agreementId);
int insertRad(BackApplyInfo wx);
List<BackApplyInfo> getBfList(ScrapAudit scrapAudit);
int insertSad(BackApplyInfo bf);
Integer selectTaskNumByMonthWx(@Param("date") Date date, @Param("taskType") Integer taskType);
}

View File

@ -98,4 +98,8 @@ public interface TaskMapper {
String selectTaskNumByMonths(@Param("date") Date nowDate, @Param("taskType") Integer taskType);
List<ScrapApplyDetailsVO> selectTmTaskListByDisposition(ScrapApplyDetails scrapApplyDetails);
int insertTt(BackApplyInfo applyInfo);
int updateTaskStatus(@Param("taskId") long taskId, @Param("status") int status);
}

View File

@ -69,6 +69,13 @@ public interface IScrapApplyDetailsService
* @return
*/
List<ScrapApplyDetails> getScrapAuditList(ScrapApplyDetails scrapApplyDetails);
/**
* 看报废任务-驳回退料列表
* @param scrapApplyDetails
* @return
*/
List<ScrapApplyDetails> getScrapRefuseList(ScrapApplyDetails scrapApplyDetails);
List<ScrapApplyDetails> getScrapRefuseMaCodeList(ScrapApplyDetails scrapApplyDetails);
/**
* 报废任务审核
@ -147,4 +154,18 @@ public interface IScrapApplyDetailsService
* @return
*/
List<ForecastWasteExcel> exportForecastWaste(ScrapApplyDetails scrapApplyDetails);
int setNumBack(BackApplyInfo record);
int setCodeBack(BackApplyInfo record);
int revoke(BackApplyInfo record);
List<BackApplyInfo> scrapReceiveRecordWeb(BackApplyInfo record);
List<BackApplyInfo> backReceiveRecordWebPt(BackApplyInfo record);
List<ScrapApplyDetails> getScrapRefuseIsSuc(ScrapApplyDetails scrapApplyDetails);
int endback(ScrapAudit scrapAudit);
}

View File

@ -58,5 +58,5 @@ public interface MaWholeSetService {
*/
MaWholeTreeVo selectListTree(Integer id);
List<LeaseApplyDetails> selectListByWholeTypeName(String wholeTypeName);
List<LeaseApplyDetails> selectListByWholeTypeName(MaWholeSetDto wholeTypeName);
}

View File

@ -149,23 +149,6 @@ public class BackApplyServiceImpl implements BackApplyService {
bean.setCompanyId(companyId.toString());
}
List<BackApplyInfo> view = backApplyMapper.getView(bean);
return getMaTypeDetails(view);
}
private List<BackApplyInfo> getMaTypeDetails(List<BackApplyInfo> view) {
if (view.size() > 0) {
for (BackApplyInfo backApplyInfo : view) {
List<MachinePart> machineParts = new ArrayList<>();
List<TmTask> typeIds = tmTaskMapper.getMaTypeDetails(backApplyInfo);
typeIds.removeIf(item -> item == null);
for (TmTask typeId : typeIds) {
MachinePart machinePart = tmTaskMapper.getMachineParts(typeId);
machinePart.setPartNum((int) (Double.parseDouble(typeId.getPartNum()) * Double.parseDouble(backApplyInfo.getPreNum())));
machineParts.add(machinePart);
}
backApplyInfo.setMaTypeDetails(machineParts);
}
}
return view;
}

View File

@ -43,7 +43,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
}
//先查询是否有重复的配套名称
if (selectByWholeTypeName(dto.getWholeTypeName()) > 0) {
if (selectByWholeTypeName(dto) > 0) {
return AjaxResult.error("成套名称已存在");
}
@ -157,10 +157,10 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
log.error("insertMaWholeSet方法插入异常");
throw new RuntimeException("insertMaWholeSet方法插入异常");
}
/* int count = selectByWholeTypeName(dto.getWholeTypeName());
int count = selectByWholeTypeName(dto);
if (count > 1) {
throw new RuntimeException("配套名称已重复,请重新输入");
}*/
}
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(ExceptionEnum.UPDATE_TO_DATABASE.getCode(), ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
@ -194,7 +194,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
}
@Override
public List<LeaseApplyDetails> selectListByWholeTypeName(String wholeTypeName) {
public List<LeaseApplyDetails> selectListByWholeTypeName(MaWholeSetDto wholeTypeName) {
return mapper.selectListByWholeTypeName(wholeTypeName);
}
@ -214,7 +214,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
* @param wholeTypeName
* @return
*/
private int selectByWholeTypeName(String wholeTypeName) {
private int selectByWholeTypeName(MaWholeSetDto wholeTypeName) {
return mapper.selectByWholeTypeName(wholeTypeName);
}
}

View File

@ -28,6 +28,7 @@ import com.bonus.sgzb.material.vo.ForecastWasteExcel;
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import com.bonus.sgzb.material.vo.ScrapAudit;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -106,6 +107,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
/**
* 查询预报废申请列表
*
* @param scrapApplyDetails 包含预报废申请详情的实体对象用于筛选申请列表的条件
* @return
*/
@ -122,6 +124,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
/**
* 预报废任务审核
*
* @param scrapAudit
* @return
*/
@ -137,16 +140,16 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
//获取审核列表
List<ScrapApplyDetails> scrapApplyDetailList = scrapAudit.getScrapDetailList();
if (scrapApplyDetailList == null || scrapApplyDetailList.size() == 0) {
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG,"scrapDetailList"), ExceptionDict.PARAM_IS_NULL_ERROR);
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG, "scrapDetailList"), ExceptionDict.PARAM_IS_NULL_ERROR);
}
//修改装备状态
for (ScrapApplyDetails scrapApplyDetails: scrapApplyDetailList){
for (ScrapApplyDetails scrapApplyDetails : scrapApplyDetailList) {
scrapApplyDetails.setAuditTime(new Date());
scrapApplyDetailsMapper.updateScrapApplyDetails(scrapApplyDetails);
}
//根据任务id查所有的设备
List<ScrapApplyDetails> getScrapApplyDetailList = scrapApplyDetailsMapper.selectScrapDetailsByTaskId(taskId);
if (scrapApplyDetailList.size()==0){
if (scrapApplyDetailList.size() == 0) {
return BigDecimal.ROUND_UP;
}
//获取所有装备的状态
@ -154,20 +157,20 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
TmTask task = new TmTask();
task.setTaskId(taskId);
//判断是否还有装备没有进行审核
if (statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode())){
if (statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode())) {
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.UNDER_REVIEW.getCode()));
//当全部审核以后判断是否有被驳回的装备
} else if (!statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode()) &&statusList.contains(ReviewStatusEnum.REJECTED.getCode())) {
} else if (!statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode()) && statusList.contains(ReviewStatusEnum.REJECTED.getCode())) {
//完成订单中包含驳回和通过的审核结果通过的去预报废列表驳回的根据来源回到来源处生成一个新的任务
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.PASSED.getCode()));
//判断驳回任务中是否包含审核通的单子
if (statusList.contains(ReviewStatusEnum.PASSED.getCode())){
if (statusList.contains(ReviewStatusEnum.PASSED.getCode())) {
createScrapTask(taskId);
}
//驳回回到来源
returnSource(getScrapApplyDetailList,taskId);
returnSource(getScrapApplyDetailList, taskId);
//TODO 对审核驳回的单子进行处理的业务待确认
}else {
} else {
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.PASSED.getCode()));
//生成报废的单子
createScrapTask(taskId);
@ -178,7 +181,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
return BigDecimal.ROUND_DOWN;
}
private void returnSource(List<ScrapApplyDetails> getScrapApplyDetailList,Long taskId) {
private void returnSource(List<ScrapApplyDetails> getScrapApplyDetailList, Long taskId) {
log.info("ScrapApplyDetailsServiceImpl returnSource begin");
TmTask task = taskMapper.selectTmTaskByTaskId(taskId);
if (task == null) {
@ -201,23 +204,23 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
//获取生成的任务id
int companyId = task.getCompanyId() == null ? 0 : task.getCompanyId();
if (backList.size()>0){
if (backList.size() > 0) {
//生成编号
String taskCode = purchaseCodeRule(TaskTypeConstants.T, Integer.valueOf(TaskTypeEnum.MATERIAL_RETURN_TASK.getCode()));
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());
backApplyInfo(backList, backTaskId, taskCode, tmTaskAgreement.getAgreementId());
}
if (repairList.size()>0){
if (repairList.size() > 0) {
//生成编号
String taskCode = purchaseCodeRule(TaskTypeConstants.WX, Integer.valueOf(TaskTypeEnum.MAINTENANCE_TASK.getCode()));
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);
repairApplyDetails(repairList, backTaskId);
}
log.info("ScrapApplyDetailsServiceImpl returnSource end");
}
@ -258,7 +261,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
backApplyInfoPo.setParentId(backList.get(0).getTaskId().intValue());
backApplyMapper.insertBackApplyInfo(backApplyInfoPo);
BackApplyDetailsPo backApplyDetailsPoNew = new BackApplyDetailsPo();
for (ScrapApplyDetails scrapApplyDetail: backList) {
for (ScrapApplyDetails scrapApplyDetail : backList) {
//根据退料任务和机具类型获取退料详情
BackApplyDetailsPo backApplyDetailsPo = backApplyMapper.getBackApplyDetailsByParentId(scrapApplyDetail);
backApplyDetailsPoNew.setCode(taskCode);
@ -274,11 +277,11 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
scrapApplyDetail.setParentId(backApplyInfoPo.getId());
scrapApplyDetail.setTypeId(Long.valueOf(backApplyDetailsPo.getTypeId()));
BackApplyDetailsPo backApplyDetailsPoResult = backApplyMapper.getBackApplyDetailsByParentId(scrapApplyDetail);
if (backApplyDetailsPoResult!=null){
if (backApplyDetailsPoResult != null) {
backApplyDetailsPoNew.setPreNum(backApplyDetailsPoResult.getPreNum().add(BigDecimal.ONE));
backApplyDetailsPoNew.setAuditNum(backApplyDetailsPoResult.getAuditNum().add(BigDecimal.ONE));
backApplyMapper.updateBackApplyDetailsByParentId(backApplyDetailsPoNew);
}else {
} else {
backApplyMapper.insertBackApplyDetails(backApplyDetailsPoNew);
}
//修改协议表的状态
@ -287,7 +290,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
sltAgreementInfo.setTypeId(backApplyDetailsPo.getTypeId().toString());
sltAgreementInfoMapper.updateSltAgreementInfoStatus(sltAgreementInfo);
//机具状态变为在用
if (scrapApplyDetail.getMaId() != null){
if (scrapApplyDetail.getMaId() != null) {
SltAgreementInfo agreementInfo = new SltAgreementInfo();
agreementInfo.setMaId(scrapApplyDetail.getMaId().toString());
agreementInfo.setStatus("16");
@ -301,6 +304,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
/**
* 提交报废任务
*
* @param scrapAudit 包含废弃任务审计信息的对象
* @return
*/
@ -311,9 +315,9 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
//参数校验 后期可以考虑写一个校验的工具类
List<Integer> deptIds = scrapAudit.getDeptIds();
if (deptIds == null || deptIds.size() == 0) {
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG,"deptIds"), ExceptionDict.PARAM_IS_NULL_ERROR);
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG, "deptIds"), ExceptionDict.PARAM_IS_NULL_ERROR);
}
List<Long> taskIdList =scrapAudit.getTaskIdList();
List<Long> taskIdList = scrapAudit.getTaskIdList();
if (taskIdList == null || taskIdList.size() == 0) {
throw new ServiceException(ExceptionDict.TASK_ID_IS_EMPTY_MSG, ExceptionDict.TASK_ID_IS_EMPTY);
}
@ -332,12 +336,13 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
scrapAuditorSetMapper.insertScrapAuditorSet(scrapAuditorSet);
}
}
log.info("ScrapApplyDetailsServiceImpl submitScrapTask end" );
log.info("ScrapApplyDetailsServiceImpl submitScrapTask end");
return BigDecimal.ROUND_DOWN;
}
/**
* 报废任务审核--宁夏
*
* @param scrapAuditorSet
* @return
*/
@ -356,12 +361,12 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
TmTask task = new TmTask();
task.setTaskId(Long.valueOf(scrapAuditorSet.getTaskId()));
//判断是否还有部门没有进行审核
if (statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode())){
if (statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode())) {
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.SCRAP_UNDER_REVIEW.getCode()));
//当全部审核以后判断是否有驳回的
} else if (!statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode()) &&statusList.contains(ReviewStatusEnum.REJECTED.getCode())) {
} else if (!statusList.contains(ReviewStatusEnum.IN_PROGRESS.getCode()) && statusList.contains(ReviewStatusEnum.REJECTED.getCode())) {
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.SCRAP_REJECTED.getCode()));
}else {
} else {
task.setTaskStatus(Integer.valueOf(TaskStatusEnum.SCRAP_PASSED.getCode()));
task.setDisposition(Integer.valueOf(TaskStatusEnum.NOT_DISPOSED.getCode()));
}
@ -377,12 +382,13 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
/**
* 报废任务审核列表
*
* @param scrapApplyDetails
* @return
*/
@Override
public List<ScrapApplyDetailsVO> scrapTaskReviewList(ScrapApplyDetails scrapApplyDetails) {
log.info("ScrapApplyDetailsServiceImpl scrapTaskReviewList begin:{}",scrapApplyDetails);
log.info("ScrapApplyDetailsServiceImpl scrapTaskReviewList begin:{}", scrapApplyDetails);
List<ScrapApplyDetailsVO> scrapApplyDetailsList = scrapApplyDetailsMapper.scrapTaskReviewList(scrapApplyDetails);
for (ScrapApplyDetailsVO applyDetails : scrapApplyDetailsList) {
Long taskId = applyDetails.getTaskId();
@ -391,12 +397,13 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
List<ScrapAuditorSet> scrapAuditorSetList = scrapAuditorSetMapper.selectScrapAuditListByTaskId(taskId);
applyDetails.setScrapAuditorSetList(scrapAuditorSetList);
}
log.info("ScrapApplyDetailsServiceImpl scrapTaskReviewList end:{}",scrapApplyDetails);
log.info("ScrapApplyDetailsServiceImpl scrapTaskReviewList end:{}", scrapApplyDetails);
return scrapApplyDetailsList;
}
/**
* 获取处置列表----宁夏
*
* @param scrapApplyDetails
* @return
*/
@ -415,21 +422,23 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
/**
* 处置
*
* @param tmTaskList
* @return
*/
@Override
public int obtainDisposal(List<TmTask> tmTaskList) {
log.info("ScrapApplyDetailsServiceImpl scrapTaskReviewList begin:{}",tmTaskList);
log.info("ScrapApplyDetailsServiceImpl scrapTaskReviewList begin:{}", tmTaskList);
tmTaskList.forEach(tmTask -> {
taskMapper.updateTmTask(tmTask);
});
log.info("ScrapApplyDetailsServiceImpl scrapTaskReviewList end:{}",tmTaskList);
log.info("ScrapApplyDetailsServiceImpl scrapTaskReviewList end:{}", tmTaskList);
return BigDecimal.ROUND_DOWN;
}
/**
* 导出预报废
*
* @param scrapApplyDetails
* @return
*/
@ -439,10 +448,10 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
List<ForecastWasteExcel> ForecastWasteExcelList = new ArrayList<>();
ForecastWasteExcel forecastWasteExcel = new ForecastWasteExcel();
//对预报废来源进行处理
for (ScrapApplyDetailsVO scrapApplyDetailsVO: scrapApplyDetailsList) {
BeanUtils.copyProperties(scrapApplyDetailsVO,forecastWasteExcel);
for (ScrapApplyDetailsVO scrapApplyDetailsVO : scrapApplyDetailsList) {
BeanUtils.copyProperties(scrapApplyDetailsVO, forecastWasteExcel);
//获取来源单号
forecastWasteExcel.setRepairNum(scrapApplyDetailsVO.getRepairNum()!=null?scrapApplyDetailsVO.getRepairNum(): scrapApplyDetailsVO.getRepairCode());
forecastWasteExcel.setRepairNum(scrapApplyDetailsVO.getRepairNum() != null ? scrapApplyDetailsVO.getRepairNum() : scrapApplyDetailsVO.getRepairCode());
//获取来源名称
forecastWasteExcel.setScrapSourceName(ScrapSourceEnum.getInfoByCode(scrapApplyDetailsVO.getScrapSource()));
ForecastWasteExcelList.add(forecastWasteExcel);
@ -450,8 +459,381 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
return ForecastWasteExcelList;
}
@Override
public int setNumBack(BackApplyInfo record) {
int res;
try {
// int taskId = record.getTaskId();
// //修改任务状态
// res = updateTaskStatus(taskId, 39);
//插入scrap_check_details
res = insertBcd(record);
if (res == 0) {
throw new RuntimeException("插入scrap_check_details异常");
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return res;
}
@Override
public int setCodeBack(BackApplyInfo record) {
int res = 0;
try {
BackApplyInfo[] arr = record.getArr();
if (arr.length > 0) {
for (int i = 0; i < arr.length; i++) {
//判断是否超出审核数量
int re = scrapApplyDetailsMapper.selectNumByTypeId(arr[i].getParentId(), arr[i].getTypeId());
if (re <= 0) {
res = -2;
break;
}
//根据maId和taskId查询是否已接收
re = scrapApplyDetailsMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId());
if (re > 0) {
res = -1;
break;
}
}
if (res < 0) {
return res;
}
}
// int taskId = record.getTaskId();
// //修改任务状态
// res = updateTaskStatus(taskId, 39);
// if (res == 0) {
// throw new RuntimeException("修改updateTaskStatus异常");
// }
//插入scrap_check_details
res = insertBcd(record);
if (res == 0) {
throw new RuntimeException("插入scrap_check_details异常");
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return res;
}
@Override
public int revoke(BackApplyInfo record) {
//删除scrap_check_details
int res = deleteBcd(record);
if (res == 0) {
throw new RuntimeException("该机具未领用,撤回失败");
}
return res;
}
@Override
public List<BackApplyInfo> scrapReceiveRecordWeb(BackApplyInfo record) {
String typeId = record.getTypeId();
String[] split = typeId.split(",");
List<BackApplyInfo> backApplyInfoList = new ArrayList<>();
for (String s : split) {
record.setTypeId(s);
BackApplyInfo backApplyInfo = scrapApplyDetailsMapper.scrapReceiveRecordWeb(record);
if (backApplyInfo != null) {
backApplyInfoList.add(backApplyInfo);
}
}
return backApplyInfoList;
}
@Override
public List<BackApplyInfo> backReceiveRecordWebPt(BackApplyInfo record) {
String typeId = record.getTypeId();
String[] split = typeId.split(",");
List<BackApplyInfo> backApplyInfoList = new ArrayList<>();
for (String s : split) {
record.setTypeId(s);
BackApplyInfo backApplyInfo = scrapApplyDetailsMapper.scrapReceiveRecordWebPt(record);
if (backApplyInfo != null) {
backApplyInfoList.add(backApplyInfo);
}
}
return backApplyInfoList;
}
@Override
public List<ScrapApplyDetails> getScrapRefuseIsSuc(ScrapApplyDetails scrapApplyDetails) {
return scrapApplyDetailsMapper.getScrapRefuseIsSuc(scrapApplyDetails);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int endback(ScrapAudit scrapAudit) {
int res;
//参数校验 后期可以考虑写一个校验的工具类
List<Integer> deptIds = scrapAudit.getDeptIds();
Long taskId = scrapAudit.getTaskId();
if (StringUtils.isBlank(taskId.toString())) {
throw new ServiceException(ExceptionDict.TASK_ID_IS_EMPTY_MSG, ExceptionDict.TASK_ID_IS_EMPTY);
}
//先判断是否已经完成退料了
int taskStatus = selectTaskStatus(taskId);
if (taskStatus == 0) {
throw new RuntimeException("该退料单已完成退料");
}
//修改任务状态为报废审核进行中
res = updateTaskStatus(taskId, 59);
if (res == 0) {
throw new RuntimeException("tm_task修改状态");
}
//更加退料接收的数据创建下一步流程
//合格的插入入库记录input_apply_details修改库存ma_type,修改机具状态
List<BackApplyInfo> hgList = scrapApplyDetailsMapper.getHgList(scrapAudit);
if (hgList != null && hgList.size() > 0) {
res = insertIad(hgList);
if (res == 0) {
throw new RuntimeException("input_apply_details");
}
res = updateMt(hgList);
if (res == 0) {
throw new RuntimeException("ma_type修改异常");
}
res = updateMaStatus(hgList);
if (res == 0) {
throw new RuntimeException("ma_machines修改异常");
}
}
//维修的创建维修任务插入任务协议表
List<BackApplyInfo> wxList = scrapApplyDetailsMapper.getWxList(scrapAudit);
if (wxList != null && wxList.size() > 0) {
//插入任务表tm_task
int newTaskId = insertTt(wxList, TaskTypeEnum.MAINTENANCE_TASK.getCode(), scrapAudit.getCreateBy());
//插入协议任务表tm_task_agreement
res = insertTta(newTaskId, wxList);
//插入维修记录表repair_apply_details
res = insertRad(newTaskId, wxList);
}
//待报废的创建报废任务插入任务协议表
List<BackApplyInfo> bfList = scrapApplyDetailsMapper.getBfList(scrapAudit);
if (bfList != null && bfList.size() > 0) {
//插入任务表tm_task
int newTaskId = insertTt(bfList, TaskTypeEnum.SCRAP_TASK.getCode(), scrapAudit.getCreateBy());
//插入协议任务表tm_task_agreement
res = insertTta(newTaskId, bfList);
//插入维修记录表scrap_apply_details
res = insertSad(newTaskId, bfList);
ScrapAuditorSet scrapAuditorSet = new ScrapAuditorSet();
scrapAuditorSet.setTaskId(taskId.intValue());
for (Integer deptId : deptIds) {
scrapAuditorSet.setDeptId(deptId);
scrapAuditorSet.setTaskId(newTaskId);
scrapAuditorSetMapper.insertScrapAuditorSet(scrapAuditorSet);
}
}
//创建审核详情
//结算功能
/* List<BackApplyInfo> allList = scrapApplyDetailsMapper.getAllList(scrapAudit);
if (allList != null && allList.size() > 0) {
res = updateSlt(scrapAudit, allList);
if (res == 0) {
throw new RuntimeException("该机具未被领料使用");
}
}*/
return res;
}
private int insertSad(int taskId, List<BackApplyInfo> list) {
int result = 0;
if (list != null) {
for (BackApplyInfo bf : list) {
bf.setTaskId(taskId);
result = scrapApplyDetailsMapper.insertSad(bf);
}
}
return result;
}
private int insertRad(int taskId, List<BackApplyInfo> wxList) {
int result = 0;
if (wxList != null) {
for (BackApplyInfo wx : wxList) {
wx.setTaskId(taskId);
result = scrapApplyDetailsMapper.insertRad(wx);
}
}
return result;
}
private int insertTta(int taskId, List<BackApplyInfo> list) {
int res;
Integer agreementId = list.get(0).getAgreementId();
res = scrapApplyDetailsMapper.insertTta(taskId, agreementId);
return res;
}
private int insertTt(List<BackApplyInfo> wxList, Integer taskType, String createBy) {
int newTask;
//生成单号
String code = genCodeRule(taskType);
BackApplyInfo applyInfo = new BackApplyInfo();
applyInfo.setTaskType(Integer.valueOf(taskType));
String taskStatus = "";
if (TaskTypeEnum.MAINTENANCE_TASK.getCode().equals(taskType)) {
//taskStatus = "43";
taskStatus = TaskStatusEnum.MAINTENANCE_PROGRESS.getCode();
}
if (TaskTypeEnum.SCRAP_TASK.getCode().equals(taskType)) {
//taskStatus = "120";
taskStatus = TaskStatusEnum.SCRAP_UNDER_REVIEW.getCode();
}
applyInfo.setTaskStatus(taskStatus);
applyInfo.setCode(code);
//创建人
applyInfo.setCreateBy(createBy);
newTask = taskMapper.insertTt(applyInfo);
if (newTask > 0 && applyInfo.getTaskId() > 0) {
newTask = applyInfo.getTaskId();
}
return newTask;
}
/**
* 编号生成规则
*/
private String genCodeRule(Integer taskType) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
Integer taskNum = scrapApplyDetailsMapper.selectTaskNumByMonthWx(nowDate, taskType);
String taskNumStr = "";
if (taskNum != null) {
// 将字符串转换为整数
// int num = Integer.parseInt(taskNum);
// 执行加一操作
taskNum++;
// 将结果转换回字符串格式并确保结果是四位数不足四位则在前面补0
taskNumStr = String.format("%04d", taskNum);
} else {
taskNumStr = "0001";
}
String code = "";
if (TaskTypeEnum.MAINTENANCE_TASK.getCode().equals(taskType)) {
code = TaskTypeConstants.WX;
}
if (TaskTypeEnum.RETURNED_MATERIALS_TO_BE_SCRAPPED.getCode().equals(taskType)) {
code = TaskTypeConstants.YBF;
}
code = code + format + "-" + taskNumStr;
return code;
}
private int updateMaStatus(List<BackApplyInfo> hgList) {
int res = 0;
if (hgList != null && hgList.size() > 0) {
for (BackApplyInfo bi : hgList) {
Integer maId = bi.getMaId();
if (maId == null) {
res = 1;
} else {
res = scrapApplyDetailsMapper.updateMaStatus(maId, "15");
}
}
}
return res;
}
private int updateMt(List<BackApplyInfo> hgList) {
int res = 0;
if (hgList != null && hgList.size() > 0) {
for (BackApplyInfo bi : hgList) {
res = scrapApplyDetailsMapper.updateMt(bi);
}
}
return res;
}
private int insertIad(List<BackApplyInfo> hgList) {
int res = 0;
if (hgList != null && hgList.size() > 0) {
for (BackApplyInfo bi : hgList) {
res = scrapApplyDetailsMapper.insertIad(bi);
}
}
return res;
}
private int updateTaskStatus(long taskId, int i) {
int res;
res = taskMapper.updateTaskStatus(taskId, i);
return res;
}
private int selectTaskStatus(long taskId) {
int taskStatus = scrapApplyDetailsMapper.selectTaskStatus(taskId);
if (taskStatus == 59) {
return 0;
} else {
return 1;
}
}
private int deleteBcd(BackApplyInfo record) {
int res = 0;
if (record != null) {
String manageType = record.getManageType();
if ("0".equals(manageType)) {
List<Integer> maId = scrapApplyDetailsMapper.getMaId(record);
for (Integer s : maId) {
//机具状态变为在用
scrapApplyDetailsMapper.updateMaStatus(s, "16");
}
res = scrapApplyDetailsMapper.deleteCheckDetails(record);
} else {
res = scrapApplyDetailsMapper.deleteCheckDetails(record);
}
}
return res;
}
private int insertBcd(BackApplyInfo record) {
int res = 0;
BackApplyInfo[] arr = record.getArr();
if (arr.length > 0) {
for (int i = 0; i < arr.length; i++) {
res = scrapApplyDetailsMapper.insertCheckDetails(arr[i]);
String manageType = arr[i].getManageType();
if ("0".equals(manageType)) {
String backStatus = arr[i].getBackStatus();
int maId = arr[i].getMaId();
if ("1".equals(backStatus)) {
//退料合格状态变为退料带入库84
scrapApplyDetailsMapper.updateMaStatus(maId, "84");
}
if ("2".equals(backStatus)) {
//退料维修状态变为退料待检修17
scrapApplyDetailsMapper.updateMaStatus(maId, "17");
}
if ("3".equals(backStatus)) {
//退料待报废状态变为退料待报废20
scrapApplyDetailsMapper.updateMaStatus(maId, "20");
}
}
}
}
return res;
}
/**
* 生成报废任务
*
* @param taskId
*/
private void createScrapTask(Long taskId) {
@ -462,7 +844,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
// 查询协议表
TmTaskAgreement tmTaskAgreement = agreementMapper.selectTmTaskAgreementByTaskId(taskId);
//生成编号
String taskCode = purchaseCodeRule(TaskTypeConstants.BF, Integer.valueOf(TaskTypeEnum.SCRAP_TASK.getCode()));
String taskCode = purchaseCodeRule(TaskTypeConstants.BF, Integer.valueOf(TaskTypeEnum.SCRAP_TASK.getCode()));
Integer taskStatus = Integer.valueOf(TaskStatusEnum.SCRAP_UNSUBMITTED.getCode());
Integer taskType = Integer.valueOf(TaskTypeEnum.SCRAP_TASK.getCode());
//获取该任务下通过预报废审核的装备信息
@ -470,14 +852,14 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
scrapApplyDetails.setTaskId(taskId);
scrapApplyDetails.setStatus(ReviewStatusEnum.PASSED.getCode());
List<ScrapApplyDetails> scrapApplyDetailsList = scrapApplyDetailsMapper.selectScrapAuditList(scrapApplyDetails);
if (scrapApplyDetailsList.size() == 0){
if (scrapApplyDetailsList.size() == 0) {
throw new ServiceException(ExceptionDict.TASK_DETAILS_IS_EMPTY_MSG, ExceptionDict.TASK_DETAILS_IS_EMPTY);
}
//获取生成的任务id
int companyId = task.getCompanyId() == null ? 0 : task.getCompanyId();
long backTaskId = genTask(taskCode, taskType, taskStatus, tmTaskAgreement, companyId);
//保存装备详情
processScrapApplyDetails( scrapApplyDetailsList, backTaskId);
processScrapApplyDetails(scrapApplyDetailsList, backTaskId);
}
@ -489,7 +871,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
*/
public void processScrapApplyDetails(List<ScrapApplyDetails> scrapApplyDetailsList, Long backTaskId) {
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
for (ScrapApplyDetails scrapApplyDetail:scrapApplyDetailsList) {
for (ScrapApplyDetails scrapApplyDetail : scrapApplyDetailsList) {
BeanUtil.copyProperties(scrapApplyDetail, scrapApplyDetails);
scrapApplyDetails.setStatus(ReviewStatusEnum.IN_PROGRESS.getCode());
scrapApplyDetails.setId(null);
@ -578,6 +960,16 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
return scrapApplyDetailsMapper.selectScrapAuditList(scrapApplyDetails);
}
@Override
public List<ScrapApplyDetails> getScrapRefuseList(ScrapApplyDetails scrapApplyDetails) {
return scrapApplyDetailsMapper.getScrapRefuseList(scrapApplyDetails);
}
@Override
public List<ScrapApplyDetails> getScrapRefuseMaCodeList(ScrapApplyDetails scrapApplyDetails) {
return scrapApplyDetailsMapper.getScrapRefuseMaCodeList(scrapApplyDetails);
}
/**
* 报废任务审核
*
@ -713,14 +1105,14 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
String taskNum = taskMapper.selectTaskNumByMonths(nowDate, taskType);
if (StringHelper.isNotEmpty(taskNum)){
if (StringHelper.isNotEmpty(taskNum)) {
// 将字符串转换为整数
int num = Integer.parseInt(taskNum);
// 执行加一操作
num++;
// 将结果转换回字符串格式并确保结果是四位数不足四位则在前面补0
taskNum = String.format("%04d", num);
}else {
} else {
taskNum = "0001";
}
String codeNum = code + format + "-" + taskNum;

View File

@ -67,6 +67,10 @@ public class ScrapApplyDetailsVO {
* 工程id
*/
private String projectId;
/**
* 父id
*/
private String parentId;
/**
* 审核状态

View File

@ -42,4 +42,6 @@ public class ScrapAudit {
@ApiModelProperty(value = "处置情况")
private Integer disposition;
private String createBy;
}

View File

@ -52,7 +52,7 @@
<select id="selectByWholeTypeName" resultType="java.lang.Integer">
select COUNT(*) from ma_whole_set
where whole_type_name = #{wholeTypeName}
where whole_type_name = #{wholeTypeName} and company_id #{companyId}
</select>
<select id="selectList" resultType="com.bonus.sgzb.material.domain.MaWholeVo">
SELECT
@ -176,14 +176,9 @@
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_whole_set mws2 ON mws2.type_id = mt.type_id
AND mws2.whole_type_name = #{wholeTypeName}
AND mws2.company_id = #{companyId}
WHERE
mt.type_id IN (
SELECT
mws.type_id
FROM
ma_whole_set mws
WHERE
mws.whole_type_name = #{wholeTypeName})
mt.type_id IN ( SELECT mws.type_id FROM ma_whole_set mws WHERE mws.whole_type_name = #{wholeTypeName} AND mws.company_id = #{companyId})
AND mt.`status` = '0'
AND mt.del_flag = '0'
</select>

View File

@ -240,6 +240,322 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into repair_audit_details (task_id,repair_id,ma_id,type_id,repair_num,repaired_num,scrap_num,status,create_by,create_time,update_by,update_time,company_id)
values (#{taskId},#{repairId},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},#{status},#{createBy},now(),#{updateBy},now(),#{companyId});
</insert>
<insert id="insertCheckDetails">
insert into scrap_check_details
(
<if test="parentId != null">
parent_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="backNum != null">
back_num,
</if>
<if test="backStatus != null">
back_status,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createBy != null and createBy != ''">
update_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="scrapReason != null and scrapReason != ''">
scrap_reason,
</if>
<if test="scrapType != null and scrapType != ''">
scrap_type,
</if>
<if test="fileUrl != null and fileUrl != ''">
file_url,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
)
values (
<if test="parentId != null">
#{parentId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="backNum != null">
#{backNum},
</if>
<if test="backStatus != null">
#{backStatus},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
NOW(),
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="scrapReason != null and scrapReason != ''">
#{scrapReason},
</if>
<if test="scrapType != null and scrapType != ''">
#{scrapType},
</if>
<if test="fileUrl != null and fileUrl != ''">
#{fileUrl},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="insertIad">
insert into input_apply_details
(
<if test="taskId != null">
task_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="backNum != null">
input_num,
</if>
input_type,
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createBy != null and createBy != ''">
update_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
)
values (
<if test="taskId != null">
#{taskId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="parentId != null">
#{parentId},
</if>
<if test="backNum != null">
#{backNum},
</if>
'2',
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
NOW(),
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="insertTta">
insert into tm_task_agreement
(
<if test="taskId != null">
task_id,
</if>
<if test="agreementId != null">
agreement_id,
</if>
create_time
) values (
<if test="taskId != null">
#{taskId},
</if>
<if test="agreementId != null">
#{agreementId},
</if>
NOW()
)
</insert>
<insert id="insertRad">
insert into repair_apply_details
(
<if test="taskId != null">
task_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="backNum != null">
repair_num,
</if>
<if test="status != null">
status,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createBy != null and createBy != ''">
update_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="id != null">
back_id,
</if>
back_source,
create_time
)
values (
<if test="taskId != null">
#{taskId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="backNum != null">
#{backNum},
</if>
<if test="status != null">
#{status},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<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="id != null">
#{id},
</if>
1,
NOW()
)
</insert>
<insert id="insertSad">
insert into scrap_apply_details
(
<if test="taskId != null">
task_id,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="backNum != null">
scrap_num,
</if>
scrap_source,
status,
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="scrapReason != null and scrapReason != ''">
remark,
</if>
<if test="scrapType != null and scrapType != ''">
scrap_type,
</if>
<if test="fileUrl != null and fileUrl != ''">
file_url,
</if>
create_time
)
values (
<if test="taskId != null">
#{taskId},
</if>
<if test="parentId != null">
#{parentId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="backNum != null">
#{backNum},
</if>
'1',
'0',
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="companyId != null">
#{companyId},
</if>
<if test="scrapReason != null and scrapReason != ''">
#{scrapReason},
</if>
<if test="scrapType != null and scrapType != ''">
#{scrapType},
</if>
<if test="fileUrl != null and fileUrl != ''">
#{fileUrl},
</if>
NOW()
)
</insert>
<update id="updateScrapApplyDetails" parameterType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
update scrap_apply_details
@ -277,6 +593,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deleteCheckDetails">
delete from scrap_check_details where parent_id = #{parentId} and type_id = #{typeId}
<if test="maId != null and maId != ''">
and ma_id = #{maId}
</if>
</delete>
<select id="selectScrapAuditList" resultMap="ScrapApplyDetailsResult">
select sad.* ,mt.type_name specificationType, mt1.type_name machineTypeName, mma.ma_code maCode
@ -323,6 +645,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
audit_remark = #{auditRemark}
where id = #{id}
</update>
<update id="updateMaStatus">
update ma_machine
set ma_status=#{maStatus}
where ma_id = #{maId}
</update>
<update id="updateMt">
UPDATE ma_type
SET num = (IFNULL(num, 0)) + #{backNum}
WHERE type_id = #{typeId}
</update>
<select id="selectTypeNameByTaskId" resultType="java.lang.String">
select GROUP_CONCAT(type_name) typeName from
@ -582,5 +914,224 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY tk.CODE
order by tk.create_time desc
</select>
<select id="getScrapRefuseList" resultType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
SELECT
sum( sad.scrap_num ) AS preNum,
sum( sad.scrap_num ) - IFNULL(sum( scd.back_num ),0) AS num,
mt.type_name specificationType,
mt1.type_name machineTypeName,
mt.manage_type,
sad.parent_id,
mt.type_id
FROM
scrap_apply_details sad
LEFT JOIN scrap_check_details scd on sad.parent_id = scd.parent_id and sad.type_id = scd.type_id
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
WHERE
sad.task_id = #{taskId}
GROUP BY
sad.type_id
ORDER BY
sad.create_time DESC
</select>
<select id="getScrapRefuseMaCodeList" resultType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
SELECT
mt.type_name specificationType,
mt1.type_name machineTypeName,
mma.ma_code maCode,
mma.ma_id,
sad.type_id,
sd.`name` maStatus
FROM
scrap_apply_details sad
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ma_machine mma ON sad.ma_id = mma.ma_id
LEFT JOIN sys_dic sd ON mma.ma_status = sd.id
WHERE
sad.task_id = #{taskId}
AND sad.type_id = #{typeId}
ORDER BY
sad.create_time DESC
</select>
<select id="selectNumByTypeId" resultType="java.lang.Integer">
SELECT
ROUND(SUM( res.auditNum )- SUM( res.backNum ),0) AS backNum
FROM
(
SELECT
bad.scrap_num AS auditNum,
0 AS backNum
FROM
scrap_apply_details bad
WHERE
bad.parent_id = #{parentId}
AND bad.type_id = #{typeId} UNION
SELECT
0 AS auditNum,
SUM(
IFNULL( bcd.back_num, 0 )) AS backNum
FROM
scrap_check_details bcd
WHERE
bcd.parent_id = #{parentId}
AND bcd.type_id = #{typeId}
) res
HAVING backNum > -1
</select>
<select id="selectCodeByMaIdAndTaskId" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
scrap_check_details bcd
LEFT JOIN scrap_apply_details sad ON bcd.parent_id = sad.parent_id
WHERE
bcd.ma_id = #{maId}
AND sad.task_id = #{taskId}
</select>
<select id="getMaId" resultType="java.lang.Integer">
select ma_id from scrap_check_details where parent_id = #{parentId} and type_id = #{typeId}
</select>
<select id="scrapReceiveRecordWeb" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
SELECT
mt2.type_name AS typeName,
mt1.type_name AS typeCode,
ifnull(sum( scd.back_num ), 0) AS backNum,
SUM( CASE WHEN scd.back_status = 1 THEN scd.back_num ELSE 0 END ) AS hgNum,
SUM( CASE WHEN scd.back_status = 2 THEN scd.back_num ELSE 0 END ) AS wxNum,
SUM( CASE WHEN scd.back_status = 3 THEN scd.back_num ELSE 0 END ) AS bfNum,
mm.ma_code AS maCode,
scd.create_time AS backTime,
scd.type_id as modelId,
scd.back_status AS backStatus
FROM
scrap_check_details scd
LEFT JOIN ma_type mt1 ON mt1.type_id = scd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
LEFT JOIN ma_machine mm ON mm.ma_id = scd.ma_id
WHERE
scd.parent_id = #{parentId}
AND scd.type_id = #{typeId}
GROUP BY
scd.type_id
ORDER BY
scd.create_time DESC
</select>
<select id="scrapReceiveRecordWebPt" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
SELECT
mt2.type_name AS typeName,
mt1.type_name AS typeCode,
ifnull( scd.back_num, 0 ) AS backNum,
mm.ma_code AS maCode,
scd.create_time AS backTime,
scd.type_id AS modelId,
scd.back_status AS backStatus
FROM
scrap_check_details scd
LEFT JOIN ma_type mt1 ON mt1.type_id = scd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
LEFT JOIN ma_machine mm ON mm.ma_id = scd.ma_id
WHERE
scd.parent_id = #{parentId}
AND scd.type_id = #{typeId}
<if test="maCode != null and maCode != ''">
and mm.ma_code like concat('%', #{maCode}, '%')
</if>
ORDER BY
scd.create_time DESC
</select>
<select id="getScrapRefuseIsSuc" resultType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
SELECT
sum( sad.scrap_num ) AS preNum,
sum( sad.scrap_num ) - IFNULL( sum( scd.back_num ), 0 ) AS num,
mt.type_name specificationType,
mt1.type_name machineTypeName,
mt.manage_type,
sad.parent_id,
mma.ma_code maCode,
mma.ma_id,
scd.back_status,
mt.type_id
FROM
scrap_apply_details sad
LEFT JOIN scrap_check_details scd ON sad.parent_id = scd.parent_id
AND sad.type_id = scd.type_id
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ma_machine mma ON sad.ma_id = mma.ma_id
LEFT JOIN sys_dic sd ON mma.ma_status = sd.id
WHERE
sad.task_id = #{taskId}
GROUP BY
sad.type_id
ORDER BY
sad.create_time DESC
</select>
<select id="selectTaskStatus" resultType="java.lang.Integer">
select task_status from tm_task where task_id = #{taskId}
</select>
<select id="getHgList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
SELECT
tta.agreement_id AS agreementId,
bai.id,
bai.task_id AS taskId,
bcd.type_id AS typeId,
bcd.back_num AS backNum,
bcd.parent_id AS parentId,
bcd.create_by AS createBy,
bcd.ma_id AS maId,
bai.company_id AS companyId
FROM
scrap_check_details bcd
LEFT JOIN scrap_apply_details bai ON bai.parent_id = bcd.parent_id
LEFT JOIN scrap_apply_details bai1 ON bai.parent_id = bai1.id
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
WHERE
bai.task_id = #{taskId}
AND bcd.back_status = '1'
</select>
<select id="getWxList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
SELECT
tta.agreement_id AS agreementId,
bai.id,
bai.task_id AS taskId,
bcd.type_id AS typeId,
bcd.back_num AS backNum,
bcd.parent_id AS parentId,
bcd.create_by AS createBy,
bcd.ma_id AS maId,
bai.company_id AS companyId
FROM
scrap_check_details bcd
LEFT JOIN scrap_apply_details bai ON bai.parent_id = bcd.parent_id
LEFT JOIN scrap_apply_details bai1 ON bai.parent_id = bai1.id
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
WHERE
bai.task_id = #{taskId}
AND bcd.back_status = '2'
</select>
<select id="getBfList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
SELECT
tta.agreement_id AS agreementId,
bai.id,
bai.task_id AS taskId,
bcd.type_id AS typeId,
bcd.back_num AS backNum,
bcd.parent_id AS parentId,
bcd.create_by AS createBy,
bcd.ma_id AS maId,
bai.company_id AS companyId
FROM
scrap_check_details bcd
LEFT JOIN scrap_apply_details bai ON bai.parent_id = bcd.parent_id
LEFT JOIN scrap_apply_details bai1 ON bai.parent_id = bai1.id
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
WHERE
bai.task_id = #{taskId}
AND bcd.back_status = '3'
</select>
<select id="selectTaskNumByMonthWx" resultType="java.lang.Integer">
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType}
</select>
</mapper>

View File

@ -192,6 +192,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<insert id="insertTt" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.material.domain.TmTask" useGeneratedKeys="true">
insert into tm_task
(
<if test="taskType != null">
task_type,
</if>
<if test="taskStatus != null">
task_status,
</if>
<if test="code != null and code != ''">
code,
</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>
create_time
) values (
<if test="taskType != null">
#{taskType},
</if>
<if test="taskStatus != null">
#{taskStatus},
</if>
<if test="code != null and code != ''">
#{code},
</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>
NOW()
)
</insert>
<update id="updateTmTask" parameterType="com.bonus.sgzb.material.domain.TmTask">
update tm_task
@ -211,6 +267,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where task_id = #{taskId}
</update>
<update id="updateTaskStatus">
update tm_task
set task_status=#{status}
where task_id = #{taskId}
</update>
<delete id="deleteTmTaskByTaskId" parameterType="Long">
delete from tm_task where task_id = #{taskId}