package com.steerinfo.dil.service.impl; import com.steerinfo.dil.mapper.WmspGridMaterialMapper; import com.steerinfo.dil.mapper.WmspInboundResultMapper; import com.steerinfo.dil.mapper.WmspInboundScanResultMapper; import com.steerinfo.dil.model.*; import com.steerinfo.dil.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @Service public class WmspReboundResultServiceImpl implements WmsReboundResultService { @Autowired private RmsStackingServiceImpl rmsStackingService; @Autowired private RmsPwarehouseGridServiceImpl rmsPwarehouseGridService; @Autowired private WmspGridMaterialServiceImpl wmspGridMaterialService; @Autowired private WmsInboundResultServiceImpl wmsInboundResultService; @Autowired private WmsInboundDrivingResultServiceImpl wmsInboundDrivingResultService; @Autowired private WmsInboundScanResultServiceImpl wmsInboundScanResultService; @Autowired private WmsInboundStackResultServiceImpl wmsInboundStackResultService; @Autowired WmspInboundResultMapper wmspInboundResultMapper; @Autowired RmsMaterialSteelServiceImpl rmsMaterialSteelServiceImpl; @Autowired RmsMaterialServiceImpl rmsMaterialService; @Autowired WmspInboundScanResultMapper wmspInboundScanResultMapper; @Autowired WmspGridMaterialMapper wmspGridMaterialMapper; @Override public int addReboundResult(List> mapList) { //新增退库实绩 for (Map map : mapList) { BigDecimal ST = new BigDecimal(map.get("stackingId").toString()); //获取退库单ID BigDecimal reboundId = new BigDecimal((Integer) map.get("inboundId")); //根据垛位ID查询物资数,确定层次层序,即网格ID HashMap map1 = new HashMap<>(); map1.put("stackingId", ST); //获取物资数 Integer MN = rmsStackingService.selectMaterialNumber(map1); //计算层次号 Integer CC = (MN + 1) / 24 + 1; //计算层序号 Integer CX = (MN + 1) % 24; //更新垛位表 rmsStackingService.updateStack(ST); //根据仓库id、垛位ID,层次号,层序号查找仓储网格 HashMap map3 = new HashMap<>(); map3.put("warehouseId", 1); map3.put("stackingID", ST); map3.put("gradationNumber", CC); map3.put("sequenceNumber", CX); BigDecimal gridId = rmsPwarehouseGridService.getGridId(map3); /* 插入一条网格物资中间表 */ WmspGridMaterial wmspGridMaterial = new WmspGridMaterial(); //设置主键ID wmspGridMaterial.setGmId(wmspGridMaterialMapper.getCount()); wmspGridMaterial.setGridId(gridId); wmspGridMaterial.setGmNumber(new BigDecimal(1)); //设置网格物资表里面的物资ID BigDecimal materialId = (BigDecimal) map.get("materialId"); wmspGridMaterial.setMaterialId(materialId); //设置标准字段 wmspGridMaterial.setStandardDataId(new BigDecimal(1)); //设置逻辑删除字段 wmspGridMaterial.setDeleted(new BigDecimal(0)); //设置常规字段 wmspGridMaterial.setInsertUsername("admin"); wmspGridMaterial.setInsertTime(new Date()); wmspGridMaterial.setUpdateUsername("admin"); wmspGridMaterial.setUpdateTime(new Date()); wmspGridMaterial.setInsertUpdateRemark("无"); wmspGridMaterialService.insertWmspGridMaterial(wmspGridMaterial); /* 根据退库实绩ID,更新退库实绩表 */ HashMap map9 = new HashMap<>(); map9.put("inboundId", reboundId); map9.put("GridId", gridId); wmsInboundResultService.updateReboundResult(map9); /* 新增行车工接收实绩 */ WmspInboundDrivingResult wmspInboundDrivingResult = new WmspInboundDrivingResult(); wmspInboundDrivingResult.setDrivingId(new BigDecimal(wmsInboundDrivingResultService.count() + 1)); wmspInboundDrivingResult.setDriverId(new BigDecimal(3)); wmspInboundDrivingResult.setDrivingReceiveTime(new Date()); wmspInboundDrivingResult.setInboundResultId(reboundId); wmspInboundDrivingResult.setInsertUsername("admin"); wmspInboundDrivingResult.setInsertTime(new Date()); wmspInboundDrivingResult.setUpdateUsername("admin"); wmspInboundDrivingResult.setUpdateTime(new Date()); wmspInboundDrivingResult.setInsertUpdateRemark("无"); wmspInboundDrivingResult.setResultDeleted(new BigDecimal(0)); /* 新增选择垛位实绩 */ WmspInboundStackResult wmspInboundStackResult = new WmspInboundStackResult(); wmspInboundStackResult.setResultId(new BigDecimal(wmsInboundStackResultService.count() + 1)); wmspInboundStackResult.setInboundResultId(reboundId); wmspInboundStackResult.setStackingId(ST); wmspInboundStackResult.setResultDeleted(new BigDecimal(1)); //设置常规字段 wmspInboundStackResult.setInsertUsername("admin"); wmspInboundStackResult.setInsertTime(new Date()); wmspInboundStackResult.setUpdateUsername("admin"); wmspInboundStackResult.setUpdateTime(new Date()); wmspInboundStackResult.setInsertUpdateRemark("无"); /* 编辑扫描实绩-根据前台返回的扫描实绩ID修改扫描实绩 */ BigDecimal RESULTID = new BigDecimal((Integer) map.get("RESULTID")); HashMap map5 = new HashMap<>(); map5.put("RESULTID", RESULTID); wmsInboundScanResultService.updateWmsReboundScanById(map5); } return 5; } @Override public int IssueToCrane(Map map) { //下发给行车工 return 0; } }