工单完成按钮添加

This commit is contained in:
loujf
2022-08-01 21:48:28 +08:00
parent 49cd752a30
commit c6ada8d8c8
12 changed files with 186 additions and 84 deletions

View File

@@ -714,7 +714,6 @@ public class AgvServiceImpl implements AgvService {
SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver;
LnshStationDeviceDriver lnshStationDeviceDriver;
LnshPackageSiteDeviceDriver lnshPackageSiteDeviceDriver;
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
//请求进入
if ("onEntry".equals(type)) {
@@ -742,12 +741,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 +770,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 +846,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 +854,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 +878,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 +1261,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 +1286,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

@@ -665,6 +665,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;
}
@@ -781,7 +792,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
if (result.getStatus() == 200 && jsonObject.get("status").equals("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);
}
}
@@ -875,6 +890,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

@@ -26,10 +26,11 @@ public class ItemProtocol {
public static String item_standby_time = "standby_time ";
public static String item_production_time = "production_time";
public static String item_error_time = "error_time";
public static String item_to_command = "to_command";
public static String item_to_command1 = "to_command1";
public static String item_to_onset1 = "to_onset1";
public static String item_to_target1 = "to_target1";
public static String item_to_task = "to_task";
public static String item_to_task1 = "to_task1";
public static String item_to_command2 = "to_command2";
public static String item_to_task2 = "to_task2";
public static String item_to_onset2 = "to_onset2";
public static String item_to_target2 = "to_target2";
@@ -100,8 +101,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_task2);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
public int getTo_command1() {
return this.getOpcIntegerValue(item_to_command1);
}
public int getTo_onset1() {
@@ -120,8 +121,12 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_target2);
}
public int getTo_task() {
return this.getOpcIntegerValue(item_to_task);
public int getTo_command2() {
return this.getOpcIntegerValue(item_to_command2);
}
public int getTo_task1() {
return this.getOpcIntegerValue(item_to_task1);
}
public int getTo_task2() {
@@ -170,13 +175,14 @@ public class ItemProtocol {
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0"));
list.add(new ItemDto(item_to_command1, "前工位下发命令", "DB2.W0"));
list.add(new ItemDto(item_to_onset1, "下发起始站", "DB2.W2"));
list.add(new ItemDto(item_to_target1, "下发目标站", "DB2.W4"));
list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D8"));
list.add(new ItemDto(item_to_task1, "下发任务号", "DB2.D6"));
list.add(new ItemDto(item_to_command2, "后工位下发命令", "DB2.W10"));
list.add(new ItemDto(item_to_onset2, "下发起始站", "DB2.W12"));
list.add(new ItemDto(item_to_target2, "下发目标站", "DB2.W14"));
list.add(new ItemDto(item_to_task2, "下发任务号2", "DB2.D20"));
list.add(new ItemDto(item_to_task2, "下发任务号2", "DB2.D16"));
return list;
}

View File

@@ -219,11 +219,11 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
switch (flag) {
//取货完成
case 1:
writing(2);
writing1(2);
return;
//放货完成
case 2:
writing(3);
writing1(3);
return;
}
@@ -276,11 +276,26 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
ReadUtil.write(itemMap, server);
}
public void writing(int command) {
public void writing1(int command) {
String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command1;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command1, command);
ReadUtil.write(itemMap, server);
}
public void writing2(int command) {
String to_command2 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command2;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command2, command);
ReadUtil.write(itemMap, server);
}

View File

@@ -242,6 +242,17 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
}
break;
}
switch (flag) {
//取货完成
case 2:
writing(2);
return;
//放货完成
case 4:
writing(3);
return;
}
}
last_mode = mode;
@@ -273,14 +284,12 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("type","4");
json.put("weight",weight);
json.put("vehicle_code",barcode);
json.put("is_full","0");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
this.writing(this.mode);
this.writing(1);
}
}
this.setRequireSucess(true);
@@ -303,14 +312,14 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("type","2");
json.put("weight",weight);
json.put("pcsn",batch);
json.put("vehicle_code",barcode);
json.put("is_full","0");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
this.writing(this.mode);
this.writing(1);
}
}
this.setRequireSucess(true);
@@ -340,7 +349,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
this.writing(this.mode);
this.writing(1);
}
}
this.setRequireSucess(true);
@@ -415,12 +424,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

@@ -698,6 +698,17 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
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;
}
@@ -819,7 +830,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
if (result.getStatus() == 200 && jsonObject.get("status").equals("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);
}
}
@@ -911,6 +926,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
String tool_coordinate = content.getString("tool_coordinate");
this.writing(this.mode);
this.writing("to_product_code",product_code);
this.writing("to_material_qty",qty);
this.writing("to_material_code",material_code);
this.writing("to_AlongSide",AlongSide);

View File

@@ -422,25 +422,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (ObjectUtil.isEmpty(device)) {
throw new Exception("未找到对应设备:" + device_code);
}
BallMillDeviceDriver ballMillDeviceDriver;
SparyTowerDeviceDriver sparyTowerDeviceDriver;
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
if (device.getDeviceDriver() instanceof BallMillDeviceDriver) {
ballMillDeviceDriver = (BallMillDeviceDriver) device.getDeviceDriver();
ItemProtocol itemProtocol = new ItemProtocol();
if (!ballMillDeviceDriver.isExistFieldName(code, itemProtocol)) {
throw new Exception("设备:" + device_code + "未找到对应信号:" + code);
}
ballMillDeviceDriver.writing(code, value);
}
if (device.getDeviceDriver() instanceof SparyTowerDeviceDriver) {
sparyTowerDeviceDriver = (SparyTowerDeviceDriver) device.getDeviceDriver();
ItemProtocol itemProtocol = new ItemProtocol();
if (!sparyTowerDeviceDriver.isExistFieldName(code, itemProtocol)) {
throw new Exception("设备:" + device_code + "未找到对应信号:" + code);
}
sparyTowerDeviceDriver.writing(code, value);
}
//晟华覆膜机
if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver();

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);
}
}