| | |
| | | import com.consum.base.pojo.response.FormInventoryGoodsVO; |
| | | import com.consum.base.pojo.response.FormInventoryVO; |
| | | import com.consum.base.service.FinSysTenantUserServiceImpl; |
| | | import com.consum.base.service.LWhFormInventoryServiceImpl; |
| | | import com.consum.base.service.LWhFormInventoryService; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormInventory; |
| | | import com.iplatform.model.po.S_user_core; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | public class LWhFormInventoryController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LWhFormInventoryServiceImpl lWhFormInventoryService; |
| | | private LWhFormInventoryService lWhFormInventoryService; |
| | | @Autowired |
| | | private FinSysTenantUserServiceImpl finSysTenantUserService; |
| | | |
| | |
| | | FinSysTenantUser monitorUserInfo = new FinSysTenantUser(); |
| | | monitorUserInfo.setId(param.getMonitorUserId()); |
| | | FinSysTenantUser monitorUser = finSysTenantUserService.get(monitorUserInfo); |
| | | int result = this.lWhFormInventoryService.add(param, this.getSysInfo(), operatorUser, monitorUser); |
| | | int result = lWhFormInventoryService.add(param, this.getSysInfo(), operatorUser, monitorUser); |
| | | if (result > 0) { |
| | | return ResponseValue.success(); |
| | | } |
| | |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | GenericPager<LWhFormInventory> pager = this.lWhFormInventoryService.queryList(param, sysInfo); |
| | | GenericPager<LWhFormInventory> pager = lWhFormInventoryService.queryList(param, sysInfo); |
| | | return ResponseValue.success(pager); |
| | | } |
| | | |
| | |
| | | return ResponseValue.error("参数不能为空"); |
| | | } |
| | | //通过机构查询相关的模板信息 |
| | | FormInventoryVO formInventoryVO = this.lWhFormInventoryService.queryInventBaseGoodTemplate(id); |
| | | FormInventoryVO formInventoryVO = lWhFormInventoryService.queryInventBaseGoodTemplate(id); |
| | | |
| | | // 保存后返回记录信息 |
| | | List<FormInventoryGoodsVO> result = this.lWhFormInventoryService.saveInventory(formInventoryVO, id); |
| | | FormInventoryVO result = lWhFormInventoryService.saveInventory(formInventoryVO, id); |
| | | return ResponseValue.success(result); |
| | | } |
| | | |
| | |
| | | FinSysTenantUser monitorUserInfo = new FinSysTenantUser(); |
| | | monitorUserInfo.setId(param.getMonitorUserId()); |
| | | FinSysTenantUser monitorUser = finSysTenantUserService.get(monitorUserInfo); |
| | | int result = this.lWhFormInventoryService.add(param, this.getSysInfo(), operatorUser, monitorUser); |
| | | int result = lWhFormInventoryService.add(param, this.getSysInfo(), operatorUser, monitorUser); |
| | | |
| | | if (result > 0) { |
| | | return ResponseValue.success(); |
| | |
| | | return ResponseValue.error("参数错误"); |
| | | } |
| | | |
| | | int num = this.lWhFormInventoryService.updateInventoryInfo(param, 1, null, null); |
| | | int num = lWhFormInventoryService.updateInventoryInfo(param, 1, null, null); |
| | | return num > 0 ? ResponseValue.success(1) : ResponseValue.error("暂存失败!"); |
| | | } |
| | | |
| | |
| | | } |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | int num = this.lWhFormInventoryService.updateInventoryInfo(param, 2, currentUser, sysInfo); |
| | | int num = lWhFormInventoryService.updateInventoryInfo(param, 2, currentUser, sysInfo); |
| | | |
| | | return num > 0 ? ResponseValue.success(1) : ResponseValue.error("盘点失败!"); |
| | | } |
| | |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | PageUtil<FormInventoryDetailVO> result = this.lWhFormInventoryService.queryPdDetailList(param, sysInfo); |
| | | PageUtil<FormInventoryDetailVO> result = lWhFormInventoryService.queryPdDetailList(param, sysInfo); |
| | | return ResponseValue.success(result); |
| | | } |
| | | |
| | |
| | | |
| | | LWhFormInventory lWhFormInventory = new LWhFormInventory(); |
| | | lWhFormInventory.setId(id); |
| | | LWhFormInventory item = this.lWhFormInventoryService.get(lWhFormInventory); |
| | | LWhFormInventory item = lWhFormInventoryService.get(lWhFormInventory); |
| | | if (Objects.isNull(item)) { |
| | | return ResponseValue.error("盘点单不存在"); |
| | | } |
| | | BeanUtils.copyProperties(item, formInventoryVO); |
| | | List<FormInventoryGoodsVO> formInventoryGoodsVOS = this.lWhFormInventoryService.selectDetailById(id); |
| | | List<FormInventoryGoodsVO> formInventoryGoodsVOS = lWhFormInventoryService.selectDetailById(id); |
| | | formInventoryVO.setFormInventoryGoodsList(formInventoryGoodsVOS); |
| | | return ResponseValue.success(formInventoryVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "盘点单导出", notes = "盘点单导出") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "盘点单id", dataType = "Long", required = true, paramType = "query") |
| | | }) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | |
| | | List<InventoryExcelTemplate> exportList = lWhFormInventoryService.getExportList(id); |
| | | if (CollectionUtils.isEmpty(exportList)) { |
| | |
| | | exportList, map); |
| | | |
| | | downLoadExcel("低值易耗品盘点表", response, workbook); |
| | | } |
| | | |
| | | private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) { |
| | | try (OutputStream out = response.getOutputStream()) { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xls", "UTF-8")); |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | workbook.write(baos); |
| | | response.setHeader("Content-Length", String.valueOf(baos.size())); |
| | | out.write(baos.toByteArray()); |
| | | } catch (Exception e) { |
| | | logger.error("导出文件失败", e); |
| | | } |
| | | } |
| | | |
| | | |