From cf0d751327211993638e4f7db7ef3eefc25470b9 Mon Sep 17 00:00:00 2001 From: bns_han <1604366271@qq.com> Date: Mon, 22 Jan 2024 18:25:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controller/BackApplyController.java | 25 +++--- .../service/impl/BackApplyServiceImpl.java | 5 ++ .../service/impl/BackReceiveServiceImpl.java | 58 +++++++------ .../controller/BackApplyController.java | 2 +- .../PurchaseAccessoryController.java | 29 +++++++ .../material/domain/PurchasePartDetails.java | 8 +- .../material/domain/PurchasePartInfo.java | 37 ++++++--- .../mapper/PurchaseAccessoryMapper.java | 14 ++++ .../service/IPurchaseAccessoryService.java | 14 ++++ .../impl/PurchaseAccessoryServiceImpl.java | 10 +++ .../material/PurchaseAccessoryMapper.xml | 83 +++++++++++++++---- 11 files changed, 212 insertions(+), 73 deletions(-) diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackApplyController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackApplyController.java index f0b6a016..e07b8ea8 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackApplyController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackApplyController.java @@ -3,6 +3,7 @@ package com.bonus.sgzb.app.controller; import cn.hutool.core.collection.CollUtil; import com.bonus.sgzb.app.domain.BackApplyInfo; import com.bonus.sgzb.app.domain.BmAgreementInfo; +import com.bonus.sgzb.app.domain.GlobalConstants; import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.service.BackApplyService; import com.bonus.sgzb.app.service.LeaseApplyDetailsService; @@ -23,26 +24,22 @@ import java.util.Date; import java.util.List; /** - * 退料申请--App - */ +* @description 退料申请--app +* @author hay +* @date 2024/1/22 10:17 +*/ @RestController @RequestMapping("/back_apply") public class BackApplyController extends BaseController { @Resource - private BackApplyService backApplyService; // 任务表Service + private BackApplyService backApplyService; /** * 服务对象 */ @Resource - private TmTaskService tmTaskService; // 任务表Service - - @Resource - private LeaseApplyInfoService leaseApplyInfoService; // 领料申请表Service - - @Resource - private LeaseApplyDetailsService leaseApplyDetailsService; // 领料申请明细表Service + private TmTaskService tmTaskService; /** * 退料申请列表 @@ -231,16 +228,18 @@ public class BackApplyController extends BaseController { } } - // 退料编号生成规则 + /** + * 退料编号生成规则 + */ private String purchaseCodeRule() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); Date nowDate = DateUtils.getNowDate(); String format = dateFormat.format(nowDate); int taskNum = tmTaskService.selectTaskNumByMonth(nowDate, 36) + 1; String code = ""; - if (taskNum > 9 && taskNum < 100) { + if (taskNum > GlobalConstants.NINE && taskNum < GlobalConstants.ONE_HUNDRED) { code = "T" + format + "-00" + taskNum; - } else if (taskNum > 99 && taskNum < 1000) { + } else if (taskNum > GlobalConstants.NINETY_NINE && taskNum < GlobalConstants.ONE_THOUSAND) { code = "T" + format + "-0" + taskNum; } else { code = "T" + format + "-000" + taskNum; diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackApplyServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackApplyServiceImpl.java index ba9fa1ff..4d5c4c3a 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackApplyServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackApplyServiceImpl.java @@ -10,6 +10,11 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; +/** +* @description 退料申请--app +* @author hay +* @date 2024/1/22 11:13 +*/ @Service public class BackApplyServiceImpl implements BackApplyService { diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java index 8f539fd3..1c5f9254 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.app.service.impl; import com.bonus.sgzb.app.domain.BackApplyInfo; +import com.bonus.sgzb.app.domain.GlobalConstants; import com.bonus.sgzb.app.mapper.BackReceiveMapper; import com.bonus.sgzb.app.service.BackReceiveService; import com.bonus.sgzb.common.core.utils.DateUtils; @@ -12,6 +13,11 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +/** +* @description 退料申请--app +* @author hay +* @date 2024/1/22 11:16 +*/ @Service public class BackReceiveServiceImpl implements BackReceiveService { @@ -33,13 +39,13 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Override @Transactional(rollbackFor = Exception.class) public int setNumBack(BackApplyInfo record) { - int res =0; + int res; try{ int taskId = record.getTaskId(); //修改任务状态 res= updateTaskStatus(taskId,39); //插入back_check_details - res = insertBCD(record); + res = insertBcd(record); if(res == 0) { throw new RuntimeException("插入back_check_details异常"); } @@ -51,7 +57,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { } private int updateTaskStatus(int taskId, int i) { - int res=0; + int res; res=backReceiveMapper.updateTaskStatus(taskId,i); return res; } @@ -59,7 +65,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Override @Transactional(rollbackFor = Exception.class) public int setCodeBack(BackApplyInfo record) { - int res = 0; + int res; try{ //todo 此处需要判断 接收数量是否大于退料数量或者查询待接收数量是否为0 @@ -70,7 +76,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { throw new RuntimeException("插入back_check_details异常"); } //插入back_check_details - res = insertBCD(record); + res = insertBcd(record); if(res == 0) { throw new RuntimeException("插入back_check_details异常"); } @@ -83,7 +89,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Override @Transactional(rollbackFor = Exception.class) public int endBack(BackApplyInfo record) { - int res =0; + int res; try{ int taskId = record.getTaskId(); //修改任务状态 @@ -95,11 +101,11 @@ public class BackReceiveServiceImpl implements BackReceiveService { //合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态 List hgList = backReceiveMapper.getHgList(record); if(hgList!=null && hgList.size()>0){ - res = insertIAD(hgList); + res = insertIad(hgList); if(res == 0) { throw new RuntimeException("input_apply_details"); } - res = updateMT(hgList); + res = updateMt(hgList); if(res == 0) { throw new RuntimeException("ma_type"); } @@ -112,22 +118,22 @@ public class BackReceiveServiceImpl implements BackReceiveService { List wxList = backReceiveMapper.getWxList(record); if(wxList!=null && wxList.size()>0){ //插入任务表tm_task - int newTaskId = insertTT(wxList,41,record.getCreateBy()); + int newTaskId = insertTt(wxList,41,record.getCreateBy()); //插入协议任务表tm_task_agreement - res = insertTTA(newTaskId,wxList); + res = insertTta(newTaskId,wxList); //插入维修记录表repair_apply_details - res = insertRAD(newTaskId,wxList); + res = insertRad(newTaskId,wxList); } //待报废的创建报废任务,插入任务协议表 List bfList = backReceiveMapper.getBfList(record); if(bfList!=null && bfList.size()>0){ //插入任务表tm_task - int newTaskId = insertTT(bfList,57,record.getCreateBy()); + int newTaskId = insertTt(bfList,57,record.getCreateBy()); //插入协议任务表tm_task_agreement - res = insertTTA(newTaskId,bfList); + res = insertTta(newTaskId,bfList); //插入维修记录表scrap_apply_details - res = insertSAD(newTaskId,bfList); + res = insertSad(newTaskId,bfList); } }catch (Exception e){ throw new RuntimeException(e.getMessage()); @@ -150,7 +156,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { return backReceiveMapper.backReceiveRecord(record); } - private int insertRAD(int taskId, List wxList) { + private int insertRad(int taskId, List wxList) { int result = 0; if(wxList !=null){ for( BackApplyInfo wx : wxList ){ @@ -161,7 +167,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { return result; } - private int insertSAD(int taskId, List list) { + private int insertSad(int taskId, List list) { int result = 0; if(list !=null){ for( BackApplyInfo bf : list ){ @@ -172,21 +178,21 @@ public class BackReceiveServiceImpl implements BackReceiveService { return result; } - private int insertTTA(int taskId, List list) { - int res = 0 ; + private int insertTta(int taskId, List list) { + int res; String agreementId = list.get(0).getAgreementId(); res = backReceiveMapper.insertTTA(taskId,agreementId); return res; } - private int insertTT(List hgList, int taskType,String createBy) { - int newTask = 0; + private int insertTt(List hgList, int taskType,String createBy) { + int newTask; //生成单号 String code = genCodeRule(taskType); BackApplyInfo applyInfo = new BackApplyInfo(); applyInfo.setTaskType(taskType); String taskStatus=""; - if(41 == taskType){ + if(GlobalConstants.FORTY_ONE == taskType){ taskStatus = "43"; } if(57 == taskType){ @@ -219,7 +225,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { return res; } - private int updateMT(List hgList) { + private int updateMt(List hgList) { int res =0; if(hgList!=null && hgList.size()>0){ for(BackApplyInfo bi : hgList){ @@ -229,7 +235,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { return res; } - private int insertIAD(List hgList) { + private int insertIad(List hgList) { int res =0; if(hgList!=null && hgList.size()>0){ for(BackApplyInfo bi : hgList){ @@ -239,7 +245,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { return res; } - private int insertBCD(BackApplyInfo record) { + private int insertBcd(BackApplyInfo record) { int res =0; BackApplyInfo[] arr = record.getArr(); if(arr.length>0){ @@ -268,7 +274,9 @@ public class BackReceiveServiceImpl implements BackReceiveService { } - // 编号生成规则 + /** + * 编号生成规则 + */ private String genCodeRule(int taskType) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); Date nowDate = DateUtils.getNowDate(); diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/BackApplyController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/BackApplyController.java index 8f683557..e87b5a93 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/BackApplyController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/BackApplyController.java @@ -215,6 +215,6 @@ public class BackApplyController extends BaseController { { List list = backApplyService.exportList(bean); ExcelUtil util = new ExcelUtil(BackApplyInfo.class); - util.exportExcel(response, list, "新购验收任务数据"); + util.exportExcel(response, list, "退料申请数据"); } } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseAccessoryController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseAccessoryController.java index 4ef3f6fa..da42d4ef 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseAccessoryController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseAccessoryController.java @@ -1,5 +1,6 @@ package com.bonus.sgzb.material.controller; +import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.page.TableDataInfo; @@ -12,6 +13,8 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -93,6 +96,19 @@ public class PurchaseAccessoryController extends BaseController return toAjax(purchaseAccessoryService.updatePurchaseCheckDetails(purchasePartDetailsList)); } + /** + * 新购配件验收导出 + */ + @ApiOperation("新购配件验收导出") + @Log(title = "新购配件验收导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PurchasePartInfo bean) + { + List list = purchaseAccessoryService.exportList(bean); + ExcelUtil util = new ExcelUtil(PurchasePartInfo.class); + util.exportExcel(response, list, "新购配件验收数据"); + } + /** @@ -136,4 +152,17 @@ public class PurchaseAccessoryController extends BaseController public AjaxResult checkInput(@RequestBody List purchasePartDetails){ return toAjax(purchaseAccessoryService.checkInput(purchasePartDetails)); } + + /** + * 新购配件入库导出 + */ + @ApiOperation("新购配件入库导出") + @Log(title = "新购配件入库导出", businessType = BusinessType.EXPORT) + @PostMapping("/inputExport") + public void inputExport(HttpServletResponse response, PurchasePartDetails bean) + { + List list = purchaseAccessoryService.inputExport(bean); + ExcelUtil util = new ExcelUtil(PurchasePartDetails.class); + util.exportExcel(response, list, "新购配件入库数据"); + } } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/PurchasePartDetails.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/PurchasePartDetails.java index ee2ffa95..13792b89 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/PurchasePartDetails.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/PurchasePartDetails.java @@ -1,5 +1,6 @@ package com.bonus.sgzb.material.domain; +import com.bonus.sgzb.common.core.annotation.Excel; import com.bonus.sgzb.common.core.web.domain.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; @@ -33,6 +34,10 @@ public class PurchasePartDetails extends BaseEntity @ApiModelProperty(value = "规格id") private Long modelId; + @ApiModelProperty(value = "采购单号") + @Excel(name = "采购单号") + private String code; + /** 采购单价 */ @ApiModelProperty(value = "采购单价") private String purchasePrice; @@ -124,9 +129,6 @@ public class PurchasePartDetails extends BaseEntity @ApiModelProperty(value = "管理方式(0编号 1计数)") private String manageType; - @ApiModelProperty(value = "采购单号") - private String code; - @ApiModelProperty(value = "关键字筛选") private String keyWord; diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/PurchasePartInfo.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/PurchasePartInfo.java index c36b55fe..504742b6 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/PurchasePartInfo.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/PurchasePartInfo.java @@ -39,43 +39,46 @@ public class PurchasePartInfo extends BaseEntity @Excel(name = "到货日期") private String arrivalTime; - /** 采购员名称 */ - @ApiModelProperty(value = "采购员名称") - @Excel(name = "采购员") - private String purchaserName; - /** 采购员 */ @ApiModelProperty(value = "采购员") private Long purchaser; /** 采购机具设备名称 */ @ApiModelProperty(value = "采购机具设备") - @Excel(name = "机具类型名称") + @Excel(name = "配件名称") private String purchasingTypeName; /** 采购机具设备型号 */ @ApiModelProperty(value = "规格型号") - @Excel(name = "规格型号") + @Excel(name = "配件规格") private String purchasingTypeCode; + /** 采购员名称 */ + @ApiModelProperty(value = "采购员名称") + @Excel(name = "采购员") + private String purchaserName; + /** 管理模式 */ @ApiModelProperty(value = "管理模式") - @Excel(name = "管理模式",readConverterExp = "0=编码管理,1=计数管理") private String manageType; - /** 机具厂家 */ - @ApiModelProperty(value = "机具厂家") - @Excel(name = "机具厂家") - private String supplier; + /** 采购单价 */ + @ApiModelProperty(value = "采购单价") + @Excel(name = "采购单价") + private String purchasePrice; /** 采购数量 */ @ApiModelProperty(value = "采购数量") @Excel(name = "采购数量") private String purchaseNum; + /** 配件厂家 */ + @ApiModelProperty(value = "配件厂家") + @Excel(name = "配件厂家") + private String supplier; + /** 验收数量 */ @ApiModelProperty(value = "验收数量") - @Excel(name = "验收数量") private String checkNum; /** 采购状态 */ @@ -324,6 +327,14 @@ public class PurchasePartInfo extends BaseEntity this.taskStatusResult = taskStatusResult; } + public String getPurchasePrice() { + return purchasePrice; + } + + public void setPurchasePrice(String purchasePrice) { + this.purchasePrice = purchasePrice; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseAccessoryMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseAccessoryMapper.java index 8f408f39..11263b66 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseAccessoryMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseAccessoryMapper.java @@ -86,4 +86,18 @@ public interface PurchaseAccessoryMapper int updatePartTypeNum(@Param("partId") Long partId,@Param("inputNum") BigDecimal inputNum); int setlectStatusById(Long id); + + /** + * 新购配件导出 + * @param bean + * @return List + */ + List exportList(PurchasePartInfo bean); + + /** + * 新购配件入库导出 + * @param bean + * @return List + */ + List inputExport(PurchasePartDetails bean); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseAccessoryService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseAccessoryService.java index 5d4ed432..f439d5a6 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseAccessoryService.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseAccessoryService.java @@ -73,4 +73,18 @@ public interface IPurchaseAccessoryService List selectPutinDetails(PurchasePartDetails purchasePartDetails); int checkInput(List purchasePartDetails); + + /** + * 新购配件导出 + * @param bean + * @return List + */ + List exportList(PurchasePartInfo bean); + + /** + * 新购配件入库导出 + * @param bean + * @return List + */ + List inputExport(PurchasePartDetails bean); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseAccessoryServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseAccessoryServiceImpl.java index dd383917..2bb310fa 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseAccessoryServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseAccessoryServiceImpl.java @@ -281,6 +281,16 @@ public class PurchaseAccessoryServiceImpl implements IPurchaseAccessoryService return res; } + @Override + public List exportList(PurchasePartInfo bean) { + return purchaseAccessoryMapper.exportList(bean); + } + + @Override + public List inputExport(PurchasePartDetails bean) { + return purchaseAccessoryMapper.inputExport(bean); + } + /** * 新购配件--采购单号编码生成规则 */ diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseAccessoryMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseAccessoryMapper.xml index 281c0b2e..fca94da3 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseAccessoryMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseAccessoryMapper.xml @@ -266,25 +266,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + \ No newline at end of file