This commit is contained in:
USER-20220102CG\noblelift
2022-08-02 08:46:49 +08:00
9 changed files with 181 additions and 46 deletions

View File

@@ -742,12 +742,14 @@ public class AgvServiceImpl implements AgvService {
if ("Load".equals(action)) {
if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() > 0) {
inst.setExecute_status("1");
lnshStationDeviceDriver.setFlag(1);
is_feedback = true;
}
//请求放货
} else if ("Unload".equals(action)) {
if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
lnshStationDeviceDriver.setFlag(3);
is_feedback = true;
}
}
@@ -769,23 +771,6 @@ public class AgvServiceImpl implements AgvService {
}
}
}
//晟华码垛机械手
if (addressdevice.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
if ("Load".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
inst.setExecute_status("1");
is_feedback = true;
}
//请求放货
} else if ("Unload".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
inst.setExecute_status("3");
is_feedback = true;
}
}
}
if (addressdevice.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
@@ -862,6 +847,7 @@ public class AgvServiceImpl implements AgvService {
if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() == 0) {
inst.setExecute_device_code(processingVehicle);
inst.setExecute_status("2");
lnshStationDeviceDriver.setFlag(2);
is_feedback = true;
}
//放货完成
@@ -869,6 +855,7 @@ public class AgvServiceImpl implements AgvService {
if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() > 0) {
inst.setExecute_device_code(address);
inst.setExecute_status("4");
lnshStationDeviceDriver.setFlag(4);
is_feedback = true;
}
}
@@ -892,25 +879,6 @@ public class AgvServiceImpl implements AgvService {
}
}
}
//晟华码垛机械手
if (addressdevice.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) addressdevice.getDeviceDriver();
//取货完成
if ("Load".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
inst.setExecute_device_code(processingVehicle);
inst.setExecute_status("2");
is_feedback = true;
}
//放货完成
} else if ("Unload".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
inst.setExecute_device_code(address);
inst.setExecute_status("4");
is_feedback = true;
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//取货完成
@@ -1294,21 +1262,22 @@ public class AgvServiceImpl implements AgvService {
}
@Override
public String requestOpenOrCloseDoor(String device, String param) {
log.info("AGV请求开关门参数设备:{},参数:{}", device, param);
public String requestOpenOrCloseDoor(String device_code, String param) {
log.info("AGV请求开关门参数设备:{},参数:{}", device_code, param);
int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE));
switch (type) {
case 4:
acsToWmsService.applyOpenOrCloseDoor(device, param);
acsToWmsService.applyOpenOrCloseDoor(device_code, param);
break;
default:
StandardAutodoorDeviceDriver autodoor;
Device doordevice = deviceAppService.findDeviceByCode(device);
if (ObjectUtil.isEmpty(doordevice)) {
LnshStationDeviceDriver lnshStationDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new BadRequestException("未找到对应设备");
}
if (doordevice.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
autodoor = (StandardAutodoorDeviceDriver) doordevice.getDeviceDriver();
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
autodoor = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals("open", param)) {
autodoor.OpenOrClose("1");
log.info("下发开门请求");
@@ -1318,6 +1287,17 @@ public class AgvServiceImpl implements AgvService {
log.info("下发关门请求");
}
}
if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals("open", param)) {
lnshStationDeviceDriver.OpenOrClose("1");
log.info("下发进入区域");
} else if (StrUtil.equals("close", param)) {
lnshStationDeviceDriver.OpenOrClose("2");
log.info("下发离开区域");
}
}
break;
}

View File

@@ -664,6 +664,17 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
if (!requireSucess) {
applyEmpty();
}
case 9:
//工单完成
if (!requireSucess && order_No != 0) {
JSONObject json = new JSONObject();
json.put("producetask_code",order_No);
json.put("device_code",this.device_code);
json.put("material_code",material);
json.put("qty",qty);
json.put("type","3");
enterProduction(json);
}
break;
}
@@ -778,7 +789,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
if (result.getStatus() == 200) {
this.writing(this.mode);
ProduceshiftorderDto dto = produceshiftorderService.findByCode(String.valueOf(order_No));
dto.setOrder_status("0");
if (this.mode == 4) {
dto.setOrder_status("0");
} else if (this.mode == 9){
dto.setOrder_status("2");
}
produceshiftorderService.update(dto);
}
requireSucess = true;
@@ -870,6 +885,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
this.writing(this.mode);
this.writing("to_material_qty",qty);
this.writing("to_material_code",material_code);
this.writing("to_product_code",product_code);
this.writing("to_AlongSide",AlongSide);
this.writing("to_BshortSide",BshortSide);
this.writing("to_Htrapezoidal",Htrapezoidal);

View File

@@ -227,6 +227,17 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
}
break;
}
switch (flag) {
//取货完成
case 2:
writing(2);
return;
//放货完成
case 4:
writing(3);
return;
}
}
last_mode = mode;
@@ -392,12 +403,24 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
}
public synchronized void OpenOrClose(String type) {
//进入区域
if ("1".equals(type)) {
writing(5);
} else {
//离开区域
writing(6);
}
}
public String toString() {

View File

@@ -72,4 +72,13 @@ public class ProduceshiftorderController {
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
produceshiftorderService.download(produceshiftorderService.queryAll(whereJson), response);
}
@Log("完成工单")
@ApiOperation("完成工单")
@PostMapping(value = "/finish/{id}")
//@PreAuthorize("@el.check('produceshiftorder:list')")
public ResponseEntity<Object> finish(@RequestBody String id) throws IOException {
produceshiftorderService.finish(id);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -70,4 +70,11 @@ public interface ProduceshiftorderService {
* @throws IOException /
*/
void download(List<ProduceshiftorderDto> dtos, HttpServletResponse response) throws IOException;
/**
* 完成工单
*
* @param ids
*/
void finish(String ids);
}

View File

@@ -147,4 +147,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
}
FileUtil.downloadExcel(list, response);
}
@Override
public void finish(String ids) {
ProduceshiftorderDto dto = this.findById(ids);
dto.setOrder_status("3");
this.update(dto);
}
}