| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.ApiConfig; |
| | | import com.zy.asrs.service.ApiConfigService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.ApiConfig; |
| | | import com.zy.asrs.service.ApiConfigService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @RequestMapping(value = "/apiConfig/list/auth") |
| | | // @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<ApiConfig> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(apiConfigService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/apiConfig/update/auth") |
| | | @ManagerAuth |
| | | public R update(ApiConfig apiConfig){ |
| | | if (Cools.isEmpty(apiConfig) || null==apiConfig.getId()){ |
| | | @RequestMapping(value = "/apiConfig/update/auth") |
| | | @ManagerAuth |
| | | public R update(ApiConfig apiConfig) { |
| | | if (Cools.isEmpty(apiConfig) || null == apiConfig.getId()) { |
| | | return R.error(); |
| | | } |
| | | apiConfig.setUpdateBy(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/apiConfig/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | apiConfigService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/apiConfig/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<ApiConfig> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("apiConfig")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<ApiConfig> page = apiConfigService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (ApiConfig apiConfig : page.getRecords()){ |
| | | for (ApiConfig apiConfig : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", apiConfig.getId()); |
| | | map.put("value", apiConfig.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<ApiConfig> wrapper = new EntityWrapper<ApiConfig>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != apiConfigService.selectOne(wrapper)){ |
| | | if (null != apiConfigService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(ApiConfig.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @RequestMapping(value = "/apiLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<ApiLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | wrapper.orderDesc(Collections.singleton("create_time")); |
| | | return R.ok(apiLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/apiLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(ApiLog apiLog){ |
| | | if (Cools.isEmpty(apiLog) || null==apiLog.getId()){ |
| | | @RequestMapping(value = "/apiLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(ApiLog apiLog) { |
| | | if (Cools.isEmpty(apiLog) || null == apiLog.getId()) { |
| | | return R.error(); |
| | | } |
| | | apiLogService.updateById(apiLog); |
| | |
| | | |
| | | @RequestMapping(value = "/apiLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | apiLogService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/apiLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<ApiLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("apiLog")); |
| | |
| | | wrapper.like("uuid", condition); |
| | | Page<ApiLog> page = apiLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (ApiLog apiLog : page.getRecords()){ |
| | | for (ApiLog apiLog : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", apiLog.getId()); |
| | | map.put("value", apiLog.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<ApiLog> wrapper = new EntityWrapper<ApiLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != apiLogService.selectOne(wrapper)){ |
| | | if (null != apiLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(ApiLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnError/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<BasCrnError> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(basCrnErrorService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/basCrnError/add/auth") |
| | | @ManagerAuth(memo = "堆垛机异常码添加") |
| | | public R add(BasCrnError basCrnError) { |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basCrnError/update/auth") |
| | | @RequestMapping(value = "/basCrnError/update/auth") |
| | | @ManagerAuth(memo = "堆垛机异常码修改") |
| | | public R update(BasCrnError basCrnError){ |
| | | if (Cools.isEmpty(basCrnError) || null==basCrnError.getErrorCode()){ |
| | | public R update(BasCrnError basCrnError) { |
| | | if (Cools.isEmpty(basCrnError) || null == basCrnError.getErrorCode()) { |
| | | return R.error(); |
| | | } |
| | | basCrnError.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnError/delete/auth") |
| | | @ManagerAuth(memo = "堆垛机异常码删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<BasCrnError> list = JSONArray.parseArray(param, BasCrnError.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasCrnError entity : list){ |
| | | for (BasCrnError entity : list) { |
| | | basCrnErrorService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnError/export/auth") |
| | | @ManagerAuth(memo = "堆垛机异常码导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<BasCrnError> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basCrnError")); |
| | |
| | | wrapper.like("err_name", condition); |
| | | Page<BasCrnError> page = basCrnErrorService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasCrnError basCrnError : page.getRecords()){ |
| | | for (BasCrnError basCrnError : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basCrnError.getErrorCode()); |
| | | map.put("value", basCrnError.getErrName()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasCrnError> wrapper = new EntityWrapper<BasCrnError>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basCrnErrorService.selectOne(wrapper)){ |
| | | if (null != basCrnErrorService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasCrnError.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnStatus/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false, defaultValue = "stsNo")String orderByField, |
| | | @RequestParam(required = false, defaultValue = "asc")String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false, defaultValue = "stsNo") String orderByField, |
| | | @RequestParam(required = false, defaultValue = "asc") String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<BasCrnStatus> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else { |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } else { |
| | | wrapper.orderBy("sts_no", true); |
| | | } |
| | | return R.ok(basCrnStatusService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basCrnStatus/update/auth") |
| | | @ManagerAuth(memo = "堆垛机状态修改") |
| | | public R update(BasCrnStatus basCrnStatus){ |
| | | if (Cools.isEmpty(basCrnStatus) || null==basCrnStatus.getStsNo()){ |
| | | @RequestMapping(value = "/basCrnStatus/update/auth") |
| | | @ManagerAuth(memo = "堆垛机状态修改") |
| | | public R update(BasCrnStatus basCrnStatus) { |
| | | if (Cools.isEmpty(basCrnStatus) || null == basCrnStatus.getStsNo()) { |
| | | return R.error(); |
| | | } |
| | | basCrnStatus.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnStatus/delete/auth") |
| | | @ManagerAuth(memo = "堆垛机状态删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<BasCrnStatus> list = JSONArray.parseArray(param, BasCrnStatus.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasCrnStatus entity : list){ |
| | | for (BasCrnStatus entity : list) { |
| | | basCrnStatusService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnStatus/export/auth") |
| | | @ManagerAuth(memo = "堆垛机状态导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<BasCrnStatus> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basCrnStatus")); |
| | |
| | | wrapper.like("sts_desc", condition); |
| | | Page<BasCrnStatus> page = basCrnStatusService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasCrnStatus basCrnStatus : page.getRecords()){ |
| | | for (BasCrnStatus basCrnStatus : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basCrnStatus.getStsNo()); |
| | | map.put("value", basCrnStatus.getStsDesc()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasCrnStatus> wrapper = new EntityWrapper<BasCrnStatus>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basCrnStatusService.selectOne(wrapper)){ |
| | | if (null != basCrnStatusService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasCrnStatus.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnp/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<BasCrnp> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(basCrnpService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basCrnp/update/auth") |
| | | @ManagerAuth(memo = "堆垛机修改") |
| | | public R update(BasCrnp basCrnp){ |
| | | if (Cools.isEmpty(basCrnp) || null==basCrnp.getCrnNo()){ |
| | | @RequestMapping(value = "/basCrnp/update/auth") |
| | | @ManagerAuth(memo = "堆垛机修改") |
| | | public R update(BasCrnp basCrnp) { |
| | | if (Cools.isEmpty(basCrnp) || null == basCrnp.getCrnNo()) { |
| | | return R.error(); |
| | | } |
| | | basCrnp.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnp/delete/auth") |
| | | @ManagerAuth(memo = "堆垛机删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<BasCrnp> list = JSONArray.parseArray(param, BasCrnp.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasCrnp entity : list){ |
| | | for (BasCrnp entity : list) { |
| | | basCrnpService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basCrnp/export/auth") |
| | | @ManagerAuth(memo = "堆垛机导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<BasCrnp> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basCrnp")); |
| | |
| | | wrapper.like("crn_no", condition); |
| | | Page<BasCrnp> page = basCrnpService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasCrnp basCrnp : page.getRecords()){ |
| | | for (BasCrnp basCrnp : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basCrnp.getCrnNo()); |
| | | map.put("value", basCrnp.getCrnNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasCrnp> wrapper = new EntityWrapper<BasCrnp>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basCrnpService.selectOne(wrapper)){ |
| | | if (null != basCrnpService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasCrnp.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basDevp/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<BasDevp> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(basDevpService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basDevp/update/auth") |
| | | @ManagerAuth(memo = "站点修改") |
| | | public R update(BasDevp basDevp){ |
| | | if (Cools.isEmpty(basDevp) || null==basDevp.getDevNo()){ |
| | | @RequestMapping(value = "/basDevp/update/auth") |
| | | @ManagerAuth(memo = "站点修改") |
| | | public R update(BasDevp basDevp) { |
| | | if (Cools.isEmpty(basDevp) || null == basDevp.getDevNo()) { |
| | | return R.error(); |
| | | } |
| | | basDevp.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basDevp/delete/auth") |
| | | @ManagerAuth(memo = "站点删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<BasDevp> list = JSONArray.parseArray(param, BasDevp.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasDevp entity : list){ |
| | | for (BasDevp entity : list) { |
| | | basDevpService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basDevp/export/auth") |
| | | @ManagerAuth(memo = "站点导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<BasDevp> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basDevp")); |
| | |
| | | wrapper.like("dev_no", condition); |
| | | Page<BasDevp> page = basDevpService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasDevp basDevp : page.getRecords()){ |
| | | for (BasDevp basDevp : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basDevp.getDevNo()); |
| | | map.put("value", basDevp.getDevNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasDevp> wrapper = new EntityWrapper<BasDevp>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basDevpService.selectOne(wrapper)){ |
| | | if (null != basDevpService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasDevp.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | @RequestMapping(value = "/basDevp/weigh/auth") |
| | | @ManagerAuth(memo = "站点称重查询") |
| | | public Double weigh(Integer dev_no) { |
| | | BasDevp basDevp=basDevpService.selectById(dev_no); |
| | | BasDevp basDevp = basDevpService.selectById(dev_no); |
| | | return basDevp.getGrossWt(); |
| | | } |
| | | |
| | |
| | | |
| | | @RequestMapping(value = "/basErrLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<BasErrLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } else { |
| | | wrapper.orderBy("create_time", false); |
| | |
| | | return R.ok(basErrLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basErrLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(BasErrLog basErrLog){ |
| | | if (Cools.isEmpty(basErrLog) || null==basErrLog.getId()){ |
| | | @RequestMapping(value = "/basErrLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(BasErrLog basErrLog) { |
| | | if (Cools.isEmpty(basErrLog) || null == basErrLog.getId()) { |
| | | return R.error(); |
| | | } |
| | | basErrLogService.updateById(basErrLog); |
| | |
| | | |
| | | @RequestMapping(value = "/basErrLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<BasErrLog> list = JSONArray.parseArray(param, BasErrLog.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasErrLog entity : list){ |
| | | for (BasErrLog entity : list) { |
| | | basErrLogService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basErrLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<BasErrLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basErrLog")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<BasErrLog> page = basErrLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasErrLog basErrLog : page.getRecords()){ |
| | | for (BasErrLog basErrLog : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basErrLog.getId()); |
| | | map.put("value", basErrLog.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasErrLog> wrapper = new EntityWrapper<BasErrLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basErrLogService.selectOne(wrapper)){ |
| | | if (null != basErrLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasErrLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basLocSts/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<BasLocSts> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(basLocStsService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | @RequestMapping(value = "/basLocSts/edit/auth") |
| | | @ManagerAuth |
| | | public R edit(BasLocSts basLocSts) { |
| | | if (Cools.isEmpty(basLocSts)){ |
| | | if (Cools.isEmpty(basLocSts)) { |
| | | return R.error(); |
| | | } |
| | | if (null == basLocSts.getLocSts()){ |
| | | if (null == basLocSts.getLocSts()) { |
| | | basLocStsService.insert(basLocSts); |
| | | } else { |
| | | basLocStsService.updateById(basLocSts); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basLocSts/update/auth") |
| | | @RequestMapping(value = "/basLocSts/update/auth") |
| | | @ManagerAuth(memo = "库位状态修改") |
| | | public R update(BasLocSts basLocSts){ |
| | | if (Cools.isEmpty(basLocSts) || null==basLocSts.getLocSts()){ |
| | | public R update(BasLocSts basLocSts) { |
| | | if (Cools.isEmpty(basLocSts) || null == basLocSts.getLocSts()) { |
| | | return R.error(); |
| | | } |
| | | basLocSts.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basLocSts/delete/auth") |
| | | @ManagerAuth(memo = "库位状态删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<BasLocSts> list = JSONArray.parseArray(param, BasLocSts.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasLocSts entity : list){ |
| | | for (BasLocSts entity : list) { |
| | | basLocStsService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basLocSts/export/auth") |
| | | @ManagerAuth(memo = "库位状态导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<BasLocSts> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basLocSts")); |
| | |
| | | wrapper.like("loc_desc", condition); |
| | | Page<BasLocSts> page = basLocStsService.selectPage(new Page<>(0, 32), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasLocSts basLocSts : page.getRecords()){ |
| | | for (BasLocSts basLocSts : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basLocSts.getLocSts()); |
| | | map.put("value", basLocSts.getLocDesc()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasLocSts> wrapper = new EntityWrapper<BasLocSts>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basLocStsService.selectOne(wrapper)){ |
| | | if (null != basLocStsService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasLocSts.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.BasPlcerror; |
| | | import com.zy.asrs.service.BasPlcerrorService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.BasPlcerror; |
| | | import com.zy.asrs.service.BasPlcerrorService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | public class BasPlcerrorController extends BaseController { |
| | |
| | | |
| | | @RequestMapping(value = "/basPlcerror/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<BasPlcerror> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(basPlcerrorService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basPlcerror/update/auth") |
| | | @ManagerAuth |
| | | public R update(BasPlcerror basPlcerror){ |
| | | if (Cools.isEmpty(basPlcerror) || null==basPlcerror.getErrorCode()){ |
| | | @RequestMapping(value = "/basPlcerror/update/auth") |
| | | @ManagerAuth |
| | | public R update(BasPlcerror basPlcerror) { |
| | | if (Cools.isEmpty(basPlcerror) || null == basPlcerror.getErrorCode()) { |
| | | return R.error(); |
| | | } |
| | | basPlcerror.setAppeUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basPlcerror/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Integer[] ids){ |
| | | for (Integer id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Integer[] ids) { |
| | | for (Integer id : ids) { |
| | | basPlcerrorService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basPlcerror/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<BasPlcerror> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basPlcerror")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<BasPlcerror> page = basPlcerrorService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasPlcerror basPlcerror : page.getRecords()){ |
| | | for (BasPlcerror basPlcerror : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basPlcerror.getErrorCode()); |
| | | map.put("value", basPlcerror.getErrorCode()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasPlcerror> wrapper = new EntityWrapper<BasPlcerror>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basPlcerrorService.selectOne(wrapper)){ |
| | | if (null != basPlcerrorService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasPlcerror.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.BasPlcerrorLog; |
| | | import com.zy.asrs.service.BasPlcerrorLogService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.BasPlcerrorLog; |
| | | import com.zy.asrs.service.BasPlcerrorLogService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | public class BasPlcerrorLogController extends BaseController { |
| | |
| | | |
| | | @RequestMapping(value = "/basPlcerrorLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<BasPlcerrorLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(basPlcerrorLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basPlcerrorLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(BasPlcerrorLog basPlcerrorLog){ |
| | | if (Cools.isEmpty(basPlcerrorLog) || null==basPlcerrorLog.getId()){ |
| | | @RequestMapping(value = "/basPlcerrorLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(BasPlcerrorLog basPlcerrorLog) { |
| | | if (Cools.isEmpty(basPlcerrorLog) || null == basPlcerrorLog.getId()) { |
| | | return R.error(); |
| | | } |
| | | basPlcerrorLogService.updateById(basPlcerrorLog); |
| | |
| | | |
| | | @RequestMapping(value = "/basPlcerrorLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | basPlcerrorLogService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basPlcerrorLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<BasPlcerrorLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basPlcerrorLog")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<BasPlcerrorLog> page = basPlcerrorLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasPlcerrorLog basPlcerrorLog : page.getRecords()){ |
| | | for (BasPlcerrorLog basPlcerrorLog : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basPlcerrorLog.getId()); |
| | | map.put("value", basPlcerrorLog.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasPlcerrorLog> wrapper = new EntityWrapper<BasPlcerrorLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basPlcerrorLogService.selectOne(wrapper)){ |
| | | if (null != basPlcerrorLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasPlcerrorLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basWrkIotype/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<BasWrkIotype> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(basWrkIotypeService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | @RequestMapping(value = "/basWrkIotype/edit/auth") |
| | | @ManagerAuth |
| | | public R edit(BasWrkIotype basWrkIotype) { |
| | | if (Cools.isEmpty(basWrkIotype)){ |
| | | if (Cools.isEmpty(basWrkIotype)) { |
| | | return R.error(); |
| | | } |
| | | if (null == basWrkIotype.getIoType()){ |
| | | if (null == basWrkIotype.getIoType()) { |
| | | basWrkIotypeService.insert(basWrkIotype); |
| | | } else { |
| | | basWrkIotypeService.updateById(basWrkIotype); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basWrkIotype/update/auth") |
| | | @RequestMapping(value = "/basWrkIotype/update/auth") |
| | | @ManagerAuth(memo = "入出库类型修改") |
| | | public R update(BasWrkIotype basWrkIotype){ |
| | | if (Cools.isEmpty(basWrkIotype) || null==basWrkIotype.getIoType()){ |
| | | public R update(BasWrkIotype basWrkIotype) { |
| | | if (Cools.isEmpty(basWrkIotype) || null == basWrkIotype.getIoType()) { |
| | | return R.error(); |
| | | } |
| | | basWrkIotype.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basWrkIotype/delete/auth") |
| | | @ManagerAuth(memo = "入出库类型删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<BasWrkIotype> list = JSONArray.parseArray(param, BasWrkIotype.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasWrkIotype entity : list){ |
| | | for (BasWrkIotype entity : list) { |
| | | basWrkIotypeService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basWrkIotype/export/auth") |
| | | @ManagerAuth(memo = "入出库类型导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<BasWrkIotype> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basWrkIotype")); |
| | |
| | | wrapper.like("io_desc", condition); |
| | | Page<BasWrkIotype> page = basWrkIotypeService.selectPage(new Page<>(0, 20), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasWrkIotype basWrkIotype : page.getRecords()){ |
| | | for (BasWrkIotype basWrkIotype : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basWrkIotype.getIoType()); |
| | | map.put("value", basWrkIotype.getIoDesc()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasWrkIotype> wrapper = new EntityWrapper<BasWrkIotype>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basWrkIotypeService.selectOne(wrapper)){ |
| | | if (null != basWrkIotypeService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasWrkIotype.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basWrkStatus/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<BasWrkStatus> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(basWrkStatusService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | @RequestMapping(value = "/basWrkStatus/edit/auth") |
| | | @ManagerAuth |
| | | public R edit(BasWrkStatus basWrkStatus) { |
| | | if (Cools.isEmpty(basWrkStatus)){ |
| | | if (Cools.isEmpty(basWrkStatus)) { |
| | | return R.error(); |
| | | } |
| | | if (null == basWrkStatus.getWrkSts()){ |
| | | if (null == basWrkStatus.getWrkSts()) { |
| | | basWrkStatusService.insert(basWrkStatus); |
| | | } else { |
| | | basWrkStatusService.updateById(basWrkStatus); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basWrkStatus/update/auth") |
| | | @RequestMapping(value = "/basWrkStatus/update/auth") |
| | | @ManagerAuth(memo = "工作状态修改") |
| | | public R update(BasWrkStatus basWrkStatus){ |
| | | if (Cools.isEmpty(basWrkStatus) || null==basWrkStatus.getWrkSts()){ |
| | | public R update(BasWrkStatus basWrkStatus) { |
| | | if (Cools.isEmpty(basWrkStatus) || null == basWrkStatus.getWrkSts()) { |
| | | return R.error(); |
| | | } |
| | | basWrkStatus.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basWrkStatus/delete/auth") |
| | | @ManagerAuth(memo = "工作状态删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<BasWrkStatus> list = JSONArray.parseArray(param, BasWrkStatus.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasWrkStatus entity : list){ |
| | | for (BasWrkStatus entity : list) { |
| | | basWrkStatusService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/basWrkStatus/export/auth") |
| | | @ManagerAuth(memo = "工作状态导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<BasWrkStatus> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basWrkStatus")); |
| | |
| | | wrapper.like("wrk_desc", condition); |
| | | Page<BasWrkStatus> page = basWrkStatusService.selectPage(new Page<>(0, 20), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasWrkStatus basWrkStatus : page.getRecords()){ |
| | | for (BasWrkStatus basWrkStatus : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basWrkStatus.getWrkSts()); |
| | | map.put("value", basWrkStatus.getWrkDesc()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasWrkStatus> wrapper = new EntityWrapper<BasWrkStatus>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basWrkStatusService.selectOne(wrapper)){ |
| | | if (null != basWrkStatusService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasWrkStatus.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.service.CommandInfoService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.service.CommandInfoService; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.enums.CommandStatusType; |
| | |
| | | |
| | | @RequestMapping(value = "/commandInfo/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<CommandInfo> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(commandInfoService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfo/listLog/auth") |
| | | @ManagerAuth |
| | | public R listLog(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R listLog(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<CommandInfo> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(commandInfoService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfo/update/auth") |
| | | @ManagerAuth |
| | | public R update(CommandInfo commandInfo){ |
| | | if (Cools.isEmpty(commandInfo) || null==commandInfo.getId()){ |
| | | @RequestMapping(value = "/commandInfo/update/auth") |
| | | @ManagerAuth |
| | | public R update(CommandInfo commandInfo) { |
| | | if (Cools.isEmpty(commandInfo) || null == commandInfo.getId()) { |
| | | return R.error(); |
| | | } |
| | | commandInfoService.updateById(commandInfo); |
| | |
| | | |
| | | @RequestMapping(value = "/commandInfo/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | commandInfoService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/commandInfo/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<CommandInfo> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("commandInfo")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<CommandInfo> page = commandInfoService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (CommandInfo commandInfo : page.getRecords()){ |
| | | for (CommandInfo commandInfo : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", commandInfo.getId()); |
| | | map.put("value", commandInfo.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<CommandInfo> wrapper = new EntityWrapper<CommandInfo>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != commandInfoService.selectOne(wrapper)){ |
| | | if (null != commandInfoService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(CommandInfo.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.entity.CommandInfoLog; |
| | | import com.zy.asrs.service.CommandInfoLogService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.CommandInfoLog; |
| | | import com.zy.asrs.service.CommandInfoLogService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | public class CommandInfoLogController extends BaseController { |
| | |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/listLog/auth") |
| | | @ManagerAuth |
| | | public R listLog(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R listLog(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<CommandInfoLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(commandInfoLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<CommandInfoLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(commandInfoLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(CommandInfoLog commandInfoLog){ |
| | | if (Cools.isEmpty(commandInfoLog) || null==commandInfoLog.getId()){ |
| | | @RequestMapping(value = "/commandInfoLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(CommandInfoLog commandInfoLog) { |
| | | if (Cools.isEmpty(commandInfoLog) || null == commandInfoLog.getId()) { |
| | | return R.error(); |
| | | } |
| | | commandInfoLogService.updateById(commandInfoLog); |
| | |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | commandInfoLogService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<CommandInfoLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("commandInfoLog")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<CommandInfoLog> page = commandInfoLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (CommandInfoLog commandInfoLog : page.getRecords()){ |
| | | for (CommandInfoLog commandInfoLog : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", commandInfoLog.getId()); |
| | | map.put("value", commandInfoLog.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<CommandInfoLog> wrapper = new EntityWrapper<CommandInfoLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != commandInfoLogService.selectOne(wrapper)){ |
| | | if (null != commandInfoLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(CommandInfoLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @PostMapping("/system/running/status") |
| | | @ManagerAuth(memo = "系统运行状态") |
| | | public R systemRunningStatus(){ |
| | | public R systemRunningStatus() { |
| | | return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); |
| | | } |
| | | |
| | | @PostMapping("/system/switch") |
| | | @ManagerAuth(memo = "系统运行开关操作") |
| | | public R systemSwitch(SystemSwitchParam param) throws InterruptedException { |
| | | if (Cools.isEmpty(param.getOperatorType())){ |
| | | if (Cools.isEmpty(param.getOperatorType())) { |
| | | return R.error(); |
| | | } |
| | | if (param.getOperatorType() == 0) { |
| | | if (Cools.isEmpty(param.getPassword())){ |
| | | if (Cools.isEmpty(param.getPassword())) { |
| | | return R.error("请输入口令"); |
| | | } |
| | | if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)){ |
| | | if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)) { |
| | | return R.error("口令错误"); |
| | | } |
| | | } |
| | | Thread.sleep(200L); |
| | | SystemProperties.WCS_RUNNING_STATUS.set(param.getOperatorType()==1?Boolean.TRUE:Boolean.FALSE); |
| | | SystemProperties.WCS_RUNNING_STATUS.set(param.getOperatorType() == 1 ? Boolean.TRUE : Boolean.FALSE); |
| | | return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/latest/data/site") |
| | | @ManagerAuth(memo = "站点实时数据") |
| | | public R siteLatestData(){ |
| | | public R siteLatestData() { |
| | | List<SiteLatestDataVo> vos = new ArrayList<>(); |
| | | Map<Integer, StaProtocol> stations = new HashMap<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | |
| | | |
| | | @PostMapping("/latest/data/crn") |
| | | @ManagerAuth(memo = "堆垛机实时数据") |
| | | public R crnLatestData(){ |
| | | public R crnLatestData() { |
| | | List<CrnLatestDataVo> vos = new ArrayList<>(); |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | // 获取堆垛机信息 |
| | |
| | | if (crnProtocol.getAlarm1() > 0) { |
| | | vo.setCrnStatus(CrnStatusType.MACHINE_ERROR); |
| | | } else { |
| | | if (crnProtocol.getTaskNo()>0) { |
| | | if (crnProtocol.getTaskNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | | vo.setCrnStatus(CrnStatusType.process(wrkMast.getIoType())); |
| | | } else { |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO : CrnStatusType.MACHINE_UN_AUTO); |
| | | } |
| | | } else { |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO : CrnStatusType.MACHINE_UN_AUTO); |
| | | } |
| | | } |
| | | vos.add(vo); |
| | |
| | | |
| | | @PostMapping("/latest/data/barcode") |
| | | @ManagerAuth(memo = "条码扫描仪实时数据") |
| | | public R barcodeLatestData(){ |
| | | public R barcodeLatestData() { |
| | | List<BarcodeDataVo> list = new ArrayList<>(); |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcode.getId()); |
| | |
| | | |
| | | @PostMapping("/latest/data/scale") |
| | | @ManagerAuth(memo = "磅秤实时数据") |
| | | public R scaleLatestData(){ |
| | | public R scaleLatestData() { |
| | | List<ScaleDataVo> list = new ArrayList<>(); |
| | | for (Slave scale : slaveProperties.getScale()) { |
| | | ScaleThread scaleThread = (ScaleThread) SlaveConnection.get(SlaveType.Scale, scale.getId()); |
| | |
| | | |
| | | @PostMapping("/site/detail") |
| | | @ManagerAuth(memo = "输送设备数据详情") |
| | | public R siteDetail(@RequestParam Integer siteId){ |
| | | if (Cools.isEmpty(siteId)){ |
| | | public R siteDetail(@RequestParam Integer siteId) { |
| | | if (Cools.isEmpty(siteId)) { |
| | | return R.parse(CodeRes.EMPTY); |
| | | } |
| | | SiteDetailVo vo = new SiteDetailVo(); |
| | |
| | | } |
| | | } |
| | | |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | vo.setAutoing(staProtocol.isAutoing() ? "Y" : "N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | |
| | | vo.setCanining(basDevp.getCanining()); // 能入 |
| | | vo.setCanouting(basDevp.getCanouting()); // 能出 |
| | |
| | | |
| | | @PostMapping("/crn/detail") |
| | | @ManagerAuth(memo = "堆垛机设备数据详情") |
| | | public R crnDetail(@RequestParam Integer crnNo){ |
| | | if (Cools.isEmpty(crnNo)){ |
| | | public R crnDetail(@RequestParam Integer crnNo) { |
| | | if (Cools.isEmpty(crnNo)) { |
| | | return R.parse(CodeRes.EMPTY); |
| | | } |
| | | CrnDetailVo vo = new CrnDetailVo(); |
| | |
| | | @Deprecated |
| | | @PostMapping("/site/update") |
| | | @ManagerAuth(memo = "输送设备数据修改") |
| | | public R updateSite(){ |
| | | public R updateSite() { |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Deprecated |
| | | @PostMapping("/crn/update") |
| | | @ManagerAuth(memo = "堆垛机数据修改") |
| | | public R updateCrn(){ |
| | | public R updateCrn() { |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/barcode/output/site") |
| | | public R crnOutput(){ |
| | | public R crnOutput() { |
| | | ArrayList<JSONObject> jsonObjects = new ArrayList<>(OutputQueue.SCALE); |
| | | jsonObjects.sort(new Comparator<JSONObject>() { |
| | | @Override |
| | |
| | | } |
| | | |
| | | @PostMapping("loc/pie/charts") |
| | | public R dsa(){ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | List<ChartBean> list = new ArrayList<ChartBean>(); |
| | | public R dsa() { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | List<ChartBean> list = new ArrayList<ChartBean>(); |
| | | |
| | | LocChartPie locUseRate = reportQueryMapper.getLocUseRate(); |
| | | if(locUseRate!=null) { |
| | | if (locUseRate != null) { |
| | | ChartBean fqty = new ChartBean(); |
| | | fqty.setName("在库库位"); |
| | | fqty.setY(locUseRate.getFqty()); |
| | |
| | | xqty.setY(locUseRate.getXqty()); |
| | | list.add(xqty); |
| | | } |
| | | map.put("rows",list); |
| | | map.put("rows", list); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | @PostMapping("locIo/line/charts") |
| | | public R locIoLineCharts(){ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | public R locIoLineCharts() { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | List<AxisBean> list = new ArrayList<AxisBean>(); |
| | | |
| | | List<WorkChartAxis> listChart = reportQueryMapper.getChartAxis(); |
| | | |
| | | if(listChart!=null) { |
| | | if (listChart != null) { |
| | | ArrayList<Integer> data1 = new ArrayList<Integer>(); |
| | | ArrayList<Integer> data2 = new ArrayList<Integer>(); |
| | | |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DATE, -12); |
| | | for(int i=0;i<12;i++) { |
| | | for (int i = 0; i < 12; i++) { |
| | | boolean flag = true; |
| | | calendar.add(Calendar.DATE, 1); |
| | | String str = sf.format(calendar.getTime()); |
| | | for(WorkChartAxis workChart : listChart) { |
| | | if(str.equals(workChart.getYmd())) { |
| | | for (WorkChartAxis workChart : listChart) { |
| | | if (str.equals(workChart.getYmd())) { |
| | | data1.add(workChart.getInqty()); |
| | | data2.add(workChart.getOutqty()); |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if(flag) { |
| | | if (flag) { |
| | | data1.add(0); |
| | | data2.add(0); |
| | | } |
| | |
| | | outqty.setData(data2.toArray(array2)); |
| | | list.add(outqty); |
| | | } |
| | | map.put("rows",list); |
| | | map.put("rows", list); |
| | | return R.ok(map); |
| | | } |
| | | |
| | |
| | | import com.zy.asrs.domain.vo.CrnListVo; |
| | | import com.zy.asrs.domain.vo.CrnMsgTableVo; |
| | | import com.zy.asrs.domain.vo.CrnStateTableVo; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.BasCrnError; |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.mapper.BasCrnErrorMapper; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.LocMastService; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | private String movePath; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | |
| | | |
| | | @ManagerAuth(memo = "进行中的命令") |
| | | @PostMapping("/crn/command/ongoing") |
| | | public R ongoingCommand(){ |
| | | public R ongoingCommand() { |
| | | List<CommandLogVo> list = new ArrayList<>(); |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | CommandLogVo vo = new CommandLogVo(); |
| | |
| | | vo.setStatus(1); // 状态 |
| | | Task task = MessageQueue.peek(SlaveType.Crn, crn.getId()); |
| | | if (task != null) { |
| | | vo.setCommand(JSON.toJSONString((CrnCommand)task.getData())); |
| | | vo.setCommand(JSON.toJSONString((CrnCommand) task.getData())); |
| | | } |
| | | } |
| | | return R.ok().add(list); |
| | |
| | | |
| | | @PostMapping("/crn/table/crn/state") |
| | | @ManagerAuth(memo = "堆垛机信息表") |
| | | public R crnStateTable(){ |
| | | public R crnStateTable() { |
| | | List<CrnStateTableVo> list = new ArrayList<>(); |
| | | List<BasCrnp> crnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().orderBy("crn_no")); |
| | | for (BasCrnp basCrnp : crnps) { |
| | |
| | | |
| | | vo.setForkOffset(crnProtocol.getForkPosType().desc); // 货叉位置 |
| | | vo.setLiftPos(crnProtocol.getLiftPosType().desc); |
| | | vo.setWalkPos(crnProtocol.getWalkPos()==1?"不在定位":"在定位"); |
| | | vo.setWalkPos(crnProtocol.getWalkPos() == 1 ? "不在定位" : "在定位"); |
| | | vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1())); |
| | | if (crnProtocol.getAlarm() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); |
| | | vo.setAlarm(crnError==null?"未知异常":crnError.getErrName()); |
| | | vo.setAlarm(crnError == null ? "未知异常" : crnError.getErrName()); |
| | | } |
| | | } |
| | | return R.ok().add(list); |
| | |
| | | |
| | | @PostMapping("/crn/table/crn/{id}/state") |
| | | @ManagerAuth(memo = "堆垛机信息表") |
| | | public R crnStateTable(@PathVariable("id") Integer id){ |
| | | public R crnStateTable(@PathVariable("id") Integer id) { |
| | | BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", id).orderBy("crn_no")); |
| | | // 表格行 |
| | | CrnStateTableVo vo = new CrnStateTableVo(); |
| | |
| | | |
| | | vo.setForkOffset(crnProtocol.getForkPosType().desc); // 货叉位置 |
| | | vo.setLiftPos(crnProtocol.getLiftPosType().desc); |
| | | vo.setWalkPos(crnProtocol.getWalkPos()==1?"不在定位":"在定位"); |
| | | vo.setWalkPos(crnProtocol.getWalkPos() == 1 ? "不在定位" : "在定位"); |
| | | vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1())); |
| | | if (crnProtocol.getAlarm1() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1()); |
| | | vo.setAlarm(crnError==null?"未知异常":crnError.getErrName()); |
| | | vo.setAlarm(crnError == null ? "未知异常" : crnError.getErrName()); |
| | | } |
| | | return R.ok().add(vo); |
| | | } |
| | | |
| | | @PostMapping("/crn/table/crn/msg") |
| | | @ManagerAuth(memo = "堆垛机数据表") |
| | | public R crnMsgTable(){ |
| | | public R crnMsgTable() { |
| | | List<CrnMsgTableVo> list = new ArrayList<>(); |
| | | List<BasCrnp> crnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().orderBy("crn_no")); |
| | | for (BasCrnp basCrnp : crnps) { |
| | |
| | | } |
| | | |
| | | vo.setWorkNo(crnProtocol.getTaskNo()); // 任务号 |
| | | if (crnProtocol.getTaskNo()>0) { |
| | | if (crnProtocol.getTaskNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | | vo.setStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc()); // 模式状态 |
| | |
| | | vo.setLocNo(wrkMast.getLocNo()); // 目标库位 |
| | | } |
| | | } else { |
| | | vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO.getDesc(): CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO.getDesc() : CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | } |
| | | vo.setXspeed(crnProtocol.getXSpeed()); // 走行速度(m/min) |
| | | vo.setYspeed(crnProtocol.getYSpeed()); // 升降速度(m/min) |
| | |
| | | |
| | | @PostMapping("/crn/table/crn/{id}/msg") |
| | | @ManagerAuth(memo = "堆垛机数据表") |
| | | public R crnMsgTable(@PathVariable("id") Integer id){ |
| | | public R crnMsgTable(@PathVariable("id") Integer id) { |
| | | BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", id).orderBy("crn_no")); |
| | | // 表格行 |
| | | CrnMsgTableVo vo = new CrnMsgTableVo(); |
| | |
| | | } |
| | | |
| | | vo.setWorkNo(crnProtocol.getTaskNo()); // 任务号 |
| | | if (crnProtocol.getTaskNo()>0) { |
| | | if (crnProtocol.getTaskNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | | vo.setStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc()); // 模式状态 |
| | |
| | | vo.setLocNo(wrkMast.getLocNo()); // 目标库位 |
| | | } |
| | | } else { |
| | | vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO.getDesc(): CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO.getDesc() : CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | } |
| | | vo.setXspeed(crnProtocol.getXSpeed()); // 走行速度(m/min) |
| | | vo.setYspeed(crnProtocol.getYSpeed()); // 升降速度(m/min) |
| | |
| | | |
| | | @GetMapping("/crn/list/auth") |
| | | @ManagerAuth(memo = "堆垛机数据表") |
| | | public R crnList(){ |
| | | public R crnList() { |
| | | List<CrnListVo> list = new ArrayList<>(); |
| | | List<BasCrnp> crnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().orderBy("crn_no")); |
| | | for (BasCrnp basCrnp : crnps) { |
| | |
| | | } |
| | | |
| | | vo.setWorkNo(crnProtocol.getTaskNo()); // 任务号 |
| | | if (crnProtocol.getTaskNo()>0) { |
| | | if (crnProtocol.getTaskNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | | vo.setDeviceStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc()); // 模式状态 |
| | |
| | | vo.setLocNo(wrkMast.getLocNo()); // 目标库位 |
| | | } |
| | | } else { |
| | | vo.setDeviceStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO.getDesc(): CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | vo.setDeviceStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO.getDesc() : CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | } |
| | | vo.setXspeed(crnProtocol.getXSpeed()); // 走行速度(m/min) |
| | | vo.setYspeed(crnProtocol.getYSpeed()); // 升降速度(m/min) |
| | |
| | | |
| | | vo.setForkOffset(crnProtocol.getForkPosType().desc); // 货叉位置 |
| | | vo.setLiftPos(crnProtocol.getLiftPosType().desc); |
| | | vo.setWalkPos(crnProtocol.getWalkPos()==1?"不在定位":"在定位"); |
| | | vo.setWalkPos(crnProtocol.getWalkPos() == 1 ? "不在定位" : "在定位"); |
| | | vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1())); |
| | | if (crnProtocol.getAlarm1() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1()); |
| | | vo.setAlarm(crnError==null?"未知异常":crnError.getErrName()); |
| | | vo.setAlarm(crnError == null ? "未知异常" : crnError.getErrName()); |
| | | } |
| | | vo.setInEnable(basCrnp.getInEnable()); |
| | | vo.setOutEnable(basCrnp.getOutEnable()); |
| | |
| | | |
| | | @PostMapping("/crn/output/site") |
| | | @ManagerAuth(memo = "堆垛机报文日志输出") |
| | | public R crnOutput(){ |
| | | public R crnOutput() { |
| | | StringBuilder str = new StringBuilder(); |
| | | String s; |
| | | int i = 0; |
| | | while((s = OutputQueue.CRN.poll()) != null && i <=10) { |
| | | while ((s = OutputQueue.CRN.poll()) != null && i <= 10) { |
| | | str.append("\n").append(s); |
| | | i++; |
| | | } |
| | |
| | | |
| | | |
| | | @GetMapping("/crn/demo/status") |
| | | public R demoStatus(){ |
| | | public R demoStatus() { |
| | | List<Map<String, Object>> res = new ArrayList<>(); |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | @PostMapping("/crn/demo/switch") |
| | | @ManagerAuth(memo = "堆垛机演示") |
| | | public R crnDemo(CrnDemoParam param) throws InterruptedException { |
| | | if (Cools.isEmpty(param.getCrnId())){ |
| | | if (Cools.isEmpty(param.getCrnId())) { |
| | | return R.error(); |
| | | } |
| | | if (Cools.isEmpty(param.getPassword())){ |
| | | if (Cools.isEmpty(param.getPassword())) { |
| | | return R.error("请输入口令"); |
| | | } |
| | | if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)){ |
| | | if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)) { |
| | | return R.error("口令错误"); |
| | | } |
| | | Thread.sleep(200L); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /****************************************************************/ |
| | | /************************** 手动操作 ******************************/ |
| | | /****************************************************************/ |
| | | |
| | | @ManagerAuth(memo = "入库") |
| | | @PostMapping("/crn/operator/put") |
| | | public R crnPut(CrnOperatorParam param){ |
| | | public R crnPut(CrnOperatorParam param) { |
| | | // // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | command.setDestinationPosY(param.getBay()); // 目标库位列 |
| | | command.setDestinationPosZ(param.getLev()); // 目标库位层 |
| | | // command.setCommand((short)1); |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "出库") |
| | | @PostMapping("/crn/operator/take") |
| | | public R crnTake(CrnOperatorParam param){ |
| | | public R crnTake(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | command.setDestinationPosY(param.getBay()); // 目标库位列 |
| | | command.setDestinationPosZ(param.getLev()); // 目标库位层 |
| | | // command.setCommand((short)1); |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "库位转移") |
| | | @PostMapping("/crn/operator/stockMove") |
| | | public R crnStockMove(CrnOperatorParam param){ |
| | | public R crnStockMove(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getDestinationPosX()) |
| | | .eq("bay1", command.getDestinationPosY()).eq("lev1", command.getDestinationPosZ())); |
| | | VersionUtils.locMoveCheckLocType(sourceLoc, loc); |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "站到站") |
| | | @PostMapping("/crn/operator/siteMove") |
| | | public R crnSiteMove(CrnOperatorParam param){ |
| | | public R crnSiteMove(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | command.setDestinationPosX(param.getStaNo()); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 1); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "回原点") |
| | | @PostMapping("/crn/operator/bacOrigin") |
| | | public R crnBacOrigin(CrnOperatorParam param){ |
| | | public R crnBacOrigin(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | command.setDestinationPosX((short) 0); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 0); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "反原点") |
| | | @PostMapping("/crn/operator/reverseOrigin") |
| | | public R reverseOrigin(CrnOperatorParam param){ |
| | | public R reverseOrigin(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | command.setDestinationPosX((short) 0); // 目标库位排 |
| | | command.setDestinationPosY((short) 22); // 目标库位列 |
| | | command.setDestinationPosZ((short) 1); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | // @ManagerAuth(memo = "坐标移动") |
| | |
| | | |
| | | @ManagerAuth(memo = "任务完成") |
| | | @PostMapping("/crn/operator/taskComplete") |
| | | public R crnTaskComplete(CrnOperatorParam param){ |
| | | public R crnTaskComplete(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | command.setDestinationPosX((short) 0); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 0); // 目标库位层 |
| | | command.setCommand((short)0); |
| | | return crnControl(command)?R.ok():R.error(); |
| | | command.setCommand((short) 0); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | // @ManagerAuth(memo = "暂停") |
| | |
| | | |
| | | @ManagerAuth(memo = "清除命令") |
| | | @PostMapping("/crn/operator/clearCommand") |
| | | public R crnClearCommand(CrnOperatorParam param){ |
| | | public R crnClearCommand(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | command.setDestinationPosX((short) 0); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 0); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "手动复位") |
| | |
| | | |
| | | @ManagerAuth(memo = "切换联机模式") |
| | | @PostMapping("/crn/operator/auto") |
| | | public R crnAuto(CrnOperatorParam param){ |
| | | public R crnAuto(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setAuto((short)1); |
| | | command.setAuto((short) 1); |
| | | |
| | | return crnControl2(command)?R.ok():R.error(); |
| | | return crnControl2(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "切换半手动模式") |
| | | @PostMapping("/crn/operator/semiAutomatic") |
| | | public R crnsemiAutomatic(CrnOperatorParam param){ |
| | | public R crnsemiAutomatic(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setAuto((short)2); |
| | | command.setAuto((short) 2); |
| | | |
| | | return crnControl2(command)?R.ok():R.error(); |
| | | return crnControl2(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "切换手动模式") |
| | | @PostMapping("/crn/operator/hand") |
| | | public R onlineWrk1(CrnOperatorParam param){ |
| | | public R onlineWrk1(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setAuto((short)3); |
| | | command.setAuto((short) 3); |
| | | |
| | | return crnControl2(command)?R.ok():R.error(); |
| | | return crnControl2(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "申请完成任务") |
| | | @PostMapping("/crn/operator/onlineWrk1") |
| | | public R onlineWrk2(CrnOperatorParam param){ |
| | | public R onlineWrk2(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setOnlineWrk1((short)1); |
| | | command.setOnlineWrk1((short) 1); |
| | | |
| | | return crnControl2(command)?R.ok():R.error(); |
| | | return crnControl2(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "申请取消任务") |
| | | @PostMapping("/crn/operator/onlineWrk2") |
| | | public R onlineWrk3(CrnOperatorParam param){ |
| | | public R onlineWrk3(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setOnlineWrk2((short)1); |
| | | command.setOnlineWrk2((short) 1); |
| | | |
| | | return crnControl2(command)?R.ok():R.error(); |
| | | return crnControl2(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "清除联机任务") |
| | | @PostMapping("/crn/operator/onlineWrk3") |
| | | public R onlineWrk4(CrnOperatorParam param){ |
| | | public R onlineWrk4(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setOnlineWrk3((short)1); |
| | | command.setOnlineWrk3((short) 1); |
| | | |
| | | return crnControl2(command)?R.ok():R.error(); |
| | | return crnControl2(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "恢复联机任务") |
| | | @PostMapping("/crn/operator/onlineWrk4") |
| | | public R crnHand(CrnOperatorParam param){ |
| | | public R crnHand(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setOnlineWrk4((short)1); |
| | | command.setOnlineWrk4((short) 1); |
| | | |
| | | return crnControl2(command)?R.ok():R.error(); |
| | | return crnControl2(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "复位") |
| | | @PostMapping("/crn/operator/reset") |
| | | public R crnReset(CrnOperatorParam param){ |
| | | public R crnReset(CrnOperatorParam param) { |
| | | // 系统运行状态判断 |
| | | // if (SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | // return R.error("wcs系统状态为开启"); |
| | |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setReset((short)1); |
| | | command.setReset((short) 1); |
| | | |
| | | return crnControl2(command)?R.ok():R.error(); |
| | | return crnControl2(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | |
| | | |
| | | private boolean crnControl2(CrnCommand command){ |
| | | private boolean crnControl2(CrnCommand command) { |
| | | if (command.getCrnNo() == null) { |
| | | throw new CoolException("请选择堆垛机"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private boolean crnControl(CrnCommand command){ |
| | | private boolean crnControl(CrnCommand command) { |
| | | if (command.getCrnNo() == null) { |
| | | throw new CoolException("请选择堆垛机"); |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | private void staNoProcess(CrnOperatorParam param, CrnCommand command){ |
| | | if (param.getSourceStaNo()!=null) { |
| | | private void staNoProcess(CrnOperatorParam param, CrnCommand command) { |
| | | if (param.getSourceStaNo() != null) { |
| | | if (param.getSourceStaNo() == 5) { |
| | | command.setSourcePosX((short) 2); // 源库位排 |
| | | command.setSourcePosY((short) 0); // 源库位列 |
| | |
| | | command.setSourcePosZ((short) 1); // 源库位层 |
| | | } |
| | | } |
| | | if (param.getStaNo()!=null) { |
| | | if (param.getStaNo() != null) { |
| | | if (param.getStaNo() == 5) { |
| | | command.setDestinationPosX((short) 2); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | |
| | | // /crn/list/auth |
| | | @RequestMapping(value = "/crnListQuery/auth") |
| | | @ManagerAuth |
| | | public R listQuery(String condition){ |
| | | public R listQuery(String condition) { |
| | | ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | // 获取堆垛机信息 |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.DataResource; |
| | | import com.zy.asrs.service.DataResourceService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.DataResource; |
| | | import com.zy.asrs.service.DataResourceService; |
| | | import com.zy.common.utils.YamlUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | public class DataResourceController extends BaseController { |
| | |
| | | |
| | | @RequestMapping(value = "/dataResource/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<DataResource> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(dataResourceService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/dataResource/tree/auth") |
| | | @ManagerAuth |
| | | public R tree(){ |
| | | public R tree() { |
| | | return R.parse("0-操作成功").add(dataResourceService.selectAll()); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/dataResource/update/auth") |
| | | @ManagerAuth |
| | | public R update(DataResource dataResource){ |
| | | if (Cools.isEmpty(dataResource) || null==dataResource.getId()){ |
| | | @RequestMapping(value = "/dataResource/update/auth") |
| | | @ManagerAuth |
| | | public R update(DataResource dataResource) { |
| | | if (Cools.isEmpty(dataResource) || null == dataResource.getId()) { |
| | | return R.error(); |
| | | } |
| | | dataResourceService.updateById(dataResource); |
| | |
| | | |
| | | @RequestMapping(value = "/dataResource/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Integer[] ids){ |
| | | for (Integer id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Integer[] ids) { |
| | | for (Integer id : ids) { |
| | | dataResourceService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/dataResource/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<DataResource> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("dataResource")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<DataResource> page = dataResourceService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (DataResource dataResource : page.getRecords()){ |
| | | for (DataResource dataResource : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", dataResource.getId()); |
| | | map.put("value", dataResource.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<DataResource> wrapper = new EntityWrapper<DataResource>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != dataResourceService.selectOne(wrapper)){ |
| | | if (null != dataResourceService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(DataResource.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.DeviceError; |
| | | import com.zy.asrs.service.DeviceErrorService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.DeviceError; |
| | | import com.zy.asrs.service.DeviceErrorService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @RequestMapping(value = "/deviceError/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<DeviceError> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(deviceErrorService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/deviceError/update/auth") |
| | | @ManagerAuth |
| | | public R update(DeviceError deviceError){ |
| | | if (Cools.isEmpty(deviceError) || null==deviceError.getId()){ |
| | | @RequestMapping(value = "/deviceError/update/auth") |
| | | @ManagerAuth |
| | | public R update(DeviceError deviceError) { |
| | | if (Cools.isEmpty(deviceError) || null == deviceError.getId()) { |
| | | return R.error(); |
| | | } |
| | | deviceErrorService.updateById(deviceError); |
| | |
| | | |
| | | @RequestMapping(value = "/deviceError/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | deviceErrorService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/deviceError/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<DeviceError> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("deviceError")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<DeviceError> page = deviceErrorService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (DeviceError deviceError : page.getRecords()){ |
| | | for (DeviceError deviceError : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", deviceError.getId()); |
| | | map.put("value", deviceError.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<DeviceError> wrapper = new EntityWrapper<DeviceError>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != deviceErrorService.selectOne(wrapper)){ |
| | | if (null != deviceErrorService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(DeviceError.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/locDetl/auth") |
| | | @ManagerAuth |
| | | public R stockOutList(@RequestParam(value = "locNos[]") List<String> locNos){ |
| | | public R stockOutList(@RequestParam(value = "locNos[]") List<String> locNos) { |
| | | if (!locNos.isEmpty()) { |
| | | List<LocDetl> res = new ArrayList<>(); |
| | | for (String locNo : new HashSet<>(locNos)) { |
| | |
| | | |
| | | @RequestMapping(value = "/locDetl/list/auth")// /locDetl/list/auth 接口问题 |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(LocDetl.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locDetl/update/auth") |
| | | @ManagerAuth(memo = "库位明细修改") |
| | | public R update(LocDetl locDetl){ |
| | | if (Cools.isEmpty(locDetl) || null==locDetl.getMatnr()){ |
| | | @RequestMapping(value = "/locDetl/update/auth") |
| | | @ManagerAuth(memo = "库位明细修改") |
| | | public R update(LocDetl locDetl) { |
| | | if (Cools.isEmpty(locDetl) || null == locDetl.getMatnr()) { |
| | | return R.error(); |
| | | } |
| | | locDetl.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/locDetl/delete/auth") |
| | | @ManagerAuth(memo = "库位明细删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<LocDetl> list = JSONArray.parseArray(param, LocDetl.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (LocDetl entity : list){ |
| | | for (LocDetl entity : list) { |
| | | locDetlService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/locDetl/export/auth") |
| | | @ManagerAuth(memo = "库位明细导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("locDetl")); |
| | |
| | | if (chooseRow.length() == 1) { |
| | | row = "0" + chooseRow; |
| | | map.remove("row"); |
| | | }else { |
| | | } else { |
| | | row = chooseRow; |
| | | map.remove("row"); |
| | | } |
| | | } |
| | | convert(map, wrapper); |
| | | if (!row.equals("")){ |
| | | if (!row.equals("")) { |
| | | wrapper.and() |
| | | .where("loc_no like '" +row +"%'"); |
| | | .where("loc_no like '" + row + "%'"); |
| | | } |
| | | List<LocDetl> list = locDetlService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | |
| | | wrapper.like("matnr", condition); |
| | | Page<LocDetl> page = locDetlService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (LocDetl locDetl : page.getRecords()){ |
| | | for (LocDetl locDetl : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", locDetl.getMatnr()); |
| | | map.put("value", locDetl.getMatnr()); |
| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.param.LocMastInitParam; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.Shelves; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @RequestMapping(value = "/locMast/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper.eq("status",0))); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper.eq("status", 0))); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | |
| | | @RequestMapping(value = "/locMast/delete/auth") |
| | | @ManagerAuth(memo = "库位删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<LocMast> list = JSONArray.parseArray(param, LocMast.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (LocMast entity : list){ |
| | | for (LocMast entity : list) { |
| | | locMastService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/locMast/export/auth") |
| | | @ManagerAuth(memo = "库位导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("locMast")); |
| | |
| | | wrapper.like("loc_no", condition); |
| | | Page<LocMast> page = locMastService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (LocMast locMast : page.getRecords()){ |
| | | for (LocMast locMast : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", locMast.getLocNo()); |
| | | map.put("value", locMast.getLocNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<LocMast> wrapper = new EntityWrapper<LocMast>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != locMastService.selectOne(wrapper)){ |
| | | if (null != locMastService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(LocMast.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/locMast/update/auth") |
| | | @ManagerAuth(memo = "库位修改") |
| | | public R update(LocMast locMast){ |
| | | if (Cools.isEmpty(locMast) || null==locMast.getLocNo()){ |
| | | public R update(LocMast locMast) { |
| | | if (Cools.isEmpty(locMast) || null == locMast.getLocNo()) { |
| | | return R.error(); |
| | | } |
| | | if (!Cools.isEmpty(locMast.getContainerCode())){ |
| | | if (!Cools.isEmpty(locMast.getContainerCode())) { |
| | | locMast.setBarcode(locMast.getContainerCode()); |
| | | } |
| | | |
| | | if (locMast.getEmptyContainer$().equals("N") ){ |
| | | if (locMast.getContainerCode().isEmpty() || locMast.getContainerTypeCode().isEmpty()){ |
| | | if (locMast.getEmptyContainer$().equals("N")) { |
| | | if (locMast.getContainerCode().isEmpty() || locMast.getContainerTypeCode().isEmpty()) { |
| | | return R.error("容器编码或容器类型有误"); |
| | | } |
| | | } |
| | | if (locMast.getLocSts().equals("O")){ |
| | | if (locMast.getLocSts().equals("O")) { |
| | | locMast.setBarcode(null); |
| | | } |
| | | locMast.setModiUser(getUserId()); |
| | |
| | | // @Transactional |
| | | public R init(LocMastInitParam param) { |
| | | List<LocMast> list = new ArrayList<>(); |
| | | for (int r=param.getStartRow(); r<=param.getEndRow(); r++){ |
| | | for (int b=param.getStartBay(); b<=param.getEndBay(); b++) { |
| | | for (int l=param.getStartLev(); l<=param.getEndLev(); l++) { |
| | | for (int r = param.getStartRow(); r <= param.getEndRow(); r++) { |
| | | for (int b = param.getStartBay(); b <= param.getEndBay(); b++) { |
| | | for (int l = param.getStartLev(); l <= param.getEndLev(); l++) { |
| | | // 获取库位号 |
| | | String locNo = String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l); |
| | | // 获取堆垛机号 |
| | |
| | | // break; |
| | | // } |
| | | // } |
| | | Date now = new Date(); |
| | | Date now = new Date(); |
| | | LocMast locMast = new LocMast(); |
| | | locMast.setLocNo(locNo); |
| | | locMast.setLocSts("O"); |
| | |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | |
| | | @RequestMapping("/monitor") |
| | | public class MonitorController { |
| | | |
| | | private static final String[] WEEK = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"}; |
| | | private static final String[] WEEK = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; |
| | | |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | |
| | | calendar.setTime(now); |
| | | return R.ok( |
| | | Cools.add("year", calendar.get(Calendar.YEAR)) |
| | | .add("month", CommonService.zerofill(String.valueOf(calendar.get(Calendar.MONTH)+1), 2)) |
| | | .add("day", CommonService.zerofill(String.valueOf(calendar.get(Calendar.DATE)), 2)) |
| | | .add("hour", CommonService.zerofill(String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)), 2)) |
| | | .add("minute", CommonService.zerofill(String.valueOf(calendar.get(Calendar.MINUTE)), 2)) |
| | | .add("second", CommonService.zerofill(String.valueOf(calendar.get(Calendar.SECOND)) , 2)) |
| | | .add("week", WEEK[calendar.get(Calendar.DAY_OF_WEEK)-1]) |
| | | .add("month", CommonService.zerofill(String.valueOf(calendar.get(Calendar.MONTH) + 1), 2)) |
| | | .add("day", CommonService.zerofill(String.valueOf(calendar.get(Calendar.DATE)), 2)) |
| | | .add("hour", CommonService.zerofill(String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)), 2)) |
| | | .add("minute", CommonService.zerofill(String.valueOf(calendar.get(Calendar.MINUTE)), 2)) |
| | | .add("second", CommonService.zerofill(String.valueOf(calendar.get(Calendar.SECOND)), 2)) |
| | | .add("week", WEEK[calendar.get(Calendar.DAY_OF_WEEK) - 1]) |
| | | ); |
| | | } |
| | | |
| | |
| | | |
| | | return R.ok( |
| | | Cools.add("xSpeed", Arith.multiplys(1, Math.abs(xSpeed), 1)) // 行走速度 |
| | | .add("ySpeed", Arith.multiplys(1, Math.abs(ySpeed), 1)) // 升降速度 |
| | | .add("zSpeed", Arith.multiplys(1, Math.abs(zSpeed), 1)) // 叉牙速度 |
| | | .add("forkPos", forkPos) // 叉牙速度 |
| | | .add("xDistance", Arith.multiplys(1, Math.abs(xDistance), 1)) // 累计走行距离km |
| | | .add("yDistance", Arith.multiplys(1, Math.abs(yDistance), 1)) // 累计升降距离km |
| | | .add("xDuration", Arith.multiplys(1, Math.abs(xDuration), 1)) // 累计走行时长h |
| | | .add("yDuration", Arith.multiplys(1, Math.abs(yDuration), 1)) // 累计升降时长h |
| | | .add("ySpeed", Arith.multiplys(1, Math.abs(ySpeed), 1)) // 升降速度 |
| | | .add("zSpeed", Arith.multiplys(1, Math.abs(zSpeed), 1)) // 叉牙速度 |
| | | .add("forkPos", forkPos) // 叉牙速度 |
| | | .add("xDistance", Arith.multiplys(1, Math.abs(xDistance), 1)) // 累计走行距离km |
| | | .add("yDistance", Arith.multiplys(1, Math.abs(yDistance), 1)) // 累计升降距离km |
| | | .add("xDuration", Arith.multiplys(1, Math.abs(xDuration), 1)) // 累计走行时长h |
| | | .add("yDuration", Arith.multiplys(1, Math.abs(yDuration), 1)) // 累计升降时长h |
| | | // .add("isShow", !Cools.isEmpty(ledContent)) // 是否显示内容 |
| | | // .add("content", ledContent) // 显示内容 |
| | | ); |
| | |
| | | */ |
| | | @RateLimit(2) |
| | | @GetMapping("/pakin/rep") |
| | | public R monitorPakinRep(){ |
| | | public R monitorPakinRep() { |
| | | // 入库 |
| | | List<Map<String, Object>> pakinRep = reportQueryMapper.queryPakinRep(); |
| | | for (Map<String, Object> map : pakinRep) { |
| | | if (map.get("node")!=null) { |
| | | if (map.get("node") != null) { |
| | | map.put("node", String.valueOf(map.get("node")).substring(5, 10)); |
| | | } |
| | | } |
| | |
| | | |
| | | @RateLimit(2) |
| | | @GetMapping("/line/charts") |
| | | public R locIoLineCharts(){ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | public R locIoLineCharts() { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | List<AxisBean> list = new ArrayList<AxisBean>(); |
| | | |
| | | List<WorkChartAxis> listChart = reportQueryMapper.getChartAxis(); |
| | | |
| | | if(listChart!=null) { |
| | | if (listChart != null) { |
| | | ArrayList<Integer> data1 = new ArrayList<Integer>(); |
| | | ArrayList<Integer> data2 = new ArrayList<Integer>(); |
| | | |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DATE, -12); |
| | | for(int i=0;i<12;i++) { |
| | | for (int i = 0; i < 12; i++) { |
| | | boolean flag = true; |
| | | calendar.add(Calendar.DATE, 1); |
| | | String str = sf.format(calendar.getTime()); |
| | | for(WorkChartAxis workChart : listChart) { |
| | | if(str.equals(workChart.getYmd())) { |
| | | for (WorkChartAxis workChart : listChart) { |
| | | if (str.equals(workChart.getYmd())) { |
| | | data1.add(workChart.getInqty()); |
| | | data2.add(workChart.getOutqty()); |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if(flag) { |
| | | if (flag) { |
| | | data1.add(0); |
| | | data2.add(0); |
| | | } |
| | |
| | | outqty.setData(data2.toArray(array2)); |
| | | list.add(outqty); |
| | | } |
| | | map.put("rows",list); |
| | | map.put("rows", list); |
| | | return R.ok(map); |
| | | } |
| | | |
| | |
| | | */ |
| | | @RateLimit(2) |
| | | @GetMapping("/loc/rep") |
| | | public R monitorLocRep(){ |
| | | public R monitorLocRep() { |
| | | List<Map<String, Object>> pie = new ArrayList<>(); |
| | | |
| | | LocChartPie locUseRate = reportQueryMapper.getLocUseRate(); |
| | | if(locUseRate!=null) { |
| | | if (locUseRate != null) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", "在库"); |
| | | map.put("value", locUseRate.getFqty()); |
| | |
| | | |
| | | return R.ok( |
| | | Cools.add("pie", pie) |
| | | .add("stockCunt", locUseRate.getFqty()) |
| | | .add("emptyCount", locUseRate.getOqty()) |
| | | .add("noneCount", locUseRate.getXqty()) |
| | | .add("total", total) |
| | | .add("used", used) |
| | | .add("usedPr", usedPr) |
| | | .add("stockCunt", locUseRate.getFqty()) |
| | | .add("emptyCount", locUseRate.getOqty()) |
| | | .add("noneCount", locUseRate.getXqty()) |
| | | .add("total", total) |
| | | .add("used", used) |
| | | .add("usedPr", usedPr) |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 自动补零 |
| | | */ |
| | | private List<Map<String, Object>> fill(List<Map<String, Object>> list, int start, int end){ |
| | | for (int i = start ; i <= end; i++){ |
| | | private List<Map<String, Object>> fill(List<Map<String, Object>> list, int start, int end) { |
| | | for (int i = start; i <= end; i++) { |
| | | boolean exist = false; |
| | | for (Map seq : list){ |
| | | if (Integer.parseInt(String.valueOf(seq.get("node"))) == i){ |
| | | for (Map seq : list) { |
| | | if (Integer.parseInt(String.valueOf(seq.get("node"))) == i) { |
| | | exist = true; |
| | | } |
| | | } |
| | | if (!exist){ |
| | | if (!exist) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("node", i); |
| | | map.put("val", 0); |
| | |
| | | |
| | | /** |
| | | * x轴单位转换 |
| | | * |
| | | * @param dot y轴数值保留小数位 |
| | | */ |
| | | private List<Map<String, Object>> convert(List<Map<String, Object>> list, StatsType statsType, int dot){ |
| | | for (Map<String, Object> map : list){ |
| | | private List<Map<String, Object>> convert(List<Map<String, Object>> list, StatsType statsType, int dot) { |
| | | for (Map<String, Object> map : list) { |
| | | Object val = map.get("val"); |
| | | map.put("val", Arith.multiplys(dot, 1, (Number) val)); |
| | | Object node = map.get("node"); |
| | | switch (statsType){ |
| | | switch (statsType) { |
| | | case MONTH: |
| | | map.put("node", node + "号"); |
| | | break; |
| | |
| | | return list; |
| | | } |
| | | |
| | | enum StatsType{ |
| | | enum StatsType { |
| | | |
| | | YEAR(1,1, 12), |
| | | MONTH(2,1, 30), |
| | | YEAR(1, 1, 12), |
| | | MONTH(2, 1, 30), |
| | | ; |
| | | |
| | | int id; |
| | | int start; |
| | | int end; |
| | | |
| | | StatsType(int id, int start, int end) { |
| | | this.id = id; |
| | | this.start = start; |
| | |
| | | |
| | | static StatsType get(int id) { |
| | | StatsType[] values = StatsType.values(); |
| | | for (StatsType statsType : values){ |
| | | if (statsType.id == id){ |
| | | for (StatsType statsType : values) { |
| | | if (statsType.id == id) { |
| | | return statsType; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 异常通知 |
| | | */ |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.AppAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.entity.param.CarryParam; |
| | | import com.zy.asrs.entity.param.CrnStatusParam; |
| | | import com.zy.asrs.entity.param.TaskCreateParam; |
| | | import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.core.model.DevpSlave; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | |
| | | import static org.apache.ibatis.ognl.OgnlRuntime.setFieldValue; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //任务下发接口 |
| | | @PostMapping("/outboundTaskSend") |
| | | @PostMapping("/inboundTaskSend") |
| | | @Transactional |
| | | public HashMap<String, Object> outboundTaskSend(@RequestBody HashMap<String,Object> hashMap) { |
| | | public HashMap<String, Object> inboundTaskSend(@RequestBody HashMap<String, Object> hashMap) { |
| | | String jsonString = JSON.toJSONString(hashMap.get("TaskList")); |
| | | List<CarryParam> params= JSONObject.parseArray(jsonString,CarryParam.class); |
| | | List<CarryParam> params = JSONObject.parseArray(jsonString, CarryParam.class); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | List<WMSAndAGVInterfaceParam> params1 =new ArrayList<>(); |
| | | for (CarryParam param:params){ |
| | | if (Cools.isEmpty(param)){ |
| | | map.put("ReturnStatus",1); |
| | | map.put("ErrorMessage","参数为空!"); |
| | | List<WMSAndAGVInterfaceParam> params1 = new ArrayList<>(); |
| | | for (CarryParam param : params) { |
| | | if (Cools.isEmpty(param)) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "参数为空!"); |
| | | return map; |
| | | } else if (Cools.isEmpty(param.getTaskNo())){ |
| | | map.put("ReturnStatus",1); |
| | | map.put("ErrorMessage","任务号为空!"); |
| | | } else if (Cools.isEmpty(param.getTaskNo())) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "任务号为空!"); |
| | | return map; |
| | | } else if (Cools.isEmpty(param.getStereoscopicTaskType())){ |
| | | map.put("ReturnStatus",1); |
| | | map.put("ErrorMessage","任务类型为空!"); |
| | | } else if (Cools.isEmpty(param.getStereoscopicTaskType())) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "任务类型为空!"); |
| | | return map; |
| | | } |
| | | String fusion = Utils.Fusion(param.getOriginalRowNo(), param.getOriginalFloorNo(), param.getOriginalColumnNo()); |
| | | param.setStartPoint(fusion); |
| | | LocMast locMast = locMastService.selectByLocNo(param.getStartPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | map.put("ReturnStatus",1); |
| | | map.put("ErrorMessage","初始库位无法找到!"); |
| | | if (Cools.isEmpty(locMast)) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "初始库位无法找到!"); |
| | | return map; |
| | | } |
| | | |
| | | HashMap<String,Object> r = new HashMap<>(); |
| | | HashMap<String, Object> r = new HashMap<>(); |
| | | |
| | | if(param.getStereoscopicTaskType() == 2){ |
| | | if (param.getStereoscopicTaskType() == 1) { |
| | | //出库任务创建 |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("type_no",2) |
| | | .eq("crn_no",locMast.getCrnNo()) |
| | | .eq("stn_no",param.getTerminalNo())); |
| | | if(Cools.isEmpty(staDesc)){ |
| | | map.put("ReturnStatus",1); |
| | | map.put("ErrorMessage","出库路劲不存在!"); |
| | | .eq("type_no", 1) |
| | | .eq("crn_no", locMast.getCrnNo()) |
| | | .eq("stn_no", param.getTerminalNo())); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "入库路径不存在!"); |
| | | return map; |
| | | } |
| | | r = openService.taskCreate(new TaskCreateParam(param,staDesc.getCrnNo())); |
| | | if(r.get("ReturnStatus").equals(1)){ |
| | | return r; |
| | | } |
| | | }else if (param.getStereoscopicTaskType() == 3){ |
| | | String fusion1 = Utils.Fusion(param.getGoalRowNo(), param.getGoalFloorNo(), param.getGoalColumnNo()); |
| | | param.setTerminalNo(fusion1); |
| | | //移库任务创建 |
| | | r = openService.taskCreate(new TaskCreateParam(param,locMast.getCrnNo())); |
| | | if(r.get("ReturnStatus").equals(1)){ |
| | | r = openService.taskCreate(new TaskCreateParam(param, staDesc.getCrnNo())); |
| | | if (r.get("ReturnStatus").equals(1)) { |
| | | return r; |
| | | } |
| | | } |
| | | apiLogService.save("Wms任务下发接口" |
| | | ,request.getRemoteAddr()+request.getRequestURI() |
| | | ,"" |
| | | ,request.getRemoteAddr() |
| | | ,JSON.toJSONString(param) |
| | | ,r.toString() |
| | | ,true |
| | | apiLogService.save("Wms入库任务下发接口" |
| | | , request.getRemoteAddr() + request.getRequestURI() |
| | | , "" |
| | | , request.getRemoteAddr() |
| | | , JSON.toJSONString(param) |
| | | , r.toString() |
| | | , true |
| | | ); |
| | | } |
| | | map.put("ReturnStatus",0); |
| | | map.put("ErrorMessage","ok"); |
| | | map.put("ReturnStatus", 0); |
| | | map.put("ErrorMessage", "ok"); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | //任务下发接口 |
| | | @PostMapping("/outboundTaskSend") |
| | | @Transactional |
| | | public HashMap<String, Object> outboundTaskSend(@RequestBody HashMap<String, Object> hashMap) { |
| | | String jsonString = JSON.toJSONString(hashMap.get("TaskList")); |
| | | List<CarryParam> params = JSONObject.parseArray(jsonString, CarryParam.class); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | List<WMSAndAGVInterfaceParam> params1 = new ArrayList<>(); |
| | | for (CarryParam param : params) { |
| | | if (Cools.isEmpty(param)) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "参数为空!"); |
| | | return map; |
| | | } else if (Cools.isEmpty(param.getTaskNo())) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "任务号为空!"); |
| | | return map; |
| | | } else if (Cools.isEmpty(param.getStereoscopicTaskType())) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "任务类型为空!"); |
| | | return map; |
| | | } |
| | | String fusion = Utils.Fusion(param.getOriginalRowNo(), param.getOriginalFloorNo(), param.getOriginalColumnNo()); |
| | | param.setStartPoint(fusion); |
| | | LocMast locMast = locMastService.selectByLocNo(param.getStartPoint()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "初始库位无法找到!"); |
| | | return map; |
| | | } |
| | | |
| | | HashMap<String, Object> r = new HashMap<>(); |
| | | |
| | | if (param.getStereoscopicTaskType() == 2) { |
| | | //出库任务创建 |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("type_no", 2) |
| | | .eq("crn_no", locMast.getCrnNo()) |
| | | .eq("stn_no", param.getTerminalNo())); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", "出库路劲不存在!"); |
| | | return map; |
| | | } |
| | | r = openService.taskCreate(new TaskCreateParam(param, staDesc.getCrnNo())); |
| | | if (r.get("ReturnStatus").equals(1)) { |
| | | return r; |
| | | } |
| | | } else if (param.getStereoscopicTaskType() == 3) { |
| | | String fusion1 = Utils.Fusion(param.getGoalRowNo(), param.getGoalFloorNo(), param.getGoalColumnNo()); |
| | | param.setTerminalNo(fusion1); |
| | | //移库任务创建 |
| | | r = openService.taskCreate(new TaskCreateParam(param, locMast.getCrnNo())); |
| | | if (r.get("ReturnStatus").equals(1)) { |
| | | return r; |
| | | } |
| | | } |
| | | apiLogService.save("Wms出移库任务下发接口" |
| | | , request.getRemoteAddr() + request.getRequestURI() |
| | | , "" |
| | | , request.getRemoteAddr() |
| | | , JSON.toJSONString(param) |
| | | , r.toString() |
| | | , true |
| | | ); |
| | | } |
| | | map.put("ReturnStatus", 0); |
| | | map.put("ErrorMessage", "ok"); |
| | | return map; |
| | | } |
| | | |
| | | //任务取消接口 |
| | | @PostMapping("/taskCancel") |
| | | public R taskCancel(@RequestHeader String appkey, |
| | | @RequestBody WMSAndAGVInterfaceParam param, |
| | | HttpServletRequest request) { |
| | | @RequestBody WMSAndAGVInterfaceParam param, |
| | | HttpServletRequest request) { |
| | | auth(appkey, param, request); |
| | | if (Cools.isEmpty(param)){ |
| | | if (Cools.isEmpty(param)) { |
| | | return R.error("参数为空!"); |
| | | } else if (Cools.isEmpty(param.getTaskNo())){ |
| | | } else if (Cools.isEmpty(param.getTaskNo())) { |
| | | return R.error("工作号为空!"); |
| | | } else if (Cools.isEmpty(param.getIoType())){ |
| | | } else if (Cools.isEmpty(param.getIoType())) { |
| | | return R.error("操作类型为空!"); |
| | | } else if (Cools.isEmpty(param.getBarcode())){ |
| | | } else if (Cools.isEmpty(param.getBarcode())) { |
| | | return R.error("托盘码不能为空!"); |
| | | } |
| | | |
| | | TaskWrk taskWrk = taskWrkService.selectOne(new EntityWrapper<TaskWrk>() |
| | | .eq("task_no", param.getTaskNo()) |
| | | .eq("io_type",param.getIoType()) |
| | | .eq("barcode",param.getBarcode())); |
| | | if (Cools.isEmpty(taskWrk)){ |
| | | return R.error("未查到当前任务---"+param); |
| | | .eq("io_type", param.getIoType()) |
| | | .eq("barcode", param.getBarcode())); |
| | | if (Cools.isEmpty(taskWrk)) { |
| | | return R.error("未查到当前任务---" + param); |
| | | } |
| | | boolean sign =false; |
| | | switch (param.getTaskStatus()){ |
| | | boolean sign = false; |
| | | switch (param.getTaskStatus()) { |
| | | case 1://正常取消 |
| | | if (taskWrk.getStatus()>1){ |
| | | if (taskWrk.getStatus() > 1) { |
| | | return R.error("任务已开始执行"); |
| | | } |
| | | break; |
| | | case 2://正常完成 |
| | | if (taskWrk.getStatus()>1){ |
| | | if (taskWrk.getStatus() > 1) { |
| | | return R.error("任务已开始执行"); |
| | | } |
| | | sign=true; |
| | | sign = true; |
| | | break; |
| | | default: |
| | | return R.error("未知操作"); |
| | | } |
| | | return taskWrkOperate(taskWrk,sign); |
| | | return taskWrkOperate(taskWrk, sign); |
| | | } |
| | | |
| | | //任务操作 |
| | | private R taskWrkOperate(TaskWrk taskWrk,boolean sign){ |
| | | try{ |
| | | if (sign){//完成 |
| | | private R taskWrkOperate(TaskWrk taskWrk, boolean sign) { |
| | | try { |
| | | if (sign) {//完成 |
| | | return taskWrkController.complete(taskWrk.getTaskNo()); |
| | | }else {//取消 |
| | | } else {//取消 |
| | | return taskWrkController.cancel(taskWrk.getTaskNo()); |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | return R.error(); |
| | | } |
| | | } |
| | |
| | | @GetMapping("/deviceStatus") |
| | | @Transactional |
| | | public HashMap<String, Object> deviceStatus() { |
| | | HashMap<String,Object> map=new HashMap<>(); |
| | | List<CrnStatusParam> crnStatusParams=new ArrayList<>(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | List<CrnStatusParam> crnStatusParams = new ArrayList<>(); |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>()); |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | for (BasCrnp basCrnp:basCrnps){ |
| | | CrnStatusParam crnStatusParam=new CrnStatusParam(); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | CrnStatusParam crnStatusParam = new CrnStatusParam(); |
| | | crnStatusParam.setCrnNo(basCrnp.getCrnNo()); |
| | | crnStatusParam.setCrnSts(basCrnp.getCrnSts()); |
| | | crnStatusParam.setErrorCode(basCrnp.getCrnErr()); |
| | | BasCrnError error=basCrnErrorService.selectOne(new EntityWrapper<BasCrnError>().eq("error_code",basCrnp.getCrnErr())); |
| | | if(Cools.isEmpty(error)){ |
| | | BasCrnError error = basCrnErrorService.selectOne(new EntityWrapper<BasCrnError>().eq("error_code", basCrnp.getCrnErr())); |
| | | if (Cools.isEmpty(error)) { |
| | | crnStatusParam.setErrorMsg(""); |
| | | }else { |
| | | } else { |
| | | crnStatusParam.setErrorMsg(error.getErrName()); |
| | | } |
| | | crnStatusParams.add(crnStatusParam); |
| | | } |
| | | for (BasDevp basDevp : basDevps) { |
| | | CrnStatusParam crnStatusParam=new CrnStatusParam(); |
| | | CrnStatusParam crnStatusParam = new CrnStatusParam(); |
| | | crnStatusParam.setDevpNo(basDevp.getDevNo()); |
| | | crnStatusParam.setOutEnable(basDevp.getOutEnable()); |
| | | crnStatusParam.setInEnable(basDevp.getInEnable()); |
| | | crnStatusParam.setLoading(basDevp.getLoading()); |
| | | if(!Cools.isEmpty(basDevp.getAutoing())&&basDevp.getAutoing().equals("Y")){ |
| | | if (!Cools.isEmpty(basDevp.getAutoing()) && basDevp.getAutoing().equals("Y")) { |
| | | crnStatusParam.setCrnSts(3); |
| | | }else{ |
| | | } else { |
| | | crnStatusParam.setCrnSts(2); |
| | | } |
| | | crnStatusParams.add(crnStatusParam); |
| | | } |
| | | map.put("ReturnStatus",0); |
| | | map.put("ErrorMessage",""); |
| | | map.put("data",crnStatusParams); |
| | | map.put("ReturnStatus", 0); |
| | | map.put("ErrorMessage", ""); |
| | | map.put("data", crnStatusParams); |
| | | return map; |
| | | } |
| | | |
| | |
| | | |
| | | return list; |
| | | } |
| | | |
| | | private static void setFieldValue(Object obj, Field field, Object value) throws IllegalAccessException { |
| | | Class<?> fieldType = field.getType(); |
| | | |
| | |
| | | |
| | | /** |
| | | * 日志统计控制器层 |
| | | * |
| | | * @author admin |
| | | * @date 2018年11月23日 |
| | | */ |
| | |
| | | @RequestMapping("/report") |
| | | public class ReportQueryController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | | |
| | | //------------------库位使用统计-------------------------------------- |
| | | @RequestMapping("/viewStockUseList.action") |
| | | public R queryViewStockUseListByPages(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam Map<String, Object> param){ |
| | | ViewStockUseBean bean = new ViewStockUseBean(); |
| | | bean.setPageSize(limit); |
| | | bean.setPageNumber(curr); |
| | | List<ViewStockUseBean> list= reportQueryMapper.queryViewStockUseList(bean); |
| | | int count = reportQueryMapper.getViewStockUseCount(bean); |
| | | Page<ViewStockUseBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | //------------------库位使用统计-------------------------------------- |
| | | @RequestMapping("/viewStockUseList.action") |
| | | public R queryViewStockUseListByPages(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam Map<String, Object> param) { |
| | | ViewStockUseBean bean = new ViewStockUseBean(); |
| | | bean.setPageSize(limit); |
| | | bean.setPageNumber(curr); |
| | | List<ViewStockUseBean> list = reportQueryMapper.queryViewStockUseList(bean); |
| | | int count = reportQueryMapper.getViewStockUseCount(bean); |
| | | Page<ViewStockUseBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | // 导出 |
| | | @RequestMapping(value = "/viewStockUseExport.action") |
| | | @ManagerAuth(memo = "库位使用统计导出") |
| | | public R viewStockUseExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<ViewStockUseBean> list = reportQueryMapper.getViewStockUseAll(new ViewStockUseBean()); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | // 导出 |
| | | @RequestMapping(value = "/viewStockUseExport.action") |
| | | @ManagerAuth(memo = "库位使用统计导出") |
| | | public R viewStockUseExport(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<ViewStockUseBean> list = reportQueryMapper.getViewStockUseAll(new ViewStockUseBean()); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | //------------------库存滞留统计-------------------------------------- |
| | | @RequestMapping("/viewStayTimeList.action") |
| | | public Map<String,Object> queryViewStayTimeListByPages(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam Map<String, Object> param){ |
| | | ViewStayTimeBean bean = new ViewStayTimeBean(); |
| | | bean.setPageSize(limit); |
| | | bean.setPageNumber(curr); |
| | | String locNo = String.valueOf(param.get("loc_no")); |
| | | if (!Cools.isEmpty(locNo) && !locNo.equals("null")) { |
| | | bean.setLoc_no(locNo); |
| | | } |
| | | List<ViewStayTimeBean> list = reportQueryMapper.queryViewStayTimeList(bean); |
| | | int count = reportQueryMapper.getViewStayTimeCount(bean); |
| | | Page<ViewStayTimeBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | //------------------库存滞留统计-------------------------------------- |
| | | @RequestMapping("/viewStayTimeList.action") |
| | | public Map<String, Object> queryViewStayTimeListByPages(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam Map<String, Object> param) { |
| | | ViewStayTimeBean bean = new ViewStayTimeBean(); |
| | | bean.setPageSize(limit); |
| | | bean.setPageNumber(curr); |
| | | String locNo = String.valueOf(param.get("loc_no")); |
| | | if (!Cools.isEmpty(locNo) && !locNo.equals("null")) { |
| | | bean.setLoc_no(locNo); |
| | | } |
| | | List<ViewStayTimeBean> list = reportQueryMapper.queryViewStayTimeList(bean); |
| | | int count = reportQueryMapper.getViewStayTimeCount(bean); |
| | | Page<ViewStayTimeBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | // 导出 |
| | | @RequestMapping(value = "/viewStayTimeExport.action") |
| | | @ManagerAuth(memo = "库存滞留统计导出") |
| | | public R viewStayTimeExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<ViewStayTimeBean> list = reportQueryMapper.getViewStayTimeAll(new ViewStayTimeBean()); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | // 导出 |
| | | @RequestMapping(value = "/viewStayTimeExport.action") |
| | | @ManagerAuth(memo = "库存滞留统计导出") |
| | | public R viewStayTimeExport(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<ViewStayTimeBean> list = reportQueryMapper.getViewStayTimeAll(new ViewStayTimeBean()); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | //-----------------库存MAP图-------------------------------------- |
| | | @RequestMapping("/viewLocMapList/rows.action") |
| | | public R queryViewLocMapRows(){ |
| | | return R.ok().add(reportQueryMapper.getViewLocRowTotal()); |
| | | } |
| | | //-----------------库存MAP图-------------------------------------- |
| | | @RequestMapping("/viewLocMapList/rows.action") |
| | | public R queryViewLocMapRows() { |
| | | return R.ok().add(reportQueryMapper.getViewLocRowTotal()); |
| | | } |
| | | |
| | | @RequestMapping("/viewLocMapList.action") |
| | | public R queryViewLocMapListByPages(@RequestParam(defaultValue = "1")Integer row){ |
| | | // 获取排级数据 |
| | | // 表格标题:列 ===>> 升序 |
| | | List<String> bays = reportQueryMapper.getViewLocBayCount(row); |
| | | // !表格第一列放层级数 |
| | | bays.add(0, ""); |
| | | // 表格行:层 ====>> 倒序 |
| | | List<String> levs = reportQueryMapper.getViewLocLevCount(row); |
| | | List<Map<String, Object>> body = new ArrayList<>(); |
| | | for (String lev : levs){ |
| | | // 获取层级数据 |
| | | List<ViewLocMapDto> dtos = reportQueryMapper.getViewLocBays(row, Integer.parseInt(lev)); |
| | | // !表格第一列放层级数 |
| | | dtos.add(0, new ViewLocMapDto(null ,null, lev)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("loc", dtos); |
| | | body.add(map); |
| | | } |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("title", bays); |
| | | result.put("body", body); |
| | | return R.ok(result); |
| | | } |
| | | @RequestMapping("/viewLocMapList.action") |
| | | public R queryViewLocMapListByPages(@RequestParam(defaultValue = "1") Integer row) { |
| | | // 获取排级数据 |
| | | // 表格标题:列 ===>> 升序 |
| | | List<String> bays = reportQueryMapper.getViewLocBayCount(row); |
| | | // !表格第一列放层级数 |
| | | bays.add(0, ""); |
| | | // 表格行:层 ====>> 倒序 |
| | | List<String> levs = reportQueryMapper.getViewLocLevCount(row); |
| | | List<Map<String, Object>> body = new ArrayList<>(); |
| | | for (String lev : levs) { |
| | | // 获取层级数据 |
| | | List<ViewLocMapDto> dtos = reportQueryMapper.getViewLocBays(row, Integer.parseInt(lev)); |
| | | // !表格第一列放层级数 |
| | | dtos.add(0, new ViewLocMapDto(null, null, lev)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("loc", dtos); |
| | | body.add(map); |
| | | } |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("title", bays); |
| | | result.put("body", body); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | |
| | | //------------------站点日入出库次数统计-------------------------------------- |
| | | @RequestMapping("/viewInOutList.action") |
| | | public Map<String,Object> viewInOutList(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam Map<String, Object> param){ |
| | | ViewInOutBean bean = new ViewInOutBean(); |
| | | bean.setPageSize(limit); |
| | | bean.setPageNumber(curr); |
| | | List<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(bean); |
| | | int count = reportQueryMapper.getViewInOutCount(bean); |
| | | Page<ViewInOutBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | //------------------站点日入出库次数统计-------------------------------------- |
| | | @RequestMapping("/viewInOutList.action") |
| | | public Map<String, Object> viewInOutList(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam Map<String, Object> param) { |
| | | ViewInOutBean bean = new ViewInOutBean(); |
| | | bean.setPageSize(limit); |
| | | bean.setPageNumber(curr); |
| | | List<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(bean); |
| | | int count = reportQueryMapper.getViewInOutCount(bean); |
| | | Page<ViewInOutBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | //excel导出 |
| | | @RequestMapping("/viewInOutExport.action") |
| | | @ManagerAuth(memo = "站点日入出库次数统计导出") |
| | | public R viewInOutExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<ViewInOutBean> list = reportQueryMapper.getViewInOutAll(new ViewInOutBean()); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | //excel导出 |
| | | @RequestMapping("/viewInOutExport.action") |
| | | @ManagerAuth(memo = "站点日入出库次数统计导出") |
| | | public R viewInOutExport(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<ViewInOutBean> list = reportQueryMapper.getViewInOutAll(new ViewInOutBean()); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | //------------------日入库明细统计-------------------------------------- |
| | | @RequestMapping("/viewWorkInList.action") |
| | | public Map<String,Object> viewWorkInList(ViewWorkInBean bean){ |
| | | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(bean); |
| | | int count = reportQueryMapper.getViewWorkInCount(bean); |
| | | Page<ViewWorkInBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | //------------------日入库明细统计-------------------------------------- |
| | | @RequestMapping("/viewWorkInList.action") |
| | | public Map<String, Object> viewWorkInList(ViewWorkInBean bean) { |
| | | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(bean); |
| | | int count = reportQueryMapper.getViewWorkInCount(bean); |
| | | Page<ViewWorkInBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | /** |
| | | * 日入库汇总查询 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/viewWorkCountInList.action") |
| | | public R viewWorkCountInList(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam Map<String, Object> param){ |
| | | String startTime = "1970.1.2"; |
| | | String endTime = "2099.1.2"; |
| | | if (!Cools.isEmpty(param.get("query_date"))) { |
| | | String queryDate = (String) param.get("query_date"); |
| | | String[] split = queryDate.split(" - "); |
| | | startTime= split[0].split(" ")[0].replace("-","."); |
| | | endTime = split[1].split(" ")[0].replace("-","."); |
| | | } |
| | | List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountIn(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime,endTime); |
| | | Integer total = reportQueryMapper.selectWorkCountInTotal((String) param.get("matnr"), startTime,endTime); |
| | | Page<ViewWorkCountInView> page = new Page<>(); |
| | | page.setRecords(allCountIn); |
| | | page.setTotal(total); |
| | | Integer sum = reportQueryMapper.selectWorkCountInSum((String) param.get("matnr"), startTime,endTime); |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("page",page); |
| | | result.put("sum",sum); |
| | | return R.ok(result); |
| | | } |
| | | /** |
| | | * 日入库汇总查询 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/viewWorkCountInList.action") |
| | | public R viewWorkCountInList(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam Map<String, Object> param) { |
| | | String startTime = "1970.1.2"; |
| | | String endTime = "2099.1.2"; |
| | | if (!Cools.isEmpty(param.get("query_date"))) { |
| | | String queryDate = (String) param.get("query_date"); |
| | | String[] split = queryDate.split(" - "); |
| | | startTime = split[0].split(" ")[0].replace("-", "."); |
| | | endTime = split[1].split(" ")[0].replace("-", "."); |
| | | } |
| | | List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountIn(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime, endTime); |
| | | Integer total = reportQueryMapper.selectWorkCountInTotal((String) param.get("matnr"), startTime, endTime); |
| | | Page<ViewWorkCountInView> page = new Page<>(); |
| | | page.setRecords(allCountIn); |
| | | page.setTotal(total); |
| | | Integer sum = reportQueryMapper.selectWorkCountInSum((String) param.get("matnr"), startTime, endTime); |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("page", page); |
| | | result.put("sum", sum); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | /** |
| | | * 日出库汇总 |
| | | */ |
| | | @RequestMapping("/viewWorkCountOutList.action") |
| | | public R viewWorkCountOutList(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam Map<String, Object> param){ |
| | | String startTime = "1970.1.2"; |
| | | String endTime = "2099.1.2"; |
| | | if (!Cools.isEmpty(param.get("query_date"))) { |
| | | String queryDate = (String) param.get("query_date"); |
| | | String[] split = queryDate.split(" - "); |
| | | startTime= split[0].split(" ")[0].replace("-","."); |
| | | endTime = split[1].split(" ")[0].replace("-","."); |
| | | } |
| | | List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountOut(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime,endTime); |
| | | Integer total = reportQueryMapper.selectWorkCountOutTotal((String) param.get("matnr"), startTime,endTime); |
| | | Page<ViewWorkCountInView> page = new Page<>(); |
| | | page.setRecords(allCountIn); |
| | | page.setTotal(total); |
| | | Integer sum = reportQueryMapper.selectWorkCountOutSum((String) param.get("matnr"), startTime,endTime); |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("page",page); |
| | | result.put("sum",sum); |
| | | return R.ok(result); |
| | | } |
| | | /** |
| | | * 日出库汇总 |
| | | */ |
| | | @RequestMapping("/viewWorkCountOutList.action") |
| | | public R viewWorkCountOutList(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam Map<String, Object> param) { |
| | | String startTime = "1970.1.2"; |
| | | String endTime = "2099.1.2"; |
| | | if (!Cools.isEmpty(param.get("query_date"))) { |
| | | String queryDate = (String) param.get("query_date"); |
| | | String[] split = queryDate.split(" - "); |
| | | startTime = split[0].split(" ")[0].replace("-", "."); |
| | | endTime = split[1].split(" ")[0].replace("-", "."); |
| | | } |
| | | List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountOut(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime, endTime); |
| | | Integer total = reportQueryMapper.selectWorkCountOutTotal((String) param.get("matnr"), startTime, endTime); |
| | | Page<ViewWorkCountInView> page = new Page<>(); |
| | | page.setRecords(allCountIn); |
| | | page.setTotal(total); |
| | | Integer sum = reportQueryMapper.selectWorkCountOutSum((String) param.get("matnr"), startTime, endTime); |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("page", page); |
| | | result.put("sum", sum); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | //excel导出 |
| | | @RequestMapping("/viewWorkInExport.action") |
| | | @ManagerAuth(memo = "日入库明细统计导出") |
| | | public R viewWorkInExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | @SuppressWarnings("unchecked") |
| | | ViewWorkInBean bean = Cools.conver((Map<? extends String, ?>) param.get("exportData"), ViewWorkInBean.class); |
| | | bean.setQuery_date(bean.getQuery_date()); |
| | | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkInAll(bean); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | //excel导出 |
| | | @RequestMapping("/viewWorkInExport.action") |
| | | @ManagerAuth(memo = "日入库明细统计导出") |
| | | public R viewWorkInExport(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | @SuppressWarnings("unchecked") |
| | | ViewWorkInBean bean = Cools.conver((Map<? extends String, ?>) param.get("exportData"), ViewWorkInBean.class); |
| | | bean.setQuery_date(bean.getQuery_date()); |
| | | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkInAll(bean); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | //------------------日出库明细统计-------------------------------------- |
| | | @RequestMapping("/viewWorkOutList.action") |
| | | public R viewWorkOutList(ViewWorkInBean bean){ |
| | | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkOutList(bean); |
| | | int count = reportQueryMapper.getViewWorkOutCount(bean); |
| | | Page<ViewWorkInBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | //------------------日出库明细统计-------------------------------------- |
| | | @RequestMapping("/viewWorkOutList.action") |
| | | public R viewWorkOutList(ViewWorkInBean bean) { |
| | | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkOutList(bean); |
| | | int count = reportQueryMapper.getViewWorkOutCount(bean); |
| | | Page<ViewWorkInBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | //excel导出 |
| | | @RequestMapping("/viewWorkOutExport.action") |
| | | @ManagerAuth(memo = "日出库明细统计导出") |
| | | public R viewWorkOutExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | @SuppressWarnings("unchecked") |
| | | ViewWorkInBean bean = Cools.conver((Map<? extends String, ?>) param.get("exportData"), ViewWorkInBean.class); |
| | | bean.setQuery_date(bean.getQuery_date()); |
| | | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkOutAll(bean); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | //excel导出 |
| | | @RequestMapping("/viewWorkOutExport.action") |
| | | @ManagerAuth(memo = "日出库明细统计导出") |
| | | public R viewWorkOutExport(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | @SuppressWarnings("unchecked") |
| | | ViewWorkInBean bean = Cools.conver((Map<? extends String, ?>) param.get("exportData"), ViewWorkInBean.class); |
| | | bean.setQuery_date(bean.getQuery_date()); |
| | | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkOutAll(bean); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.utils.CommandUtils; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 输送设备接口 |
| | |
| | | |
| | | @GetMapping("/io/mode/info/site") |
| | | @ManagerAuth(memo = "入出库模式") |
| | | public R ioMode(){ |
| | | public R ioMode() { |
| | | List<Map<String, Object>> res = new ArrayList<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("floor", 2); |
| | | map2.put("modeVal", devpThread.ioModeOf2F.id); |
| | | map2.put("modeDesc", devpThread.ioModeOf2F.desc); |
| | | map2.put("modeVal", devpThread.ioModeOf1F.id); |
| | | map2.put("modeDesc", devpThread.ioModeOf1F.desc); |
| | | res.add(map2); |
| | | } |
| | | return R.ok().add(res); |
| | |
| | | |
| | | @PostMapping("/table/site") |
| | | @ManagerAuth(memo = "站点信息表") |
| | | public R siteTable(){ |
| | | public R siteTable() { |
| | | List<SiteTableVo> list = new ArrayList<>(); |
| | | // 内存数据 |
| | | Map<Integer, StaProtocol> station = new HashMap<>(); |
| | |
| | | vo.setDevNo(devp.getDevNo()); // 站点编号 |
| | | list.add(vo); |
| | | StaProtocol staProtocol = station.get(devp.getDevNo()); |
| | | if (null == staProtocol) { continue; } |
| | | if (null == staProtocol) { |
| | | continue; |
| | | } |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable()?"Y":"N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable()?"Y":"N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk()?"Y":"N"); // 入库标记 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 空板信号 |
| | | vo.setAutoing(staProtocol.isAutoing() ? "Y" : "N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk() ? "Y" : "N"); // 入库标记 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | // vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | vo.setLocType1(devp.getDevNo()==102 ? "高" : "低"); |
| | | vo.setLocType1(devp.getDevNo() == 102 ? "高" : "低"); |
| | | } |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | @GetMapping("/list/auth") |
| | | @ManagerAuth(memo = "站点信息表") |
| | | public R crnList(){ |
| | | public R crnList() { |
| | | List<SiteTableVo> list = new ArrayList<>(); |
| | | // 内存数据 |
| | | Map<Integer, StaProtocol> station = new HashMap<>(); |
| | |
| | | vo.setDevNo(devp.getDevNo()); // 站点编号 |
| | | list.add(vo); |
| | | StaProtocol staProtocol = station.get(devp.getDevNo()); |
| | | if (null == staProtocol) { continue; } |
| | | if (null == staProtocol) { |
| | | continue; |
| | | } |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable()?"Y":"N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable()?"Y":"N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk()?"Y":"N"); // 入库标记 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 空板信号 |
| | | vo.setAutoing(staProtocol.isAutoing() ? "Y" : "N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk() ? "Y" : "N"); // 入库标记 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | // vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | vo.setLocType1(devp.getDevNo()==102 ? "高" : "低"); |
| | | vo.setLocType1(devp.getDevNo() == 102 ? "高" : "低"); |
| | | } |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | @PostMapping("/table/plc/errors") |
| | | @ManagerAuth(memo = "输送设备plc异常信息表") |
| | | public R plcErrorTable(){ |
| | | public R plcErrorTable() { |
| | | List<PlcErrorTableVo> list = new ArrayList<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | Map<Integer, StaProtocol> station = devpThread.getStation(); |
| | | |
| | | for(Map.Entry<Integer, StaProtocol> entry : station.entrySet()) { |
| | | if (!Cools.isEmpty(staPlcErr(entry))){ |
| | | list.add(staPlcErr(entry).get(0)) ; |
| | | for (Map.Entry<Integer, StaProtocol> entry : station.entrySet()) { |
| | | if (!Cools.isEmpty(staPlcErr(entry))) { |
| | | list.add(staPlcErr(entry).get(0)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @PostMapping("/output/site") |
| | | @ManagerAuth(memo = "站点设备报文日志输出") |
| | | public R siteOutput(){ |
| | | public R siteOutput() { |
| | | StringBuilder str = new StringBuilder(); |
| | | String s; |
| | | int i = 0; |
| | | while((s = OutputQueue.DEVP.poll()) != null && i <=10) { |
| | | while ((s = OutputQueue.DEVP.poll()) != null && i <= 10) { |
| | | str.append("\n").append(s); |
| | | i++; |
| | | } |
| | |
| | | /****************************************************************/ |
| | | |
| | | @GetMapping("/detl/{siteId}") |
| | | public R siteDetl(@PathVariable("siteId") Integer siteId){ |
| | | public R siteDetl(@PathVariable("siteId") Integer siteId) { |
| | | SiteTableVo vo = new SiteTableVo(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | vo.setDevNo(entry.getKey()); // 站点编号 |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable()?"Y":"N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable()?"Y":"N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk()?"Y":"N"); // 需求1 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 空板信号 |
| | | vo.setAutoing(staProtocol.isAutoing() ? "Y" : "N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk() ? "Y" : "N"); // 需求1 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | vo.setCar(staProtocol.isCar() ? "有": "无"); |
| | | vo.setCar(staProtocol.isCar() ? "有" : "无"); |
| | | return R.ok().add(vo); |
| | | } |
| | | } |
| | |
| | | } |
| | | return R.error("更新失败"); |
| | | } |
| | | |
| | | @PostMapping("/detl/out") |
| | | @ManagerAuth(memo = "修改站点数据") |
| | | public R siteDetlout(@RequestParam Integer devNo, |
| | | @RequestParam Short workNo, |
| | | @RequestParam Short staNo, |
| | | @RequestParam(required = false) String pakMk, |
| | | @RequestParam(required = false) Boolean inEnable, |
| | | @RequestParam(required = false) Boolean outEnable |
| | | @RequestParam Short workNo, |
| | | @RequestParam Short staNo, |
| | | @RequestParam(required = false) String pakMk, |
| | | @RequestParam(required = false) Boolean inEnable, |
| | | @RequestParam(required = false) Boolean outEnable |
| | | ) { |
| | | BasDevp basDevp = basDevpService.selectById(devNo); |
| | | if (basDevp == null) { |
| | |
| | | } |
| | | return R.error("更新失败"); |
| | | } |
| | | |
| | | @PostMapping("/detl/in") |
| | | @ManagerAuth(memo = "修改站点数据") |
| | | public R siteDetlint(@RequestParam Integer devNo, |
| | |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历入库口 |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | if (!devNo.equals(inSta.getBackSta()) ){ |
| | | if (!devNo.equals(inSta.getBackSta())) { |
| | | continue; |
| | | } |
| | | // 获取入库站信息 |
| | |
| | | return R.error("更新失败"); |
| | | } |
| | | |
| | | public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry){ |
| | | public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry) { |
| | | List<PlcErrorTableVo> list = new ArrayList<>(); |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | if (staProtocol.getBreakerErr()){ |
| | | if (staProtocol.getBreakerErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("断路器故障"); |
| | | vo.setError("断路器故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getInfraredErr()){ |
| | | if (staProtocol.getInfraredErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("光电异常"); |
| | | vo.setError("光电异常"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getOutTimeErr()){ |
| | | if (staProtocol.getOutTimeErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("运行超时"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getSeizeSeatErr()){ |
| | | if (staProtocol.getSeizeSeatErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("占位超时"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getWrkYgoodsN()){ |
| | | if (staProtocol.getWrkYgoodsN()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("有任务无货故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getInverterErr()){ |
| | | if (staProtocol.getInverterErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("变频器故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getContactErr()){ |
| | | if (staProtocol.getContactErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("电机接触器故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getUpcontactErr()){ |
| | | if (staProtocol.getUpcontactErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("顶升电机接触器故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isFrontErr()){ |
| | | if (staProtocol.isFrontErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("前超限"); |
| | | vo.setError("前超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isBackErr()){ |
| | | if (staProtocol.isBackErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("后超限"); |
| | | vo.setError("后超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isHighErr()){ |
| | | if (staProtocol.isHighErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("高超限"); |
| | | vo.setError("高超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isLeftErr()){ |
| | | if (staProtocol.isLeftErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("左超限"); |
| | | vo.setError("左超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isRightErr()){ |
| | | if (staProtocol.isRightErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("右超限"); |
| | | vo.setError("右超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isBarcodeErr()){ |
| | | if (staProtocol.isBarcodeErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("扫码失败"); |
| | |
| | | |
| | | @RequestMapping(value = "/staDesc/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<StaDesc> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | wrapper.orderAsc(Collections.singleton("crn_no")); |
| | | return R.ok(staDescService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/staDesc/update/auth") |
| | | @ManagerAuth(memo = "站点路径修改") |
| | | public R update(StaDesc staDesc){ |
| | | if (Cools.isEmpty(staDesc) || null==staDesc.getTypeId()){ |
| | | @RequestMapping(value = "/staDesc/update/auth") |
| | | @ManagerAuth(memo = "站点路径修改") |
| | | public R update(StaDesc staDesc) { |
| | | if (Cools.isEmpty(staDesc) || null == staDesc.getTypeId()) { |
| | | return R.error(); |
| | | } |
| | | staDesc.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/staDesc/delete/auth") |
| | | @ManagerAuth(memo = "站点路径删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<StaDesc> list = JSONArray.parseArray(param, StaDesc.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (StaDesc entity : list){ |
| | | for (StaDesc entity : list) { |
| | | staDescService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/staDesc/export/auth") |
| | | @ManagerAuth(memo = "站点路径导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<StaDesc> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("staDesc")); |
| | |
| | | wrapper.like("crn_no", condition); |
| | | Page<StaDesc> page = staDescService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (StaDesc staDesc : page.getRecords()){ |
| | | for (StaDesc staDesc : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", staDesc.getCrnNo()); |
| | | map.put("value", staDesc.getCrnNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != staDescService.selectOne(wrapper)){ |
| | | if (null != staDescService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(StaDesc.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.entity.param.TaskOverToWms; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.CommandInfoService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrk/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<TaskWrk> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(taskWrkService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/taskWrk/update/auth") |
| | | @ManagerAuth |
| | | public R update(TaskWrk taskWrk){ |
| | | @RequestMapping(value = "/taskWrk/update/auth") |
| | | @ManagerAuth |
| | | public R update(TaskWrk taskWrk) { |
| | | if (Cools.isEmpty(taskWrk) || null == taskWrk.getTaskNo()) { |
| | | return R.error(); |
| | | } |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrk/updatePoint/auth") |
| | | @ManagerAuth |
| | | public R updatePoint(TaskWrk taskWrk){ |
| | | public R updatePoint(TaskWrk taskWrk) { |
| | | if (Cools.isEmpty(taskWrk) || null == taskWrk.getTaskNo()) { |
| | | return R.error(); |
| | | } |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrk/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | taskWrkService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrk/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<TaskWrk> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("taskWrk")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<TaskWrk> page = taskWrkService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (TaskWrk taskWrk : page.getRecords()){ |
| | | for (TaskWrk taskWrk : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", taskWrk.getTaskNo()); |
| | | map.put("value", taskWrk.getTaskNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<TaskWrk> wrapper = new EntityWrapper<TaskWrk>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != taskWrkService.selectOne(wrapper)){ |
| | | if (null != taskWrkService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(TaskWrk.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | @ManagerAuth(memo = "手动完成任务") |
| | | public R complete(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (Cools.isEmpty(taskWrk) || taskWrk.getStatus()>=3){ |
| | | return R.error("已完结或已取消") ; |
| | | if (Cools.isEmpty(taskWrk) || taskWrk.getStatus() >= 3) { |
| | | return R.error("已完结或已取消"); |
| | | } |
| | | LocMast locMast=new LocMast(); |
| | | if(taskWrk.getIoType()==1){//入库任务完成库位为F |
| | | locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | LocMast locMast = new LocMast(); |
| | | if (taskWrk.getIoType() == 1) {//入库任务完成库位为F |
| | | locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | R.error("没有找到该库位"); |
| | | } |
| | | locMast.setLocSts("F"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setBarcode(taskWrk.getBarcode()); |
| | | }else if(taskWrk.getIoType()==2){//出库任务完成库位为O |
| | | locMast=locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } else if (taskWrk.getIoType() == 2) {//出库任务完成库位为O |
| | | locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | R.error("没有找到该库位"); |
| | | } |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(new Date()); |
| | | }else if(taskWrk.getIoType()==3){ |
| | | locMast=locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } else if (taskWrk.getIoType() == 3) { |
| | | locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | R.error("没有找到该库位"); |
| | | } |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(new Date()); |
| | | locMastService.updateById(locMast); |
| | | locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | R.error("没有找到该库位"); |
| | | } |
| | | locMast.setLocSts("F"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setBarcode(taskWrk.getBarcode()); |
| | | |
| | | } |
| | | String response=""; |
| | | try{ |
| | | String response = ""; |
| | | try { |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("TaskNo",taskWrk.getTaskNo()); |
| | | headParam.put("Result",1); |
| | | headParam.put("TaskNo", taskWrk.getTaskNo()); |
| | | headParam.put("Result", 1); |
| | | // headParam.put("reportTime",new Date()); |
| | | log.info("wcs手动完成任务上报wms={}", taskWrk); |
| | | response = new HttpHandler.Builder() |
| | |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcs手动完成任务上报wms" |
| | | ,wmsUrl+TaskExecCallback |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(headParam) |
| | | ,response |
| | | ,true |
| | | , wmsUrl + TaskExecCallback |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(headParam) |
| | | , response |
| | | , true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs手动完成任务上报wms失{},返回值={}", taskWrk,response); |
| | | } catch (Exception e) { |
| | | log.error("wcs手动完成任务上报wms失{},返回值={}", taskWrk, response); |
| | | // throw new CoolException(e); |
| | | } |
| | | locMastService.updateById(locMast); |
| | |
| | | @ManagerAuth(memo = "重新给堆垛机下发任务") |
| | | public R returnWorkingCondition(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts()==12){ |
| | | if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts() == 12) { |
| | | taskWrk.setWrkSts(11); |
| | | if(!taskWrkService.updateById(taskWrk)){ |
| | | if (!taskWrkService.updateById(taskWrk)) { |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok(); |
| | | } else if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts()==3) { |
| | | } else if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts() == 3) { |
| | | taskWrk.setWrkSts(2); |
| | | taskWrkService.updateById(taskWrk); |
| | | if(!taskWrkService.updateById(taskWrk)){ |
| | | if (!taskWrkService.updateById(taskWrk)) { |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok(); |
| | | }else{ |
| | | } else { |
| | | return R.error("任务状态不对无法重新给堆垛机下发任务"); |
| | | } |
| | | |
| | |
| | | Date now = new Date(); |
| | | taskWrk.setStatus(TaskStatusType.CANCEL.id); |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | try{ |
| | | try { |
| | | taskWrk.setModiUser(getUserId());//操作员 |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | taskWrk.setModiUser(9999L);//操作员 |
| | | } |
| | | String response=""; |
| | | try{ |
| | | String response = ""; |
| | | try { |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("TaskNo",taskWrk.getTaskNo()); |
| | | headParam.put("Result",0); |
| | | headParam.put("TaskNo", taskWrk.getTaskNo()); |
| | | headParam.put("Result", 0); |
| | | // headParam.put("reportTime",new Date()); |
| | | |
| | | log.info("wcs手动取消任务上报wm={}", taskWrk); |
| | |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcs手动取消任务上报wms" |
| | | ,wmsUrl+TaskExecCallback |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(headParam) |
| | | ,response |
| | | ,true |
| | | , wmsUrl + TaskExecCallback |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(headParam) |
| | | , response |
| | | , true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs手动取消任务上报wms失败={},返回值={}", taskWrk,response); |
| | | } catch (Exception e) { |
| | | log.error("wcs手动取消任务上报wms失败={},返回值={}", taskWrk, response); |
| | | // throw new CoolException(e); |
| | | } |
| | | taskWrk.setCompleteTime(now);//完结时间 |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | public static String getTaskType(Integer paramIoType){ |
| | | switch (paramIoType){ |
| | | public static String getTaskType(Integer paramIoType) { |
| | | switch (paramIoType) { |
| | | case 1: |
| | | return "RK"; |
| | | case 2: |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.TaskWrkLog; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.TaskWrkLogService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | public class TaskWrkLogController extends BaseController { |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrkLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<TaskWrkLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | wrapper.orderDesc(Collections.singleton("create_time")); |
| | | return R.ok(taskWrkLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/taskWrkLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(TaskWrkLog taskWrkLog){ |
| | | if (Cools.isEmpty(taskWrkLog)){ |
| | | @RequestMapping(value = "/taskWrkLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(TaskWrkLog taskWrkLog) { |
| | | if (Cools.isEmpty(taskWrkLog)) { |
| | | return R.error(); |
| | | } |
| | | taskWrkLogService.updateById(taskWrkLog); |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrkLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | taskWrkLogService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrkLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<TaskWrkLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("taskWrkLog")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<TaskWrkLog> page = taskWrkLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (TaskWrkLog taskWrkLog : page.getRecords()){ |
| | | for (TaskWrkLog taskWrkLog : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", taskWrkLog.getTaskNo()); |
| | | map.put("value", taskWrkLog.getTaskNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<TaskWrkLog> wrapper = new EntityWrapper<TaskWrkLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != taskWrkLogService.selectOne(wrapper)){ |
| | | if (null != taskWrkLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(TaskWrkLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrkLog/resubmitTheTask/auth") |
| | | @ManagerAuth(memo = "重新上报任务完结") |
| | | public R resubmitTheTask(@RequestParam String taskNo){ |
| | | public R resubmitTheTask(@RequestParam String taskNo) { |
| | | TaskWrkLog taskWrk = taskWrkLogService.selectOne(new EntityWrapper<TaskWrkLog>().eq("task_no", taskNo)); |
| | | if(!Cools.isEmpty(taskWrk)){ |
| | | if (!Cools.isEmpty(taskWrk)) { |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | if (taskWrk.getStatus().equals(TaskStatusType.OVER.id)) {//完成 |
| | | headParam.put("Result", 1); |
| | |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | |
| | | if(jsonObject.get("ReturnStatus").equals(0)){ |
| | | if (jsonObject.get("ReturnStatus").equals(0)) { |
| | | bool = true; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("重新上报任务完结失败{},返回值={}", taskWrk, response); |
| | | }finally { |
| | | } finally { |
| | | apiLogService.save("重新上报任务完结" |
| | | , wmsUrl + TaskExecCallback |
| | | , null |
| | |
| | | @RequestMapping("/hand/control/wrkMast") |
| | | @ManagerAuth(memo = "手动处理工作档") |
| | | public R handControlWrkMast(@RequestParam String workNo, |
| | | @RequestParam Integer type){ |
| | | @RequestParam Integer type) { |
| | | if (type == 1) { |
| | | workService.completeWrkMast(workNo, getUserId()); |
| | | return R.ok("任务已完成"); |
| | |
| | | return R.ok(wrkDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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 { |
| | | if (entry.getKey().equals("io_time")) { |
| | | wrapper.eq("io_time", DateUtils.convert(val, DateUtils.yyyyMMddHHmmsssss_F)); |
| | | }else { |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | |
| | | |
| | | @RequestMapping(value = "/wrkDetl/delete/auth") |
| | | @ManagerAuth(memo = "工作档明细删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<WrkDetl> list = JSONArray.parseArray(param, WrkDetl.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (WrkDetl entity : list){ |
| | | for (WrkDetl entity : list) { |
| | | wrkDetlService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkDetl/export/auth") |
| | | @ManagerAuth(memo = "工作档明细导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<WrkDetl> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("wrkDetl")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<WrkDetl> page = wrkDetlService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (WrkDetl wrkDetl : page.getRecords()){ |
| | | for (WrkDetl wrkDetl : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", wrkDetl.getWrkNo()); |
| | | map.put("value", wrkDetl.getWrkNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != wrkDetlService.selectOne(wrapper)){ |
| | | if (null != wrkDetlService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(WrkDetl.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | */ |
| | | @RequestMapping(value = "/wrkDetlLogByMast/list/auth") |
| | | @ManagerAuth |
| | | public R list1(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | public R list1(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam Integer wrk_no, |
| | | @RequestParam String ioTime){ |
| | | @RequestParam String ioTime) { |
| | | EntityWrapper<WrkDetlLog> wrapper = new EntityWrapper<>(); |
| | | if(!Cools.isEmpty(wrk_no) && wrk_no != 0){ |
| | | wrapper.eq("wrk_no",wrk_no); |
| | | if (!Cools.isEmpty(wrk_no) && wrk_no != 0) { |
| | | wrapper.eq("wrk_no", wrk_no); |
| | | } |
| | | if(!Cools.isEmpty(ioTime)){ |
| | | if (!Cools.isEmpty(ioTime)) { |
| | | wrapper.eq("io_time", DateUtils.convert(ioTime, DateUtils.yyyyMMddHHmmsssss_F)); |
| | | } |
| | | return R.ok(wrkDetlLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkDetlLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<WrkDetlLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | else { |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } else { |
| | | wrapper.orderBy("modi_time", false); |
| | | } |
| | | return R.ok(wrkDetlLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkDetlLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(WrkDetlLog wrkDetlLog){ |
| | | if (Cools.isEmpty(wrkDetlLog) || null==wrkDetlLog.getWrkNo()){ |
| | | @RequestMapping(value = "/wrkDetlLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(WrkDetlLog wrkDetlLog) { |
| | | if (Cools.isEmpty(wrkDetlLog) || null == wrkDetlLog.getWrkNo()) { |
| | | return R.error(); |
| | | } |
| | | wrkDetlLogService.updateById(wrkDetlLog); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkDetlLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<WrkDetlLog> list = JSONArray.parseArray(param, WrkDetlLog.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (WrkDetlLog entity : list){ |
| | | for (WrkDetlLog entity : list) { |
| | | wrkDetlLogService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkDetlLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<WrkDetlLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("wrkDetlLog")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<WrkDetlLog> page = wrkDetlLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (WrkDetlLog wrkDetlLog : page.getRecords()){ |
| | | for (WrkDetlLog wrkDetlLog : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", wrkDetlLog.getWrkNo()); |
| | | map.put("value", wrkDetlLog.getWrkNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<WrkDetlLog> wrapper = new EntityWrapper<WrkDetlLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != wrkDetlLogService.selectOne(wrapper)){ |
| | | if (null != wrkDetlLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(WrkDetlLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkLastno/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<WrkLastno> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(wrkLastnoService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkLastno/update/auth") |
| | | @ManagerAuth(memo = "工作序号修改") |
| | | public R update(WrkLastno wrkLastno){ |
| | | if (Cools.isEmpty(wrkLastno) || null==wrkLastno.getWrkMk()){ |
| | | @RequestMapping(value = "/wrkLastno/update/auth") |
| | | @ManagerAuth(memo = "工作序号修改") |
| | | public R update(WrkLastno wrkLastno) { |
| | | if (Cools.isEmpty(wrkLastno) || null == wrkLastno.getWrkMk()) { |
| | | return R.error(); |
| | | } |
| | | wrkLastno.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkLastno/delete/auth") |
| | | @ManagerAuth(memo = "工作序号删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<WrkLastno> list = JSONArray.parseArray(param, WrkLastno.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (WrkLastno entity : list){ |
| | | for (WrkLastno entity : list) { |
| | | wrkLastnoService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkLastno/export/auth") |
| | | @ManagerAuth(memo = "工作序号导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<WrkLastno> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("wrkLastno")); |
| | |
| | | wrapper.like("wrk_mk", condition); |
| | | Page<WrkLastno> page = wrkLastnoService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (WrkLastno wrkLastno : page.getRecords()){ |
| | | for (WrkLastno wrkLastno : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", wrkLastno.getWrkMk()); |
| | | map.put("value", wrkLastno.getWrkMk()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<WrkLastno> wrapper = new EntityWrapper<WrkLastno>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != wrkLastnoService.selectOne(wrapper)){ |
| | | if (null != wrkLastnoService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(WrkLastno.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkMast/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<WrkMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | allLike(WrkMast.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | if (orderByField.endsWith("$")){ |
| | | orderByField = orderByField.substring(0, orderByField.length()-1); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | if (orderByField.endsWith("$")) { |
| | | orderByField = orderByField.substring(0, orderByField.length() - 1); |
| | | } |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | }else { |
| | | } else { |
| | | wrapper.orderBy("io_time", false); |
| | | } |
| | | return R.ok(wrkMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/update/auth") |
| | | @ManagerAuth(memo = "工作档修改") |
| | | public R update(WrkMast wrkMast){ |
| | | if (Cools.isEmpty(wrkMast) || null==wrkMast.getWrkNo()){ |
| | | @RequestMapping(value = "/wrkMast/update/auth") |
| | | @ManagerAuth(memo = "工作档修改") |
| | | public R update(WrkMast wrkMast) { |
| | | if (Cools.isEmpty(wrkMast) || null == wrkMast.getWrkNo()) { |
| | | return R.error(); |
| | | } |
| | | wrkMast.setModiUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkMast/delete/auth") |
| | | @ManagerAuth(memo = "工作档删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<WrkMast> list = JSONArray.parseArray(param, WrkMast.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (WrkMast entity : list){ |
| | | for (WrkMast entity : list) { |
| | | wrkMastService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkMast/export/auth") |
| | | @ManagerAuth(memo = "工作档导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<WrkMast> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("wrkMast")); |
| | |
| | | wrapper.like("wrk_no", condition); |
| | | Page<WrkMast> page = wrkMastService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (WrkMast wrkMast : page.getRecords()){ |
| | | for (WrkMast wrkMast : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", wrkMast.getWrkNo()); |
| | | map.put("value", wrkMast.getWrkNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<WrkMast> wrapper = new EntityWrapper<WrkMast>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != wrkMastService.selectOne(wrapper)){ |
| | | if (null != wrkMastService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(WrkMast.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | if (list.isEmpty()) { |
| | | return R.error("请至少选择一行数据"); |
| | | } |
| | | for (WrkMast entity : list){ |
| | | entity.setIoPri(entity.getIoPri() + 1); |
| | | for (WrkMast entity : list) { |
| | | entity.setIoPri(entity.getIoPri() + 1); |
| | | } |
| | | wrkMastService.updateBatchById(list); |
| | | return R.ok(); |
| | |
| | | if (list.isEmpty()) { |
| | | return R.error("请至少选择一行数据"); |
| | | } |
| | | for (WrkMast entity : list){ |
| | | for (WrkMast entity : list) { |
| | | entity.setIoPri(entity.getIoPri() - 1); |
| | | } |
| | | wrkMastService.updateBatchById(list); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkMastLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<WrkMastLog> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | allLike(WrkMastLog.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | if (orderByField.endsWith("$")){ |
| | | orderByField = orderByField.substring(0, orderByField.length()-1); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | if (orderByField.endsWith("$")) { |
| | | orderByField = orderByField.substring(0, orderByField.length() - 1); |
| | | } |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | }else { |
| | | } else { |
| | | wrapper.orderBy("modi_time", false); |
| | | } |
| | | return R.ok(wrkMastLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMastLog/update/auth") |
| | | @ManagerAuth(memo = "工作历史档修改") |
| | | public R update(WrkMastLog wrkMastLog){ |
| | | if (Cools.isEmpty(wrkMastLog) || null==wrkMastLog.getId()){ |
| | | @RequestMapping(value = "/wrkMastLog/update/auth") |
| | | @ManagerAuth(memo = "工作历史档修改") |
| | | public R update(WrkMastLog wrkMastLog) { |
| | | if (Cools.isEmpty(wrkMastLog) || null == wrkMastLog.getId()) { |
| | | return R.error(); |
| | | } |
| | | wrkMastLogService.updateById(wrkMastLog); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkMastLog/delete/auth") |
| | | @ManagerAuth(memo = "工作历史档删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<WrkMastLog> list = JSONArray.parseArray(param, WrkMastLog.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (WrkMastLog entity : list){ |
| | | for (WrkMastLog entity : list) { |
| | | wrkMastLogService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/wrkMastLog/export/auth") |
| | | @ManagerAuth(memo = "工作历史档导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<WrkMastLog> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("wrkMastLog")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<WrkMastLog> page = wrkMastLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (WrkMastLog wrkMastLog : page.getRecords()){ |
| | | for (WrkMastLog wrkMastLog : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", wrkMastLog.getId()); |
| | | map.put("value", wrkMastLog.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<WrkMastLog> wrapper = new EntityWrapper<WrkMastLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != wrkMastLogService.selectOne(wrapper)){ |
| | | if (null != wrkMastLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(WrkMastLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.controller.CrnController; |
| | | import com.zy.asrs.controller.OpenController; |
| | | import com.zy.asrs.controller.SiteController; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | |
| | | import com.zy.asrs.entity.param.Result; |
| | | import com.zy.asrs.entity.param.StorageEscalationParam; |
| | | import com.zy.asrs.entity.param.TaskOverToWms; |
| | | import com.zy.asrs.mapper.*; |
| | | import com.zy.asrs.mapper.BasCrnErrorMapper; |
| | | import com.zy.asrs.mapper.StaDescMapper; |
| | | import com.zy.asrs.mapper.TaskWrkMapper; |
| | | import com.zy.asrs.mapper.WrkMastMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.CommandUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.LedSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.CommandPackage; |
| | | import com.zy.core.model.command.CrnCommand; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.LedThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.concurrent.CompletableFuture; |
| | | |
| | | /** |
| | | * 立体仓库WCS系统主流程业务 |
| | |
| | | errMsg = "超重"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isBarcodeErr()) { |
| | | errMsg = "扫码失败"; |
| | | back = true; |
| | | } |
| | | // if (!back && staProtocol.isBarcodeErr()) { |
| | | // errMsg = "扫码失败"; |
| | | // back = true; |
| | | // } |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && workNo >= 9990 |
| | | && staProtocol.isPakMk()) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | | String BoxNo = ""; |
| | | if (barcodeThread != null) { |
| | | BoxNo = barcodeThread.getBarcode(); |
| | | TaskWrk taskWrk1 = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", BoxNo)); |
| | | if (!Cools.isEmpty(taskWrk1)) { |
| | | log.info("托盘码:" + BoxNo + "任务档存在"); |
| | | if (taskWrk1.getIoType() == 1 && taskWrk1.getStartPoint().equals(staProtocol.getSiteId().toString())) { |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("crn_no", taskWrk1.getCrnNo()).eq("type_no", 1).eq("stn_no", staProtocol.getSiteId())); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | return; |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | if (back) { |
| | | storageEscalationParam.setWCSStatus(1); |
| | | storageEscalationParam.setWCSErrorMessage(storageEscalationParam.getWCSErrorMessage() + errMsg); |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = errMsg; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | if (back) { |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = errMsg; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | } |
| | | |
| | | |
| | | storageEscalationParam.setBoxNo(BoxNo); |
| | | //是否满板 1满板 0空板 |
| | | storageEscalationParam.setStaType(staProtocol.isEmptyMk() ? 0 : 1); |
| | | //库位类型 1高库位 0低库位 |
| | | storageEscalationParam.setLocType(staProtocol.isHigh() ? 1 : 0); |
| | | storageEscalationParam.setTerminalNo(staProtocol.getSiteId()); |
| | | log.info("组托入库={}", storageEscalationParam); |
| | | String response = ""; |
| | | Boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | TaskWrk taskWrk = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().orderBy("create_time")); |
| | | if (taskWrk != null) { |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("TaskNo", taskWrk.getTaskNo()); |
| | | //开始上报,任务开始时,WCS回调WMS |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath(inboundTaskApplyPath) |
| | | .setJson(JSON.toJSONString(storageEscalationParam)) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(hashMap)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (back) { |
| | | staProtocol.setWorkNo((short) 9991); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | } else { |
| | | if (!Cools.isEmpty(response) && !Cools.isEmpty(jsonObject.get("ReturnStatus")) && jsonObject.get("ReturnStatus").equals(0) && !Cools.isEmpty(jsonObject.get("Result").toString())) { |
| | | Result result = JSON.parseObject(jsonObject.get("Result").toString(), Result.class); |
| | | // 创新一个入库工作档 |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(result.getTaskNo()); |
| | | if (Cools.isEmpty(taskWrk)) { |
| | | taskWrk = createTask1(result, BoxNo,staProtocol.getSiteId()); |
| | | if (Cools.isEmpty(taskWrk)) { |
| | | log.error("库位异常,库位号:={}", taskWrk.getOriginTargetPoint()); |
| | | } else { |
| | | taskWrkService.insert(taskWrk); |
| | | StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() |
| | | .eq("crn_no", taskWrk.getCrnNo()).eq("type_no", 1).eq("stn_no", staProtocol.getSiteId())); |
| | | staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(staDesc.getCrnStn().shortValue()); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("TaskNo", taskWrk.getTaskNo()); |
| | | try { |
| | | //开始上报,任务开始时,WCS回调WMS |
| | | response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(hashMap)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject1 = JSON.parseObject(response); |
| | | Boolean bool = false; |
| | | if (jsonObject1.get("ReturnStatus").equals(0)) { |
| | | taskWrk.setStatus(2);//派发任务 |
| | | bool = true; |
| | | taskWrkService.updateById(taskWrk); |
| | | } |
| | | apiLogService.save("wcs开始入库任务上报wms" |
| | | , wmsUrl + TaskExecCallback |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(hashMap) |
| | | , response |
| | | , bool |
| | | ); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | } else { |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = "已有入库任务!!!"; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | staProtocol.setWorkNo((short) 9991); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | } |
| | | |
| | | } else { |
| | | |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = jsonObject.getString("ErrorMessage"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | |
| | | staProtocol.setWorkNo((short) 9991); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | } |
| | | JSONObject jsonObject1 = JSON.parseObject(response); |
| | | Boolean bool = false; |
| | | if (jsonObject1.get("ReturnStatus").equals(0)) { |
| | | taskWrk.setStatus(2);//派发任务 |
| | | bool = true; |
| | | taskWrkService.updateById(taskWrk); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("请求入库调用接口失败"); |
| | | log.error("异常信息打印:" + e); |
| | | try { |
| | | BasDevp basDevp = basDevpService.selectById(inSta.getStaNo()); |
| | | if (Cools.isEmpty(basDevp)) { |
| | | log.error("站点号异常" + inSta.getStaNo()); |
| | | } else if (basDevp.getStaErr() != 0) { |
| | | basDevp.setStaErr(2); |
| | | basDevpService.updateById(basDevp); |
| | | } |
| | | } catch (Exception e1) { |
| | | // 退回 |
| | | log.error("扫码检测程序异常" + inSta.getStaNo() + "异常信息" + e1); |
| | | } |
| | | } finally { |
| | | apiLogService.save("wms请求入库货位接口" |
| | | , wmsUrl + inboundTaskApplyPath |
| | | apiLogService.save("wcs开始入库任务上报wms" |
| | | , wmsUrl + TaskExecCallback |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(storageEscalationParam) |
| | | , JSON.toJSONString(hashMap) |
| | | , response |
| | | , success |
| | | , bool |
| | | ); |
| | | } |
| | | log.info("入库请求参数=" + JSON.toJSONString(BoxNo)); |
| | | log.info("入库请求返回参数=" + JSON.toJSONString(response)); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | } catch ( |
| | | Exception e) { |
| | | log.error("generateStoreWrkFile e", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | |
| | | // 获取条码扫描仪信息 |
| | | String BoxNo = ""; |
| | | //站点拣料回库任务是会有一条 |
| | | TaskWrk taskWrkk =taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("start_point",staProtocol.getSiteId())); |
| | | TaskWrk taskWrkk = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("start_point", staProtocol.getSiteId())); |
| | | if (!Cools.isEmpty(taskWrkk)) { |
| | | continue; |
| | | } |
| | | if(!staProtocol.isEmptyMk()&&staProtocol.getWorkNo()<9990){ |
| | | if (!staProtocol.isEmptyMk() && staProtocol.getWorkNo() < 9990) { |
| | | |
| | | TaskWrk taskWrk1 = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("wrk_no", workNo)); |
| | | |
| | |
| | | // 创新一个入库工作档 |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(result.getTaskNo()); |
| | | if (Cools.isEmpty(taskWrk)) { |
| | | taskWrk = createTask1(result, BoxNo,staProtocol.getSiteId()); |
| | | taskWrk = createTask1(result, BoxNo, staProtocol.getSiteId()); |
| | | if (Cools.isEmpty(taskWrk)) { |
| | | log.error("库位异常,库位号:={}", taskWrk.getOriginTargetPoint()); |
| | | } else { |
| | |
| | | if (taskWrk == null) { |
| | | continue; |
| | | } |
| | | log.info("下发输送线任务:taskWrk:" + JSON.toJSONString(taskWrk)); |
| | | // R r = siteController.siteDetlUpdate(Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getWrkNo().shortValue(), (short) 0, "Y", false, false); |
| | | staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(staDesc.getStnNo().shortValue()); |
| | | boolean offer = false; |
| | | try { |
| | | offer = MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol)); |
| | | } catch (Exception e) { |
| | | log.error("下发输送线任务失败:异常:" + e); |
| | | log.error("下发输送线任务失败:异常:offer:" + offer); |
| | | } |
| | | // log.info("下发输送线任务:taskWrk:" + JSON.toJSONString(taskWrk)); |
| | | //// R r = siteController.siteDetlUpdate(Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getWrkNo().shortValue(), (short) 0, "Y", false, false); |
| | | // staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); |
| | | // staProtocol.setStaNo(staDesc.getStnNo().shortValue()); |
| | | // boolean offer = false; |
| | | // try { |
| | | // offer = MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol)); |
| | | // } catch (Exception e) { |
| | | // log.error("下发输送线任务失败:异常:" + e); |
| | | // log.error("下发输送线任务失败:异常:offer:" + offer); |
| | | // } |
| | | // JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(r)); |
| | | if (offer) { |
| | | log.info("下发输送线任务成功:taskWrk:" + JSON.toJSONString(taskWrk)); |
| | | // if (offer) { |
| | | // log.info("下发输送线任务成功:taskWrk:" + JSON.toJSONString(taskWrk)); |
| | | taskWrk.setStatus(5); |
| | | taskWrk.setWrkSts(14); |
| | | taskWrkService.updateById(taskWrk); |
| | | |
| | | } else { |
| | | log.error("下发输送线任务失败:taskWrk:" + JSON.toJSONString(taskWrk)); |
| | | // log.error("下发输送线任务失败:异常信息:"+JSON.toJSONString(r)); |
| | | } |
| | | // } else { |
| | | // log.error("下发输送线任务失败:taskWrk:" + JSON.toJSONString(taskWrk)); |
| | | //// log.error("下发输送线任务失败:异常信息:"+JSON.toJSONString(r)); |
| | | // } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("出库到出库站异常:异常信息:" + e); |
| | |
| | | } |
| | | if (locMast.getRow1() == 8) { |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", (locMast.getRow1() - 1 )) |
| | | .eq("row1", (locMast.getRow1() - 1)) |
| | | .eq("bay1", locMast.getBay1()) |
| | | .eq("lev1", locMast.getLev1()).eq("loc_sts", "F")); |
| | | if (!Cools.isEmpty(locMast1)) { |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 执行对工作档的完成操作 |
| | | */ |
| | | /** |
| | | * 执行对工作档的完成操作 |
| | | */ |
| | | // public void storeFinished() { |
| | | // for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | // // 获取堆垛机信息 |
| | |
| | | return response; |
| | | } |
| | | |
| | | private TaskWrk createTask1(Result result, String barcode,Integer staNo) { |
| | | private TaskWrk createTask1(Result result, String barcode, Integer staNo) { |
| | | String locNo = Utils.Fusion(result.getRow(), result.getFloor(), result.getColumn()); |
| | | |
| | | Date now = new Date(); |
| | |
| | | taskWrk.setIoPri(13);//优先级 |
| | | taskWrk.setBarcode(barcode);//条码 |
| | | taskWrk.setTargetPoint(locNo); |
| | | taskWrk.setStartPoint(staNo+""); |
| | | taskWrk.setStartPoint(staNo + ""); |
| | | taskWrk.setCrnNo(Integer.valueOf(result.getAlley()));//堆垛机号 |
| | | |
| | | if (taskWrk.getIoType() == 1) { |
| | |
| | | return taskWrk; |
| | | } |
| | | |
| | | //----------------------------------------------------------电视机显示处理---------------------------------------- |
| | | //----------------------------------------------------------电视机显示处理---------------------------------------- |
| | | |
| | | /** |
| | | * 其他 ===>> LED显示器复位,显示默认信息 |
| | | */ |
| | |
| | | if (reset && !ledThread.isLedMk()) { |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | log.error(""+mark+" - 1"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | log.error("" + mark + " - 1" + " - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.TaskCreateParam; |
| | | import com.zy.asrs.entity.param.TaskOverParam; |
| | | import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; |
| | | import com.zy.asrs.entity.param.TaskCreateParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | |
| | | public ArrayList<String> wharfCode1 = new ArrayList<String>() {{ |
| | | add("J-1101"); |
| | | add("J-1103"); |
| | |
| | | |
| | | @Override |
| | | public HashMap<String, Object> taskCreate(TaskCreateParam param) { |
| | | HashMap<String,Object> map=new HashMap<>(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | if (taskWrk != null) { |
| | | map.put("ReturnStatus",1); |
| | | map.put("ErrorMessage",param.getTaskNo()+"任务已经生成!"); |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", param.getTaskNo() + "任务已经生成!"); |
| | | return map; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if (!taskWrkService.insert(taskWrk)) { |
| | | map.put("ReturnStatus",1); |
| | | map.put("ErrorMessage",param.getTaskNo()+"创建任务失败!"); |
| | | map.put("ReturnStatus", 1); |
| | | map.put("ErrorMessage", param.getTaskNo() + "创建任务失败!"); |
| | | return map; |
| | | } |
| | | map.put("ReturnStatus",0); |
| | | map.put("ErrorMessage","ok"); |
| | | map.put("ReturnStatus", 0); |
| | | map.put("ErrorMessage", "ok"); |
| | | return map; |
| | | } |
| | | |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * WCS主流程 |
| | |
| | | /** |
| | | * =====>> 开始工作 |
| | | */ |
| | | public void start(){ |
| | | public void start() { |
| | | thread = new Thread(() -> { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | |
| | | } |
| | | |
| | | // 演示 |
| | | mainService.crnDemoOfLocMove1(); |
| | | //mainService.crnDemoOfLocMove1(); |
| | | // 入库 ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档 |
| | | mainService.generateStoreWrkFile1(); // 组托 |
| | | // 入库 ===>> 拣料盘点回库,输送线工作号保留的情况下入库 |
| | | mainService.PickingAndReturningToTheWarehouse(); |
| | | //mainService.PickingAndReturningToTheWarehouse(); |
| | | // 出库 ===>> 堆垛机出库站到出库站 |
| | | mainService.crnStnToOutStn(); |
| | | // 入出库 ===>> 堆垛机入出库作业下发 |
| | |
| | | // } |
| | | |
| | | //自动派发任务 |
| | | // mainService.autoDistribute(); |
| | | // mainService.autoDistribute(); |
| | | //自动完成任务 |
| | | // mainService.autoCompleteTask(); |
| | | //agv取放货完成 |
| | |
| | | } |
| | | |
| | | @PreDestroy |
| | | public void shutDown(){ |
| | | public void shutDown() { |
| | | if (thread != null) thread.interrupt(); |
| | | } |
| | | |
| | |
| | | new Thread((Runnable) devpThread).start(); |
| | | SlaveConnection.put(SlaveType.Devp, devp.getId(), devpThread); |
| | | } |
| | | // 初始化条码扫描仪线程 |
| | | log.info("初始化条码扫描仪线程..................................................."); |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | BarcodeThread barcodeThread = new BarcodeThread(barcode); |
| | | // new Thread(barcodeThread).start(); |
| | | SlaveConnection.put(SlaveType.Barcode, barcode.getId(), barcodeThread); |
| | | } |
| | | // 初始化LED线程 |
| | | log.info("初始化LED线程..................................................."); |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | LedThread ledThread = new LedThread(led); |
| | | new Thread(ledThread).start(); |
| | | SlaveConnection.put(SlaveType.Led, led.getId(), ledThread); |
| | | } |
| | | // // 初始化条码扫描仪线程 |
| | | // log.info("初始化条码扫描仪线程..................................................."); |
| | | // for (Slave barcode : slaveProperties.getBarcode()) { |
| | | // BarcodeThread barcodeThread = new BarcodeThread(barcode); |
| | | //// new Thread(barcodeThread).start(); |
| | | // SlaveConnection.put(SlaveType.Barcode, barcode.getId(), barcodeThread); |
| | | // } |
| | | // // 初始化LED线程 |
| | | // log.info("初始化LED线程..................................................."); |
| | | // for (LedSlave led : slaveProperties.getLed()) { |
| | | // LedThread ledThread = new LedThread(led); |
| | | // new Thread(ledThread).start(); |
| | | // SlaveConnection.put(SlaveType.Led, led.getId(), ledThread); |
| | | // } |
| | | // // 初始化磅秤线程 |
| | | // log.info("初始化磅秤线程..................................................."); |
| | | // for (Slave scale : slaveProperties.getScale()) { |
| | |
| | | @Data |
| | | public static class CrnStn { |
| | | |
| | | // 输送线plc编号 |
| | | private Integer devpPlcId; |
| | | |
| | | // 堆垛机站点编号 |
| | | private Integer staNo; |
| | | |
| | |
| | | //退回站点 |
| | | private Integer backSta; |
| | | |
| | | private Integer devpPlcId; |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.CommandPackage; |
| | | import com.zy.core.model.command.CrnCommand; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | crnProtocol.setXDuration(siemensNet.getByteTransform().TransSingle(result.Content, 48)); |
| | | crnProtocol.setYDuration(siemensNet.getByteTransform().TransSingle(result.Content, 52)); |
| | | |
| | | |
| | | // TODO |
| | | //更新虚拟输送线状态 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | //devpThread.setData(); |
| | | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | |
| | | |
| | | // 复位信号 |
| | | if (crnProtocol.getTaskFinish() == 0) { |
| | | if (resetFlag) { |
| | |
| | | package com.zy.core.thread; |
| | | |
| | | import HslCommunication.Core.Types.OperateResult; |
| | | import HslCommunication.Core.Types.OperateResultExOne; |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.entity.CommandInfoLog; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.CommandStatusType; |
| | | import com.zy.core.enums.IoModeType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.protocol.Cycle; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | |
| | | private SiemensS7Net siemensS7Net; |
| | | private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>(); |
| | | private short heartBeatVal = 1; |
| | | public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{ |
| | | add(1001); |
| | | add(1002); |
| | | add(1003); |
| | | add(1004); |
| | | add(1005); |
| | | add(1006); |
| | | add(1007); |
| | | add(1008); |
| | | add(1009); |
| | | add(1010); |
| | | add(1011); |
| | | add(1012); |
| | | add(1013); |
| | | add(1014); |
| | | add(1015); |
| | | add(1016); |
| | | add(1017); |
| | | add(1018); |
| | | add(1019); |
| | | add(1020); |
| | | |
| | | |
| | | }}; |
| | | public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{ |
| | | add(2001); |
| | | add(2002); |
| | | add(2003); |
| | | add(2004); |
| | | add(2005); |
| | | add(2006); |
| | | add(2007); |
| | | add(2008); |
| | | add(2009); |
| | | add(2010); |
| | | add(2011); |
| | | add(2012); |
| | | add(2013); |
| | | add(2014); |
| | | add(2015); |
| | | add(2016); |
| | | add(2017); |
| | | add(2018); |
| | | add(2019); |
| | | |
| | | }}; |
| | | public static final ArrayList<Integer> staNos3 = new ArrayList<Integer>() {{ |
| | | add(1051); |
| | | add(1052); |
| | | add(1053); |
| | | add(1054); |
| | | add(1055); |
| | | add(1056); |
| | | add(1057); |
| | | add(1058); |
| | | }}; |
| | | public static final ArrayList<Integer> staNos4 = new ArrayList<Integer>() {{ |
| | | add(2051); |
| | | add(2052); |
| | | add(2053); |
| | | add(2054); |
| | | add(2055); |
| | | add(2056); |
| | | add(2057); |
| | | add(2058); |
| | | |
| | | public static final ArrayList<Integer> staNos = new ArrayList<Integer>() {{ |
| | | add(100); |
| | | }}; |
| | | |
| | | /** |
| | |
| | | * 3.出库启动中 (不能生成入库工作档) |
| | | * 4.出库模式 |
| | | */ |
| | | public IoModeType ioModeOf2F = IoModeType.NONE; |
| | | |
| | | // public IoModeType ioMode = IoModeType.NONE; |
| | | private ArrayList<Integer> getStaNo() { |
| | | switch (slave.getId()) { |
| | | case 1: |
| | | return staNos1; |
| | | case 2: |
| | | return staNos2; |
| | | case 3: |
| | | return staNos3; |
| | | case 4: |
| | | return staNos4; |
| | | default: |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | | } |
| | | public IoModeType ioModeOf1F = IoModeType.NONE; |
| | | |
| | | public SiemensDevpThread(DevpSlave slave) { |
| | | this.slave = slave; |
| | | } |
| | | |
| | | @Override |
| | | @SuppressWarnings("InfiniteLoopStatement") |
| | | public void run() { |
| | | connect(); |
| | | while (true) { |
| | | try { |
| | | int step = 1; |
| | | Task task = MessageQueue.poll(SlaveType.Devp, slave.getId()); |
| | | if (task != null) { |
| | | step = task.getStep(); |
| | | } |
| | | switch (step) { |
| | | // 读数据 |
| | | case 1: |
| | | read(); |
| | | break; |
| | | // 写数据 ID+目标站 |
| | | case 2: |
| | | write((StaProtocol) task.getData()); |
| | | read(); |
| | | break; |
| | | // 写数据 ID+目标站 |
| | | case 4: |
| | | writeCycle((StaProtocol) task.getData()); |
| | | read(); |
| | | break; |
| | | /* case 3: |
| | | write2((StaProtocol)task.getData()); |
| | | read(); |
| | | break;*/ |
| | | default: |
| | | break; |
| | | } |
| | | // 心跳 |
| | | // heartbeat(); |
| | | Thread.sleep(400); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化站点状态 |
| | | */ |
| | | private void initSite() { |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | public void setData(Integer siteId, boolean loading, boolean inEnable, boolean outEnable) { |
| | | // 站点编号 |
| | | for (Integer siteId : staNos) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setWorkNo((short) 0); // ID |
| | | staProtocol.setAutoing(false); // 自动 |
| | | staProtocol.setLoading(false); // 有物 |
| | | staProtocol.setInEnable(false); // 可入 |
| | | staProtocol.setOutEnable(false); // 可出 |
| | | staProtocol.setEmptyMk(false); // 空板信号 |
| | | staProtocol.setStaNo((short) 0); // 目标站 |
| | | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | boolean result = false; |
| | | siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200, slave.getIp()); |
| | | siemensS7Net.setRack(slave.getRack().byteValue()); |
| | | siemensS7Net.setSlot(slave.getSlot().byteValue()); |
| | | OperateResult connect = siemensS7Net.ConnectServer(); |
| | | if (connect.IsSuccess) { |
| | | result = true; |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | log.info("输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | log.error("输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | // DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | // deviceErrorService.addDeviceError("devp", slave.getId(), "输送线plc连接失败"); |
| | | initSite(); |
| | | } |
| | | siemensS7Net.ConnectClose(); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 读取状态 ====> 整块plc |
| | | */ |
| | | private void read() throws InterruptedException { |
| | | // // 更新入出库模式 |
| | | // updateIoMode(); |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int staNoSize = staNos.size(); |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize * 8)); |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | for (Integer sta : staNos) { |
| | | if (sta.equals(siteId)) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setWorkNo((short) siemensS7Net.getByteTransform().TransInt32(result.Content, i * 8)); // 工作号 |
| | | |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 8 + 4)); // 目标站 |
| | | |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i * 8 + 6, 2); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setHigh(status[6]); // 高库位 |
| | | staProtocol.setLow(status[7]); // 低库位 |
| | | |
| | | staProtocol.setWorkNo((short) 0); // ID |
| | | staProtocol.setAutoing(true); // 自动 |
| | | staProtocol.setLoading(loading); // 有物 |
| | | staProtocol.setInEnable(inEnable); // 可入 |
| | | staProtocol.setOutEnable(outEnable); // 可出 |
| | | staProtocol.setEmptyMk(false); // 空板信号 |
| | | staProtocol.setStaNo((short) 0); // 目标站 |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //条码 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.840.0", (short) 8); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < 1; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, slave.getId()); |
| | | if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //外形检测 |
| | | OperateResultExOne<byte[]> resultErr1 = siemensS7Net.Read("DB101.802.0", (short) (barcodeSize * 1)); |
| | | if (resultErr1.IsSuccess) { |
| | | int sta = 0; |
| | | switch (slave.getId()) { |
| | | case 1: |
| | | sta = 1014; |
| | | break; |
| | | case 2: |
| | | sta = 2007; |
| | | break; |
| | | case 3: |
| | | sta = 1052; |
| | | break; |
| | | case 4: |
| | | sta = 2056; |
| | | break; |
| | | } |
| | | StaProtocol staProtocol1 = station.get(sta); |
| | | boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErr1.Content, 0, 1); |
| | | staProtocol1.setFrontErr(status1[0]); |
| | | staProtocol1.setBackErr(status1[1]); |
| | | staProtocol1.setHighErr(status1[2]); |
| | | staProtocol1.setLeftErr(status1[3]); |
| | | staProtocol1.setRightErr(status1[4]); |
| | | staProtocol1.setWeightErr(status1[5]); |
| | | staProtocol1.setBarcodeErr(status1[6]); |
| | | } |
| | | |
| | | |
| | | // OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.922.0", (short) (staNoSize * 4)); |
| | | // if (resultErr.IsSuccess) { |
| | | // for (int i = 0; i < staNoSize; i++) { |
| | | // Integer siteId = staNos.get(i); // 站点编号 |
| | | // boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 4, 1); |
| | | // StaProtocol staProtocol = station.get(siteId); |
| | | // staProtocol.setBreakerErr(status[0]); |
| | | // staProtocol.setInfraredErr(status[1]); |
| | | // staProtocol.setOutTimeErr(status[2]); |
| | | // staProtocol.setSeizeSeatErr(status[3]); |
| | | // staProtocol.setWrkYgoodsN(status[4]); |
| | | // staProtocol.setInverterErr(status[5]); |
| | | // staProtocol.setContactErr(status[6]); |
| | | // staProtocol.setUpcontactErr(status[7]); |
| | | // |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // //RGV台车位置 |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB100.0",(short)4); |
| | | // if (result3.IsSuccess) { |
| | | // for (int i = 0; i < 2; i++) { |
| | | // Integer siteId = i==0 ? 1 : 2; // 站点编号 |
| | | // StaProtocol staProtocol = station.get(siteId); |
| | | // if (null == staProtocol) { |
| | | // staProtocol = new StaProtocol(); |
| | | // staProtocol.setSiteId(siteId); |
| | | // station.put(siteId, staProtocol); |
| | | // } |
| | | // staProtocol.setNearbySta(String.valueOf(siemensS7Net.getByteTransform().TransInt16(result3.Content, i*2))); |
| | | //// String aa = staProtocol.getNearbySta(); |
| | | //// System.out.println(siteId + "===>>" + staProtocol.getNearbySta()); |
| | | // } |
| | | // } |
| | | |
| | | // OperateResultExOne<Short> result2 = siemensS7Net.ReadInt16("DB200.0"); |
| | | // if (result2.IsSuccess) { |
| | | // this.ioMode = IoModeType.get(result2.Content); |
| | | // } |
| | | |
| | | if (result.IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | // 根据实时信息更新数据库 |
| | | try { |
| | | List<BasDevp> basDevps = new ArrayList<>(); |
| | | for (Integer siteId : staNos) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | } |
| | | |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】更新数据库数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | log.error("更新数据库数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | } |
| | | |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.deleteDeviceError("devp", slave.getId()); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | // log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("devp", slave.getId(), "读取输送线plc状态信息失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 写入 ID+目标站 =====> 单站点写入 |
| | | */ |
| | | private void writeAgvOk(StaProtocol staProtocol) throws InterruptedException { |
| | | if (null == staProtocol) { |
| | | return; |
| | | } |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int index = staNos.indexOf(staProtocol.getSiteId()); |
| | | if (staProtocol.getAgvTypeSign() == 0 || staProtocol.getAgvTypeSign() == 2) { //0取货 |
| | | switch (staProtocol.getSiteId()) { |
| | | case 100: |
| | | index = 32; |
| | | break; |
| | | case 101: |
| | | index = 34; |
| | | break; |
| | | case 102: |
| | | index = 38; |
| | | break; |
| | | case 103: |
| | | index = 40; |
| | | break; |
| | | case 104: |
| | | index = 44; |
| | | break; |
| | | case 105: |
| | | index = 46; |
| | | break; |
| | | case 106: |
| | | index = 50; |
| | | break; |
| | | case 107: |
| | | index = 52; |
| | | break; |
| | | default: |
| | | return; |
| | | } |
| | | } else { |
| | | switch (staProtocol.getSiteId()) { |
| | | case 100: |
| | | index = 30; |
| | | break; |
| | | case 102: |
| | | index = 36; |
| | | break; |
| | | case 104: |
| | | index = 42; |
| | | break; |
| | | case 106: |
| | | index = 48; |
| | | break; |
| | | default: |
| | | return; |
| | | } |
| | | } |
| | | |
| | | OperateResult write = null; |
| | | //任务下发次数 |
| | | int writeCount = 0; |
| | | do { |
| | | short textWrite = 1;// 任务完成 |
| | | if (staProtocol.getAgvTypeSign() > 1) { |
| | | textWrite = 0;// 任务复位 |
| | | } |
| | | write = siemensS7Net.Write("DB102." + index, textWrite); |
| | | if (write.IsSuccess) { |
| | | writeCount = 6; |
| | | } else { |
| | | writeCount++; |
| | | log.error("写入输送线取放货完成命令后读取失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | } |
| | | } while (writeCount < 5); |
| | | |
| | | if (!write.IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线站点数据失败。输送线plc编号={1},站点数据={2}", slave.getId(), JSON.toJSON(staProtocol))); |
| | | log.error("写入输送线取放货完成站点数据失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); |
| | | log.info("输送线取放货完成命令下发码垛完成 给输送线写任务完成 [id:{}] >>>>> 命令下发: {}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | private void write(StaProtocol staProtocol) throws InterruptedException { |
| | | if (staProtocol == null) { |
| | | return; |
| | | } |
| | | |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int index = staNos.indexOf(staProtocol.getSiteId()); |
| | | |
| | | if (index == -1) { |
| | | log.error("站点编号 {} 不在已知列表中,无法写入任务!", staProtocol.getSiteId()); |
| | | return; |
| | | } |
| | | |
| | | int writeCount = 0; // 任务下发尝试次数 |
| | | boolean writeFlag = false; // 任务下发成功标记 |
| | | String plcAddressWorkNo = "DB100." + index * 6; |
| | | String plcAddressStaNo = "DB100." + (index * 6 + 4); |
| | | Thread.sleep(100); |
| | | while (writeCount < 5) { |
| | | // **读取当前PLC状态,避免不必要的写入** |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read(plcAddressWorkNo, (short) 6); |
| | | if (readResult.IsSuccess) { |
| | | int currentWorkNo = siemensS7Net.getByteTransform().TransInt32(readResult.Content, 0); |
| | | short currentStaNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 4); |
| | | |
| | | if (currentWorkNo == staProtocol.getWorkNo().intValue() && currentStaNo == staProtocol.getStaNo()) { |
| | | log.info("站点 {} 当前状态已匹配,无需重复写入", staProtocol.getSiteId()); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // **清零并确认** |
| | | if (!clearPLCData(plcAddressWorkNo, plcAddressStaNo, staProtocol.getSiteId())) { |
| | | writeCount++; |
| | | continue; // 重新尝试清零 |
| | | } |
| | | |
| | | // **写入新任务** |
| | | if (writeTaskToPLC(plcAddressWorkNo, plcAddressStaNo, staProtocol)) { |
| | | writeFlag = true; |
| | | log.info("输送线命令写入成功,PLC编号={},站点数据={},尝试次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | break; |
| | | } |
| | | |
| | | log.warn("输送线命令写入失败,PLC编号={},站点数据={},尝试次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | writeCount++; |
| | | } |
| | | |
| | | // **写入失败处理** |
| | | handleWriteFailure(staProtocol, writeFlag); |
| | | } |
| | | |
| | | private void writeCycle(StaProtocol staProtocol) throws InterruptedException { |
| | | if (staProtocol == null) { |
| | | return; |
| | | } |
| | | |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int index = staNos.indexOf(staProtocol.getSiteId()); |
| | | |
| | | if (index == -1) { |
| | | log.error("站点编号 {} 不在已知列表中,无法写入任务!", staProtocol.getSiteId()); |
| | | return; |
| | | } |
| | | |
| | | int writeCount = 0; // 任务下发尝试次数 |
| | | boolean writeFlag = false; // 任务下发成功标记 |
| | | String plcAddressWorkNo = ""; |
| | | String plcAddressStaNo = ""; |
| | | switch (staProtocol.getSiteId()) { |
| | | case 105: |
| | | plcAddressWorkNo = "DB73." + 0; |
| | | plcAddressStaNo = "DB73." + 4; |
| | | break; |
| | | case 106: |
| | | plcAddressWorkNo = "DB73." + 6; |
| | | plcAddressStaNo = "DB73." + (6 + 4); |
| | | break; |
| | | case 108: |
| | | plcAddressWorkNo = "DB73." + 2 * 6; |
| | | plcAddressStaNo = "DB73." + (2 * 6 + 4); |
| | | break; |
| | | case 110: |
| | | plcAddressWorkNo = "DB73." + 3 * 6; |
| | | plcAddressStaNo = "DB73." + (3 * 6 + 4); |
| | | break; |
| | | case 112: |
| | | plcAddressWorkNo = "DB73." + 4 * 6; |
| | | plcAddressStaNo = "DB73." + (4 * 6 + 4); |
| | | break; |
| | | } |
| | | |
| | | |
| | | // **写入新任务** |
| | | if (writeTaskToPLC(plcAddressWorkNo, plcAddressStaNo, staProtocol)) { |
| | | writeFlag = true; |
| | | log.info("输送线命令写入成功,PLC编号={},站点数据={},尝试次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | } |
| | | |
| | | // **写入失败处理** |
| | | handleWriteFailure(staProtocol, writeFlag); |
| | | } |
| | | |
| | | /** |
| | | * 清零 PLC 数据并验证清零是否成功 |
| | | */ |
| | | private boolean clearPLCData(String plcAddressWorkNo, String plcAddressStaNo, int siteId) throws InterruptedException { |
| | | siemensS7Net.Write(plcAddressWorkNo, 0); |
| | | siemensS7Net.Write(plcAddressStaNo, (short) 0); |
| | | Thread.sleep(100); // 等待PLC识别 |
| | | |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read(plcAddressWorkNo, (short) 6); |
| | | if (readResult.IsSuccess) { |
| | | int readWorkNo = siemensS7Net.getByteTransform().TransInt32(readResult.Content, 0); |
| | | short readStaNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 4); |
| | | if (readWorkNo == 0 && readStaNo == 0) { |
| | | return true; // 清零成功 |
| | | } |
| | | } |
| | | |
| | | log.warn("站点 {} 清零失败,尝试重新清零...", siteId); |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 写入新任务到 PLC 并验证是否成功 |
| | | */ |
| | | private boolean writeTaskToPLC(String plcAddressWorkNo, String plcAddressStaNo, StaProtocol staProtocol) throws InterruptedException { |
| | | OperateResult writeResult2 = siemensS7Net.Write(plcAddressStaNo, staProtocol.getStaNo()); |
| | | |
| | | OperateResult writeResult1 = siemensS7Net.Write(plcAddressWorkNo, staProtocol.getWorkNo().intValue()); |
| | | |
| | | if (writeResult1.IsSuccess && writeResult2.IsSuccess) { |
| | | Thread.sleep(200); // 等待 PLC 识别新值 |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read(plcAddressWorkNo, (short) 6); |
| | | if (readResult.IsSuccess) { |
| | | int workNo = siemensS7Net.getByteTransform().TransInt32(readResult.Content, 0); |
| | | short staNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 4); |
| | | return workNo == staProtocol.getWorkNo().intValue() && staNo == staProtocol.getStaNo(); |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private boolean writeTaskToPLC(String plcAddressWorkNo, String plcAddressStaNo, Cycle cycle) throws InterruptedException { |
| | | OperateResult writeResult1 = siemensS7Net.Write(plcAddressWorkNo, cycle.getWorkNo().intValue()); |
| | | OperateResult writeResult2 = siemensS7Net.Write(plcAddressStaNo, cycle.getStaNo()); |
| | | |
| | | if (writeResult1.IsSuccess && writeResult2.IsSuccess) { |
| | | Thread.sleep(200); // 等待 PLC 识别新值 |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read(plcAddressWorkNo, (short) 6); |
| | | if (readResult.IsSuccess) { |
| | | int workNo = siemensS7Net.getByteTransform().TransInt32(readResult.Content, 0); |
| | | short staNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 4); |
| | | return workNo == cycle.getWorkNo().intValue() && staNo == cycle.getStaNo(); |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 处理写入失败的情况 |
| | | */ |
| | | private void handleWriteFailure(StaProtocol staProtocol, boolean writeFlag) { |
| | | if (!writeFlag) { |
| | | StaProtocol currentStaProtocol = station.get(staProtocol.getSiteId()); |
| | | if (currentStaProtocol.getWorkNo() == 0 && currentStaProtocol.getStaNo() == 0) { |
| | | currentStaProtocol.setPakMk(true); |
| | | } |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线命令尝试5次失败。PLC编号={1},站点数据={2}", |
| | | slave.getId(), JSON.toJSON(currentStaProtocol))); |
| | | log.error("输送线命令尝试5次失败,PLC编号={},站点数据={}", slave.getId(), JSON.toJSON(currentStaProtocol)); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线命令成功 [id:{1}] >>>>> {2}", |
| | | DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); |
| | | log.info("输送线命令成功 [id:{}] >>>>> {}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void write2(StaProtocol staProtocol) throws InterruptedException { |
| | | if (null == staProtocol) { |
| | | return; |
| | | } |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | |
| | | int index = staNos.indexOf(staProtocol.getSiteId()); |
| | | short[] array = new short[2]; |
| | | array[0] = staProtocol.getWorkNo(); |
| | | array[1] = staProtocol.getStaNo(); |
| | | |
| | | OperateResult writeResult; |
| | | //任务下发次数 |
| | | int writeCount = 0; |
| | | //任务下发成功标识 |
| | | boolean writeFlag = false; |
| | | while (writeCount < 5) { |
| | | writeResult = siemensS7Net.Write("DB100." + index * 4, array); // 工作号、目标站 |
| | | |
| | | if (writeResult.IsSuccess) { |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index * 4, (short) 4); |
| | | if (readResult.IsSuccess) { |
| | | short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0); |
| | | short staNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 2); |
| | | if (staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)) { |
| | | //任务命令写入成功 |
| | | writeFlag = true; |
| | | log.info("写入输送线命令后返回成功,并且回读成功。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | |
| | | Date now = new Date(); |
| | | break; |
| | | } else {//返回结果是成功了,但是真实值不相同 |
| | | writeCount++; |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令后返回成功,但是读取任务值不一致。输送线plc编号={1},站点数据={2},写入次数={3}", |
| | | slave.getId(), JSON.toJSON(staProtocol), writeCount)); |
| | | log.error("写入输送线命令后返回成功,但是读取任务值不一致。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | |
| | | } |
| | | } else { |
| | | writeCount++; |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令后读取失败。输送线plc编号={1},站点数据={2},写入次数={3}", |
| | | slave.getId(), JSON.toJSON(staProtocol), writeCount)); |
| | | log.error("写入输送线命令后读取失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | |
| | | } |
| | | } else { |
| | | writeCount++; |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令失败。输送线plc编号={1},站点数据={2},写入次数={3}", |
| | | slave.getId(), JSON.toJSON(staProtocol), writeCount)); |
| | | log.error("写入输送线命令失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | |
| | | } |
| | | Thread.sleep(200); |
| | | } |
| | | |
| | | //写命令尝试了5次还是失败了 |
| | | if (!writeFlag) { |
| | | staProtocol = station.get(staProtocol.getSiteId()); |
| | | if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() == 0) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令尝试5次失败。输送线plc编号={1},站点数据={2}", slave.getId(), JSON.toJSON(staProtocol))); |
| | | log.error("写入输送线命令尝试5次失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | |
| | | //重新添加数据到任务队列 |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, slave.getId(), new Task(3, staProtocol)); |
| | | read();//读取1次设备状态 |
| | | return; |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发成功 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); |
| | | //log.info("输送线命令下发 [id:{}] >>>>> 命令下发成功: {}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | |
| | | Integer siteId = staProtocol.getSiteId(); |
| | | staProtocol = station.get(siteId); |
| | | if ((siteId == 101 || siteId == 201) && (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() == 0)) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | // /** |
| | | // * 写入 ID+目标站 =====> 单站点写入 |
| | | // */ |
| | | // private void write(StaProtocol staProtocol) throws InterruptedException { |
| | | // if (null == staProtocol) { |
| | | // return; |
| | | // } |
| | | // int index = staNos.indexOf(staProtocol.getSiteId()); |
| | | // short[] array = new short[2]; |
| | | // array[0] = staProtocol.getWorkNo(); |
| | | // array[1] = staProtocol.getStaNo(); |
| | | // OperateResult write = siemensS7Net.Write("DB100." + index*4, array); |
| | | // |
| | | //// OperateResult write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo()); // 工作号 |
| | | //// Thread.sleep(500); |
| | | //// OperateResult write1 = siemensS7Net.Write("DB101." + index*2, staProtocol.getStaNo()); // 目标站 |
| | | // |
| | | // if (!write.IsSuccess) { |
| | | // staProtocol = station.get(staProtocol.getSiteId()); |
| | | // if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) { |
| | | // staProtocol.setPakMk(true); |
| | | // } |
| | | // OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线站点数据失败。输送线plc编号={1},站点数据={2}", slave.getId(), JSON.toJSON(staProtocol))); |
| | | // log.error("写入输送线站点数据失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | // } else { |
| | | // OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); |
| | | // log.info("输送线命令下发 [id:{}] >>>>> 命令下发: {}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | // |
| | | // Integer siteId = staProtocol.getSiteId(); |
| | | // staProtocol = station.get(siteId); |
| | | // if ((siteId == 101 || siteId == 201)&&(staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0)) { |
| | | // staProtocol.setPakMk(true); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // 更新入出库模式 |
| | | private void updateIoMode() throws InterruptedException { |
| | | if (this.ioModeOf2F != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.180", this.ioModeOf2F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 心跳 |
| | | */ |
| | | private void heartbeat() { |
| | | if (heartBeatVal == 1) { |
| | | heartBeatVal = 2; |
| | | } else { |
| | | heartBeatVal = 1; |
| | | } |
| | | OperateResult write = siemensS7Net.Write("DB100.50", heartBeatVal); |
| | | if (!write.IsSuccess) { |
| | | log.error("输送线plc编号={} 心跳失败", slave.getId()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置入库标记 |
| | | */ |
| | | @Override |
| | | public void setPakMk(Integer siteId, boolean pakMk) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null != staProtocol) { |
| | | staProtocol.setPakMk(pakMk); |
| | | } |
| | | public boolean connect() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public void close() { |
| | | siemensS7Net.ConnectClose(); |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | ArrayList<Integer> staNos = staNos1; |
| | | System.out.println(staNos.indexOf(129)); |
| | | System.out.println(staNos.size()); |
| | | for (int i = 0; i < staNos.size(); i++) { |
| | | // System.out.println(i*2); |
| | | // System.out.println(i*2 + 200); |
| | | // System.out.println(i); |
| | | } |
| | | int index = staNos.indexOf(128); |
| | | System.out.println(index * 2); |
| | | System.out.println(index * 2 + 200); |
| | | |
| | | @Override |
| | | public void setPakMk(Integer siteId, boolean pakMk) { |
| | | |
| | | } |
| | | |
| | | // public static void main(String[] args) throws Exception { |
| | | // DevpSlave slave = new DevpSlave(); |
| | | // slave.setIp("192.168.2.125"); |
| | | // SiemensDevpThread devpThread = new SiemensDevpThread(slave); |
| | | // devpThread.connect(); |
| | | // devpThread.read(); |
| | | // // 写 |
| | | // StaProtocol staProtocol = devpThread.getStation().get(1); |
| | | // staProtocol.setWorkNo((short) 232); |
| | | // staProtocol.setStaNo((short) 6); |
| | | // staProtocol.setAutoing(true); |
| | | // staProtocol.setEmptyMk(true); |
| | | // staProtocol.setInEnable(true); |
| | | // devpThread.write(staProtocol); |
| | | // System.out.println("----------------------------------------"); |
| | | // // 读 |
| | | // devpThread.read(); |
| | | // System.out.println(JSON.toJSONString(devpThread.station)); |
| | | // |
| | | // } |
| | | @Override |
| | | public void run() { |
| | | |
| | | } |
| | | } |
| | |
| | | wcs-slave: |
| | | doubleDeep: true #双深 |
| | | doubleLocs: 5,8 #双深库位排号 1,4 |
| | | doubleLocs: 1,4 #双深库位排号 1,4 |
| | | groupCount: 4 #一个堆垛机负责的货架排数 |
| | | crn[0]: #堆垛机1 |
| | | id: 1 |
| | |
| | | offset: 2 #偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | port: 102 |
| | | crnOutStn[0]: #堆垛机出库站点--1F输送线 放货口 |
| | | staNo: 1002 |
| | | staNo: 100 |
| | | row: 1 |
| | | bay: 1 |
| | | lev: 1 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | devpPlcId: 1 |
| | | crnInStn[0]: #堆垛机入库站点1--1F输送线 取货口 |
| | | staNo: 1004 |
| | | staNo: 100 |
| | | row: 2 |
| | | bay: 1 |
| | | lev: 1 |
| | | backSta: 102 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | crnOutStn[1]: #堆垛机出库站点--2F输送线 放货口 |
| | | staNo: 2002 |
| | | row: 1 |
| | | bay: 59 |
| | | lev: 11 |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | crnInStn[1]: #堆垛机入库站点--2F输送线 取货口 |
| | | staNo: 2003 |
| | | row: 2 |
| | | bay: 59 |
| | | lev: 11 |
| | | backSta: 102 |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | crn[1]: #堆垛机2 |
| | | id: 2 |
| | | ip: 192.168.110.90 |
| | | slot: 0 |
| | | demo: false |
| | | rack: 0 |
| | | offset: 2 #偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | port: 102 |
| | | crnOutStn[0]: #堆垛机出库站点--1F输送线 放货口 |
| | | staNo: 1006 |
| | | row: 3 |
| | | bay: 1 |
| | | lev: 1 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | crnInStn[0]: #堆垛机入库站点1--1F输送线 取货口 |
| | | staNo: 1008 |
| | | row: 4 |
| | | bay: 1 |
| | | lev: 1 |
| | | backSta: 106 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | crnOutStn[1]: #堆垛机出库站点--2F输送线 放货口 |
| | | staNo: 2013 |
| | | row: 4 |
| | | bay: 59 |
| | | lev: 11 |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | crnInStn[1]: #堆垛机入库站点1--2F输送线 取货口 |
| | | staNo: 2012 |
| | | row: 3 |
| | | bay: 59 |
| | | lev: 11 |
| | | backSta: 106 |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | crn[2]: #堆垛机3 |
| | | id: 3 |
| | | ip: 192.168.110.10 |
| | | slot: 0 |
| | | demo: false |
| | | rack: 0 |
| | | offset: 2 #偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | port: 102 |
| | | crnOutStn[0]: #堆垛机出库站点--1F输送线 放货口 |
| | | staNo: 1056 |
| | | row: 7 |
| | | bay: 1 |
| | | lev: 1 |
| | | devpPlcId: ${wcs-slave.devp[2].id} |
| | | crnInStn[0]: #堆垛机入库站点1--1F输送线 取货口 |
| | | staNo: 1058 |
| | | row: 6 |
| | | bay: 1 |
| | | lev: 1 |
| | | backSta: 106 |
| | | devpPlcId: ${wcs-slave.devp[2].id} |
| | | crnOutStn[1]: #堆垛机出库站点--2F输送线 放货口 |
| | | staNo: 2057 |
| | | row: 7 |
| | | bay: 1 |
| | | lev: 13 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnInStn[1]: #堆垛机入库站点1--2F输送线 取货口 |
| | | staNo: 2057 |
| | | row: 7 |
| | | bay: 1 |
| | | lev: 13 |
| | | backSta: 106 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnOutStn[2]: #堆垛机出库站点--2F输送线 放货口 |
| | | staNo: 2058 |
| | | row: 6 |
| | | bay: 1 |
| | | lev: 13 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnInStn[2]: #堆垛机入库站点1--2F输送线 取货口 |
| | | staNo: 2058 |
| | | row: 6 |
| | | bay: 1 |
| | | lev: 13 |
| | | backSta: 106 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnOutStn[3]: #堆垛机出库站点--2F输送线 放货口 |
| | | staNo: 2051 |
| | | row: 7 |
| | | bay: 13 |
| | | lev: 13 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnInStn[3]: #堆垛机入库站点1--2F输送线 取货口 |
| | | staNo: 2051 |
| | | row: 7 |
| | | bay: 13 |
| | | lev: 13 |
| | | backSta: 106 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnOutStn[4]: #堆垛机出库站点--2F输送线 放货口 |
| | | staNo: 2052 |
| | | row: 7 |
| | | bay: 10 |
| | | lev: 13 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnInStn[4]: #堆垛机入库站点1--2F输送线 取货口 |
| | | staNo: 2052 |
| | | row: 7 |
| | | bay: 10 |
| | | lev: 13 |
| | | backSta: 106 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnOutStn[5]: #堆垛机出库站点--2F输送线 放货口 |
| | | staNo: 2054 |
| | | row: 7 |
| | | bay: 4 |
| | | lev: 13 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | crnInStn[5]: #堆垛机入库站点1--2F输送线 取货口 |
| | | staNo: 2056 |
| | | row: 7 |
| | | bay: 2 |
| | | lev: 13 |
| | | backSta: 106 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | devp[0]: #输送线--半成品1F |
| | | id: 1 |
| | | ip: 192.168.110.50 |
| | | rack: 0 |
| | | port: 102 |
| | | slot: 0 |
| | | emptyInSta[0]: #空板入库口0 |
| | | staNo: 1014 |
| | | inSta[0]: #入库口1 |
| | | staNo: 1014 |
| | | backSta: 1015 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | led: ${wcs-slave.led[2].id} |
| | | outSta[0]: #出库口1 |
| | | staNo: 1019 |
| | | outSta[1]: #出库口2 |
| | | staNo: 1010 |
| | | outSta[2]: #出库口2 |
| | | staNo: 1020 |
| | | devp[1]: #输送线--半成品2F |
| | | id: 2 |
| | | ip: 192.168.110.70 |
| | | rack: 0 |
| | | port: 102 |
| | | slot: 0 |
| | | emptyInSta[0]: #空板入库口0 |
| | | staNo: 2007 |
| | | inSta[0]: #入库口1 |
| | | staNo: 2007 |
| | | backSta: 2006 |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | led: ${wcs-slave.led[8].id} |
| | | outSta[0]: #出库口1 |
| | | staNo: 2001 |
| | | outSta[1]: #出库口2 |
| | | staNo: 2019 |
| | | devp[2]: #输送线--成品1F |
| | | id: 3 |
| | | ip: 192.168.110.30 |
| | | rack: 0 |
| | | port: 102 |
| | | slot: 0 |
| | | inSta[0]: #入库口1 |
| | | staNo: 1052 |
| | | backSta: 1051 |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | led: ${wcs-slave.led[0].id} |
| | | inSta[1]: #空板入库口0 |
| | | staNo: 1058 |
| | | outSta[0]: #出库口1 |
| | | staNo: 1053 |
| | | devp[3]: #输送线--成品2F |
| | | id: 4 |
| | | ip: 192.168.110.40 |
| | | rack: 0 |
| | | port: 102 |
| | | slot: 0 |
| | | emptyInSta[0]: #空板入库口0 |
| | | staNo: 2056 |
| | | led: ${wcs-slave.led[3].id} |
| | | inSta[0]: #入库口1 |
| | | staNo: 2056 |
| | | backSta: 2055 |
| | | barcode: ${wcs-slave.barcode[3].id} |
| | | led: ${wcs-slave.led[4].id} |
| | | outSta[0]: #出库口1 |
| | | staNo: 1053 |
| | | outSta[1]: #出库口1 |
| | | staNo: 251 |
| | | outSta[2]: #出库口1 |
| | | staNo: 252 |
| | | outSta[3]: #出库口1 |
| | | staNo: 257 |
| | | outSta[4]: #出库口1 |
| | | staNo: 258 |
| | | # 拣料入库口1 |
| | | pickSta[0]: |
| | | staNo: 2051 |
| | | led: ${wcs-slave.led[6].id} |
| | | # 拣料入库口2 |
| | | pickSta[1]: |
| | | staNo: 2052 |
| | | # 拣料入库口3 |
| | | pickSta[2]: |
| | | staNo: 2057 |
| | | led: ${wcs-slave.led[3].id} |
| | | # 拣料入库口4 |
| | | pickSta[3]: |
| | | staNo: 2058 |
| | | barcode[0]: #条码扫描仪 |
| | | port: 51236 |
| | | ip: 172.17.91.39 |
| | | id: 1 |
| | | barcode[1]: #条码扫描仪 |
| | | port: 51236 |
| | | ip: 172.17.91.39 |
| | | id: 2 |
| | | barcode[2]: #条码扫描仪 |
| | | port: 51236 |
| | | ip: 172.17.91.39 |
| | | id: 3 |
| | | barcode[3]: #条码扫描仪 |
| | | port: 51236 |
| | | ip: 172.17.91.39 |
| | | id: 4 |
| | | # LED1 成品库1F |
| | | led[0]: |
| | | id: 1 |
| | | ip: 192.168.110.210 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[2].id} |
| | | staArr: 1052 |
| | | # LED2 成品库1F |
| | | led[1]: |
| | | id: 2 |
| | | ip: 192.168.110.211 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[2].id} |
| | | staArr: 1051 |
| | | # LED3 半成品库1F |
| | | led[2]: |
| | | id: 3 |
| | | ip: 192.168.110.212 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 1014 |
| | | # LED4 成品库2F |
| | | led[3]: |
| | | id: 4 |
| | | ip: 192.168.110.213 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | staArr: 2057 |
| | | # LED5 成品库2F |
| | | led[4]: |
| | | id: 5 |
| | | ip: 192.168.110.214 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | staArr: 2056 |
| | | # LED6 成品库2F |
| | | led[5]: |
| | | id: 6 |
| | | ip: 192.168.110.215 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | staArr: 2054 |
| | | # LED7 成品库2F |
| | | led[6]: |
| | | id: 7 |
| | | ip: 192.168.110.216 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[3].id} |
| | | staArr: 2051 |
| | | # LED8 半成品库2F |
| | | led[7]: |
| | | id: 8 |
| | | ip: 192.168.110.217 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | staArr: 2002 |
| | | # LED9 半成品库2F |
| | | led[8]: |
| | | id: 9 |
| | | ip: 192.168.110.218 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | staArr: 2007 |
| | | # LED10 半成品库2F |
| | | led[9]: |
| | | id: 10 |
| | | ip: 192.168.110.219 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | staArr: 2018 |
| | | # crn[0]: #堆垛机1 |
| | | # rack: 0 |
| | | # offset: 2 #偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | # port: 102 |
| | | # crnOutStn[0]: #堆垛机出库站点 |
| | | # staNo: 101 |
| | | # row: 2 |
| | | # bay: 1 |
| | | # lev: 1 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # ip: 192.168.1.100 |
| | | # crnInStn[0]: #堆垛机入库站点1 |
| | | # staNo: 100 |
| | | # row: 1 |
| | | # bay: 1 |
| | | # lev: 1 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # id: 1 |
| | | # slot: 0 |
| | | # demo: false |
| | | # crn[1]: #堆垛机2 |
| | | # rack: 0 |
| | | # offset: 2 #偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | # port: 102 |
| | | # crnOutStn[0]: #堆垛机出库站点 |
| | | # staNo: 103 |
| | | # row: 5 |
| | | # bay: 1 |
| | | # lev: 1 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # ip: 192.168.1.110 |
| | | # crnInStn[0]: #堆垛机入库站点1 |
| | | # staNo: 102 |
| | | # row: 4 |
| | | # bay: 1 |
| | | # lev: 1 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # id: 2 |
| | | # slot: 0 |
| | | # demo: false |
| | | # barcode[3]: #条码扫描仪4 |
| | | # port: 51236 |
| | | # ip: 10.10.10.52 |
| | | # id: 4 |
| | | # barcode[2]: #条码扫描仪3 |
| | | # port: 51236 |
| | | # ip: 10.10.10.52 |
| | | # id: 3 |
| | | # |
| | | # barcode[1]: #条码扫描仪2 |
| | | # port: 51236 |
| | | # ip: 10.10.10.52 |
| | | # id: 2 |
| | | # |
| | | # devp[0]: #输送线 |
| | | # emptyInSta[2]: #空板入库口3 |
| | | # staNo: 104 |
| | | # emptyInSta[1]: #空板入库口2 |
| | | # staNo: 102 |
| | | # rack: 0 |
| | | # emptyInSta[0]: #空板入库口1 |
| | | # staNo: 100 |
| | | # ip: 192.168.1.140 |
| | | # outSta[4]: #出库口5 |
| | | # staNo: 104 |
| | | # outSta[3]: #出库口4 |
| | | # staNo: 103 |
| | | # outSta[6]: #出库口7 |
| | | # staNo: 106 |
| | | # slot: 0 |
| | | # outSta[5]: #出库口6 |
| | | # staNo: 105 |
| | | # outSta[0]: #出库口1 |
| | | # staNo: 100 |
| | | # outSta[2]: #出库口3 |
| | | # staNo: 102 |
| | | # emptyInSta[3]: #空板入库口4 |
| | | # staNo: 106 |
| | | # outSta[1]: #出库口2 |
| | | # staNo: 101 |
| | | # inSta[2]: |
| | | # staNo: 104 |
| | | # barcode: ${wcs-slave.barcode[2].id} |
| | | # inSta[3]: |
| | | # staNo: 106 |
| | | # barcode: ${wcs-slave.barcode[3].id} |
| | | # port: 102 |
| | | # outSta[7]: #出库口8 |
| | | # staNo: 107 |
| | | # inSta[0]: #入库口1 |
| | | # staNo: 100 |
| | | # barcode: ${wcs-slave.barcode[0].id} |
| | | # inSta[1]: #入库口2 |
| | | # staNo: 102 |
| | | # barcode: ${wcs-slave.barcode[1].id} |
| | | # id: 1 |
| | | # |
| | | # |
| | | # crn[2]: #堆垛机3 |
| | | # rack: 0 |
| | | # offset: 2 #偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | # port: 102 |
| | | # crnOutStn[0]: #堆垛机出库站点 |
| | | # staNo: 105 |
| | | # row: 9 |
| | | # bay: 1 |
| | | # lev: 1 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # ip: 192.168.1.120 |
| | | # crnInStn[0]: #堆垛机入库站点1 |
| | | # staNo: 104 |
| | | # row: 8 |
| | | # bay: 1 |
| | | # lev: 1 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # id: 3 |
| | | # slot: 0 |
| | | # demo: false |
| | | # crn[3]: #堆垛机4 |
| | | # rack: 0 |
| | | # offset: 2 #偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | # port: 102 |
| | | # crnOutStn[0]: #堆垛机出库站点 |
| | | # staNo: 107 |
| | | # row: 12 |
| | | # bay: 1 |
| | | # lev: 1 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # ip: 192.168.1.130 |
| | | # crnInStn[0]: #堆垛机入库站点1 |
| | | # staNo: 106 |
| | | # row: 11 |
| | | # bay: 1 |
| | | # lev: 1 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # id: 4 |
| | | # slot: 0 |
| | | # demo: false |
| | | backSta: 100 |
| | | devpPlcId: 1 |
| | | |
| | | |
| | | |
| | | |