diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 271e80e..f8eed87 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -17,7 +17,7 @@ echo "--------moveFile end--------------" export sgzb_auth_enable=true export sgzb_gateway_enable=true export sgzb_modules_system_enable=true -export sgzb_modules_base_enable=true +export sgzb_modules_base_enable=false export sgzb_modules_file_enable=false export sgzb_modules_material_enable=true diff --git a/scripts/pipeline.sh b/scripts/pipeline.sh index 50d138c..3583573 100644 --- a/scripts/pipeline.sh +++ b/scripts/pipeline.sh @@ -12,11 +12,11 @@ pipeline { withCredentials([usernamePassword(credentialsId: 'f7070987-9b49-4ae1-af6d-53a3bf26799b', passwordVariable: 'Max@2023', usernameVariable: 'bonus')]) { checkout([ $class: 'GitSCM', - branches: [[name: '*/dev-cq']], + branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: '']], submoduleCfg: [], - userRemoteConfigs: [[url: 'http://192.168.0.56:3000/bonus/devicesmgt.git']] + userRemoteConfigs: [[url: 'http://192.168.0.56:3000/bonus/cqdevicemgt.git']] ]) } } diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaMachine.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaMachine.java index 8495f12..3a1c186 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaMachine.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaMachine.java @@ -240,6 +240,12 @@ public class MaMachine extends BaseEntity { @ApiModelProperty(value = "1:二维码绑定标识 2:rfid绑定标识") private Integer flag; + @ApiModelProperty(value = "数据来源(0新购 1盘点 2数据推送)") + private Integer souceBy; + + @ApiModelProperty(value = "数据推送id") + private Integer dataReceiveId; + /** 导出选中列表 */ private List dataCondition; diff --git a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/constant/Constants.java b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/constant/Constants.java index e4b0ccb..e282522 100644 --- a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/constant/Constants.java +++ b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/constant/Constants.java @@ -2,7 +2,7 @@ package com.bonus.sgzb.common.core.constant; /** * 通用常量信息 - * + * * @author ruoyi */ public class Constants @@ -56,6 +56,12 @@ public class Constants * 失败标记 */ public static final Integer FAIL = 500; + /* + * 区分系统标记 + * */ + public static final String UPLOAD_DIR="/data/sgzb/"; + + public static final String UPLOAD_DIR_WIN="D:/data/sgzb"; /** * 登录成功状态 diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/MaPartTypeController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/MaPartTypeController.java index f17785a..a20a61e 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/MaPartTypeController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/MaPartTypeController.java @@ -4,6 +4,7 @@ import com.bonus.sgzb.base.domain.MaPartType; import com.bonus.sgzb.base.domain.MapType; import com.bonus.sgzb.base.service.ExcelService; import com.bonus.sgzb.base.service.IPartTypeService; +import com.bonus.sgzb.common.core.constant.Constants; 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; @@ -44,8 +45,6 @@ public class MaPartTypeController extends BaseController { @Resource private ExcelService excelService; - private static final String UPLOAD_DIR = "D:/work/wcy"; - /** * 查询配件类型列表 @@ -89,21 +88,34 @@ public class MaPartTypeController extends BaseController { @PostMapping("/readExcel") public AjaxResult readExcelFile(@RequestParam("file") MultipartFile file) throws IOException { + String os = System.getProperty("os.name").toLowerCase(); + boolean isLinux = false; + if (os.contains("nix") || os.contains("nux") || os.contains("linux")) { + isLinux = true; + } // 创建上传目录,如果不存在的话 - File dir = new File(UPLOAD_DIR); + File dir = null; + if (isLinux){ + dir = new File(Constants.UPLOAD_DIR); + }else { + dir = new File(Constants.UPLOAD_DIR_WIN); + } + if (!dir.exists()) { dir.mkdirs(); } - // 获取文件名 String fileName = file.getOriginalFilename(); - + Path filePath; // 定义文件路径 - Path filePath = Paths.get(UPLOAD_DIR, fileName); + if (isLinux){ + filePath = Paths.get(Constants.UPLOAD_DIR, fileName); + }else { + filePath = Paths.get(Constants.UPLOAD_DIR_WIN, fileName); + } // 保存文件 file.transferTo(filePath.toFile()); - Map>> stringMapMap = excelService.readExcelFile(filePath.toString()); return AjaxResult.success(); } @@ -115,45 +127,45 @@ public class MaPartTypeController extends BaseController { } - /** - * poi - * 删除配件管理类型 - * - * @param paId - * @return - */ - @DeleteMapping("/{paId}") - public AjaxResult delete (@PathVariable("paId") Long paId){ - if (maPartTypeService.hasChildBypaId(paId)) { - return warn("存在下级仓库列表,不允许删除"); - } - return toAjax(maPartTypeService.deletePaById(paId)); + /** + * poi + * 删除配件管理类型 + * + * @param paId + * @return + */ + @DeleteMapping("/{paId}") + public AjaxResult delete (@PathVariable("paId") Long paId){ + if (maPartTypeService.hasChildBypaId(paId)) { + return warn("存在下级仓库列表,不允许删除"); } - - /** - * 根据id获取数据 - * - * @param paId - * @return - */ - @GetMapping("/{paId}") - public AjaxResult getById (@PathVariable("paId") Long paId){ - MaPartType bean = maPartTypeService.getById(paId); - return AjaxResult.success(bean); - } - - /** - * 根据id修改数据 - * - * @param maPartType - * @return - */ - @PostMapping("/updateById") - public AjaxResult updateById (@RequestBody MaPartType maPartType){ - maPartType.setUpdateBy(SecurityUtils.getUsername()); - return toAjax(maPartTypeService.updateById(maPartType)); - } - - + return toAjax(maPartTypeService.deletePaById(paId)); } + /** + * 根据id获取数据 + * + * @param paId + * @return + */ + @GetMapping("/{paId}") + public AjaxResult getById (@PathVariable("paId") Long paId){ + MaPartType bean = maPartTypeService.getById(paId); + return AjaxResult.success(bean); + } + + /** + * 根据id修改数据 + * + * @param maPartType + * @return + */ + @PostMapping("/updateById") + public AjaxResult updateById (@RequestBody MaPartType maPartType){ + maPartType.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(maPartTypeService.updateById(maPartType)); + } + + +} + diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/MaReceiveController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/MaReceiveController.java new file mode 100644 index 0000000..f309528 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/MaReceiveController.java @@ -0,0 +1,99 @@ +package com.bonus.sgzb.base.controller; + +import cn.hutool.core.collection.CollUtil; +import com.bonus.sgzb.base.domain.DataReceiveDetail; +import com.bonus.sgzb.base.domain.DataReceiveInfo; +import com.bonus.sgzb.base.service.MaReceiveService; +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; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2024/7/24 - 10:47 + */ + +@RestController +@RequestMapping("/receive") +public class MaReceiveController extends BaseController { + + @Resource + private MaReceiveService maReceiveService; + + /** + * 数据推送接收 + */ + @ApiOperation(value = "获取推送数据") + @PostMapping("/dataReceive") + public AjaxResult getProjectInfoAll(@RequestBody List dataReceiveDetails) { + if (CollUtil.isEmpty(dataReceiveDetails)) { + return AjaxResult.error("推送数据为空"); + } + DataReceiveInfo dataReceiveInfo = new DataReceiveInfo(); + dataReceiveInfo.setPushNum(dataReceiveDetails.size()); + int id = maReceiveService.saveDataReceiveInfo(dataReceiveInfo); + if (id == 0) { + return AjaxResult.error("推送数据失败"); + } + for (DataReceiveDetail dataReceiveDetail : dataReceiveDetails) { + dataReceiveDetail.setReceiveId(id); + maReceiveService.saveDataReceiveDetails(dataReceiveDetail); + } + return AjaxResult.success("数据推送成功"); + } + + + @ApiOperation(value = "获取推送数据") + @GetMapping("/getDataReceive") + public TableDataInfo getDataReceive(DataReceiveInfo dataReceiveInfo) { + startPage(); + List list = maReceiveService.getDataReceive(dataReceiveInfo); + return getDataTable(list); + } + + @ApiOperation(value = "导出推送数据") + @PostMapping("/export") + public void export(HttpServletResponse response, DataReceiveInfo dataReceiveInfo) { + List list = maReceiveService.getDataReceive(dataReceiveInfo); + ExcelUtil util = new ExcelUtil<>(DataReceiveInfo.class); + util.exportExcel(response, list, "推送数据列表"); + } + + @ApiOperation(value = "获取推送详情") + @GetMapping("/getDataReceiveDetails") + public TableDataInfo getDataReceiveDetails(DataReceiveDetail dataReceiveDetail) { + startPage(); + List dataReceiveDetails = maReceiveService.getDataReceiveDetails(dataReceiveDetail); + return getDataTable(dataReceiveDetails); + } + + @ApiOperation(value = "数据接收") + @PostMapping("/saveMachine") + public AjaxResult saveMachine(@RequestBody DataReceiveInfo dataReceiveInfo) { + if (CollUtil.isEmpty(dataReceiveInfo.getDataReceiveDetailList())) { + return AjaxResult.error("接收数据为空"); + } + int res = maReceiveService.saveMachine(dataReceiveInfo); + if (res == 0) { + return AjaxResult.error("接收失败"); + } else { + return AjaxResult.success("接收成功"); + } + } + + + @ApiOperation(value = "数据接收") + @GetMapping("/getDateReceiveMachine") + public TableDataInfo getDateReceiveMachine(DataReceiveDetail dataReceiveDetail) { + startPage(); + List dateReceiveMachine = maReceiveService.getDateReceiveMachine(dataReceiveDetail); + return getDataTable(dateReceiveMachine); + } +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/DataReceiveDetail.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/DataReceiveDetail.java new file mode 100644 index 0000000..8c4ccde --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/DataReceiveDetail.java @@ -0,0 +1,88 @@ +package com.bonus.sgzb.base.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @Author:liang.chao + * @Date:2024/7/24 - 10:53 + */ +@Data +public class DataReceiveDetail { + @ApiModelProperty(value = "ID") + private Integer id; + + @ApiModelProperty(value = "推送ID") + private Integer receiveId; + + @ApiModelProperty(value = "机具类型id") + private Integer typeId; + + @ApiModelProperty(value = "机具编码ID") + private Integer maId; + + @ApiModelProperty(value = "机具编码") + private String maCode; + @ApiModelProperty(value = "机具名称") + private String machineName; + @ApiModelProperty(value = "机具类型") + private String typeName; + @ApiModelProperty(value = "机具类型") + private String modelName; + @ApiModelProperty(value = "机具状态") + private String maStatus; + + @ApiModelProperty(value = "租赁日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date rentTime; + + @ApiModelProperty(value = "租赁价格") + private String rentPrice; + + @ApiModelProperty(value = "所属单位") + private Integer unitId; + + @ApiModelProperty(value = "生产厂家") + private String supplier; + + @ApiModelProperty(value = "出厂日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date outFactoryTime; + + @ApiModelProperty(value = "是否新装备(0 是 1否)") + private Integer isNew; + + @ApiModelProperty(value = "检验证编号") + private String checkCode; + + @ApiModelProperty(value = "检验单位") + private String checkUnit; + + @ApiModelProperty(value = "检验日期") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date checkDate; + + @ApiModelProperty(value = "下次检验日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date nextCheckDate; + + @ApiModelProperty(value = "机手姓名") + private String maUserName; + + @ApiModelProperty(value = "关键字") + private String keyWord; + + @ApiModelProperty(value = "状态(0 未接收 1已接收)") + private Integer status; + @ApiModelProperty(value = "数据来源(0新购 1盘点 2数据推送)") + private Integer souceBy; + +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/DataReceiveInfo.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/DataReceiveInfo.java new file mode 100644 index 0000000..c721f76 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/DataReceiveInfo.java @@ -0,0 +1,46 @@ +package com.bonus.sgzb.base.domain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2024/7/24 - 13:11 + */ + +@Data +public class DataReceiveInfo { + @ApiModelProperty(value = "id") + private Integer id; + + @ApiModelProperty(value = "接收状态(0 未完成 1已完成)") + @Excel(name = "接收状态", readConverterExp = "0=未完成,1=已完成") + private Integer receiveStatus; + + @ApiModelProperty(value = "推送数量") + @Excel(name = "推送数量") + private Integer pushNum; + + @ApiModelProperty(value = "接收数量") + @Excel(name = "接收数量") + private Integer receiveNum; + + @ApiModelProperty(value = "接收日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "推送日期") + private Date receiveDate; + + @ApiModelProperty(value = "开始时间") + private String startTime; + @ApiModelProperty(value = "结束时间") + private String endTime; + + private List dataReceiveDetailList; +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaReceiveMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaReceiveMapper.java new file mode 100644 index 0000000..d574a3c --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaReceiveMapper.java @@ -0,0 +1,28 @@ +package com.bonus.sgzb.base.mapper; + +import com.bonus.sgzb.base.domain.DataReceiveDetail; +import com.bonus.sgzb.base.domain.DataReceiveInfo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2024/7/24 - 13:21 + */ + +@Mapper +public interface MaReceiveMapper { + int saveDataReceiveInfo(DataReceiveInfo dataReceiveInfo); + int saveDataReceiveDetails(DataReceiveDetail dataReceiveDetail); + List getDataReceive(DataReceiveInfo dataReceiveInfo); + + List getDataReceiveDetails(DataReceiveDetail dataReceiveDetail); + List getDataReceiveDetailsById(Integer receiveId); + + int updateStatus(DataReceiveDetail dataReceiveDetail); + + List getDateReceiveMachine(DataReceiveDetail dataReceiveDetail); + + int updateInfoStatus(Integer id); +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java index d1d90d0..0777ba3 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java @@ -1,5 +1,6 @@ package com.bonus.sgzb.base.mapper; +import com.bonus.sgzb.base.api.domain.MaMachine; import com.bonus.sgzb.base.api.domain.MaType; import com.bonus.sgzb.base.domain.MaPropSet; import com.bonus.sgzb.base.domain.MaTypeKeeper; @@ -81,4 +82,6 @@ public interface MaTypeMapper { int deleteKeeperByTypeId(Long typeId); int deletePropSetByTypeId(Long typeId); + + int updateTypeNum(MaMachine maMachine); } \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/MaReceiveService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/MaReceiveService.java new file mode 100644 index 0000000..087cf15 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/MaReceiveService.java @@ -0,0 +1,23 @@ +package com.bonus.sgzb.base.service; + +import com.bonus.sgzb.base.domain.DataReceiveDetail; +import com.bonus.sgzb.base.domain.DataReceiveInfo; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2024/7/24 - 13:20 + */ +public interface MaReceiveService { + int saveDataReceiveInfo(DataReceiveInfo dataReceiveInfo); + + int saveDataReceiveDetails(DataReceiveDetail dataReceiveDetail); + + List getDataReceive(DataReceiveInfo dataReceiveInfo); + List getDataReceiveDetails(DataReceiveDetail dataReceiveDetail); + + int saveMachine(DataReceiveInfo dataReceiveInfo); + + List getDateReceiveMachine(DataReceiveDetail dataReceiveDetail); +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/ExcelServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/ExcelServiceImpl.java index fb46153..af0e5fb 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/ExcelServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/ExcelServiceImpl.java @@ -1,14 +1,10 @@ package com.bonus.sgzb.base.service.impl;// ExcelServiceImpl.java - import com.bonus.sgzb.base.domain.MaPartType; import com.bonus.sgzb.base.domain.MapType; import com.bonus.sgzb.base.mapper.ExcelMapper; import com.bonus.sgzb.base.service.ExcelService; import com.bonus.sgzb.common.security.utils.SecurityUtils; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -44,7 +40,37 @@ public class ExcelServiceImpl implements ExcelService { while (iterator.hasNext()) { Row currentRow = iterator.next(); if (currentRow.getRowNum() == 0) { - // 跳过标题行 + // 校验模板 + Cell zeroLevelCell = currentRow.getCell(0); + Cell firstLevelCell = currentRow.getCell(1); + Cell secondLevelCell = currentRow.getCell(2); + Cell thirdLevelCell = currentRow.getCell(3); + Cell fourthLevelCell = currentRow.getCell(4); + Cell fifthLevelCell = currentRow.getCell(5); + String zeroLevel = getCellValueAsString(zeroLevelCell); + String firstLevel = getCellValueAsString(firstLevelCell); + String secondLevel = getCellValueAsString(secondLevelCell); + String thirdLevel = getCellValueAsString(thirdLevelCell); + String fourthLevel = getCellValueAsString(fourthLevelCell); + String fifthLevel = getCellValueAsString(fifthLevelCell); + if (!(zeroLevel.equals("序号"))){ + throw new RuntimeException("导入模板不正确"); + } + if (!(firstLevel.equals("配件类型"))){ + throw new RuntimeException("导入模板不正确"); + } + if (!(secondLevel.equals("配件名称"))){ + throw new RuntimeException("导入模板不正确"); + } + if (!(thirdLevel.equals("规格型号"))){ + throw new RuntimeException("导入模板不正确"); + } + if (!(fourthLevel.equals("单位"))){ + throw new RuntimeException("导入模板不正确"); + } + if (!(fifthLevel.equals("价格"))){ + throw new RuntimeException("导入模板不正确"); + } continue; } @@ -163,7 +189,7 @@ public class ExcelServiceImpl implements ExcelService { for (Map.Entry> secondLevel : firstLevel.getValue().entrySet()) { System.out.println("\tlevel_2: " + secondLevel.getKey()); //TODO, sql查询:是否有此名字 + parentId=firstLevelId, select * from ma_part_type where name=? and parent_id = firstLevelId; - MaPartType maPartType_level2 = excelMapper.selectMa(firstLevel.getKey(),firstLevelId); + MaPartType maPartType_level2 = excelMapper.selectMa(secondLevel.getKey(),firstLevelId); //TODO, 以上返回 maPartType_level2 if (Objects.nonNull(maPartType_level2)) { looplevel3(secondLevel, outExist, maPartType_level2.getPaId()); diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/MaReceiveServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/MaReceiveServiceImpl.java new file mode 100644 index 0000000..ce37e77 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/MaReceiveServiceImpl.java @@ -0,0 +1,117 @@ +package com.bonus.sgzb.base.service.impl; + +import com.bonus.sgzb.base.api.domain.MaMachine; +import com.bonus.sgzb.base.domain.DataReceiveDetail; +import com.bonus.sgzb.base.domain.DataReceiveInfo; +import com.bonus.sgzb.base.mapper.MaMachineMapper; +import com.bonus.sgzb.base.mapper.MaReceiveMapper; +import com.bonus.sgzb.base.mapper.MaTypeMapper; +import com.bonus.sgzb.base.service.MaReceiveService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2024/7/24 - 13:20 + */ +@Service +public class MaReceiveServiceImpl implements MaReceiveService { + + @Resource + private MaReceiveMapper maReceiveMapper; + + @Resource + private MaMachineMapper maMachineMapper; + + @Resource + private MaTypeMapper maTypeMapper; + + @Override + @Transactional + public int saveDataReceiveInfo(DataReceiveInfo dataReceiveInfo) { + maReceiveMapper.saveDataReceiveInfo(dataReceiveInfo); + if (dataReceiveInfo.getId() != null) { + return dataReceiveInfo.getId(); + } else { + return 0; + } + } + + @Override + @Transactional + public int saveDataReceiveDetails(DataReceiveDetail dataReceiveDetail) { + int i = 0; + i = maReceiveMapper.saveDataReceiveDetails(dataReceiveDetail); + if (i == 0) { + throw new RuntimeException("保存失败"); + } + return i; + } + + @Override + public List getDataReceive(DataReceiveInfo dataReceiveInfo) { + List dataReceive = maReceiveMapper.getDataReceive(dataReceiveInfo); + for (DataReceiveInfo receiveInfo : dataReceive) { + List dataReceiveDetails = maReceiveMapper.getDataReceiveDetailsById(receiveInfo.getId()); + long num = dataReceiveDetails.stream() + .filter(t -> t.getStatus() == 1) + .count(); + receiveInfo.setReceiveNum((int) num); + } + return dataReceive; + } + + @Override + public List getDataReceiveDetails(DataReceiveDetail dataReceiveDetail) { + return maReceiveMapper.getDataReceiveDetails(dataReceiveDetail); + } + + @Override + public int saveMachine(DataReceiveInfo dataReceiveInfo) { + for (DataReceiveDetail dataReceiveDetail : dataReceiveInfo.getDataReceiveDetailList()) { + MaMachine maMachine = new MaMachine(); + maMachine.setMaCode(dataReceiveDetail.getMaCode()); + maMachine.setTypeId(dataReceiveDetail.getTypeId()); + maMachine.setMaCode(dataReceiveDetail.getMaCode()); + maMachine.setMaStatus("15"); + maMachine.setCreateTime(new Date()); + maMachine.setSouceBy(2); + maMachine.setDataReceiveId(dataReceiveInfo.getId()); + // 添加机具 + int i = maMachineMapper.maMachineAdd(maMachine); + if (i == 0) { + return i; + } + // 增加库存 + int j = maTypeMapper.updateTypeNum(maMachine); + if (j == 0) { + return j; + } + // 修改状态为已接收 + dataReceiveDetail.setMaId((int) maMachine.getMaId()); + int k = maReceiveMapper.updateStatus(dataReceiveDetail); + if (k == 0) { + return k; + } + } + List dataReceiveDetails = maReceiveMapper.getDataReceiveDetailsById(dataReceiveInfo.getId()); + if (dataReceiveDetails.stream().allMatch(t -> t.getStatus() == 1)) { + int i = maReceiveMapper.updateInfoStatus(dataReceiveInfo.getId()); + if (i == 0) { + return i; + } + } + return 1; + + } + + @Override + public List getDateReceiveMachine(DataReceiveDetail dataReceiveDetail) { + List dateReceiveMachine = maReceiveMapper.getDateReceiveMachine(dataReceiveDetail); + return dateReceiveMachine; + } +} diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaMachineTypeMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaMachineTypeMapper.xml index 9ce2f4b..c01007e 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaMachineTypeMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaMachineTypeMapper.xml @@ -415,4 +415,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + update ma_type set num = IFNULL( num, 0 ) + 1 where type_id = #{typeId} + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaReceiveMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaReceiveMapper.xml new file mode 100644 index 0000000..ee9cc92 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaReceiveMapper.xml @@ -0,0 +1,88 @@ + + + + + + insert into data_receive_info(push_num,receive_date) + values(#{pushNum},now()) + + + insert into data_receive_detail(receive_id,check_code,check_unit,check_date,is_new,ma_code,ma_user_name,next_check_date,out_factory_time,rent_price,rent_time,supplier,type_id,unit_id) + values(#{receiveId},#{checkCode},#{checkUnit},#{checkDate},#{isNew},#{maCode},#{maUserName},#{nextCheckDate},#{outFactoryTime},#{rentPrice},#{rentTime},#{supplier},#{typeId},#{unitId}) + + + UPDATE data_receive_detail + SET STATUS = 1, + ma_id = #{maId} + where receive_id = #{receiveId} and type_id = #{typeId} + AND ma_code = #{maCode} + + + UPDATE data_receive_info + SET receive_status = 1 + where id = #{receiveId} + + + + + + \ No newline at end of file diff --git a/sgzb-ui/src/api/claimAndRefund/return.js b/sgzb-ui/src/api/claimAndRefund/return.js index 03ce585..b5e8cd9 100644 --- a/sgzb-ui/src/api/claimAndRefund/return.js +++ b/sgzb-ui/src/api/claimAndRefund/return.js @@ -169,7 +169,7 @@ export function getBackMachine(query) { // 退料接收 查看记录 export function backReceiveRecordWeb(data) { return request({ - url: 'base/backReceive/backReceiveRecordWeb ', + url: 'material/base/backReceive/backReceiveRecordWeb ', method: 'post', data: data }) @@ -177,7 +177,7 @@ export function backReceiveRecordWeb(data) { export function backReceiveRecordWebPt(data) { return request({ - url: 'base/backReceive/backReceiveRecordWebPt ', + url: 'material/base/backReceive/backReceiveRecordWebPt ', method: 'post', data: data }) @@ -186,7 +186,7 @@ export function backReceiveRecordWebPt(data) { // 退料接收 数量接收 export function setNumBack(data) { return request({ - url: 'base/backReceive/setNumBack', + url: 'material/base/backReceive/setNumBack', method: 'post', data: data }) @@ -195,7 +195,7 @@ export function setNumBack(data) { // 退料接收 编码接收 export function setCodeBack(data) { return request({ - url: 'base/backReceive/setCodeBack', + url: 'material/base/backReceive/setCodeBack', method: 'post', data: data }) @@ -204,7 +204,7 @@ export function setCodeBack(data) { // 退料接收 完成前判断是否存在记录 export function getRecord(query) { return request({ - url: 'base/backReceive/getRecord', + url: 'material/base/backReceive/getRecord', method: 'get', params: query }) @@ -213,7 +213,7 @@ export function getRecord(query) { // 退料接收 撤回操作 export function revoke(data) { return request({ - url: 'base/backReceive/revoke', + url: 'material/base/backReceive/revoke', method: 'post', data: data }) @@ -222,7 +222,7 @@ export function revoke(data) { // 退料接收 完成接收 export function endBack(data) { return request({ - url: 'base/backReceive/endBack', + url: 'material/base/backReceive/endBack', method: 'post', data: data }) diff --git a/sgzb-ui/src/views/base/assetAttributeAllocation/index.vue b/sgzb-ui/src/views/base/assetAttributeAllocation/index.vue index 0246ab5..48fd648 100644 --- a/sgzb-ui/src/views/base/assetAttributeAllocation/index.vue +++ b/sgzb-ui/src/views/base/assetAttributeAllocation/index.vue @@ -481,7 +481,7 @@ /** 导出按钮操作 */ handleExport() { this.download( - 'base/maPropInfo/exportConfig', + 'material/base/maPropInfo/exportConfig', { ...this.queryParams, dataCondition: this.ids, diff --git a/sgzb-ui/src/views/base/assetAttributeManagement/index.vue b/sgzb-ui/src/views/base/assetAttributeManagement/index.vue index ba92516..2608b7d 100644 --- a/sgzb-ui/src/views/base/assetAttributeManagement/index.vue +++ b/sgzb-ui/src/views/base/assetAttributeManagement/index.vue @@ -383,7 +383,7 @@ export default { /** 导出按钮操作 */ handleExport() { this.download( - 'base/maPropInfo/export', + 'material/base/maPropInfo/export', { ...this.queryParams, dataCondition: this.ids, diff --git a/sgzb-ui/src/views/base/comeAndGo/index.vue b/sgzb-ui/src/views/base/comeAndGo/index.vue index 620ec01..ff17b79 100644 --- a/sgzb-ui/src/views/base/comeAndGo/index.vue +++ b/sgzb-ui/src/views/base/comeAndGo/index.vue @@ -471,7 +471,7 @@ export default { /** 导出按钮操作 */ handleExport() { this.download( - 'base/bmUnitInfo/export', + 'material/base/bmUnitInfo/export', { ...this.queryParams, }, diff --git a/sgzb-ui/src/views/base/project/index.vue b/sgzb-ui/src/views/base/project/index.vue index 92ae23c..fbaccea 100644 --- a/sgzb-ui/src/views/base/project/index.vue +++ b/sgzb-ui/src/views/base/project/index.vue @@ -462,7 +462,7 @@ export default { /** 导出按钮操作 */ handleExport() { this.download( - 'base/bmProjectInfo/export', + 'material/base/bmProjectInfo/export', { ...this.queryParams, dataCondition: this.ids, diff --git a/sgzb-ui/src/views/base/section/index.vue b/sgzb-ui/src/views/base/section/index.vue index 7f7289a..735c8ae 100644 --- a/sgzb-ui/src/views/base/section/index.vue +++ b/sgzb-ui/src/views/base/section/index.vue @@ -180,7 +180,7 @@ @@ -836,7 +836,7 @@ export default { /** 导出按钮操作 */ handleExport() { this.downloadJson( - 'base/tm_task/export', + 'material/base/tm_task/export', JSON.stringify(this.queryParams), `领料出库_${new Date().getTime()}.xlsx`, ) diff --git a/sgzb-ui/src/views/claimAndreturn/return/receive/component/home.vue b/sgzb-ui/src/views/claimAndreturn/return/receive/component/home.vue index d997e46..cea5db1 100644 --- a/sgzb-ui/src/views/claimAndreturn/return/receive/component/home.vue +++ b/sgzb-ui/src/views/claimAndreturn/return/receive/component/home.vue @@ -257,7 +257,7 @@ > - +