| | |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.entity.params.PdaGeneralParam; |
| | | import com.vincent.rsf.server.api.service.PdaOtherService; |
| | | import com.vincent.rsf.server.manager.entity.BasStation; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.entity.Transfer; |
| | | import com.vincent.rsf.server.manager.enums.LocStatusType; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.service.BasStationService; |
| | | import com.vincent.rsf.server.manager.service.LocItemService; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.manager.service.TransferService; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | private LocService locService; |
| | | @Autowired |
| | | private LocItemService locItemService; |
| | | |
| | | @Autowired |
| | | private BasStationService basStationService; |
| | | |
| | | @Override |
| | | public R transferPage(String orderNo, Integer curr, Integer limit) { |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R stationPage(String staNo, Integer curr, Integer limit) { |
| | | Page<BasStation> page = new Page<>(curr, limit); |
| | | LambdaQueryWrapper<BasStation> basStationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | basStationLambdaQueryWrapper.eq(!Cools.isEmpty(staNo), BasStation::getStationName, staNo); |
| | | Page<BasStation> page1 = basStationService.page(page, basStationLambdaQueryWrapper); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R staOperate(PdaGeneralParam generalParam, User user) { |
| | | switch (generalParam.getStaOperateType()){ |
| | | case 1: |
| | | stationDisabled(generalParam.getTransferStationNo(),user); |
| | | break; |
| | | case 2: |
| | | stationLiftTheBan(generalParam.getTransferStationNo(),user); |
| | | break; |
| | | case 3: |
| | | stationRelease(generalParam.getTransferStationNo(),user); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void stationDisabled(String transferStationNo,User user){ |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, transferStationNo)); |
| | | if (Cools.isEmpty(basStation)) { |
| | | throw new CoolException("未找到正确的站点"); |
| | | } |
| | | if (basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | throw new CoolException("当前站点正在工作"); |
| | | } |
| | | basStation.setUseStatus(LocStsType.LOC_STS_TYPE_X.type); |
| | | basStation.setUpdateBy(user.getId()); |
| | | basStation.setUpdateTime(new Date()); |
| | | basStationService.updateById(basStation); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void stationLiftTheBan(String transferStationNo,User user){ |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, transferStationNo)); |
| | | if (Cools.isEmpty(basStation)) { |
| | | throw new CoolException("未找到正确的站点"); |
| | | } |
| | | if (basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | throw new CoolException("当前站点正在工作"); |
| | | } |
| | | |
| | | basStation.setUseStatus(Cools.isEmpty(basStation.getBarcode())?LocStsType.LOC_STS_TYPE_O.type:LocStsType.LOC_STS_TYPE_F.type); |
| | | basStation.setUpdateBy(user.getId()); |
| | | basStation.setUpdateTime(new Date()); |
| | | basStationService.updateById(basStation); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void stationRelease(String transferStationNo,User user){ |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, transferStationNo)); |
| | | if (Cools.isEmpty(basStation)) { |
| | | throw new CoolException("未找到正确的站点"); |
| | | } |
| | | if (basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | throw new CoolException("当前站点正在工作"); |
| | | } |
| | | |
| | | basStation.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); |
| | | basStation.setBarcode(null); |
| | | basStation.setUpdateBy(user.getId()); |
| | | basStation.setUpdateTime(new Date()); |
| | | basStationService.updateById(basStation); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R locPage(String locNo, Integer curr, Integer limit) { |
| | | Page<Loc> page = new Page<>(curr, limit); |
| | | LambdaQueryWrapper<Loc> basStationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | basStationLambdaQueryWrapper.eq(!Cools.isEmpty(locNo), Loc::getCode, locNo); |
| | | Page<Loc> page1 = locService.page(page, basStationLambdaQueryWrapper); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R locOperate(PdaGeneralParam generalParam, User user) { |
| | | switch (generalParam.getStaOperateType()){ |
| | | case 1: |
| | | locDisabled(generalParam.getLocNo(),user); |
| | | break; |
| | | case 2: |
| | | locLiftTheBan(generalParam.getLocNo(),user); |
| | | break; |
| | | case 3: |
| | | locRelease(generalParam.getLocNo(),user); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void locDisabled(String transferStationNo,User user){ |
| | | Loc lco = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, transferStationNo)); |
| | | if (Cools.isEmpty(lco)) { |
| | | throw new CoolException("未找到正确的库位"); |
| | | } |
| | | if (lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | throw new CoolException("当前站点正在工作"); |
| | | } |
| | | lco.setUseStatus(LocStsType.LOC_STS_TYPE_X.type); |
| | | lco.setUpdateBy(user.getId()); |
| | | lco.setUpdateTime(new Date()); |
| | | locService.updateById(lco); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void locLiftTheBan(String transferStationNo,User user){ |
| | | Loc lco = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, transferStationNo)); |
| | | if (Cools.isEmpty(lco)) { |
| | | throw new CoolException("未找到正确的库位"); |
| | | } |
| | | if (lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | throw new CoolException("当前库位正在工作"); |
| | | } |
| | | |
| | | lco.setUseStatus(Cools.isEmpty(lco.getBarcode())?LocStsType.LOC_STS_TYPE_O.type:LocStsType.LOC_STS_TYPE_F.type); |
| | | lco.setUpdateBy(user.getId()); |
| | | lco.setUpdateTime(new Date()); |
| | | locService.updateById(lco); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void locRelease(String transferStationNo,User user){ |
| | | Loc lco = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, transferStationNo)); |
| | | if (Cools.isEmpty(lco)) { |
| | | throw new CoolException("未找到正确的库位"); |
| | | } |
| | | if (lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | throw new CoolException("当前库位正在工作"); |
| | | } |
| | | |
| | | lco.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); |
| | | lco.setBarcode(null); |
| | | lco.setUpdateBy(user.getId()); |
| | | lco.setUpdateTime(new Date()); |
| | | locService.updateById(lco); |
| | | } |
| | | |
| | | } |