|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.OrderItem; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.entity.Parameter; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.entity.Shelves; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.param.LocMastInitParam; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.LocDetl; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.LocMast; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.Mat; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.LocDetlService; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.LocMastService; | 
|---|
|  |  |  | import com.zy.asrs.framework.annotations.ManagerAuth; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import static jdk.nashorn.api.scripting.ScriptUtils.convert; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | public class LocMastController extends BaseController { | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false) String condition, | 
|---|
|  |  |  | @RequestParam(required = false) String timeRange, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | LambdaQueryWrapper<LocMast> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq(LocMast::getHostId, getHostId()); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(LocMast::getLocNo, condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(timeRange)) { | 
|---|
|  |  |  | String[] range = timeRange.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(LocMast::getAppeTime, DateUtils.convert(range[0])); | 
|---|
|  |  |  | wrapper.le(LocMast::getAppeTime, DateUtils.convert(range[1])); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("loc_no"))) { | 
|---|
|  |  |  | wrapper.eq(LocMast::getLocNo, param.get("loc_no")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("loc_sts"))) { | 
|---|
|  |  |  | wrapper.eq(LocMast::getLocSts, param.get("loc_sts")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | QueryWrapper<LocMast> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq("host_id",getHostId()); | 
|---|
|  |  |  | //wrapper.eq(LocMast::getHostId, getHostId()); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | //if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | //    wrapper.like(LocMast::getLocNo, condition); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //if (!Cools.isEmpty(timeRange)) { | 
|---|
|  |  |  | //    String[] range = timeRange.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | //    wrapper.ge(LocMast::getAppeTime, DateUtils.convert(range[0])); | 
|---|
|  |  |  | //    wrapper.le(LocMast::getAppeTime, DateUtils.convert(range[1])); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //if (!Cools.isEmpty(param.get("loc_no"))) { | 
|---|
|  |  |  | //    wrapper.eq(LocMast::getLocNo, param.get("loc_no")); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //if (!Cools.isEmpty(param.get("loc_sts"))) { | 
|---|
|  |  |  | //    wrapper.eq(LocMast::getLocSts, param.get("loc_sts")); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | return R.ok(locMastService.page(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private <T> void convert(Map<String, Object> map,QueryWrapper<T> wrapper){ | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : map.entrySet()){ | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (val.contains(RANGE_TIME_LINK)){ | 
|---|
|  |  |  | String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); | 
|---|
|  |  |  | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.like(entry.getKey(), val); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/group/empty/stock") | 
|---|
|  |  |  | @ManagerAuth(memo = "获取同组货架的空库位") | 
|---|
|  |  |  | public R getGroupEmptyStock(@RequestParam(required = false) String sourceLocNo) { | 
|---|