|
|
@ -3,13 +3,21 @@ package com.win.module.wms.controller.productionreceiptRecord; |
|
|
|
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; |
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
import com.win.module.wms.controller.issueJob.vo.IssueJobMainExcelVO; |
|
|
|
import com.win.module.wms.controller.productionreceiptRecord.vo.*; |
|
|
|
import com.win.module.wms.convert.issueJob.IssueJobMainConvert; |
|
|
|
import com.win.module.wms.convert.productionreceiptRecord.ProductionreceiptRecordMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.issueJob.IssueJobDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.issueJob.IssueJobMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productionreceiptRecord.ProductionreceiptRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productionreceiptRecord.ProductionreceiptRecordMainDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.productionreceiptRecord.ProductionreceiptRecordDetailService; |
|
|
|
import com.win.module.wms.service.productionreceiptRecord.ProductionreceiptRecordMainService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
@ -22,8 +30,7 @@ import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.validation.Valid; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
@ -34,36 +41,14 @@ import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
|
@Validated |
|
|
|
public class ProductionreceiptRecordMainController { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private ProductionreceiptRecordDetailService productionreceiptRecordDetailService; |
|
|
|
@Resource |
|
|
|
private ProductionreceiptRecordMainService productionreceiptRecordMainService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private AdminUserApi userApi; |
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
|
@Operation(summary = "创建生产收料记录主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productionreceipt-record-main:create')") |
|
|
|
public CommonResult<Long> createProductionreceiptRecordMain(@Valid @RequestBody ProductionreceiptRecordMainCreateReqVO createReqVO) { |
|
|
|
return success(productionreceiptRecordMainService.createProductionreceiptRecordMain(createReqVO)); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/update") |
|
|
|
@Operation(summary = "更新生产收料记录主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productionreceipt-record-main:update')") |
|
|
|
public CommonResult<Boolean> updateProductionreceiptRecordMain(@Valid @RequestBody ProductionreceiptRecordMainUpdateReqVO updateReqVO) { |
|
|
|
productionreceiptRecordMainService.updateProductionreceiptRecordMain(updateReqVO); |
|
|
|
return success(true); |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping("/delete") |
|
|
|
@Operation(summary = "删除生产收料记录主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productionreceipt-record-main:delete')") |
|
|
|
public CommonResult<Boolean> deleteProductionreceiptRecordMain(@RequestParam("id") Long id) { |
|
|
|
productionreceiptRecordMainService.deleteProductionreceiptRecordMain(id); |
|
|
|
return success(true); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/get") |
|
|
|
@Operation(summary = "获得生产收料记录主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
|
@ -90,23 +75,6 @@ public class ProductionreceiptRecordMainController { |
|
|
|
return success(ProductionreceiptRecordMainConvert.INSTANCE.convertPage(pageResult)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel") |
|
|
|
@Operation(summary = "导出生产收料记录主 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productionreceipt-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportProductionreceiptRecordMainExcel(@Valid ProductionreceiptRecordMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<ProductionreceiptRecordMainDO> list = productionreceiptRecordMainService.getProductionreceiptRecordMainList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
List<ProductionreceiptRecordMainExcelVO> datas = ProductionreceiptRecordMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(ProductionreceiptRecordMainExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "生产收料记录主.xls", "数据", ProductionreceiptRecordMainExcelVO.class, datas); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/senior") |
|
|
|
@Operation(summary = "高级搜索获得生产收料记录主分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productionreceipt-record-main:query')") |
|
|
@ -121,4 +89,64 @@ public class ProductionreceiptRecordMainController { |
|
|
|
return success(result); |
|
|
|
} |
|
|
|
|
|
|
|
private List<ProductionreceiptRecordMainExcelVO> getExcelVo(List<ProductionreceiptRecordMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] locationType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
mapDropDown.put(17, locationType); |
|
|
|
mapDropDown.put(18, locationType); |
|
|
|
String[] areaType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.AREA_TYPE); |
|
|
|
mapDropDown.put(24, areaType); |
|
|
|
mapDropDown.put(25, areaType); |
|
|
|
String[] trueFalse = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(26, trueFalse); |
|
|
|
mapDropDown.put(27, trueFalse); |
|
|
|
mapDropDown.put(28, trueFalse); |
|
|
|
mapDropDown.put(29, trueFalse); |
|
|
|
mapDropDown.put(30, trueFalse); |
|
|
|
mapDropDown.put(31, trueFalse); |
|
|
|
mapDropDown.put(32, trueFalse); |
|
|
|
mapDropDown.put(33, trueFalse); |
|
|
|
mapDropDown.put(34, trueFalse); |
|
|
|
mapDropDown.put(35, trueFalse); |
|
|
|
mapDropDown.put(36, trueFalse); |
|
|
|
List<ProductionreceiptRecordMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for(ProductionreceiptRecordMainDO mainDO : list) { |
|
|
|
List<ProductionreceiptRecordDetailDO> subList = productionreceiptRecordDetailService.selectList(mainDO.getId()); |
|
|
|
for(ProductionreceiptRecordDetailDO detailDO : subList) { |
|
|
|
ProductionreceiptRecordMainExcelVO vo = ProductionreceiptRecordMainConvert.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") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productionreceipt-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportProductionreceiptRecordMainExcel(@Valid ProductionreceiptRecordMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<ProductionreceiptRecordMainDO> list = productionreceiptRecordMainService.getProductionreceiptRecordList(exportReqVO); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<ProductionreceiptRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "生产收料记录.xlsx", "生产收料", ProductionreceiptRecordMainExcelVO.class, resultList, mapDropDown);; |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出生产收料记录 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productionreceipt-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportProductionreceiptRecordMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<ProductionreceiptRecordMainDO> list = productionreceiptRecordMainService.getProductionreceiptRecordMainList(conditions); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<ProductionreceiptRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "生产收料记录.xlsx", "生产收料", ProductionreceiptRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|