fix 压机叫料

This commit is contained in:
张江玮
2023-09-27 09:35:02 +08:00
parent f9e58f9c36
commit c3b3a24f60
6 changed files with 48 additions and 0 deletions

View File

@@ -192,6 +192,9 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
order = this.itemProtocol.getOrder();
if (mode != last_mode) {
if ("true".equals(this.getExtraValue().get("ignore_release_check"))) {
acsToWmsService.deactivatePoint(this.device_code, mode != 0);
}
if (mode == 3) {
this.setRequireSucess(false);
}

View File

@@ -69,4 +69,6 @@ public interface AcsToWmsService {
*/
JSONObject findVehicle(JSONObject param);
void deactivatePoint(String deviceCode, boolean isUsed);
}

View File

@@ -16,6 +16,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.system.service.ParamService;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -247,4 +248,26 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
}
@Override
public void deactivatePoint(String deviceCode, boolean isUsed) {
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject param = new JSONObject();
param.put("device_code", deviceCode);
param.put("is_used", isUsed);
log.info("deactivatePoint - 请求参数 {}", param);
AddressDto addressDto = addressService.findByCode("deactivatePoint");
String methods_url = addressDto.getMethods_url();
try {
HttpResponse response = HttpRequest
.post(wmsurl + methods_url)
.timeout(2000)
.body(param.toJSONString())
.execute();
log.info("deactivatePoint - 响应参数 {}", response.body());
} catch (Exception e) {
log.error("deactivatePoint - 请求错误!", e);
}
}
}

View File

@@ -107,4 +107,12 @@ public class AcsToWmsController {
public ResponseEntity<Object> updateKiln(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.updateKiln(whereJson), HttpStatus.OK);
}
@PostMapping("/deactivatePoint")
@Log("禁用或启用点位")
@ApiOperation("禁用或启用点位")
@SaIgnore
public void deactivatePoint(@RequestBody JSONObject param) {
acsToWmsService.deactivatePoint(param);
}
}

View File

@@ -95,4 +95,6 @@ public interface AcsToWmsService {
*/
JSONObject updateKiln(JSONObject whereJson);
void deactivatePoint(JSONObject param);
}

View File

@@ -631,4 +631,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return resp;
}
public void deactivatePoint(JSONObject param) {
String pointCode = param.getString("device_code");
if (StrUtil.isNotBlank(pointCode)) {
JSONObject update = new JSONObject();
update.put("is_used", param.getBooleanValue("is_used") ? "1" : "0");
update.put("update_time", DateUtil.now());
WQLObject.getWQLObject("sch_base_point").update(update, "point_code = '" + pointCode + "'");
}
}
}