package com.steerinfo.dil.controller; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.service.IRmsPwarehouseGridService; import com.steerinfo.dil.service.IWmspRestackScanResultService; import com.steerinfo.dil.service.impl.RmsPwarehouseGridServiceImpl; import com.steerinfo.dil.service.impl.WmspRestackMakeResultServiceImpl; import com.steerinfo.dil.service.impl.WmspRestackScanResultServiceImpl; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.service.pagehelper.PageHelper; import com.steerinfo.dil.model.WmspRestackMakeResult; import com.steerinfo.dil.service.IWmspRestackMakeResultService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.*; import java.math.BigDecimal; /** * WmspRestackMakeResult RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-09-06 03:02 * 类描述 * 修订历史: * 日期:2021-09-06 * 作者:generator * 参考: * 描述:WmspRestackMakeResult RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/wmsprestackmakeresults") public class WmspRestackMakeResultController extends BaseRESTfulController { @Autowired WmspRestackMakeResultServiceImpl wmspRestackMakeResultService; @Autowired ColumnDataUtil columnDataUtil; @Autowired RmsPwarehouseGridServiceImpl rmsPwarehouseGridService; @Autowired ESFeign esFeign; @Autowired WmspRestackScanResultServiceImpl wmspRestackScanResultService; @ApiOperation(value="展示物资信息,并根据仓库,垛位,层次进行筛选", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "106", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/getWmspRestackMakeResultList") public RESTfulResult getWmspRestackMakeResultList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, Integer warehouseid, Integer stackingId, Integer gradtionNumber, String con ){ if (mapVal==null){ mapVal=new HashMap<>(); } int count=0; //不分页筛选数据 if (warehouseid!=null){ mapVal.put("warehouseid",warehouseid); count++; } if (gradtionNumber!=null){ mapVal.put("gradtionNumber",gradtionNumber); count++; } if (stackingId!=null){ mapVal.put("stackingId",stackingId); count++; } if (con != null) { if (!"undefined".equals(con)) { String index = "get_wms_restackresult";//设置要查询的索引名称 return success(esFeign.getConResult(mapVal, index, apiId, pageNum, pageSize, con));//获取查询结果 } } List> libaryInBoundList = null; if (mapVal.size() == count) { //将查询结果存入索引中 libaryInBoundList = wmspRestackMakeResultService.selectRestackMakeResultList(mapVal); Map map1 = new HashMap<>(); //添加索引 map1.put("index", "get_wms_restackresult"); //添加id map1.put("indexId", "restackResultId"); libaryInBoundList.add(map1); //新建索引 esFeign.insertIndex(libaryInBoundList); //删除 libaryInBoundList.remove(libaryInBoundList.size() - 1); } if (libaryInBoundList == null) { libaryInBoundList = wmspRestackMakeResultService.selectRestackMakeResultList(mapVal); } PageHelper.startPage(pageNum, pageSize); List> columnList = wmspRestackMakeResultService.selectRestackMakeResultList(mapVal); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, libaryInBoundList, columnList); return success(pageList); } //添加库管员填写倒垛单实绩 @ApiOperation(value="添加库管员编写倒垛单实绩", notes="根据WmspRestackMakeResult对象创建") @ApiImplicitParam(name = "wmspRestackMakeResult", value = "详细实体wmspRestackMakeResult", required = true, dataType = "WmspRestackMakeResult") //@RequiresPermissions("wmsprestackmakeresult:create") @PostMapping(value = "/addRestackMakeResult") public RESTfulResult addRestackMakeResult(@RequestBody Map mapval){ int code= wmspRestackMakeResultService.addMakeResult(mapval); return success(code); } //删除 @PostMapping(value = "/deleteByResultId/{resultId}", produces = "application/json;charset=UTF-8") public RESTfulResult deleteByResultId(@PathVariable String resultId){ WmspRestackMakeResult wmspRestackMakeResult=new WmspRestackMakeResult(); wmspRestackMakeResult.setResultId(new BigDecimal(resultId)); wmspRestackMakeResult.setDeleted(new BigDecimal(1)); wmspRestackMakeResultService.updateByPrimaryKeySelective(wmspRestackMakeResult); return success(); } //下发 @ApiOperation(value="下发", notes="根据url的id下发") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @PostMapping(value = "/dispatchDistrubtionStatus/{resultId}")//BigDecimal public RESTfulResult dispatchDistrubtionStatus(@PathVariable String resultId){ WmspRestackMakeResult wmspRestackMakeResult=new WmspRestackMakeResult(); wmspRestackMakeResult.setResultId(new BigDecimal(resultId)); wmspRestackMakeResult.setDistributionstatus(new BigDecimal(1)); //设置下发时间 wmspRestackMakeResult.setResultKeeperIssueTime(new Date()); wmspRestackMakeResultService.updateByPrimaryKeySelective(wmspRestackMakeResult); return success(); } //下拉框获取层次号 @GetMapping(value = "/selectGardationNumber", produces = "application/json;charset=UTF-8") public RESTfulResult selectGardationNumber( Integer warehouseid,Integer stackingId){ List> code=wmspRestackMakeResultService.selectGardationNumber(warehouseid,stackingId); return success(code); } //下拉框获取垛位 @GetMapping(value = "/selectStackingId", produces = "application/json;charset=UTF-8") public RESTfulResult selectStackingId(Integer warehouseid){ List> code=wmspRestackMakeResultService.selectStackingId(warehouseid); return success(code); } //下拉框获取仓库名称 @GetMapping(value = "/selectWarehouse", produces = "application/json;charset=UTF-8") public RESTfulResult selectWarehouse(){ List> code=wmspRestackMakeResultService.selectWarehouse(); return success(code); } @ApiOperation(value="展示未下发倒垛单", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "368", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/selectRestackList") public RESTfulResult selectRestackList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, Integer DistrubtionStatus ) { if (mapVal == null) { mapVal = new HashMap<>(); } mapVal.put("DistrubtionStatus", DistrubtionStatus); //不分页筛选数据 List> list = wmspRestackMakeResultService.selectRestackForPc(mapVal); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = wmspRestackMakeResultService.selectRestackForPc(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList); return success(data); } @ApiOperation(value="展示已下发倒垛单", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "368", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/selectRestackList2") public RESTfulResult selectRestackList2(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, Integer DistrubtionStatus ) { if (mapVal == null) { mapVal = new HashMap<>(); } mapVal.put("DistrubtionStatus", DistrubtionStatus); //不分页筛选数据 List> list = wmspRestackMakeResultService.selectRestackForPc(mapVal); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = wmspRestackMakeResultService.selectRestackForPc(mapVal); // 将获取到的columnList中的完成状态用中文表示 for (Map map1: list){ BigDecimal resultStatus =(BigDecimal)map1.get("resultStatus"); if (resultStatus.equals(0)){ map1.put("resultStatus","未完成"); } if (resultStatus.equals(1)){ map1.put("resultStatus","已完成"); } } PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList); return success(data); } //根据实绩查找倒垛信息 @ApiImplicitParam(value = "apiId:369") @PostMapping(value = "/getRestackInfoByResultId") public RESTfulResult getRestackInfoByResultId(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId ){ String resultId =(String) mapVal.get("resultId"); List> libaryInBoundList = wmspRestackMakeResultService.selectRestackInfoByResultId(resultId); PageHelper.startPage(pageNum, pageSize); List> columnList = wmspRestackMakeResultService.selectRestackInfoByResultId(resultId); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, libaryInBoundList, columnList); return success(pageList); } //修改库管员填写倒垛单实绩 @ApiOperation(value="修改库管员编写倒垛单实绩", notes="根据WmspRestackMakeResult对象创建") @ApiImplicitParam(name = "wmspRestackMakeResult", value = "详细实体wmspRestackMakeResult", required = true, dataType = "WmspRestackMakeResult") //@RequiresPermissions("wmsprestackmakeresult:create") @PostMapping(value = "/editRestackMakeResult") public RESTfulResult editRestackMakeResult(@RequestBody Map map){ int code= wmspRestackMakeResultService.update(map); return success(code); } //渲染倒垛后的仓库信息 @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @PostMapping("/selectAfterWarehouseByResultId/{resultId}") public RESTfulResult selectAfterWarehouseByResultId(@PathVariable("resultId") String resultId){ List> RestackResult = wmspRestackMakeResultService.selectAfterWarehouseByResultId(resultId); return success(RestackResult); } //渲染倒垛后的垛位信息 @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @PostMapping("/selectAfterstackingByResultId/{resultId}") public RESTfulResult selectAfterstackingByResultId(@PathVariable("resultId") String resultId){ List> RestackResult = wmspRestackMakeResultService.selectAfterstackingByResultId(resultId); return success(RestackResult); } //PDA展示倒垛信息 @PostMapping("/selectRestackForPDA") public RESTfulResult selectRestackForPDA(@RequestBody(required = false) Map map){ List> list=wmspRestackMakeResultService.selectRestack(map); return success(list); } //PDA根据实绩id查找物资信息 @PostMapping("/selectMaterialInfoByResultId") public RESTfulResult selectMaterialInfoByResultId(@RequestBody(required = false) Map map ){ String resultId= (String) map.get("resultId"); List> list=wmspRestackMakeResultService.selectMaterialInfoByResultId(resultId); return success(list); } //PDA根据仓库id查找倒垛单 @PostMapping("/selectRestackByWarehouseId") public RESTfulResult selectRestackByWarehouseId(@RequestBody(required = false) Map map ){ Integer warehouseid= (Integer) map.get("warehouseid"); String DistrubtionStatus=(String)map.get("DistrubtionStatus"); Map map1=new HashMap(); map1.put("warehouseid",warehouseid); map1.put("DistrubtionStatus",DistrubtionStatus); List> list=wmspRestackMakeResultService.selectMaterialInfoByResultId(DistrubtionStatus); return success(list); } @ApiOperation(value = "创建倒垛单",notes = "管理员创建一个垛位倒另一个垛位的倒垛单,其中包括原来朵唯信息和物质类型") @ApiImplicitParams({ @ApiImplicitParam(name = "keeperId" ,dataType = "BigDecimal",value = "库管员ID"), @ApiImplicitParam(name = "beforeLevel" ,dataType = "String ",value = "倒垛层"), @ApiImplicitParam(name = "afterStackingId" ,dataType = "BigDecimal",value = "倒垛后垛位id"), @ApiImplicitParam(name = "afterWarehouseId" ,dataType = "BigDecimal",value = "仓库id"), @ApiImplicitParam(name = "afterBeforeStackingId" ,dataType = "BigDecimal",value = "倒垛前的垛位"), @ApiImplicitParam(name = "resultRemark" ,dataType = "BigDecimal",value = "倒垛单备注"), @ApiImplicitParam(name = "maps" ,dataType = "List>",value = "物质型号集合") }) @PostMapping("/createRestackMakeResult") public RESTfulResult createRestackMakeResult(@RequestParam("keeperId") BigDecimal keeperId, @RequestParam("beforeLevel")BigDecimal beforeLevel, @RequestParam(name = "afterStackingId",defaultValue = "20")BigDecimal afterStackingId, @RequestParam("afterWarehouseId")BigDecimal afterWarehouseId, @RequestParam("afterBeforeStackingId") BigDecimal afterBeforeStackingId, @RequestParam("resultRemark")String resultRemark, @RequestBody(required = false) List> mps){ //创建倒垛单和倒垛单类型 WmspRestackMakeResult wmspRestackMakeResult= wmspRestackMakeResultService.createRestackMakeResult(keeperId,beforeLevel,afterStackingId,afterWarehouseId,afterBeforeStackingId,resultRemark,mps); return success(wmspRestackMakeResult); } //PDA根据仓库id查找倒垛单 @GetMapping("/selectRestackByWarehouseIds") public RESTfulResult selectRestackByWarehouseIds(@RequestParam(name = "warehouseid") String warehouseid){ List> list=wmspRestackMakeResultService.selectRestackByWarehouseIds( warehouseid); return success(list); } }