|
|
@ -1,8 +1,12 @@ |
|
|
|
package com.win.module.wms.controller.repleinshRecord; |
|
|
|
|
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.framework.dict.core.util.DictFrameworkUtils; |
|
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
import com.win.module.wms.dal.dataobject.repleinshRecord.RepleinshRecordDetailDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.repleinshRecord.RepleinshRecordDetailService; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
@ -37,26 +41,14 @@ import com.win.module.wms.service.repleinshRecord.RepleinshRecordMainService; |
|
|
|
@Validated |
|
|
|
public class RepleinshRecordMainController { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private RepleinshRecordDetailService repleinshRecordDetailService; |
|
|
|
@Resource |
|
|
|
private RepleinshRecordMainService repleinshRecordMainService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private AdminUserApi userApi; |
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
|
@Operation(summary = "创建补料记录主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:repleinsh-record-main:create')") |
|
|
|
public CommonResult<Long> createRepleinshRecordMain(@Valid @RequestBody RepleinshRecordMainCreateReqVO createReqVO) { |
|
|
|
return success(repleinshRecordMainService.createRepleinshRecordMain(createReqVO)); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/update") |
|
|
|
@Operation(summary = "更新补料记录主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:repleinsh-record-main:update')") |
|
|
|
public CommonResult<Boolean> updateRepleinshRecordMain(@Valid @RequestBody RepleinshRecordMainUpdateReqVO updateReqVO) { |
|
|
|
repleinshRecordMainService.updateRepleinshRecordMain(updateReqVO); |
|
|
|
return success(true); |
|
|
|
} |
|
|
|
@PostMapping("/senior") |
|
|
|
@Operation(summary = "高级搜索获得补料记录主信息分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:RepleinshRecordMain:query')") |
|
|
@ -71,15 +63,6 @@ public class RepleinshRecordMainController { |
|
|
|
return success(result); |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping("/delete") |
|
|
|
@Operation(summary = "删除补料记录主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:repleinsh-record-main:delete')") |
|
|
|
public CommonResult<Boolean> deleteRepleinshRecordMain(@RequestParam("id") Long id) { |
|
|
|
repleinshRecordMainService.deleteRepleinshRecordMain(id); |
|
|
|
return success(true); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/get") |
|
|
|
@Operation(summary = "获得补料记录主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
|
@ -106,21 +89,55 @@ public class RepleinshRecordMainController { |
|
|
|
return success(RepleinshRecordMainConvert.INSTANCE.convertPage(pageResult)); |
|
|
|
} |
|
|
|
|
|
|
|
private List<RepleinshRecordMainExcelVO> getExcelVo(List<RepleinshRecordMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] locationType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
mapDropDown.put(15, locationType); |
|
|
|
mapDropDown.put(16, locationType); |
|
|
|
String[] useOnTheWayLocation = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(20, useOnTheWayLocation); |
|
|
|
String[] inventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); |
|
|
|
mapDropDown.put(26, inventoryStatus); |
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
mapDropDown.put(41, uom); |
|
|
|
List<RepleinshRecordMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for(RepleinshRecordMainDO mainDO : list) { |
|
|
|
List<RepleinshRecordDetailDO> subList = repleinshRecordDetailService.selectList(mainDO.getId()); |
|
|
|
for(RepleinshRecordDetailDO detailDO : subList) { |
|
|
|
RepleinshRecordMainExcelVO vo = RepleinshRecordMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(mainDO.getCreator())); |
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel") |
|
|
|
@Operation(summary = "导出补料记录主 Excel") |
|
|
|
@Operation(summary = "导出补料记录 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:repleinsh-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportRepleinshRecordMainExcel(@Valid RepleinshRecordMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<RepleinshRecordMainDO> list = repleinshRecordMainService.getRepleinshRecordMainList(exportReqVO); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<RepleinshRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
List<RepleinshRecordMainExcelVO> datas = RepleinshRecordMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(RepleinshRecordMainExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
ExcelUtils.write(response, "补料记录.xlsx", "补料记录", RepleinshRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "补料记录主.xls", "数据", RepleinshRecordMainExcelVO.class, datas); |
|
|
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出补料记录 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:repleinsh-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportRepleinshRecordMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<RepleinshRecordMainDO> list = repleinshRecordMainService.getRepleinshRecordMainList(conditions); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<RepleinshRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "补料记录.xlsx", "补料记录", RepleinshRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|