|
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.dao.collect.IoCollectLedGroupMapper;
|
|
|
|
|
import com.glxp.api.entity.basic.SysWorkplaceQueue;
|
|
|
|
|
import com.glxp.api.entity.collect.IoCollectLedGroup;
|
|
|
|
|
import com.glxp.api.entity.collect.IoCollectOrderBiz;
|
|
|
|
|
import com.glxp.api.entity.thrsys.CodeRel;
|
|
|
|
@ -16,6 +17,8 @@ import com.glxp.api.exception.JsonException;
|
|
|
|
|
import com.glxp.api.req.collect.CollectLedGroupRequest;
|
|
|
|
|
import com.glxp.api.req.collect.LedGroupRequest;
|
|
|
|
|
import com.glxp.api.res.collect.IoCollectLedGroupResponse;
|
|
|
|
|
import com.glxp.api.service.basic.SysWorkplaceQueueService;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import com.glxp.api.util.OkHttpCli;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -51,27 +54,46 @@ public class IoCollectLedGroupService extends ServiceImpl<IoCollectLedGroupMappe
|
|
|
|
|
return ioCollectLedGroupMapper.filterList(collectLedGroupRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
SysWorkplaceQueueService sysWorkplaceQueueService;
|
|
|
|
|
|
|
|
|
|
public BaseResponse<String> openLed(List<IoCollectOrderBiz> collectOrderBizs) {
|
|
|
|
|
LedGroupRequest ledGroupRequest = new LedGroupRequest();
|
|
|
|
|
for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs){
|
|
|
|
|
IoCollectLedGroup one = getOne(new LambdaQueryWrapper<IoCollectLedGroup>().eq(IoCollectLedGroup::getRelId, collectOrderBiz.getRelId()));
|
|
|
|
|
if (one == null){
|
|
|
|
|
throw new JsonException(500,"当前产品未绑定灯组");
|
|
|
|
|
for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) {
|
|
|
|
|
|
|
|
|
|
SysWorkplaceQueue sysWorkplaceQueue = sysWorkplaceQueueService.getOne(new LambdaQueryWrapper<SysWorkplaceQueue>().eq(SysWorkplaceQueue::getRelId, collectOrderBiz.getRelId()).last("limit 1"));
|
|
|
|
|
if (sysWorkplaceQueue == null) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
IoCollectLedGroup
|
|
|
|
|
one = getOne(new LambdaQueryWrapper<IoCollectLedGroup>().eq(IoCollectLedGroup::getMac, sysWorkplaceQueue.getMac()));
|
|
|
|
|
if (one == null) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
CollectLedGroupRequest collectLedGroupRequest = new CollectLedGroupRequest();
|
|
|
|
|
collectLedGroupRequest.setMac(one.getMac());
|
|
|
|
|
collectLedGroupRequest.setTimeout(one.getTimeout());
|
|
|
|
|
if (one.getLedMode()){
|
|
|
|
|
collectLedGroupRequest.setLedmode(1);
|
|
|
|
|
}else {
|
|
|
|
|
collectLedGroupRequest.setLedmode(0);
|
|
|
|
|
}
|
|
|
|
|
collectLedGroupRequest.setLedmode(1);
|
|
|
|
|
collectLedGroupRequest.setLednum(setLedNum(one));
|
|
|
|
|
if (collectLedGroupRequest.getLednum() == 1) {
|
|
|
|
|
one.setRed(collectOrderBiz.getId());
|
|
|
|
|
} else if (collectLedGroupRequest.getLednum() == 2) {
|
|
|
|
|
one.setOrange(collectOrderBiz.getId());
|
|
|
|
|
} else if (collectLedGroupRequest.getLednum() == 3) {
|
|
|
|
|
one.setBlue(collectOrderBiz.getId());
|
|
|
|
|
} else if (collectLedGroupRequest.getLednum() == 4) {
|
|
|
|
|
one.setGreen(collectOrderBiz.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ledGroupRequest.getData().add(collectLedGroupRequest);
|
|
|
|
|
updateById(one);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// http://192.168.0.166:9099/wms/associate/lighttagsled
|
|
|
|
|
String json = JSONUtil.toJsonStr(ledGroupRequest);
|
|
|
|
|
String result = okHttpCli.doPostJson( "http://192.168.0.166:9099/wms/associate/lighttagsled", json);
|
|
|
|
|
log.error("json:{}" + json);
|
|
|
|
|
String result = okHttpCli.doPostJson("http://192.168.0.166:9099/wms/associate/lighttagsled", json);
|
|
|
|
|
BaseResponse<String> response =
|
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
|
});
|
|
|
|
@ -79,15 +101,19 @@ public class IoCollectLedGroupService extends ServiceImpl<IoCollectLedGroupMappe
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Integer setLedNum(IoCollectLedGroup ioCollectLedGroup) {
|
|
|
|
|
if (!ioCollectLedGroup.getRed()) {
|
|
|
|
|
if (IntUtil.value(ioCollectLedGroup.getRed()) == 0) {
|
|
|
|
|
return LedColorStatusEnum.RED_FALSE.getReturnValue();
|
|
|
|
|
}
|
|
|
|
|
if (!ioCollectLedGroup.getOrange()) {
|
|
|
|
|
if (IntUtil.value(ioCollectLedGroup.getOrange()) == 0) {
|
|
|
|
|
return LedColorStatusEnum.ORANGE_FALSE.getReturnValue();
|
|
|
|
|
}
|
|
|
|
|
if (!ioCollectLedGroup.getBlue()) {
|
|
|
|
|
if (IntUtil.value(ioCollectLedGroup.getBlue()) == 0) {
|
|
|
|
|
return LedColorStatusEnum.BLUE_FALSE.getReturnValue();
|
|
|
|
|
}
|
|
|
|
|
return LedColorStatusEnum.DEFAULT.getReturnValue();
|
|
|
|
|
if (IntUtil.value(ioCollectLedGroup.getBlue()) == 0) {
|
|
|
|
|
return LedColorStatusEnum.DEFAULT.getReturnValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new JsonException("灯组已满");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|