| | |
| | | import com.fzzy.igds.camera.ApiCameraManager; |
| | | import com.fzzy.igds.camera.data.ApiCameraData; |
| | | import com.fzzy.igds.camera.data.ApiCameraResp; |
| | | import com.fzzy.igds.constant.OrderRespEnum; |
| | | import com.fzzy.igds.constant.RespCodeEnum; |
| | | import com.fzzy.igds.data.*; |
| | | import com.fzzy.igds.domain.*; |
| | | import com.fzzy.igds.io.manager.QuantityRemoteManager; |
| | | import com.fzzy.igds.io.service.RemoteQuantityService; |
| | | import com.fzzy.igds.request.QuantityRequest; |
| | | import com.fzzy.igds.response.BaseResponse; |
| | | import com.fzzy.igds.service.*; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.fzzy.igds.utils.DateUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private CommonManager commonManager; |
| | | @Resource |
| | | private QuantityRemoteManager remoteManager; |
| | | @Resource |
| | | private SecCameraService secCameraService; |
| | | @Resource |
| | |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功!!", fileList); |
| | | } |
| | | |
| | | /** |
| | | * 单仓检测 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public BaseResponse checkSingle(IgdsBaseParam param) { |
| | | if (null == param || StringUtils.isBlank(param.getDepotId())) { |
| | | return new BaseResponse(RespCodeEnum.CODE_1007.getCode(), RespCodeEnum.CODE_1007.getMsg()); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(param.getCompanyId())) { |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | } |
| | | |
| | | QuantityConf conf = quantityService.getCacheQuantityConf(param.getCompanyId(), param.getDepotId()); |
| | | if (conf == null) { |
| | | return new BaseResponse(RespCodeEnum.CODE_1007.getCode(), RespCodeEnum.CODE_1007.getMsg()); |
| | | } |
| | | |
| | | RemoteQuantityService remoteQuantityService = remoteManager.getRemoteQuantityService(conf.getProtocol()); |
| | | |
| | | if (null == remoteQuantityService) { |
| | | return new BaseResponse(OrderRespEnum.ORDER_ERROR.getCode(), |
| | | "系统没有" + conf.getProtocol() + "的协议实现,执行被拒绝!"); |
| | | } |
| | | |
| | | QuantityRequest request = new QuantityRequest(); |
| | | BeanUtils.copyProperties(conf, request); |
| | | request.setDepotId(conf.getDepotId()); |
| | | request.setYtIp(conf.getYtIp()); |
| | | request.setCompanyId(conf.getCompanyId()); |
| | | request.setDeptId(conf.getDeptId()); |
| | | request.setSn(conf.getSn()); |
| | | request.setLength(conf.getLength()); |
| | | |
| | | request.setBatchId(conf.getDepotId() + "_" + DateFormatUtils.format(new Date(), "yyyyMMddHHmm")); |
| | | |
| | | return remoteQuantityService.checkStart(request); |
| | | } |
| | | |
| | | /** |
| | | * 停止检测 |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public BaseResponse checkStop(IgdsBaseParam param) { |
| | | if (param == null || StringUtils.isEmpty(param.getDepotId())) { |
| | | return new BaseResponse(RespCodeEnum.CODE_1007.getCode(), RespCodeEnum.CODE_1007.getMsg()); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(param.getCompanyId())) { |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | } |
| | | |
| | | QuantityConf conf = quantityService.getCacheQuantityConf(param.getCompanyId(), param.getDepotId()); |
| | | if (conf == null) { |
| | | return new BaseResponse(RespCodeEnum.CODE_1007.getCode(), RespCodeEnum.CODE_1007.getMsg()); |
| | | } |
| | | |
| | | RemoteQuantityService remoteQuantityService = remoteManager.getRemoteQuantityService(conf.getProtocol()); |
| | | |
| | | if (null == remoteQuantityService) { |
| | | return new BaseResponse(OrderRespEnum.ORDER_ERROR.getCode(), |
| | | "系统没有" + conf.getProtocol() + "的协议实现,执行被拒绝!"); |
| | | } |
| | | |
| | | QuantityRequest request = new QuantityRequest(); |
| | | BeanUtils.copyProperties(conf, request); |
| | | request.setCompanyId(conf.getCompanyId()); |
| | | request.setYtIp(conf.getYtIp()); |
| | | request.setSn(conf.getSn()); |
| | | request.setDeptId(conf.getDeptId()); |
| | | request.setDepotId(conf.getDepotId()); |
| | | |
| | | return remoteQuantityService.checkStop(request); |
| | | } |
| | | } |