|
|
@ -3,6 +3,7 @@ package com.win.module.wms.controller.scrapJob; |
|
|
|
import com.win.framework.common.pojo.CommonResult; |
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
import com.win.framework.dict.core.util.DictFrameworkUtils; |
|
|
|
import com.win.framework.excel.core.util.ExcelUtils; |
|
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
@ -12,6 +13,7 @@ import com.win.module.wms.convert.scrapJob.ScrapJobDetailConvert; |
|
|
|
import com.win.module.wms.convert.scrapJob.ScrapJobMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.scrapJob.ScrapJobDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.scrapJob.ScrapJobMainDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.scrapJob.ScrapJobDetailService; |
|
|
|
import com.win.module.wms.service.scrapJob.ScrapJobMainService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
@ -26,10 +28,7 @@ import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.validation.Valid; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
@ -55,19 +54,21 @@ public class ScrapJobMainController { |
|
|
|
public CommonResult<Long> createScrapJobMain(@Valid @RequestBody ScrapJobMainCreateReqVO createReqVO) { |
|
|
|
return success(scrapJobMainService.createScrapJobMain(createReqVO)); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/senior") |
|
|
|
@Operation(summary = "高级搜索获得物料基本信息分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:ScrapJobMain:query')") |
|
|
|
public CommonResult<PageResult<ScrapJobMainRespVO>> getScrapJobMainSenior(@Valid @RequestBody CustomConditions conditions) { |
|
|
|
PageResult<ScrapJobMainDO> pageResult = scrapJobMainService.getScrapJobMainSenior(conditions); |
|
|
|
PageResult<ScrapJobMainRespVO> result = ScrapJobMainConvert.INSTANCE.convertPage(pageResult); |
|
|
|
for(ScrapJobMainRespVO vo : result.getList()) { |
|
|
|
for (ScrapJobMainRespVO vo : result.getList()) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} |
|
|
|
return success(result); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/update") |
|
|
|
@Operation(summary = "更新报废出库任务主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:scrap-job-main:update')") |
|
|
@ -116,16 +117,55 @@ public class ScrapJobMainController { |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:scrap-job-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportScrapJobMainExcel(@Valid ScrapJobMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<ScrapJobMainDO> list = scrapJobMainService.getScrapJobMainList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
List<ScrapJobMainExcelVO> datas = ScrapJobMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(ScrapJobMainExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<ScrapJobMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "补料申请.xlsx", "补料申请", ScrapJobMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出补料申请主 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:scrap-job-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportScrapJobMainExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<ScrapJobMainDO> list = scrapJobMainService.getScrapJobMainList(conditions); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<ScrapJobMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "补料申请.xlsx", "补料申请", ScrapJobMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
private List<ScrapJobMainExcelVO> getExcelVo(List<ScrapJobMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] status = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.JOB_STATUS); |
|
|
|
mapDropDown.put(5, status); |
|
|
|
String[] locationType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
mapDropDown.put(13, locationType); |
|
|
|
mapDropDown.put(14, locationType); |
|
|
|
String[] trueFalse = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(20, trueFalse); |
|
|
|
mapDropDown.put(21, trueFalse); |
|
|
|
mapDropDown.put(22, trueFalse); |
|
|
|
mapDropDown.put(23, trueFalse); |
|
|
|
mapDropDown.put(24, trueFalse); |
|
|
|
mapDropDown.put(25, trueFalse); |
|
|
|
mapDropDown.put(26, trueFalse); |
|
|
|
mapDropDown.put(27, trueFalse); |
|
|
|
mapDropDown.put(28, trueFalse); |
|
|
|
mapDropDown.put(29, trueFalse); |
|
|
|
List<ScrapJobMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for (ScrapJobMainDO mainDO : list) { |
|
|
|
List<ScrapJobDetailDO> subList = scrapJobDetailService.selectList(mainDO.getId()); |
|
|
|
for (ScrapJobDetailDO detailDO : subList) { |
|
|
|
ScrapJobMainExcelVO vo = ScrapJobMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
vo.setCreator(userApi.getUser(Long.valueOf(vo.getCreator())).getNickname()); |
|
|
|
vo.setUpdater(userApi.getUser(Long.valueOf(vo.getUpdater())).getNickname()); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "报废出库任务主.xls", "数据", ScrapJobMainExcelVO.class, datas); |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/getScrapJobById") |
|
|
@ -135,9 +175,10 @@ public class ScrapJobMainController { |
|
|
|
public CommonResult<ScrapJobMainRespVO> getScrapJobById(@RequestParam("id") Long id) { |
|
|
|
ScrapJobMainDO scrapJobMain = scrapJobMainService.getScrapJobMain(id); |
|
|
|
ScrapJobMainRespVO result = ScrapJobMainConvert.INSTANCE.convert(scrapJobMain); |
|
|
|
if(result==null) { |
|
|
|
if (result == null) { |
|
|
|
return success(result); |
|
|
|
}; |
|
|
|
} |
|
|
|
; |
|
|
|
ScrapJobDetailExportReqVO reqVO = new ScrapJobDetailExportReqVO(); |
|
|
|
reqVO.setMasterId(result.getId()); |
|
|
|
List<ScrapJobDetailDO> scrapJobDetailList = scrapJobDetailService.getScrapJobDetailList(reqVO); |
|
|
@ -150,11 +191,11 @@ public class ScrapJobMainController { |
|
|
|
@Operation(summary = "APP获得报废出库任务数量根据任务状态") |
|
|
|
@Parameter(name = "types", description = "类型数组", required = false, example = "\"types\":[\"1\",\"2\"]") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:scrap-job-main:query')") |
|
|
|
public CommonResult<Map<String,Integer>> getCountByStatus(@RequestBody Map<String, List<String>> map) { |
|
|
|
public CommonResult<Map<String, Integer>> getCountByStatus(@RequestBody Map<String, List<String>> map) { |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
if(map==null||map.get("types")==null|| StringUtil.isEmpty(map.get("types").toString())){ |
|
|
|
if (map == null || map.get("types") == null || StringUtil.isEmpty(map.get("types").toString())) { |
|
|
|
list.add("1");//默认不传为执行中的
|
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
list = map.get("types"); |
|
|
|
} |
|
|
|
Map<String, Integer> countByStatus = scrapJobMainService.getCountByStatus(list); |
|
|
|