| package doumeemes.api.ext; | 
|   | 
| import doumeemes.api.BaseController; | 
| import doumeemes.core.annotation.excel.ExcelExporter; | 
| import doumeemes.core.annotation.pr.PreventRepeat; | 
| import doumeemes.core.model.ApiResponse; | 
| import doumeemes.core.model.PageWrap; | 
| import doumeemes.core.model.PageData; | 
| import doumeemes.core.utils.DateUtil; | 
| import doumeemes.dao.business.model.WOutbound; | 
| import doumeemes.dao.business.model.WTransfer; | 
| import doumeemes.dao.ext.bean.*; | 
| import doumeemes.dao.ext.beanDto.QueryWOutBoundDto; | 
| import doumeemes.dao.ext.beanDto.QueryWSOutBoundDto; | 
| import doumeemes.dao.ext.dto.QueryWOutboundExtDTO; | 
| import doumeemes.dao.ext.vo.WOutboundExtListVO; | 
| import doumeemes.dao.ext.vo.WOutboundListCountVO; | 
| import doumeemes.dao.ext.vo.WorkOrderOutboundExtListVO; | 
| import doumeemes.service.business.WOutboundService; | 
| import doumeemes.service.ext.WOutboundExtService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiImplicitParam; | 
| import io.swagger.annotations.ApiImplicitParams; | 
| import io.swagger.annotations.ApiOperation; | 
| import io.swagger.models.auth.In; | 
| import org.apache.shiro.authz.annotation.RequiresPermissions; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.validation.annotation.Validated; | 
| import org.springframework.web.bind.annotation.*; | 
| import javax.servlet.http.HttpServletResponse; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| /** | 
|  * 出入库单信息接口 | 
|  * @author 江蹄蹄 | 
|  * @date 2022/04/20 10:57 | 
|  */ | 
| @RestController | 
| @RequestMapping("/ext/wOutboundExt") | 
| @Api(tags = "出入库单信息接口") | 
| public class WOutboundExtController extends BaseController { | 
|   | 
|     @Autowired | 
|     private WOutboundExtService wOutboundExtService; | 
|      | 
|     @Autowired | 
|     private WOutboundService wOutboundService; | 
|   | 
| //    @PreventRepeat | 
| //    @ApiOperation("新建") | 
| //    @PostMapping("/create") | 
| //    @RequiresPermissions("ext:woutboundext:create") | 
| //    public ApiResponse create(@RequestBody WOutbound wOutbound) { | 
| //        return ApiResponse.success(wOutboundService.create(wOutbound)); | 
| //    } | 
| // | 
| //    @ApiOperation("根据ID删除") | 
| //    @GetMapping("/delete/{id}") | 
| //    @RequiresPermissions("ext:woutboundext:delete") | 
| //    public ApiResponse deleteById(@PathVariable Integer id) { | 
| //        wOutboundService.deleteById(id); | 
| //        return ApiResponse.success(null); | 
| //    } | 
| // | 
| //    @ApiOperation("批量删除") | 
| //    @GetMapping("/delete/batch") | 
| //    @RequiresPermissions("ext:woutboundext:delete") | 
| //    public ApiResponse deleteByIds(@RequestParam String ids) { | 
| //        String [] idArray = ids.split(","); | 
| //        List<Integer> idList = new ArrayList<>(); | 
| //        for (String id : idArray) { | 
| //            idList.add(Integer.valueOf(id)); | 
| //        } | 
| //        wOutboundService.deleteByIdInBatch(idList); | 
| //        return ApiResponse.success(null); | 
| //    } | 
| // | 
| //    @ApiOperation("根据ID修改") | 
| //    @PostMapping("/updateById") | 
| //    @RequiresPermissions("ext:woutboundext:update") | 
| //    public ApiResponse updateById(@RequestBody WOutbound wOutbound) { | 
| //        wOutboundService.updateById(wOutbound); | 
| //        return ApiResponse.success(null); | 
| //    } | 
| // | 
| //    @ApiOperation("分页查询") | 
| //    @PostMapping("/page") | 
| //    @RequiresPermissions("ext:woutboundext:query") | 
| //    public ApiResponse<PageData<WOutboundExtListVO>> findPage (@RequestBody PageWrap<QueryWOutboundExtDTO> pageWrap) { | 
| //        return ApiResponse.success(wOutboundExtService.findPage(pageWrap)); | 
| //    } | 
| // | 
| //    @ApiOperation("导出Excel") | 
| //    @PostMapping("/exportExcel") | 
| //    @RequiresPermissions("ext:woutboundext:exportExcel") | 
| //    public void exportExcel (@RequestBody PageWrap<QueryWOutboundExtDTO> pageWrap, HttpServletResponse response) { | 
| //        ExcelExporter.build(WOutboundExtListVO.class).export(wOutboundExtService.findPage(pageWrap).getRecords(), "出入库单信息", response); | 
| //    } | 
| // | 
| //    @ApiOperation("根据ID查询") | 
| //    @GetMapping("/{id}") | 
| //    @RequiresPermissions("ext:woutboundext:query") | 
| //    public ApiResponse findById(@PathVariable Integer id) { | 
| //        return ApiResponse.success(wOutboundService.findById(id)); | 
| //    } | 
|   | 
|   | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建") | 
|     @PostMapping("/create") | 
|     @RequiresPermissions("ext:woutboundext:create") | 
|     public ApiResponse create(@Validated @RequestBody WOutBoundBean wOutBoundBean) { | 
|         return wOutboundService.saveBean(wOutBoundBean,getLoginUser()) ; | 
|     } | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建") | 
|     @PostMapping("/createForStandard") | 
|     @RequiresPermissions("ext:woutboundext:create") | 
|     public ApiResponse createForStandard(@Validated @RequestBody WOutBoundBean wOutBoundBean) { | 
|         return wOutboundService.saveBeanForStandard(wOutBoundBean,getLoginUser()) ; | 
|     } | 
|   | 
|     @ApiOperation("分页查询") | 
|     @PostMapping("/page") | 
|     @RequiresPermissions("ext:woutboundext:query") | 
|     public ApiResponse<PageData<WOutboundExtListVO>> findPage (@RequestBody PageWrap<QueryWOutBoundDto> pageWrap) { | 
|         return ApiResponse.success(wOutboundExtService.findListPage(pageWrap)); | 
|     } | 
|   | 
|     @ApiOperation("根据ID查询") | 
|     @GetMapping("/{id}") | 
|     public ApiResponse<WOutbound> findById(@PathVariable Integer id) { | 
|         return ApiResponse.success(wOutboundService.getBeanById(id)); | 
|     } | 
|   | 
|     @ApiOperation("导出Excel") | 
|     @PostMapping("/exportExcel") | 
|     @RequiresPermissions("ext:woutboundext:exportExcel") | 
|     public void exportExcel (@RequestBody QueryWOutBoundDto queryWOutBoundDto, HttpServletResponse response) throws Exception{ | 
|         ExcelExporter.build(WOutboundExtListVO.class).export(wOutboundExtService.listForExcel(queryWOutBoundDto), queryWOutBoundDto.getType()==0?"出":"入"+"库单信息"+DateUtil.getNowLongTime(), response); | 
|     } | 
|   | 
|     @ApiOperation("单据取消") | 
|     @GetMapping("/cancel") | 
|     @RequiresPermissions("ext:woutboundext:cancel") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "主键" , required = true), | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "detail", value = "取消描述" , required = true), | 
|     }) | 
|     public ApiResponse cancel(@RequestParam Integer id,@RequestParam String detail) { | 
|         return wOutboundService.cancel(id,detail,getLoginUser()); | 
|     } | 
|   | 
|     @ApiOperation("出入库分页查询 - H5") | 
|     @PostMapping("/listPage") | 
|     @RequiresPermissions("ext:woutboundext:query") | 
|     public ApiResponse<PageData<WOutboundExtListVO>> listPage (@RequestBody PageWrap<QueryWOutBoundDto> pageWrap) { | 
|         return ApiResponse.success(wOutboundExtService.findListPage(pageWrap)); | 
|     } | 
|   | 
|     @ApiOperation("出入库列表统计 - H5") | 
|     @PostMapping("/pageCount") | 
|     @RequiresPermissions("ext:woutboundext:query") | 
|     public ApiResponse<WOutboundListCountVO> pageCount (@RequestBody QueryWOutBoundDto queryWOutBoundDto) { | 
|         return ApiResponse.success(wOutboundExtService.pageCount(queryWOutBoundDto)); | 
|     } | 
|   | 
|     @ApiOperation("根据转库单获取出库信息 - H5") | 
|     @GetMapping("/getOutByWTransferId") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "转库单主键" , required = true) | 
|     }) | 
|     public ApiResponse<WTransfer> getOutByWTransferIdForH5(@RequestParam Integer id) { | 
|         return wOutboundService.getOutByWTransferId(id); | 
|     } | 
|   | 
|     @ApiOperation("根据转库单获取入库信息 - H5") | 
|     @GetMapping("/getInByWTransferId") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "转库单主键" , required = true) | 
|     }) | 
|     public ApiResponse<WTransfer> getInByWTransferId(@RequestParam Integer id) { | 
|         return wOutboundService.getInByWTransferId(id); | 
|     } | 
|   | 
|   | 
|     @ApiOperation("获出入库单详情 - H5") | 
|     @GetMapping("/findById") | 
|     public ApiResponse<WOutbound> findByIdForH5(@RequestParam Integer id) { | 
|         return ApiResponse.success(wOutboundService.getBeanById(id)); | 
|     } | 
|   | 
|     @ApiOperation("出库扫描篮筐码 - H5") | 
|     @GetMapping("/outScanAppliances") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "pId", value = "转库单主键/出库单主键" , required = true), | 
|             @ApiImplicitParam(paramType = "query", dataType = "String", name = "barCode", value = "条码" , required = true), | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "单据类别 :1=转库单;2=出库单;3:入库单" , required = true), | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "locationId", value = "货位主键" , required = false), | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "warehouseId", value = "仓库主键" , required = false) | 
|     }) | 
|     public ApiResponse<OutScanBean> outScanAppliances(@RequestParam String barCode, @RequestParam Integer type, Integer locationId, @RequestParam Integer pId , Integer warehouseId) { | 
|         return wOutboundService.outScanAppliances(barCode,type,pId,warehouseId,locationId,getLoginUser()); | 
|     } | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("出库单保存 - H5") | 
|     @PostMapping("/saveOut") | 
|     @RequiresPermissions("ext:woutboundext:upload") | 
|     public ApiResponse saveOut(@Validated @RequestBody WOutBoundOutBean wOutBoundOutBean) { | 
|         return wOutboundService.saveOut(wOutBoundOutBean,getLoginUser()) ; | 
|     } | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("入库单保存 - H5") | 
|     @PostMapping("/saveIn") | 
|     @RequiresPermissions("ext:woutboundext:upload") | 
|     public ApiResponse saveIn(@Validated @RequestBody WOutBoundOutBean wOutBoundOutBean) { | 
|         return wOutboundService.saveIn(wOutBoundOutBean,getLoginUser()) ; | 
|     } | 
|   | 
|   | 
|     @ApiOperation("据入库货位筛选入库单 - H5") | 
|     @GetMapping("/finishedInBill") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType = "query", dataType = "String", name = "inLocationIds", value = "入库仓位主键" , required = true) | 
|     }) | 
|     public ApiResponse<List<FinishedInBillBean>> finishedInBill(@RequestParam String  inLocationIds) { | 
|         return ApiResponse.success(wOutboundExtService.finishedInBill(inLocationIds,null)); | 
|     } | 
|   | 
|   | 
|     @ApiOperation(value = "出入库单详情与出入库业务处理", notes = "出入库单详情与出入库业务处理 - H5") | 
|     @GetMapping("/wOutBoundForInOut") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "转库单主键" , required = true), | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "wOutboundType", value = "出入库单类别 0:转出;1转入" , required = true), | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "optType", value = "操作类别:1 添加 2 移除" , required = false), | 
|             @ApiImplicitParam(paramType = "query", dataType = "String", name = "jsonBean", value = "添加条码类" , required = false) | 
|     }) | 
|     @RequiresPermissions("ext:woutboundext:deal") | 
|     public ApiResponse<WOutboundRedisBean> wOutBoundForInOut(@RequestParam Integer id, @RequestParam Integer wOutboundType, Integer optType | 
|             , String jsonBean) { | 
|         return ApiResponse.success(wOutboundService.wOutBoundForInOut(id,wOutboundType,optType,jsonBean)); | 
|     } | 
|   | 
|     @ApiOperation(value = "出入库业务处理提交", notes = "出入库业务处理提交 - H5") | 
|     @GetMapping("/wOutBoundForUpload") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "出入库单主键" , required = true), | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "wOutboundType", value = "出入库单类别 0:转出;1转入" , required = true) | 
|     }) | 
|     @RequiresPermissions("ext:woutboundext:upload") | 
|     public ApiResponse wOutBoundForUpload(@RequestParam Integer id, @RequestParam Integer wOutboundType) { | 
|         wOutboundService.wOutBoundForUpload(id,wOutboundType,getLoginUser()); | 
|         return ApiResponse.success("操作成功"); | 
|     } | 
|   | 
|     @ApiOperation(value = "库存调整、采购入库入库单创建", notes = "库存调整、采购入库入库单创建") | 
|     @PostMapping("/wOutBoundForStockUp") | 
|     @RequiresPermissions("ext:woutboundext:adjustment") | 
|     public ApiResponse wOutBoundForStockUp(@Validated @RequestBody WOutboundInHeadBean wOutboundInHeadBean ) { | 
|         wOutboundService.wOutBoundForStockUp(wOutboundInHeadBean,getLoginUser()); | 
|         return ApiResponse.success("操作成功"); | 
|     } | 
|   | 
|     @ApiOperation("出入库明细 - H5") | 
|     @PostMapping("/workOrderOutListPage") | 
|     @RequiresPermissions("ext:woutboundext:query") | 
|     public ApiResponse<PageData<WorkOrderOutboundExtListVO>> workOrderOutListPage (@RequestBody PageWrap<QueryWSOutBoundDto> pageWrap) { | 
|         return ApiResponse.success(wOutboundExtService.workOrderOutList(pageWrap)); | 
|     } | 
|   | 
|   | 
|     @ApiOperation("出入库明细 - 导出Excel") | 
|     @PostMapping("/workOrderOutListExcel") | 
|     public void exportExcel (@RequestBody PageWrap<QueryWSOutBoundDto> pageWrap, HttpServletResponse response) throws Exception{ | 
|         ExcelExporter.build(WorkOrderOutboundExtListVO.class).export(wOutboundExtService.workOrderOutList(pageWrap).getRecords(), "出入库明细"+DateUtil.getNowLongTime(), response); | 
|     } | 
|   | 
|   | 
| } |