| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.entity.BasDualCrnp; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.entity.HttpRequestLog; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.BasDualCrnpService; |
| | | import com.zy.asrs.service.BasStationService; |
| | | import com.zy.asrs.service.HttpRequestLogService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.entity.FindCrnNoResult; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.News; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | |
| | | private BasCrnpService basCrnpService; |
| | | @Autowired |
| | | private BasDualCrnpService basDualCrnpService; |
| | | @Autowired |
| | | private BasStationService basStationService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | //申请入库任务 |
| | | public synchronized String applyInTask(String barcode, Integer sourceStaNo, Integer locType1) { |
| | | String wmsUrl = null; |
| | | Config wmsSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemUri")); |
| | | if (wmsSystemUriConfig != null) { |
| | | wmsUrl = wmsSystemUriConfig.getValue(); |
| | | Object systemConfigMapObj = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key); |
| | | if (systemConfigMapObj == null) { |
| | | News.error("系统Config缓存失效"); |
| | | return null; |
| | | } |
| | | HashMap<String, String> systemConfigMap = (HashMap<String, String>) systemConfigMapObj; |
| | | |
| | | String wmsUrl = systemConfigMap.get("wmsSystemUri"); |
| | | if (wmsUrl == null) { |
| | | News.error("未配置WMS系统URI,配置文件Code编码:wmsSystemUri"); |
| | | return null; |
| | | } |
| | | |
| | | String wmsSystemInUrl = null; |
| | | Config wmsSystemInUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemInUrl")); |
| | | if (wmsSystemInUrlConfig != null) { |
| | | wmsSystemInUrl = wmsSystemInUrlConfig.getValue(); |
| | | } |
| | | |
| | | if(wmsSystemInUrlConfig == null){ |
| | | String wmsSystemInUrl = systemConfigMap.get("wmsSystemInUrl"); |
| | | if(wmsSystemInUrl == null){ |
| | | News.error("未配置WMS入库接口地址,配置文件Code编码:wmsSystemInUrl"); |
| | | return null; |
| | | } |
| | |
| | | String response = null; |
| | | int result = 0; |
| | | try { |
| | | BasStation basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("station_id", sourceStaNo)); |
| | | if(basStation == null){ |
| | | News.error("站点{}不存在", sourceStaNo); |
| | | return null; |
| | | } |
| | | |
| | | String stationNo = String.valueOf(sourceStaNo); |
| | | if(!Cools.isEmpty(basStation.getStationAlias())){ |
| | | stationNo = basStation.getStationAlias(); |
| | | } |
| | | |
| | | requestParam.put("barcode", barcode); |
| | | requestParam.put("sourceStaNo", sourceStaNo); |
| | | requestParam.put("sourceStaNo", stationNo); |
| | | requestParam.put("locType1", locType1); |
| | | requestParam.put("row", Utils.getInTaskEnableRow(sourceStaNo)); |
| | | |
| | |
| | | .setUri(wmsUrl) |
| | | .setPath(wmsSystemInUrl) |
| | | .setJson(JSON.toJSONString(requestParam)) |
| | | .setTimeout(360, TimeUnit.SECONDS) |
| | | .setTimeout(30, TimeUnit.SECONDS) |
| | | .build() |
| | | .doPost(); |
| | | if (response != null) { |
| | |
| | | .setUri(wmsUrl) |
| | | .setPath(wmsSystemReassignInTaskUrl) |
| | | .setJson(JSON.toJSONString(requestParam)) |
| | | .setTimeout(360, TimeUnit.SECONDS) |
| | | .setTimeout(30, TimeUnit.SECONDS) |
| | | .build() |
| | | .doPost(); |
| | | if (response != null) { |
| | |
| | | .setUri(wmsUrl) |
| | | .setPath(wmsSystemChangeLocNoUrl) |
| | | .setJson(JSON.toJSONString(requestParam)) |
| | | .setTimeout(360, TimeUnit.SECONDS) |
| | | .setTimeout(30, TimeUnit.SECONDS) |
| | | .build() |
| | | .doPost(); |
| | | |