package com.steerinfo.dil.controller; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.mapper.WmspGridMaterialMapper; import com.steerinfo.dil.model.*; import com.steerinfo.dil.service.ICommonService; import com.steerinfo.dil.service.impl.*; import com.steerinfo.dil.util.*; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.service.pagehelper.PageHelper; 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.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; //import java.util.*; /** * @author luobang * @create 2021-09-06 18:13 */ @Api("入库实绩") @RestController @RequestMapping("${api.version}/inboundResult") public class WmsInboundResultController extends BaseRESTfulController { @Autowired ColumnDataUtil columnDataUtil; @Autowired ESFeign esFeign; @Autowired WmsInboundResultServiceImpl wmsInboundResultServiceImpl; @Autowired WmsInboundScanResultServiceImpl wmsInboundScanResultServiceImpl; @Autowired WmsInboundDrivingResultServiceImpl wmsInboundDrivingResultServiceImpl; @Autowired RmsStackingServiceImpl rmsStackingService; @Autowired RmsPwarehouseGridServiceImpl rmsPwarehouseGridService; @Autowired WmspGridMaterialServiceImpl wmspGridMaterialService; @Autowired WmspGridMaterialMapper wmspGridMaterialMapper; @Autowired WmsInboundStackResultServiceImpl wmsInboundStackResultServiceImpl; @Autowired WmspInboundDistributeServiceImpl wmspInboundDistributeService; @Autowired ICommonService commonService; @Autowired WmsInboundScanResultServiceImpl wmsInboundScanResultService; @Autowired WmspSendReceiveServiceImpl wmspSendReceiveService; private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); /** * 展示入库实绩 * @param mapValue * @param apiId * @param pageNum * @param pageSize * @return */ @PostMapping("/getWmsInboundResult") @ApiOperation(value = "展示入库实绩信息") @ApiImplicitParams({ @ApiImplicitParam(name = "apiId", value = "371", required = false, dataType = "BigDecimal"), }) public RESTfulResult getWmsInboundResult(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, Integer warehouseId, String startTime, String endTime) { DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据 List> inboundResultList = wmsInboundResultServiceImpl.getInboundResult(mapValue,warehouseId); /*分页*/ PageHelper.startPage(pageNum, pageSize); List> columnList = wmsInboundResultServiceImpl.getInboundResult(mapValue,warehouseId); // 处理异常状态字段 for (Mapmap:columnList ) { BigDecimal isComplete = (BigDecimal) map.get("isComplete"); if(isComplete.intValue() == 1){ map.remove("isComplete"); map.put("isComplete","无异常,正常入库"); }else{ map.remove("isComplete"); map.put("isComplete","异常入库"); } } PageListAdd pageList = columnDataUtil.tableColumnData(apiId,inboundResultList,columnList); return success(pageList); } /** * 展示入库实绩 * @param mapValue * @param apiId * @param pageNum * @param pageSize * @return */ @PostMapping("/getWmsInboundResultStatistics") @ApiOperation(value = "展示入库统计信息") @ApiImplicitParams({ @ApiImplicitParam(name = "apiId", value = "445", required = false, dataType = "BigDecimal"), }) public RESTfulResult getWmsInboundResultStatistics(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, Integer warehouseId, String startTime, String endTime) { DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据 List> inboundResultList = wmsInboundResultServiceImpl.getWmsInboundResultStatistics(mapValue,warehouseId); /*分页*/ PageHelper.startPage(pageNum, pageSize); List> columnList = wmsInboundResultServiceImpl.getWmsInboundResultStatistics(mapValue,warehouseId); PageListAdd pageList = columnDataUtil.tableColumnData(apiId,inboundResultList,columnList); return success(pageList); } /** * 展示入库实绩 * @param mapValue * @param apiId * @param pageNum * @param pageSize * @return */ @PostMapping("/getWmsInboundResults") @ApiOperation(value = "展示入库实绩信息") @ApiImplicitParams({ @ApiImplicitParam(name = "apiId", value = "371", required = false, dataType = "BigDecimal"), }) public RESTfulResult getWmsInboundResults(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, Integer warehouseId, String startTime, String endTime) { DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据 List> inboundResultList = wmsInboundResultServiceImpl.getInboundResults(mapValue,warehouseId); /*分页*/ PageHelper.startPage(pageNum, pageSize); List> columnList = wmsInboundResultServiceImpl.getInboundResults(mapValue,warehouseId); // 处理异常状态字段 for (Mapmap:columnList ) { BigDecimal isComplete = (BigDecimal) map.get("isComplete"); if(isComplete.intValue() == 1){ map.remove("isComplete"); map.put("isComplete","无异常,正常入库"); }else{ map.remove("isComplete"); map.put("isComplete","异常入库"); } } PageListAdd pageList = columnDataUtil.tableColumnData(apiId,inboundResultList,columnList); return success(pageList); } /** * 展示入库实绩 * @param mapValue * @param apiId * @param pageNum * @param pageSize * @return */ @PostMapping("/getWmsReservedResult") @ApiOperation(value = "展示预留入库实绩信息") @ApiImplicitParams({ @ApiImplicitParam(name = "apiId", value = "371", required = false, dataType = "BigDecimal"), }) public RESTfulResult getWmsReservedResult(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String con) { if(con != null){ if(!"undefined".equals(con)){ String index = "get_wms_reservedresult"; return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con)); } } List>inboundResultList = null; if(mapValue.size() == 0){ //将查询结果存入索引中 inboundResultList = wmsInboundResultServiceImpl.getWmsReservedResult(mapValue); Map inboundResultMap = new HashMap<>(); //添加索引 inboundResultMap.put("index","get_wms_reservedresult"); //添加ID inboundResultMap.put("indexId","reservedresultId"); inboundResultList.add(inboundResultMap); //新建索引 esFeign.insertIndex(inboundResultList); //删除 inboundResultList.remove(inboundResultList.size() -1); } if(inboundResultList == null) { inboundResultList = wmsInboundResultServiceImpl.getWmsReservedResult(mapValue); } /*分页*/ PageHelper.startPage(pageNum, pageSize); List> columnList = wmsInboundResultServiceImpl.getWmsReservedResult(mapValue); // 处理异常状态字段 for (Mapmap:columnList ) { BigDecimal isComplete = (BigDecimal) map.get("isComplete"); if(isComplete.intValue() == 1){ map.remove("isComplete"); map.put("isComplete","无异常,正常入库"); }else{ map.remove("isComplete"); map.put("isComplete","异常入库"); } } PageListAdd pageList = columnDataUtil.tableColumnData(apiId,inboundResultList,columnList); return success(pageList); } /** * 新增入库实绩 * * @param * @return */ @ApiOperation("新增入库实绩") @PostMapping("/insertInboundResult") @Transactional public RESTfulResult addInvoice(@RequestParam("userName") String userName,@RequestParam("groupId") BigDecimal groupId,@RequestParam("personnelWorkshopid") BigDecimal personnelWorkshopid, @RequestBody(required = false) List> mapList) { //遗留 查询批次、以及状态 int batch=0; //需要判断是否已经提交过了 通过resultId判断物质是否已经下发过了跳出、多次下发的结果 int resultStatus= wmsInboundScanResultServiceImpl.getResultStatusByResultId(mapList.get(0).get("resultId").toString()); if(resultStatus==1){ return success("请勿重复下发"); } //、创建批次 WmspInboundDistribute wmspInboundDistribute=wmspInboundDistributeService.initAndCreateInboundDistribute(personnelWorkshopid,groupId,userName,batch); //判断物质是否是线材 BigDecimal count = wmsInboundScanResultService.selectMaterialTypeByMaterialId(new BigDecimal(mapList.get(0).get("materialId").toString())); if (count!=null){ //将下面的订单都录入这个批次里面 for (int i=0;i item=mapList.get(i); //获得一个默认的网格 解释:目前还没有设计出来网格的结构 没有做默认为 第一库、第一月台、第一垛位、第一行、第一列 \推送信息给行车工、让他们抢单代码备注了 BigDecimal houseGrid = rmsPwarehouseGridService.selectGrid(mapList.size()-(i+1), personnelWorkshopid,new BigDecimal(item.get("materialId").toString())); //创建一个入库作业实绩 WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(0,i+1,personnelWorkshopid,groupId,userName,wmspInboundDistribute.getDistributeId(),houseGrid,item); //改变扫码实绩里面的状态 int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()),wmspInboundResult.getInboundId()); //创建实时库存 wmspGridMaterialService.initInsertWmspGridMaterial(item,houseGrid); //改为扫一次添加得代码 //当都完成的时候就要去改变这一批的状态改为下发状态 if(mapList.size()==i+1){ int status2= wmsInboundResultServiceImpl.updateInboundStatus(wmspInboundDistribute.getDistributeId()); } } //改为扫一次添加得代码 int status3= wmspInboundDistributeService.updateDistributeStatus(wmspInboundDistribute.getDistributeId().toString()); }else { //如果是线材直接结束 //将下面的订单都录入这个批次里面 for (int i=0;i item = mapList.get(i); //获得高线库 HashMap map3 = new HashMap<>(); map3.put("warehouseId",3); BigDecimal houseGrid=rmsPwarehouseGridService.getGridId(map3);; //创建一个入库作业实绩 WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(1, i + 1, personnelWorkshopid, new BigDecimal(0), userName, wmspInboundDistribute.getDistributeId(), houseGrid, item); //改变扫码实绩里面的状态 int status = wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()), wmspInboundResult.getInboundId()); //创建实时库存 wmspGridMaterialService.initInsertWmspGridMaterial(item, houseGrid); //当都完成的时候就要去改变这一批的状态改为下发状态 if(mapList.size()==i+1){ int status2= wmsInboundResultServiceImpl.updateInboundStatus(wmspInboundDistribute.getDistributeId()); } } int status3= wmspInboundDistributeService.updateDistributeStatus(wmspInboundDistribute.getDistributeId().toString()); // wmspSendReceiveService.addInBoundSendReceive(); } return success("下发成功"); } /** * 新增入库实绩 * * @param * @return */ @ApiOperation("新增入库实绩") @PostMapping("/insertInboundResult3") @Transactional public RESTfulResult addInvoice3(@RequestParam("userName") String userName,@RequestParam("groupId") BigDecimal groupId,@RequestParam("personnelWorkshopid") BigDecimal personnelWorkshopid, @RequestBody(required = false) List> mapList) { //查询当前组最新得一条入库实绩、判断是否是自己创建得、状态是否是带下发状态 Map conditionMap=wmsInboundResultServiceImpl.selectInboundResultByGroupId(groupId); //如果最新的一条是自己的并且 //遗留 查询批次、以及状态 int batch=0; //此条件成了说明他提交之后、另外一个还没提交交 if ((conditionMap!=null&&conditionMap.get("userName").toString().equals(userName)&&conditionMap.get("resultStatus").toString().equals("1"))){ return success("等待提交"); } //此条件成了说明第二个人开始提交了 if (conditionMap!=null&&!conditionMap.get("userName").toString().equals(userName)&&conditionMap.get("resultStatus").toString().equals("1")){ //将下面的订单都录入这个批次里面 for (int i=0;i item=mapList.get(i); //获得同一批的第i个的网格 解释:目前还没有设计出来网格的结构 没有做默认为 第一库、第一月台、第一垛位、第一行、第一列 \推送信息给行车工、让他们抢单代码备注了 BigDecimal houseGrid = wmsInboundResultServiceImpl.getGrid(conditionMap.get("distributeId").toString(), i+1); //如果差不多、说明上一个人少扫了一次 if (houseGrid==null){ houseGrid = rmsPwarehouseGridService.selectGrid(mapList.size()-(i+1), personnelWorkshopid,new BigDecimal(item.get("materialId").toString())); //创建实时库存 wmspGridMaterialService.initInsertWmspGridMaterial(item,houseGrid); } //创建一个入库作业实绩 WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(0,i+1,personnelWorkshopid,groupId,userName,new BigDecimal(conditionMap.get("distributeId").toString()),houseGrid,item); //改变扫码实绩里面的状态 int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()),wmspInboundResult.getInboundId()); //当都完成的时候就要去改变这一批的状态改为下发状态 if(mapList.size()==i+1){ int status2= wmsInboundResultServiceImpl.updateInboundStatus(new BigDecimal(conditionMap.get("distributeId").toString())); } } int status3= wmspInboundDistributeService.updateDistributeStatus(conditionMap.get("distributeId").toString()); return success("下发成功"); //第n批第一次提交 }else{ //需要判断是否已经提交过了 通过resultId判断物质是否已经下发过了跳出、多次下发的结果 int resultStatus= wmsInboundScanResultServiceImpl.getResultStatusByResultId(mapList.get(0).get("resultId").toString()); if(resultStatus==1){ return success("请勿重复下发"); } //、创建批次 WmspInboundDistribute wmspInboundDistribute=wmspInboundDistributeService.initAndCreateInboundDistribute(personnelWorkshopid,groupId,userName,batch); //判断物质是否是线材 BigDecimal count = wmsInboundScanResultService.selectMaterialTypeByMaterialId(new BigDecimal(mapList.get(0).get("materialId").toString())); if (count!=null){ //将下面的订单都录入这个批次里面 for (int i=0;i item=mapList.get(i); //获得一个默认的网格 解释:目前还没有设计出来网格的结构 没有做默认为 第一库、第一月台、第一垛位、第一行、第一列 \推送信息给行车工、让他们抢单代码备注了 BigDecimal houseGrid = rmsPwarehouseGridService.selectGrid(mapList.size()-(i+1), personnelWorkshopid,new BigDecimal(item.get("materialId").toString())); //创建一个入库作业实绩 WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(0,i+1,personnelWorkshopid,groupId,userName,wmspInboundDistribute.getDistributeId(),houseGrid,item); //改变扫码实绩里面的状态 int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()),wmspInboundResult.getInboundId()); //创建实时库存 wmspGridMaterialService.initInsertWmspGridMaterial(item,houseGrid); //改为扫一次添加得代码 //当都完成的时候就要去改变这一批的状态改为下发状态 if(mapList.size()==i+1){ int status2= wmsInboundResultServiceImpl.updateInboundStatus(wmspInboundDistribute.getDistributeId()); } } //改为扫一次添加得代码 int status3= wmspInboundDistributeService.updateDistributeStatus(wmspInboundDistribute.getDistributeId().toString()); }else { //如果是线材直接结束 //将下面的订单都录入这个批次里面 for (int i=0;i item = mapList.get(i); //获得高线库 HashMap map3 = new HashMap<>(); map3.put("warehouseId",3); BigDecimal houseGrid=rmsPwarehouseGridService.getGridId(map3);; //创建一个入库作业实绩 WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(1, i + 1, personnelWorkshopid, new BigDecimal(0), userName, wmspInboundDistribute.getDistributeId(), houseGrid, item); //改变扫码实绩里面的状态 int status = wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()), wmspInboundResult.getInboundId()); //创建实时库存 wmspGridMaterialService.initInsertWmspGridMaterial(item, houseGrid); //当都完成的时候就要去改变这一批的状态改为下发状态 if(mapList.size()==i+1){ int status2= wmsInboundResultServiceImpl.updateInboundStatus(wmspInboundDistribute.getDistributeId()); } //获取物资大类id // BigDecimal materialSteelId = DataChange.dataToBigDecimal(item.get("materialId")); // BigDecimal materialId = wmspSendReceiveService.getMaterialId(materialSteelId); // Map map4 = new HashMap<>(); // map4.put("materialId",materialId); // map4.put("warehouseId",3); // wmspSendReceiveService.addInBoundSendReceive(map4); // wmspSendReceiveService.addThisdayInventorySendReceive(map4); } int status3= wmspInboundDistributeService.updateDistributeStatus(wmspInboundDistribute.getDistributeId().toString()); // wmspSendReceiveService.addInBoundSendReceive(); } return success("下发成功"); } } /** * 新增入库实绩 * * @param * @return */ @ApiOperation("新增入库实绩") @PostMapping("/insertInboundResult2") @Transactional public RESTfulResult addInvoice( @RequestBody(required = false) List> mapList) { //获取前方传来的仓库ID进行入库 BigDecimal warehouseId = new BigDecimal((Integer)mapList.get(0).get("personnelWorkshopid")); String inboundValue = null; BigDecimal ST = null; if(warehouseId.intValue() == 3){ inboundValue = wmsInboundResultServiceImpl.selectWarehouseName(new BigDecimal(3)); } //!!!默认该仓库的所有行车工都能看到 //!!!待添加,查询该仓库所有在班的行车工 String personnelJobNumber = "000417"; if(warehouseId.intValue() != 3){ //查询入库垛位信息 Map stackingMap = rmsStackingService.getStackingToUpdate(mapList.size(),warehouseId,personnelJobNumber); //获取入库垛位ID ST = (BigDecimal) stackingMap.get("stackingId"); inboundValue = stackingMap.get("stackingNo").toString(); } for (Map map:mapList ) { WmspInboundResult wmspInboundResult = new WmspInboundResult(); wmspInboundResult.setInboundId(new BigDecimal(wmsInboundResultServiceImpl.count() + 1)); /* 设置入库类型为生产入库 */ wmspInboundResult.setInboundType(new BigDecimal(0)); /* 设置入库单编号 */ String number=Liushuih.generateNextNumber("WRKD-", "yyyyMMdd-", 8, 12); wmspInboundResult.setInboundNumber(number); /* 设置逻辑删除字段 */ wmspInboundResult.setResultDeleted(new BigDecimal(0)); /* 设置常规字段 */ wmspInboundResult.setInsertUsername("admin"); wmspInboundResult.setInsertTime(new Date()); wmspInboundResult.setUpdateUsername("admin"); wmspInboundResult.setUpdateTime(new Date()); wmspInboundResult.setInsertUpdateRemark("无"); /* 设置入库日期 */ wmspInboundResult.setInboundTime(new Date()); /* 设置入库单状态为已下发 */ wmspInboundResult.setResultStatus(new BigDecimal(1)); /* 设置入库状态,当异常值为0时,入库状态设为未完成;当异常值为1时,入库状态设为完成 */ Integer K = 1; if(warehouseId.intValue() != 3){ System.out.println(map.containsKey("abnormalis")); System.out.println(map.get("abnormalis")); K = (map.containsKey("abnormalis")&&map.get("abnormalis").toString().isEmpty())?Integer.valueOf(map.get("abnormalis").toString()):0; } if (K==0){ wmspInboundResult.setResultStatus(new BigDecimal(0)); wmspInboundResult.setInboundIscomplete(new BigDecimal(0)); } else{ wmspInboundResult.setResultStatus(new BigDecimal(1)); wmspInboundResult.setInboundIscomplete(new BigDecimal(1)); } Integer MN = null ; Integer CC = null ; Integer CX = null ; if(warehouseId.intValue() != 3){ //根据垛位ID查询物资数,确定层次层序,即网格ID HashMap map1 = new HashMap<>(); map1.put("stackingId",ST); //获取物资数 MN=rmsStackingService.selectMaterialNumber(map1); //计算层次号 CC=(MN)/24+1; //计算层序号 CX=(MN)%24+1; //更新垛位表 rmsStackingService.updateStack(ST); } //根据仓库id、垛位ID,层次号,层序号查找仓储网格 HashMap map3 = new HashMap<>(); map3.put("warehouseId",warehouseId); map3.put("stackingID",ST); map3.put("gradationNumber",CC); map3.put("sequenceNumber",CX); BigDecimal gridId=rmsPwarehouseGridService.getGridId(map3); //设置入库实绩里面的网格ID wmspInboundResult.setGridId(gridId); /* 插入一条网格物资中间表 */ WmspGridMaterial wmspGridMaterial = new WmspGridMaterial(); //设置主键ID wmspGridMaterial.setGmId(wmspGridMaterialMapper.getCount()); wmspGridMaterial.setGridId(gridId); wmspGridMaterial.setGmNumber(new BigDecimal(1)); wmspGridMaterial.setStandardDataId(new BigDecimal(1)); //设置网格物资表里面的物资ID BigDecimal materialId= DataChange.dataToBigDecimal(map.get("materialId")); wmspInboundResult.setMaterialId(materialId); wmspGridMaterial.setMaterialId(materialId); //设置逻辑删除字段 wmspGridMaterial.setDeleted(new BigDecimal(0)); //设置常规字段 wmspGridMaterial.setInsertUsername("admin"); wmspGridMaterial.setInsertTime(new Date()); wmspGridMaterial.setUpdateUsername("admin"); wmspGridMaterial.setUpdateTime(new Date()); wmspGridMaterial.setInsertUpdateRemark("无"); wmspGridMaterial.setStatus(new BigDecimal(2)); wmspGridMaterialService.insertWmspGridMaterial(wmspGridMaterial); /* 新增入库实绩主表 */ wmsInboundResultServiceImpl.insertWmsInboundResult(wmspInboundResult); /* 新增天车司机接收实绩 */ WmspInboundDrivingResult wmspInboundDrivingResult = new WmspInboundDrivingResult(); wmspInboundDrivingResult.setDrivingId(new BigDecimal(wmsInboundDrivingResultServiceImpl.count()+1)); wmspInboundDrivingResult.setDriverId(new BigDecimal(9)); wmspInboundDrivingResult.setDrivingReceiveTime(new Date()); wmspInboundDrivingResult.setInboundResultId(wmspInboundResult.getInboundId()); wmspInboundDrivingResult.setInsertUsername("admin"); wmspInboundDrivingResult.setInsertTime(new Date()); wmspInboundDrivingResult.setUpdateUsername("admin"); wmspInboundDrivingResult.setResultDeleted(new BigDecimal(1)); wmsInboundDrivingResultServiceImpl.insertWmspInboundDrivingResult(wmspInboundDrivingResult); /* 新增选择垛位实绩 */ WmspInboundStackResult wmspInboundStackResult = new WmspInboundStackResult(); wmspInboundStackResult.setResultId(new BigDecimal(wmsInboundStackResultServiceImpl.count()+1)); wmspInboundStackResult.setInboundResultId(wmspInboundResult.getInboundId()); wmspInboundStackResult.setStackingId(ST); wmspInboundStackResult.setResultDeleted(new BigDecimal(1)); //设置常规字段 wmspInboundStackResult.setInsertUsername("admin"); wmspInboundStackResult.setInsertTime(new Date()); wmspInboundStackResult.setUpdateUsername("admin"); wmspInboundStackResult.setUpdateTime(new Date()); wmspInboundStackResult.setInsertUpdateRemark("无"); wmspInboundStackResult.setStackingStatus(new BigDecimal(0)); wmsInboundStackResultServiceImpl.insertWmsInboundStackResult(wmspInboundStackResult); System.out.println(map.get("LOADA")); System.out.println(map.get("LOADB")); //判断物资是否为线材 BigDecimal count = wmsInboundScanResultServiceImpl.selectMaterialTypeByMaterialId(materialId); BigDecimal resultId= new BigDecimal((Integer)map.get("resultId")) ; // BigDecimal RESULTBID= new BigDecimal((Integer)map.get("RESULTBID")) ; BigDecimal InbounId=wmspInboundResult.getInboundId(); if(count!=null){ /* 编辑扫描实绩-根据前台返回的扫描实绩ID修改扫描实绩 */ HashMap map5 = new HashMap<>(); Map otherLoadMap = new HashMap<>(); otherLoadMap.put("personnelWorkshopid",map.get("personnelWorkshopid")); otherLoadMap.put("personnelShifts",map.get("personnelShifts")); otherLoadMap.put("personnelTeam",map.get("personnelTeam")); otherLoadMap.put("resultId",resultId); //获取同一班次班组车间扫描次数扫描实绩 List> otherResultIds = wmsInboundScanResultServiceImpl.getOntherLoadId(otherLoadMap); //根据物资id查询是否该物资为线材 //设置另一个扫描实绩id为空 BigDecimal otherResultId = null; //遍历查询出的同一班次班组车间扫描次数所有扫描实绩 for (Map otherMap : otherResultIds) { //判断,查询出来的扫描实绩id是否于点击下发的扫描实绩的id相同 //如果不同,将获取到的扫描实绩主键id赋予otherResultId if (((BigDecimal) otherMap.get("resultId")).intValue() != resultId.intValue()) { otherResultId = (BigDecimal) otherMap.get("resultId"); } } //更新扫描实绩 map5.put("resultId",resultId); map5.put("InbounId",InbounId); wmsInboundScanResultServiceImpl.updateWmsInboundScanById(map5); map5.remove("resultId"); map5.put("resultId",otherResultId); wmsInboundScanResultServiceImpl.updateWmsInboundScanById(map5); } //更新扫描实绩状态 Map map7=new HashMap<>(); map7.put("resultId",resultId); map7.put("InbounId",InbounId); wmsInboundScanResultServiceImpl.updateWmsInboundScanById(map7); } return success(inboundValue); } //根据入库实绩id查找扫描实绩 @PostMapping("/selectScanResultByIboundResultId") @ApiOperation(value = "根据入库实绩id获得扫描实绩数据") @ApiImplicitParams({ @ApiImplicitParam(name = "apiId", value = "", required = false, dataType = "BigDecimal"), }) public RESTfulResult selectScanResultByIboundResultId(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String con ) { if(con != null){ if(!"undefined".equals(con)){ String index = "get_wms_inboundScanResult"; return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con)); } } List>inboundScanResultList = null; if(mapValue.size() == 0){ //将查询结果存入索引中 inboundScanResultList = wmsInboundResultServiceImpl.selectScanResultByIboundResultId(mapValue); Map inboundScanResultMap = new HashMap<>(); //添加索引 inboundScanResultMap.put("index","get_wms_inboundScanResult"); //添加ID inboundScanResultMap.put("indexId","inboundScanResultId"); inboundScanResultList.add(inboundScanResultMap); //新建索引 esFeign.insertIndex(inboundScanResultList); //删除 inboundScanResultList.remove(inboundScanResultList.size() -1); } if(inboundScanResultList == null) { inboundScanResultList = wmsInboundResultServiceImpl.selectScanResultByIboundResultId(mapValue); } /*分页*/ PageHelper.startPage(pageNum, pageSize); List> columnList = wmsInboundResultServiceImpl.selectScanResultByIboundResultId(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId,inboundScanResultList,columnList); return success(pageList); } // 根据对应的入库实绩id修改入库状态为预留 @PostMapping("/changeReserved") @ApiOperation(value = "根据对应的入库实绩id修改入库状态为预留") public int changeReserved(@RequestBody(required = false) List> mapList) { return wmsInboundResultServiceImpl.changeReserved(mapList); } }