| | |
| | | package com.zy.acs.manager.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.manager.common.annotation.OperationLog; |
| | | import com.zy.acs.manager.common.domain.BaseParam; |
| | | import com.zy.acs.manager.common.domain.PageParam; |
| | | import com.zy.acs.manager.core.constant.LocGroupConstant; |
| | | import com.zy.acs.manager.core.service.MainService; |
| | | import com.zy.acs.manager.manager.controller.param.OpenBusSubmitParam; |
| | | import com.zy.acs.manager.manager.entity.Loc; |
| | | import com.zy.acs.manager.manager.enums.LocStsType; |
| | | import com.zy.acs.manager.manager.service.LocService; |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PostMapping("/loc/one") |
| | | @OperationLog("one loc") |
| | | public R emptyLoc(@RequestBody Map<String, Object> map) { |
| | | String staNo = map.get("staNo").toString(); |
| | | Integer startRow = null; |
| | | Integer endRow = null; |
| | | if (staNo.equals("101-2")||staNo.equals("101-3")||staNo.equals("102-2")||staNo.equals("102-3")){ |
| | | startRow = Collections.min(LocGroupConstant.FAR_RIGHT_LOC_ROW_LIST); |
| | | endRow = Collections.max(LocGroupConstant.FAR_RIGHT_LOC_ROW_LIST); |
| | | } else if (staNo.equals("103-2")||staNo.equals("103-3")||staNo.equals("104-2")||staNo.equals("104-3")) { |
| | | startRow = Collections.min(LocGroupConstant.RIGHT_LOC_ROW_LIST); |
| | | endRow = Collections.max(LocGroupConstant.RIGHT_LOC_ROW_LIST); |
| | | }else if (staNo.equals("105-2")||staNo.equals("105-3")||staNo.equals("106-2")||staNo.equals("106-3")) { |
| | | startRow = Collections.min(LocGroupConstant.MIDDLE_LOC_ROW_LIST); |
| | | endRow = Collections.max(LocGroupConstant.MIDDLE_LOC_ROW_LIST); |
| | | }else if (staNo.equals("107-2")||staNo.equals("107-3")||staNo.equals("108-2")||staNo.equals("108-3")) { |
| | | startRow = Collections.min(LocGroupConstant.LEFT_LOC_ROW_LIST); |
| | | endRow = Collections.max(LocGroupConstant.LEFT_LOC_ROW_LIST); |
| | | }else if (staNo.equals("1007")){ |
| | | startRow = Collections.min(LocGroupConstant.FAR_LEFT_LOC_ROW_LIST); |
| | | endRow = Collections.max(LocGroupConstant.FAR_LEFT_LOC_ROW_LIST); |
| | | }else { |
| | | return R.error("staNo is not support"); |
| | | } |
| | | LambdaQueryWrapper<Loc> idleWrapper = new LambdaQueryWrapper<Loc>().eq(Loc::getLocSts, LocStsType.IDLE.val()); |
| | | if (null != startRow) { |
| | | idleWrapper.ge(Loc::getRow, startRow); |
| | | } |
| | | if (null != endRow) { |
| | | idleWrapper.le(Loc::getRow, endRow); |
| | | } |
| | | List<Loc> idleList = locService.list(idleWrapper); |
| | | if (Cools.isEmpty(idleList)) { |
| | | return R.error("没空库位"); |
| | | } |
| | | Collections.shuffle(idleList); |
| | | return R.ok().add(idleList.get(0)); |
| | | } |
| | | |
| | | } |