52个文件已修改
35个文件已添加
13个文件已删除
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB1.8000", |
| | | "plcAddressLenght":"84", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "edgSpeed", |
| | | "addressIndex": "48", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "thinness", |
| | | "addressIndex": "50", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | } |
| | | |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"0000", |
| | | "plcAddressLength":"50", |
| | | "requestHead":"000100000006010300000032", |
| | | "parameterInfo":[ |
| | | { |
| | | "codeId": "plcRequest", |
| | | "addressIndex": "0", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcRequestID", |
| | | "addressIndex": "2", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReport", |
| | | "addressIndex": "10", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReportID", |
| | | "addressIndex": "12", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReport2", |
| | | "addressIndex": "16", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReportID2", |
| | | "addressIndex": "18", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSend", |
| | | "addressIndex": "20", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSendID", |
| | | "addressIndex": "22", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "length", |
| | | "addressIndex": "24", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "width", |
| | | "addressIndex": "26", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "thickness", |
| | | "addressIndex": "28", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirm", |
| | | "addressIndex": "38", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirmID", |
| | | "addressIndex": "40", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirm2", |
| | | "addressIndex": "46", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirmID2", |
| | | "addressIndex": "48", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmStatus", |
| | | "addressIndex": "58", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord1", |
| | | "addressIndex": "60", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord2", |
| | | "addressIndex": "62", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord3", |
| | | "addressIndex": "64", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "machineStatusWord", |
| | | "addressIndex": "68", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut2", |
| | | "addressIndex": "70", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut3", |
| | | "addressIndex": "72", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut4", |
| | | "addressIndex": "74", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut5", |
| | | "addressIndex": "76", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut6", |
| | | "addressIndex": "78", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut7", |
| | | "addressIndex": "80", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | } |
| | | ] |
| | | |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB100.0", |
| | | "plcAddressLenght":"568", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "plcRequest", |
| | | "addressIndex": "0", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcRequestID", |
| | | "addressIndex": "2", |
| | | "addressLenght": "256", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcRequestType", |
| | | "addressIndex": "258", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby20", |
| | | "addressIndex": "260", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby21", |
| | | "addressIndex": "262", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReport", |
| | | "addressIndex": "264", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReportID", |
| | | "addressIndex": "266", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby25", |
| | | "addressIndex": "268", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby26", |
| | | "addressIndex": "270", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby27", |
| | | "addressIndex": "272", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSend", |
| | | "addressIndex": "274", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSendID", |
| | | "addressIndex": "276", |
| | | "addressLenght": "256", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "length", |
| | | "addressIndex": "532", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "width", |
| | | "addressIndex": "534", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "thickness", |
| | | "addressIndex": "536", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby28", |
| | | "addressIndex": "538", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSendType", |
| | | "addressIndex": "540", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby30", |
| | | "addressIndex": "542", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby31", |
| | | "addressIndex": "544", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby32", |
| | | "addressIndex": "546", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | } |
| | | |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"0000", |
| | | "plcAddressLength":"50", |
| | | "requestHead":"000100000006010300000032", |
| | | "parameterInfo":[ |
| | | { |
| | | "codeId": "plcRequest", |
| | | "addressIndex": "2", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcRequestID", |
| | | "addressIndex": "4", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReport", |
| | | "addressIndex": "10", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReportID", |
| | | "addressIndex": "12", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSend", |
| | | "addressIndex": "20", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSendCount", |
| | | "addressIndex": "22", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirm", |
| | | "addressIndex": "40", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmStatus", |
| | | "addressIndex": "62", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord1", |
| | | "addressIndex": "64", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord2", |
| | | "addressIndex": "66", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord3", |
| | | "addressIndex": "68", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "machineStatusWord", |
| | | "addressIndex": "70", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut2", |
| | | "addressIndex": "72", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut3", |
| | | "addressIndex": "74", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut4", |
| | | "addressIndex": "76", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut5", |
| | | "addressIndex": "78", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut6", |
| | | "addressIndex": "80", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut7", |
| | | "addressIndex": "82", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | } |
| | | ] |
| | | |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB14.0", |
| | | "plcAddressLenght":"1096", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "plcRequest", |
| | | "addressIndex": "0", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcRequestID", |
| | | "addressIndex": "2", |
| | | "addressLenght": "4", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby19", |
| | | "addressIndex": "6", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby20", |
| | | "addressIndex": "8", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby21", |
| | | "addressIndex": "10", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReport", |
| | | "addressIndex": "12", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReportID", |
| | | "addressIndex": "14", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby25", |
| | | "addressIndex": "18", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby26", |
| | | "addressIndex": "20", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSend", |
| | | "addressIndex": "22", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSend", |
| | | "addressIndex": "24", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | |
| | | { |
| | | "codeId": "mesSendID", |
| | | "addressIndex": "26", |
| | | "addressLenght": "4", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "drawingMark", |
| | | "addressIndex": "30", |
| | | "addressLenght": "256", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "drawingMark2", |
| | | "addressIndex": "258", |
| | | "addressLenght": "256", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "drawingMark3", |
| | | "addressIndex": "542", |
| | | "addressLenght": "256", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "drawingMark4", |
| | | "addressIndex": "798", |
| | | "addressLenght": "236", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | |
| | | { |
| | | "codeId": "isMark", |
| | | "addressIndex": "1034", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "width(OutOfService)", |
| | | "addressIndex": "1036", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "length(OutOfService)", |
| | | "addressIndex": "1038", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "thickness(OutOfService)", |
| | | "addressIndex": "1040", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "sumCount(OutOfService)", |
| | | "addressIndex": "1042", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby34", |
| | | "addressIndex": "1044", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "markingMode", |
| | | "addressIndex": "1046", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby36", |
| | | "addressIndex": "1048", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirm", |
| | | "addressIndex": "1050", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirmID", |
| | | "addressIndex": "1052", |
| | | "addressLenght": "4", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby39", |
| | | "addressIndex": "1056", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby40", |
| | | "addressIndex": "1058", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby41", |
| | | "addressIndex": "1060", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby42", |
| | | "addressIndex": "1062", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby43", |
| | | "addressIndex": "1064", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby44", |
| | | "addressIndex": "1066", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "MesTaskStatus", |
| | | "addressIndex": "1068", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby46", |
| | | "addressIndex": "1070", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmStatus", |
| | | "addressIndex": "1072", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord1", |
| | | "addressIndex": "1074", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord2", |
| | | "addressIndex": "1076", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord3", |
| | | "addressIndex": "1078", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord4", |
| | | "addressIndex": "1080", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "machineStatusWord", |
| | | "addressIndex": "1082", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut2", |
| | | "addressIndex": "1084", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut3", |
| | | "addressIndex": "1086", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut4", |
| | | "addressIndex": "1088", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut5", |
| | | "addressIndex": "1090", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | } |
| | | |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB100.0", |
| | | "plcAddressLenght":"554", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "plcRequest", |
| | | "addressIndex": "0", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcRequestID", |
| | | "addressIndex": "2", |
| | | "addressLenght": "256", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcRequestType", |
| | | "addressIndex": "258", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby20", |
| | | "addressIndex": "260", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby21", |
| | | "addressIndex": "262", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReport", |
| | | "addressIndex": "264", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReportID", |
| | | "addressIndex": "266", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby25", |
| | | "addressIndex": "268", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby26", |
| | | "addressIndex": "270", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby27", |
| | | "addressIndex": "272", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSend", |
| | | "addressIndex": "274", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSendID", |
| | | "addressIndex": "276", |
| | | "addressLenght": "256", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "length", |
| | | "addressIndex": "532", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "width", |
| | | "addressIndex": "534", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "thickness", |
| | | "addressIndex": "536", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "rotateType", |
| | | "addressIndex": "538", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSendType", |
| | | "addressIndex": "540", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby30", |
| | | "addressIndex": "542", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby31", |
| | | "addressIndex": "544", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby32", |
| | | "addressIndex": "546", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirm", |
| | | "addressIndex": "548", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirmID", |
| | | "addressIndex": "550", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "standby35", |
| | | "addressIndex": "552", |
| | | "addressLenght": "2", |
| | | "ratio": "1", |
| | | "unit": "" |
| | | } |
| | | |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"0000", |
| | | "plcAddressLength":"40", |
| | | "requestHead":"000100000006010300000028", |
| | | "parameterInfo":[ |
| | | { |
| | | "codeId": "plcRequest", |
| | | "addressIndex": "0", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcRequestID", |
| | | "addressIndex": "2", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReport", |
| | | "addressIndex": "10", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "plcReportID", |
| | | "addressIndex": "12", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSend", |
| | | "addressIndex": "20", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesSendID", |
| | | "addressIndex": "22", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "length", |
| | | "addressIndex": "24", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "width", |
| | | "addressIndex": "26", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "thickness", |
| | | "addressIndex": "28", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "X", |
| | | "addressIndex": "30", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "Y", |
| | | "addressIndex": "32", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "isSilkScreen", |
| | | "addressIndex": "34", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirm", |
| | | "addressIndex": "40", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "mesConfirmID", |
| | | "addressIndex": "42", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmStatus", |
| | | "addressIndex": "60", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord1", |
| | | "addressIndex": "62", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord2", |
| | | "addressIndex": "64", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "alarmWord3", |
| | | "addressIndex": "66", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "machineStatusWord", |
| | | "addressIndex": "68", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut2", |
| | | "addressIndex": "70", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut3", |
| | | "addressIndex": "72", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut4", |
| | | "addressIndex": "74", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut5", |
| | | "addressIndex": "76", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut6", |
| | | "addressIndex": "78", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "inputOrOut7", |
| | | "addressIndex": "80", |
| | | "addressLength": "2", |
| | | "type": "word", |
| | | "unit": "" |
| | | } |
| | | ] |
| | | |
| | | } |
| | |
| | | <artifactId>mssql-jdbc</artifactId> |
| | | <version>6.4.0.jre8</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.s7connector</groupId> |
| | | <artifactId>s7connector</artifactId> |
| | | <version>2.1</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | package com.mes.device; |
| | | |
| | | import com.github.s7connector.impl.serializer.converter.StringConverter; |
| | | import com.github.xingshuangs.iot.utils.IntegerUtil; |
| | | import com.github.xingshuangs.iot.utils.ShortUtil; |
| | | import com.mes.service.PlcAgreement; |
| | | import com.mes.service.PlcParameter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class PlcParameterObject { |
| | | |
| | | // è¯¥æ¨¡åæ°æ®ç±»åï¼æ°æ®èµ·å§ä½ç½® |
| | | private String plcAddressBegin; |
| | | // æ°æ®å°åé¿åº¦ï¼ç¬¬ä¸åæ°å°æåä¸ä¸ªåæ°çé¿åº¦ |
| | | private int plcAddressLength; |
| | | //private ArrayList<PlcParameterInfo> plcParameterList; |
| | | private LinkedHashMap<String,PlcParameterInfo> plcParameterMap; |
| | | |
| | | |
| | |
| | | */ |
| | | public PlcParameterInfo getPlcParameter(String codeid) { |
| | | if (plcParameterMap != null) { |
| | | return plcParameterMap.get(codeid); |
| | | return plcParameterMap.get(codeid); |
| | | } else { |
| | | return null; |
| | | } |
| | |
| | | plcParameterInfo.setValue(String.valueOf(ShortUtil.toUInt16(valueList))); |
| | | } else if (plcParameterInfo.getAddressLength() == 4) { |
| | | plcParameterInfo.setValue(String.valueOf(IntegerUtil.toUInt32(valueList))); |
| | | } |
| | | else if (plcParameterInfo.getAddressLength() >10) { |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } else { |
| | | }else if(plcParameterInfo.getAddressLength()==256){ |
| | | StringConverter converter = new StringConverter(); |
| | | String s=""; |
| | | String extract1 = converter.extract(s.getClass(),valueList, 0, 0); |
| | | plcParameterInfo.setValue(extract1); |
| | | }else { |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } |
| | | } |
| | | } |
| | | /* if (plcParameterList != null) { |
| | | |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | |
| | | byte[] valueList = new byte[plcParameterInfo.getAddressLength()]; |
| | | |
| | | // System.out.println(plcParameterInfo.getAddressLength()); |
| | | |
| | | for (int i = 0; i < plcParameterInfo.getAddressLength(); i++) { |
| | | Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]); |
| | | |
| | | } |
| | | |
| | | if (plcParameterInfo.getAddressLength() == 2) { |
| | | plcParameterInfo.setValue(String.valueOf(byte2short(valueList))); |
| | | } else if (plcParameterInfo.getAddressLength() == 4) { |
| | | plcParameterInfo.setValue(String.valueOf(byte2int(valueList))); |
| | | } |
| | | else if (plcParameterInfo.getAddressLength() >10) { |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } else { |
| | | String valuestr = new String(valueList); |
| | | plcParameterInfo.setValue(valuestr); |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | /** |
| | | * æåå
¥å¼è½¬å为byte[] |
| | |
| | | |
| | | import com.mes.tools.HexConversion; |
| | | import com.mes.utils.HexUtil; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | import static com.mes.tools.HexConversion.*; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class ModbusTcp { |
| | |
| | | private int Port; |
| | | |
| | | public Socket socket =null;//é讯 |
| | | ModbusTcp(){} |
| | | public ModbusTcp(String Ip,int Port){ |
| | | public String fileName =""; |
| | | public ModbusTcp(){} |
| | | public ModbusTcp(String Ip,int Port,String fileName){ |
| | | this.Ip=Ip; |
| | | this.Port=Port; |
| | | this.fileName=fileName; |
| | | try { |
| | | socket=new Socket(Ip,Port); |
| | | }catch (UnknownHostException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | plcAgreement.put(this.fileName,new PlcAgreement(this.fileName)); |
| | | } catch (Exception e) { |
| | | log.info("file errorï¼"+this.fileName+",{}",e.getMessage()); |
| | | } |
| | | } |
| | | //è¿æ¥ |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void a()throws Exception{ |
| | | //read(); |
| | | log.info("123"); |
| | | public void connect(){ |
| | | try { |
| | | this.socket=new Socket(Ip,Port); |
| | | this.socket.setSoTimeout(2000); |
| | | }catch (Exception e) { |
| | | log.info("The IP address of the host cannot be determined:{}",e.getMessage()); |
| | | } |
| | | } |
| | | //å
³éè¿æ¥ |
| | | public void close(){ |
| | | try { |
| | | this.socket.close(); |
| | | }catch (Exception e) { |
| | | //log.info("è¿æ¥å
³éå¼å¸¸:{}",e.getMessage()); |
| | | } |
| | | } |
| | | //è¿åè¿æ¥ç¶æ |
| | | public boolean isConnect(){ |
| | | try { |
| | | this.socket.isConnected(); |
| | | }catch (Exception e) { |
| | | log.info("Connection status exception:{}",this.socket); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | //è¯»åæ°æ® |
| | | public void read(PlcAgreement plcAgreement)throws Exception{ |
| | | int bufSizes = 0; |
| | | byte[] msgs = new byte[2048]; |
| | | //åå
¥è¯»åå°å |
| | | DataOutputStream outToServer = new DataOutputStream(socket.getOutputStream()); |
| | | outToServer.write(HexConversion.stringToInt(plcAgreement.requestHead)); |
| | | outToServer.flush(); |
| | | //读åå
容 |
| | | DataInputStream in = new DataInputStream(socket.getInputStream()); |
| | | bufSizes = in.read(msgs); |
| | | String message = HexConversion.byteToHexString(bufSizes, msgs);//åè¿å¶åèæ°ç»è½¬åå
è¿å¶å符串 |
| | | //è·ååæ°å¼ |
| | | Map<String, PlcParameter> plcParameters=plcAgreement.getPlcParameters(); |
| | | for (String key:plcParameters.keySet()){ |
| | | PlcParameter plcParameter=plcParameters.get(key); |
| | | if("bit".equals(plcParameter.getType())){ |
| | | byte font=msgs[plcParameter.getAddressStart()]; |
| | | String[] fontBitString=String.format("%8s", Integer.toBinaryString((int)font)).replace(" ", "0").split(""); |
| | | byte[] bit=new byte[1]; |
| | | bit[0]=Byte.parseByte(fontBitString[plcParameter.getAddressLength()]); |
| | | plcParameter.setReadByte(bit); |
| | | }else{ |
| | | plcParameter.setReadByte(Arrays.copyOfRange(msgs,plcParameter.getAddressStart(),(plcParameter.getAddressStart()+plcParameter.getAddressLength()))); |
| | | public boolean read(PlcAgreement plcAgreement){ |
| | | try { |
| | | if (!this.socket.isConnected()){ |
| | | // log.info("éè®¯è¿æ¥å¤±è´¥:{}",this.socket.isConnected()); |
| | | return false; |
| | | } |
| | | int bufSizes = 0; |
| | | byte[] msgs = new byte[2048]; |
| | | byte[] content = new byte[2048]; |
| | | //åå
¥è¯»åå°å |
| | | DataOutputStream outToServer = new DataOutputStream(this.socket.getOutputStream()); |
| | | outToServer.write(HexConversion.stringToInt(plcAgreement.requestHead)); |
| | | outToServer.flush(); |
| | | //读åå
容 |
| | | DataInputStream in = new DataInputStream(this.socket.getInputStream()); |
| | | bufSizes = in.read(msgs); |
| | | if(bufSizes<plcAgreement.plcAddressLength+9){ |
| | | log.info("Read byte length <1:{},contentï¼{}",bufSizes,msgs); |
| | | return false; |
| | | } |
| | | content=Arrays.copyOfRange(msgs,9,2048); |
| | | //è·ååæ°å¼ |
| | | Map<String, PlcParameter> plcParameters=plcAgreement.getPlcParameters(); |
| | | for (String key:plcParameters.keySet()){ |
| | | PlcParameter plcParameter=plcParameters.get(key); |
| | | if("bit".equals(plcParameter.getType())){ |
| | | byte font=content[plcParameter.getAddressStart()]; |
| | | String[] fontBitString=String.format("%8s", Integer.toBinaryString((int)font)).replace(" ", "0").split(""); |
| | | byte[] bit=new byte[1]; |
| | | bit[0]=Byte.parseByte(fontBitString[plcParameter.getAddressLength()]); |
| | | plcParameter.setReadByte(bit); |
| | | }else{ |
| | | plcParameter.setReadByte(Arrays.copyOfRange(content,plcParameter.getAddressStart(),(plcParameter.getAddressStart()+plcParameter.getAddressLength()))); |
| | | } |
| | | } |
| | | return true; |
| | | }catch (Exception e) { |
| | | //log.info("读åå¼å¸¸:{}",plcAgreement); |
| | | } |
| | | return false; |
| | | } |
| | | //åå
¥æ°æ® |
| | | public void write(PlcParameter plcParameter){ |
| | | try { |
| | | if (plcParameter.getWriteValue() != null && !"".equals(plcParameter.getWriteValue())) { |
| | | //åå
¥åéæ°æ® |
| | | DataOutputStream out = new DataOutputStream(socket.getOutputStream()); |
| | | out.write(HexConversion.stringToInt(plcParameter.getWriteValue().toString())); |
| | | //åå
¥åéæ°æ® 0000 0000 0009 0110 0024 0001 02 0006 |
| | | byte []sendByte=new byte[13+plcParameter.getAddressLength()]; |
| | | byte []sendLength=intToBytesDesc(7+plcParameter.getAddressLength(),2); |
| | | byte []sendAddress=intToBytesDesc(plcParameter.getAddressStart()/2,2); |
| | | byte []sendFontLength=intToBytesDesc(plcParameter.getAddressLength()/2,2); |
| | | byte []sendContent=plcParameter.getWriteByte(); |
| | | //byte []sendContent=intToBytesDesc(Integer.parseInt(plcParameter.getWriteValue().toString()),plcParameter.getAddressLength()); |
| | | sendByte[4]=sendLength[0]; |
| | | sendByte[5]=sendLength[1]; |
| | | sendByte[6]=(byte)1; |
| | | sendByte[7]=(byte)16; |
| | | sendByte[8]=sendAddress[0]; |
| | | sendByte[9]=sendAddress[1]; |
| | | sendByte[10]=sendFontLength[0]; |
| | | sendByte[11]=sendFontLength[1]; |
| | | sendByte[12]=(byte)plcParameter.getAddressLength(); |
| | | for(int i=0;i<sendContent.length;i++){ |
| | | sendByte[i+13]=sendContent[i]; |
| | | } |
| | | log.info("sendByte:{}",sendByte); |
| | | DataOutputStream out = new DataOutputStream(this.socket.getOutputStream()); |
| | | out.write(sendByte); |
| | | out.flush(); |
| | | //log.info("sendByte:{}",sendByte); |
| | | |
| | | } |
| | | } catch (IOException e) { |
| | | log.info("åå
¥æ°æ®å¼å¸¸"); |
| | | log.info("åå
¥æ°æ®å¼å¸¸:{}",plcParameter); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | //æ°æ®å¤ç |
| | | public void handleData(PlcParameter plcParameter){ |
| | | //åå
¥åéæ°æ® 0000 0000 0009 0110 0024 0001 02 0006 |
| | | try { |
| | | int sendLength=plcParameter.getAddressLength()+7;//åéé¿åº¦ |
| | | byte [] addressLength=intToBytesDesc(plcParameter.getAddressLength(),1);//åèé¿åº¦ |
| | | byte [] addressLengthFont=intToBytesDesc((plcParameter.getAddressLength()/2),2);//åé¿åº¦ |
| | | byte start[]=intToBytesDesc(plcParameter.getAddressStart()/2,2);//èµ·å§å°å |
| | | byte content[]=intToBytesDesc(Integer.valueOf(plcParameter.getWriteValue().toString()) ,2);//èµ·å§å°å |
| | | if (sendLength>14&& |
| | | addressLength.length>0&& |
| | | addressLengthFont.length>1&& |
| | | start.length>1&& |
| | | content.length>1){ |
| | | byte head[]=new byte[]{0,0,0,(byte)sendLength,1,16,start[0],start[1],addressLengthFont[0],addressLengthFont[1],addressLength[0],content[0],content[1]}; |
| | | this.write(head); |
| | | }else{ |
| | | log.info("åéå
容ä¸ç¬¦åï¼ åèé¿åº¦ {},åé¿åº¦ï¼{},èµ·å§å°å,{},å
容:{}",addressLength,addressLengthFont,start,content); |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("æ°æ®å¤çå¼å¸¸ï¼ å
容 {}",plcParameter); |
| | | } |
| | | } |
| | | //åå
¥æ°æ® |
| | | public void write(String key,String writeValue)throws Exception{ |
| | | if (writeValue != null && !"".equals(writeValue)) { |
| | | //åå
¥åéæ°æ® |
| | | DataOutputStream out = new DataOutputStream(socket.getOutputStream()); |
| | | out.write(HexConversion.stringToInt(writeValue)); |
| | | out.flush(); |
| | | public void write(byte []sendByte){ |
| | | try { |
| | | if (sendByte != null) { |
| | | //åå
¥åéæ°æ® |
| | | DataOutputStream out = new DataOutputStream(this.socket.getOutputStream()); |
| | | out.write(sendByte); |
| | | out.flush(); |
| | | log.info("åå
¥æåï¼ å
容 {}",sendByte); |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("åå
¥å¤±è´¥ï¼ å
容 {}",sendByte); |
| | | } |
| | | } |
| | | //åå
¥æ°æ®String |
| | | public void writeString(String sendString,String startAddress){ |
| | | try { |
| | | String result=message(sendString,startAddress); |
| | | if (result != null && !"".equals(result)) { |
| | | //åå
¥æ°æ® |
| | | DataOutputStream out = new DataOutputStream(socket.getOutputStream()); |
| | | out.write(HexUtil.stringToInt(result)); |
| | | out.flush(); |
| | | log.info("åå
¥æåï¼å°å {},å
容 {},åèï¼{}",startAddress,sendString,HexUtil.stringToInt(result)); |
| | | //this.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("åå
¥å¼å¸¸ï¼å°å {},å
容 {}",startAddress,sendString); |
| | | } |
| | | } |
| | | //å |
| | |
| | | public PlcAgreement getPlcAgreement(String key){ |
| | | return plcAgreement.get(key); |
| | | } |
| | | |
| | | public void consoleLogInfo(PlcAgreement thisPlcAgreement){ |
| | | String logInfo=this.fileName+" "; |
| | | Map<String,PlcParameter> plcParameterMap=thisPlcAgreement.getPlcParameters(); |
| | | for (String key:plcParameterMap.keySet()) { |
| | | logInfo+=key+":"+plcParameterMap.get(key).getValueString()+","; |
| | | } |
| | | log.info(logInfo); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * åè®®åæ° |
| | | */ |
| | | private List<String> parameterKeys=null; |
| | | private List<String> parameterKeys=new ArrayList<>(); |
| | | private Map<String,PlcParameter> parameters=null; |
| | | /** |
| | | * åè®®è·¯å¾ |
| | |
| | | public int plcAddressLength=0; |
| | | //类似åºåå·ï¼4ï¼+åè®®æ å¿ï¼4ï¼+é¿åº¦ï¼4ï¼+ä»ç«å°åï¼2ï¼+åè½ä»£ç ï¼2ï¼+èµ·å§å°åï¼4ï¼+è¯»åæ°éï¼4ï¼ "000100000006010300000032" |
| | | public String requestHead=null; |
| | | |
| | | PlcAgreement(){ |
| | | jsonFilePath = System.getProperty("user.dir") + "../../JsonFile/PlcCacheGlass.json"; |
| | | private PlcAgreement(){} |
| | | PlcAgreement(String fileName){ |
| | | //jsonFilePath = "D:/mes/JsonFile/"+fileName+".json"; |
| | | jsonFilePath = System.getProperty("user.dir") + "/JsonFile/"+fileName+".json"; |
| | | boolean initSuccess=initword(); |
| | | log.info("åå§åPlcCacheGlassï¼"+initSuccess); |
| | | //log.info("åå§åPlcCacheGlassï¼"+initSuccess); |
| | | } |
| | | //åå§åword |
| | | public boolean initword() { |
| | |
| | | fileReader.close(); |
| | | |
| | | JSONObject jsonFile = new JSONObject(content.toString()); |
| | | |
| | | //log.info("读åå
容ï¼{}",jsonFile); |
| | | JSONArray jsonArray = jsonFile.getJSONArray("parameterInfo"); |
| | | |
| | | this.plcAddressBegin=jsonFile.getStr("plcAddressBegin");//设置起å§ä½å°å |
| | | this.plcAddressLength=Integer.valueOf(jsonFile.getStr("plcAddressLength"));//设置å°åé¿åº¦ |
| | | this.requestHead=jsonFile.getStr("requestHead");//设置请æ±å¤´é¨ |
| | | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject parameterObj = jsonArray.getJSONObject(i); |
| | | String code = parameterObj.getStr("code"); |
| | | String code = parameterObj.getStr("codeId"); |
| | | PlcParameter plcParameter = new PlcParameter( |
| | | code, |
| | | Integer.valueOf(parameterObj.getStr("addressIndex")), |
| | | Integer.valueOf(parameterObj.getStr("addressLength")),""); //åæ°å®ä¾ |
| | | Integer.valueOf(parameterObj.getStr("addressLength")), |
| | | parameterObj.getStr("type")); //åæ°å®ä¾ |
| | | parameterKeys.add(code); |
| | | parameters.put(code,plcParameter); |
| | | } |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import static com.mes.tools.HexConversion.*; |
| | | |
| | | /** |
| | | * Plcåæ° |
| | | */ |
| | |
| | | * éè¦åå
¥çå¼ |
| | | */ |
| | | private Object writeValue=null; |
| | | |
| | | /** |
| | | * éè¦åå
¥çå¼ |
| | | */ |
| | | private byte[] writeByte=null; |
| | | |
| | | PlcParameter(){ |
| | | |
| | |
| | | } |
| | | |
| | | public Object getReadValue() { |
| | | |
| | | return readValue; |
| | | } |
| | | public String getValueString() { |
| | | return getValueInt()+""; |
| | | } |
| | | public int getValueInt() { |
| | | if(this.readByte==null||this.readByte.length<1){ |
| | | //log.info("读åå
容为null: {} :{}",this.getCodeId(),this.readByte); |
| | | return 0; |
| | | } |
| | | return bytesToIntDesc(this.readByte,0); |
| | | } |
| | | |
| | | public void setReadValue(Object readValue) { |
| | |
| | | return writeValue; |
| | | } |
| | | |
| | | public void setWriteValue(Object writeValue) { |
| | | this.writeValue = writeValue; |
| | | public byte [] setWriteValue(Object writeValue) { |
| | | //ä¼ å
¥å¼æ ¹æ®åæ°ç±»åè¿è¡è½¬æ¢æå符串ä¿åè¿åå
¥ åèå
å¹¶ä¸è¿å |
| | | byte []sendByte=new byte[13+this.addressLength]; |
| | | if ("int".equals(this.type)){ |
| | | this.writeByte=intToBytesDesc(Integer.parseInt(writeValue.toString()),this.addressLength); |
| | | return this.writeByte; |
| | | }else if ("word".equals(this.type)){ |
| | | this.writeByte=intToBytesDesc(Integer.parseInt(writeValue.toString()),this.addressLength); |
| | | return this.writeByte; |
| | | }else if("string".equals(this.type)){ |
| | | |
| | | }else{ |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | public byte [] getWriteByte() { |
| | | return this.writeByte; |
| | | } |
| | | } |
| | |
| | | numberHex = String.format("%2s", numberHex).replace(' ', '0'); |
| | | return numberHex; |
| | | } |
| | | |
| | | /** |
| | | * ä»byteæ°ç»ä¸åintæ°å¼ï¼æ¬æ¹æ³éç¨äº(ä½ä½å¨åï¼é«ä½å¨å)ç顺åºï¼ååintToBytes()é
å¥ä½¿ç¨ |
| | | * |
| | | * @param src: byteæ°ç» |
| | | * @param offset: 仿°ç»ç第offsetä½å¼å§ |
| | | * @return intæ°å¼ |
| | | */ |
| | | public static int bytesToIntDesc(byte[] src, int offset) { |
| | | int value=0; |
| | | int length = src.length; |
| | | for(int i=0;i<length;i++){ |
| | | value+=(int)((src[offset+i]&0xFF)<<(length-i-1)*8); |
| | | } |
| | | return value; |
| | | } |
| | | /** |
| | | * å°intæ°å¼è½¬æ¢ä¸ºå size个åèçbyteæ°ç»ï¼æ¬æ¹æ³éç¨äº(ä½ä½å¨åï¼é«ä½å¨å)ç顺åºã åbytesToIntï¼ï¼é
å¥ä½¿ç¨ |
| | | * @param value |
| | | * è¦è½¬æ¢çintå¼ |
| | | * @return byteæ°ç» |
| | | */ |
| | | public static byte[] intToBytesDesc( int value,int size ) |
| | | { |
| | | byte[] src = new byte[size]; |
| | | for(int i=0;i<size;i++){ |
| | | src[i] = (byte) ((value>>(size-i-1)*8) & 0xFF); |
| | | } |
| | | return src; |
| | | } |
| | | /** |
| | | * ä»byteæ°ç»ä¸åintæ°å¼ï¼æ¬æ¹æ³éç¨äº(ä½ä½å¨åï¼é«ä½å¨å)ç顺åºï¼ååintToBytes()é
å¥ä½¿ç¨ |
| | | * |
| | |
| | | * @return intæ°å¼ |
| | | */ |
| | | public static int bytesToInt(byte[] src, int offset) { |
| | | int value; |
| | | value = (int) ((src[offset] & 0xFF) |
| | | | ((src[offset+1] & 0xFF)<<8) |
| | | | ((src[offset+2] & 0xFF)<<16) |
| | | | ((src[offset+3] & 0xFF)<<24)); |
| | | int value=0; |
| | | for(int i=0;i<src.length;i++){ |
| | | value+=(int)((src[offset+i]&0xFF)<<i*8); |
| | | } |
| | | return value; |
| | | } |
| | | /** |
| | | * å°intæ°å¼è½¬æ¢ä¸ºå size个åèçbyteæ°ç»ï¼æ¬æ¹æ³éç¨äº(ä½ä½å¨åï¼é«ä½å¨å)ç顺åºã åbytesToIntï¼ï¼é
å¥ä½¿ç¨ |
| | | * @param value |
| | | * è¦è½¬æ¢çintå¼ |
| | | * @return byteæ°ç» |
| | | */ |
| | | public static byte[] intToBytes( int value,int size ) |
| | | { |
| | | byte[] src = new byte[size]; |
| | | for(int i=0;i<src.length;i++){ |
| | | src[i] = (byte) ((value>>i*8) & 0xFF); |
| | | } |
| | | return src; |
| | | } |
| | | } |
| | |
| | | package com.mes.tools; |
| | | |
| | | import com.github.s7connector.api.DaveArea; |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.S7PLC; |
| | | |
| | | import java.nio.ByteBuffer; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | return addresslist; |
| | | } |
| | | |
| | | public void writeString(String addr,String data) { |
| | | s7PLC.writeString(addr,data); |
| | | } |
| | | |
| | | public void writeUInt16(String addr,int data) { |
| | | s7PLC.writeUInt16(addr,data); |
| | | } |
| | | |
| | | public void writeUInt32(String addr,int data) { |
| | | s7PLC.writeUInt32(addr,data); |
| | | } |
| | | |
| | | public void writeStringy(String addr,String value) { |
| | | byte[] bytes = value.getBytes(); |
| | | s7PLC.writeByte(addr,bytes); |
| | | } |
| | | |
| | | public String readStrings(String addr) { |
| | | return s7PLC.readString(addr); |
| | | } |
| | | |
| | | } |
| | |
| | | return String.format("%4s", HexString).replace(' ', '0'); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // System.out.println(HexUtil.hexToAscii("3c5354413e48656c6c6f20576f726c64217c5468697320697320746865206669727374207369676e616c2066726f6d20646576696365213c454f463e")); |
| | | // System.out.println(HexUtil.asciiToHex("<STA>Hello World!|This is the first signal from device!<EOF>")); |
| | | // |
| | | // System.out.println(String.format("%4S", HexUtil.intToHex(55)).replace(' ', '0')); |
| | | // System.out.println(HexUtil.hexToInt("00d2")); |
| | | // |
| | | // System.out.println(HexUtil.formatHex("3c5354413e")); |
| | | String message = "Hello World!|This is the first signal from device!"; |
| | | int length = message.length() * 2 + 10; // é¿åº¦å
æ¬ç»å°¾ç<EOF>ï¼ä¸ä¸ªå符å¨ä¿¡å·ä¸ç±ä¸¤ä¸ªåè表示ã |
| | | |
| | | String command = HexUtil.asciiToHex("<STA>"); // æ·»å å¼å§æ è¯ |
| | | |
| | | command += (String.format("%4s", HexUtil.intToHex(length)).replace(' ', '0')); // æ·»å é¿åº¦æ è¯ |
| | | command += "01"; // æ·»å 设å¤ç±»å 0x01表示å岿ºï¼0x02表示é¢åç |
| | | command += "0001"; // æ·»å 设å¤åå·ï¼0x0001è¡¨ç¤ºåºæ¬æ¬¾ï¼0x0002表示ä¸çº§æ¬¾ |
| | | command += "0000"; // åè½å·ï¼0x0000æ¯ä¸ä½æºä¸»å¨åç»ä¸ä½æºï¼0x0001æ¯ä¸ä½æºä¿®æ¹ä¸ä½æºRTC |
| | | command += "00"; // å 坿¹å¼ï¼0x00表示ä¸å å¯ |
| | | |
| | | Calendar c = Calendar.getInstance(); |
| | | |
| | | // æ·»å æ¶é´ï¼å¹¶å°æ¶é´è½¬æ¢ä¸º16è¿å¶è¡¨ç¤º |
| | | command += (String.format("%4s", HexUtil.intToHex(c.get(Calendar.YEAR))).replace(' ', '0')); |
| | | command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.MONTH) + 1)).replace(' ', '0')); |
| | | command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.DAY_OF_MONTH))).replace(' ', '0')); |
| | | command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.HOUR_OF_DAY))).replace(' ', '0')); |
| | | command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.MINUTE))).replace(' ', '0')); |
| | | command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.SECOND))).replace(' ', '0')); |
| | | |
| | | command += ("00000001"); // å¯ä¸æ è¯ï¼ä½¿ç¨åºåå· |
| | | |
| | | command += (HexUtil.asciiToHex(message)); // æ·»å 主è¦ä¿¡æ¯å
容 |
| | | |
| | | command += (HexUtil.asciiToHex("<EOF>")); // æ·»å ç»å°¾æ è¯ |
| | | |
| | | System.out.println(command); |
| | | |
| | | System.out.println(String.format("%4s", "1")); |
| | | |
| | | Date time = new Date(); |
| | | System.out.println(new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss").format(time)); |
| | | |
| | | String timeHex = timeToHex(time); |
| | | System.out.println(timeHex); |
| | | System.out.println(hexToTime(timeHex)); |
| | | |
| | | System.out.println("3c5354413e001a00000000000000000000000000010007e0021500152800000000000000005041001d017c017c01017c3c454f463e".length()); |
| | | |
| | | System.out.println(hexToBinary("0c0a")); |
| | | |
| | | System.out.println(Integer.MAX_VALUE); |
| | | } |
| | | |
| | | public static String hexTo2Binary(String hexString) { |
| | | String binaryString = Integer.toBinaryString(hexToInt(hexString)); |
| | | return String.format("%8s", binaryString).replace(' ', '0'); |
| | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.29:8848 |
| | | server-addr: localhost:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | host: localhost |
| | | port: 6379 |
| | | password: 123456 |
| | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://192.168.56.10:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: root |
| | | cloud: |
| | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.29:8848 |
| | | server-addr: localhost:8848 |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | host: localhost |
| | | port: 6379 |
| | | password: 123456 |
| | |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.44:8848 |
| | | server-addr: localhost:8848 |
| | | gateway: |
| | | discovery: |
| | | locator: |
| | |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.44:8848 |
| | | server-addr: localhost:8848 |
| | | gateway: |
| | | discovery: |
| | | locator: |
| | |
| | | <artifactId>jcifs</artifactId> |
| | | <version>1.2.19</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.s7connector</groupId> |
| | | <artifactId>s7connector</artifactId> |
| | | <version>2.1</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.yulichang</groupId>--> |
| | | <!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>--> |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.*; |
| | | import com.mes.job.PLCLoad; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.LineConfigurationService; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.plcTaskThread.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @Order(1) |
| | | |
| | | public class AppRunnerConfig implements ApplicationRunner { |
| | | |
| | | @Resource |
| | | TaskingMapper taskingMapper; |
| | | @Resource |
| | | MachineMapper machineMapper; |
| | | @Resource |
| | | TaskingService taskingService; |
| | | @Resource |
| | | PrimitiveTaskService primitiveTaskService; |
| | | @Resource |
| | | LineConfigurationService lineConfigurationService; |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | // TODO Auto-generated method stub |
| | | log.info("å¯å¨å®æ"); |
| | | S7object.getinstance().start(); |
| | | |
| | | // new MachineLoad(taskingMapper,machineMapper,taskingService,primitiveTaskService,lineConfigurationService).start(); |
| | | // new MachineEdging(taskingMapper,machineMapper,taskingService,primitiveTaskService,lineConfigurationService).start(); |
| | | // new MachineFlipSlice(machineMapper,taskingService).start(); |
| | | // new MachineMarking(machineMapper,taskingService).start(); |
| | | // new MachineSilkScreen(machineMapper,taskingService).start(); |
| | | // new MachineRotate(machineMapper,taskingService).start(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.scheduling.annotation.EnableAsync; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | |
| | | @MapperScan("com.mes.*.mapper") |
| | | @EnableDiscoveryClient |
| | | @EnableSwagger2 |
| | | @EnableScheduling |
| | | @EnableAsync |
| | | public class DeviceInteractionModuleApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | SpringApplication.run(DeviceInteractionModuleApplication.class, args); |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.mes.service.ModbusTcp; |
| | | |
| | | public enum CommunicationProtocol { |
| | | S7control(), |
| | | ModbusTcp, |
| | | } |
| | |
| | | */ |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLCé讯类å®ä¾ |
| | | private EPlcType plcType = EPlcType.S1200; // 西é¨åPLCç±»å |
| | | private String ip = "192.168.10.11"; // plc ipå°å |
| | | private EPlcType plcType = EPlcType.S1500; // 西é¨åPLCç±»å |
| | | private String ip = "172.17.125.130"; // plc ipå°å |
| | | private int port = 102; // plc 端å£å· |
| | | |
| | | |
| | |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcCacheGlass.json"; |
| | | // String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath(); |
| | | System.out.println("Load Glass File: " + PlcLoadGlass); |
| | | PlcMesObject = InitUtil.initword(PlcLoadGlass); |
| | | } |
| | | } |
| | |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | if (getplcvlues != null) { |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | |
| | | |
| | | /** |
| | | * @Author : yanzhixin |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7objectCleaning extends Thread { |
| | | public S7control plccontrol; // PLCé讯类å®ä¾ |
| | | private EPlcType plcType = EPlcType.S200_SMART; // 西é¨åPLCç±»å |
| | | private String ip = "200.200.200.193"; // plc ipå°å |
| | | private int port = 102; // plc 端å£å· |
| | | |
| | | |
| | | public PlcParameterObject PlcMesObject; |
| | | private static volatile S7objectCleaning instance = null; |
| | | |
| | | private S7objectCleaning() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcCleaning.json"; |
| | | // String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath(); |
| | | System.out.println("Load Glass File: " + PlcLoadGlass); |
| | | PlcMesObject = InitUtil.initword(PlcLoadGlass); |
| | | } |
| | | } |
| | | |
| | | // å便¨¡å¼ è·åç±»çå¯ä¸å®ä¾ |
| | | public static S7objectCleaning getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7objectCleaning.class) { |
| | | if (instance == null) { |
| | | instance = new S7objectCleaning(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()]; |
| | | int maxRead=1092; |
| | | int size=PlcMesObject.getPlcAddressLength()%maxRead==0? |
| | | (PlcMesObject.getPlcAddressLength()/maxRead): |
| | | (PlcMesObject.getPlcAddressLength()/maxRead+1); |
| | | for (int i = 0; i <size ; i++) { |
| | | int begin=i*maxRead; |
| | | int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead); |
| | | //String s=PlcMesObject.getPlcAddressBegin().substring(PlcMesObject.getPlcAddressBegin().indexOf(".")+1); |
| | | int defaultStart=Integer.valueOf(PlcMesObject.getPlcAddressBegin().substring(PlcMesObject.getPlcAddressBegin().indexOf(".")+1)); |
| | | |
| | | String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+(begin+defaultStart); |
| | | byte[] getplcvlues = plccontrol.readByte(beginAddress, length); |
| | | System.arraycopy(getplcvlues,0,resultValues,begin,length); |
| | | } |
| | | if (resultValues != null) { |
| | | PlcMesObject.setPlcParameterList(resultValues); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | |
| | | |
| | | /** |
| | | * @Author : yanzhixin |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7objectFlipSlice extends Thread { |
| | | public S7control plccontrol; // PLCé讯类å®ä¾ |
| | | private EPlcType plcType = EPlcType.S1200; // 西é¨åPLCç±»å |
| | | private String ip = "10.36.164.120"; // plc ipå°å |
| | | private int port = 102; // plc 端å£å· |
| | | |
| | | |
| | | public PlcParameterObject PlcMesObject; |
| | | private static volatile S7objectFlipSlice instance = null; |
| | | |
| | | private S7objectFlipSlice() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcFlipSlice.json"; |
| | | // String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath(); |
| | | System.out.println("Load Glass File: " + PlcLoadGlass); |
| | | PlcMesObject = InitUtil.initword(PlcLoadGlass); |
| | | } |
| | | } |
| | | |
| | | // å便¨¡å¼ è·åç±»çå¯ä¸å®ä¾ |
| | | public static S7objectFlipSlice getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7objectFlipSlice.class) { |
| | | if (instance == null) { |
| | | instance = new S7objectFlipSlice(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()]; |
| | | int maxRead=1092; |
| | | int size=PlcMesObject.getPlcAddressLength()%maxRead==0? |
| | | (PlcMesObject.getPlcAddressLength()/maxRead): |
| | | (PlcMesObject.getPlcAddressLength()/maxRead+1); |
| | | for (int i = 0; i <size ; i++) { |
| | | int begin=i*maxRead; |
| | | int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead); |
| | | String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+begin; |
| | | byte[] getplcvlues = plccontrol.readByte(beginAddress, length); |
| | | System.arraycopy(getplcvlues,0,resultValues,begin,length); |
| | | } |
| | | if (resultValues != null) { |
| | | PlcMesObject.setPlcParameterList(resultValues); |
| | | } |
| | | // byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | // if (getplcvlues != null) { |
| | | // PlcMesObject.setPlcParameterList(getplcvlues); |
| | | // } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterInfo; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.LinkedHashMap; |
| | | |
| | | |
| | | /** |
| | | * @Author : yanzhixin |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | public class S7objectMachine extends Thread { |
| | | public S7control plccontrol; // PLCé讯类å®ä¾ |
| | | private EPlcType plcType = EPlcType.S1200; // 西é¨åPLCç±»å |
| | | private String ip = ""; // plc ipå°å |
| | | private int port = 102; // plc 端å£å· |
| | | private String plcFileName=""; // jsonåç§° |
| | | public PlcParameterObject PlcMesObject; |
| | | public S7objectMachine(String ip,int port,String plcFileName,EPlcType plcType) { |
| | | initialize(ip,port,plcFileName,plcType); |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(this.plcType, this.ip, this.port, 0, 0); |
| | | //String plcFileUrl = System.getProperty("user.dir") + "D:/HangZhouMes/JsonFile/"+this.plcFileName+".json"; |
| | | String plcFileUrl = "D:/mes/JsonFile/"+this.plcFileName+".json"; |
| | | PlcMesObject = InitUtil.initword(plcFileUrl); |
| | | } |
| | | } |
| | | public void initialize(String ip,int port,String plcFileName,EPlcType plcType){ |
| | | this.ip = ip; |
| | | this.port = port; |
| | | this.plcFileName = plcFileName; |
| | | this.plcType= plcType; |
| | | } |
| | | |
| | | /** |
| | | * æå°åæ°å¼ |
| | | */ |
| | | public void consoleLogInfo(){ |
| | | String logInfo=this.plcFileName+" "; |
| | | LinkedHashMap<String, PlcParameterInfo> thisPlcParameterInfo=PlcMesObject.getPlcParameterMap(); |
| | | for (String key:thisPlcParameterInfo.keySet()) { |
| | | logInfo+=key+":"+thisPlcParameterInfo.get(key).getValue()+","; |
| | | } |
| | | log.info(logInfo); |
| | | } |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()]; |
| | | int maxRead=1092; |
| | | int size=PlcMesObject.getPlcAddressLength()%maxRead==0? |
| | | (PlcMesObject.getPlcAddressLength()/maxRead): |
| | | (PlcMesObject.getPlcAddressLength()/maxRead+1); |
| | | for (int i = 0; i <size ; i++) { |
| | | int begin=i*maxRead; |
| | | int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead); |
| | | String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+begin; |
| | | byte[] getplcvlues = plccontrol.readByte(beginAddress, length); |
| | | System.arraycopy(getplcvlues,0,resultValues,begin,length); |
| | | } |
| | | if (resultValues != null) { |
| | | PlcMesObject.setPlcParameterList(resultValues); |
| | | } |
| | | } catch (Exception e) { |
| | | //log.info("å¼å¸¸:ip:{},port:{}",this.ip,this.port); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * @Author : yanzhixin |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7objectMarking extends Thread { |
| | | public S7control plccontrol; // PLCé讯类å®ä¾ |
| | | private EPlcType plcType = EPlcType.S1500; // 西é¨åPLCç±»å |
| | | private String ip = "10.36.164.40"; // plc ipå°å |
| | | private int port = 102; // plc 端å£å· |
| | | |
| | | |
| | | public PlcParameterObject PlcMesObject; |
| | | private static volatile S7objectMarking instance = null; |
| | | |
| | | private S7objectMarking() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcMarking.json"; |
| | | // String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath(); |
| | | System.out.println("Load Glass File: " + PlcLoadGlass); |
| | | PlcMesObject = InitUtil.initword(PlcLoadGlass); |
| | | } |
| | | } |
| | | |
| | | // å便¨¡å¼ è·åç±»çå¯ä¸å®ä¾ |
| | | public static S7objectMarking getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7objectMarking.class) { |
| | | if (instance == null) { |
| | | instance = new S7objectMarking(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()]; |
| | | int maxRead=1092; |
| | | int size=PlcMesObject.getPlcAddressLength()%maxRead==0? |
| | | (PlcMesObject.getPlcAddressLength()/maxRead): |
| | | (PlcMesObject.getPlcAddressLength()/maxRead+1); |
| | | for (int i = 0; i <size ; i++) { |
| | | int begin=i*maxRead; |
| | | int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead); |
| | | String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+begin; |
| | | byte[] getplcvlues = plccontrol.readByte(beginAddress, length); |
| | | System.arraycopy(getplcvlues,0,resultValues,begin,length); |
| | | } |
| | | if (resultValues != null) { |
| | | PlcMesObject.setPlcParameterList(resultValues); |
| | | } |
| | | // byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | // if (getplcvlues != null) { |
| | | // PlcMesObject.setPlcParameterList(getplcvlues); |
| | | // } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.ServerSocket; |
| | | import java.net.Socket; |
| | | |
| | | /** |
| | | * @Author : yanzhxiin |
| | | * @Date: 2024/8/20 11:19 |
| | | * @Description: |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class tcpIp { |
| | | |
| | | |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void serverTCPSocket() { |
| | | try { |
| | | // å建TCPæå¡å¨å¹¶ç»å®å°æå®ç«¯å£ |
| | | int port = 8888; |
| | | ServerSocket serverSocket = new ServerSocket(port); |
| | | System.out.println("æå¡å¨å·²å¯å¨ï¼çå¾
客æ·ç«¯è¿æ¥..."); |
| | | while (true) { |
| | | // çå¾
客æ·ç«¯è¿æ¥ |
| | | Socket clientSocket = serverSocket.accept(); |
| | | System.out.println("客æ·ç«¯è¿æ¥æå"); |
| | | // å建è¾å
¥æµåè¾åºæµ |
| | | InputStream inputStream = clientSocket.getInputStream(); |
| | | OutputStream outputStream = clientSocket.getOutputStream(); |
| | | // 读å客æ·ç«¯åéçæ°æ® |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead = inputStream.read(buffer); |
| | | String receivedMessage = new String(buffer, 0, bytesRead); |
| | | System.out.println("æ¶å°æ¶æ¯ï¼" + receivedMessage); |
| | | // åéååºæ°æ®ç»å®¢æ·ç«¯ |
| | | String responseMessage = "Hello, Client!"; |
| | | outputStream.write(responseMessage.getBytes()); |
| | | // å
³éè¿æ¥ |
| | | clientSocket.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void clientTCPSocket() { |
| | | try { |
| | | // å建TCP客æ·ç«¯å¹¶è¿æ¥å°æå¡å¨ |
| | | String serverAddress = "192.168.1.8"; |
| | | int serverPort = 2001; |
| | | Socket clientSocket = new Socket(serverAddress, serverPort); |
| | | // å建è¾å
¥æµåè¾åºæµ |
| | | InputStream inputStream = clientSocket.getInputStream(); |
| | | OutputStream outputStream = clientSocket.getOutputStream(); |
| | | // åéæ°æ®ç»æå¡å¨ |
| | | String message = "start"; |
| | | outputStream.write(message.getBytes()); |
| | | // 读åæå¡å¨ååºçæ°æ® |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead = inputStream.read(buffer); |
| | | String receivedMessage = new String(buffer, 0, bytesRead); |
| | | System.out.println("æ¶å°æå¡å¨ååºï¼" + receivedMessage); |
| | | |
| | | String message2 = "stop"; |
| | | outputStream.write(message2.getBytes()); |
| | | // å
³éè¿æ¥ |
| | | clientSocket.close(); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.md.entity.*; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.*; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.service.PlcAgreement; |
| | | import com.mes.service.PlcParameter; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.utils.HexUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class AddTask { |
| | | |
| | | @Autowired |
| | | ProjectService projectService; |
| | | |
| | | @Autowired |
| | | KBBTJPDrawingBPService kBBTJPDrawingBPService; |
| | | |
| | | //@Scheduled(fixedDelay = 30000) |
| | | public void AddTasks() { |
| | | projectService.insertProjectStandard(); |
| | | |
| | | } |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void notReceive() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<KBBTJPDrawingBP> list =kBBTJPDrawingBPService.notReceiveKBBTJPDrawingBP(); |
| | | jsonObject.append("content", list); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("notReceiveTask"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // å°æåä¸ä¸ªæ¶æ¯è½¬æ¢ä¸ºæ´æ°ç±»åçå表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.common.S7objectFlipSlice; |
| | | import com.mes.common.S7objectMachine; |
| | | import com.mes.common.S7objectMarking; |
| | | import com.mes.device.PlcParameterInfo; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.GlassInfoMapper; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * èªå¨ææ æº |
| | | * @Author : yanzhxiin |
| | | * @Date: 2024/8/20 11:19 |
| | | * @Description: |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class MachineTask { |
| | | |
| | | public static String engineerId = ""; |
| | | |
| | | @Autowired |
| | | TaskingMapper taskingMapper; |
| | | @Autowired |
| | | MachineMapper machineMapper; |
| | | @Autowired |
| | | TaskingService taskingService; |
| | | @Autowired |
| | | private GlassInfoMapper glassInfoMapper; |
| | | public int a =1; |
| | | public S7objectMachine s7objectMachine; |
| | | |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void plcMachineTask() { |
| | | Long machineId=12L; |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcMarking", EPlcType.S1500); |
| | | s7objectMachine.start(); |
| | | } |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请æ±ID |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//åéå |
| | | PlcParameterInfo isMark =plcParameterObject.getPlcParameter("isMark");//åéIDã0 䏿æ ï¼1æ 忍¡å¼ï¼2å®å¶æ¨¡å¼ã |
| | | PlcParameterInfo drawingMark =plcParameterObject.getPlcParameter("drawingMark");//ææ å¾çº¸å°å |
| | | PlcParameterInfo lengthOutOfService =plcParameterObject.getPlcParameter("length(OutOfService)");//é¿ |
| | | PlcParameterInfo widthOutOfService =plcParameterObject.getPlcParameter("width(OutOfService)");//宽 |
| | | PlcParameterInfo markingMode =plcParameterObject.getPlcParameter("markingMode");// |
| | | |
| | | PlcParameterInfo plcReport =plcParameterObject.getPlcParameter("plcReport");//æ±æ¥å |
| | | PlcParameterInfo plcReportID =plcParameterObject.getPlcParameter("plcReportID");//æ±æ¥ID |
| | | PlcParameterInfo mesConfirm =plcParameterObject.getPlcParameter("mesConfirm");//确认å |
| | | PlcParameterInfo mesConfirmID =plcParameterObject.getPlcParameter("mesConfirmID");//确认ID |
| | | |
| | | String str=S7objectMarking.getinstance().plccontrol.readString("DB14.30"); |
| | | |
| | | //String width=S7objectMarking.getinstance().plccontrol.readWord(widthOutOfService.getAddress()); |
| | | log.info("plcRequest:{},plcRequestID:{},mesSend:{},mesSendID:{},drawingMark:{}," + |
| | | "plcReport:{},plcReportID:{},mesConfirm:{},mesConfirmID:{}" |
| | | ,plcRequest.getValue(),plcRequestID.getValue(),mesSend.getValue(),isMark.getValue(),drawingMark.getValue(), |
| | | plcReport.getValue(),plcReportID.getValue(),mesConfirm.getValue(),mesConfirmID.getValue()); |
| | | if ("0".equals(plcRequest.getValue())&&"1".equals(mesSend.getValue())) { |
| | | //åéåç½®0 |
| | | log.info("1.åéåç½®é¶,æ¸
é¤ä¸æ¬¡åéçæ°æ®{},{},{},{},{}" |
| | | ,markingMode.getValue() |
| | | ,isMark.getValue() |
| | | ,lengthOutOfService.getValue() |
| | | ,widthOutOfService.getValue() |
| | | ,mesSend.getValue()); |
| | | //S7objectMarking.getinstance().plccontrol.writeString(drawingMark.getAddress(),""); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(markingMode.getAddress(), 0); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(lengthOutOfService.getAddress(), 0); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(widthOutOfService.getAddress(), 0); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(isMark.getAddress(), 0); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("0".equals(plcReport.getValue())&&"1".equals(mesConfirm.getValue())) { |
| | | log.info("2.确认åç½®é¶"); |
| | | //åéåç½®0 |
| | | S7objectMarking.getinstance().plccontrol.writeWord(mesConfirm.getAddress(), 0); |
| | | return; |
| | | } |
| | | if("1".equals(plcReport.getValue())&&"0".equals(mesConfirm.getValue())){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("3ãä»»å¡å®æ"); |
| | | if(finishCount>0){//æä»»å¡ |
| | | S7objectMarking.getinstance().plccontrol.writeWord(mesConfirm.getAddress(), 1); |
| | | return; |
| | | } |
| | | } |
| | | if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue())&& !plcRequestID.getValue().isEmpty()&&"å¼å·¥".equals(machine.getState())){ |
| | | Tasking tasking; |
| | | if("0".equals(plcRequestID.getValue())){ |
| | | //æ 忍¡å¼ |
| | | tasking=taskingService.startMachineTask(machine); |
| | | }else{ |
| | | //å®å¶æ¨¡å¼ |
| | | tasking=taskingService.startMachineTask(machine,plcRequestID.getValue()); |
| | | } |
| | | //log.info("4ãåéä»»å¡ è®¾å¤ç¶æ:{}, æ°æ®ï¼{},",machine,tasking); |
| | | if(tasking!=null){ |
| | | //模å¼ï¼1å®å¶ 0 æ¹é æ¯å¦ææ ï¼0䏿æ 1ææ |
| | | int isMark_=tasking.getDrawingMarking()==null?0:1; |
| | | int isMarkingMode_="å®å¶".equals(tasking.getTaskType()) ?1:0; |
| | | log.info("4ãåéæ°æ®:{},{},{},{},{},{}" |
| | | ,tasking.getProgramId() |
| | | ,tasking.getLength().intValue(),tasking.getWidth().intValue(),isMark_,isMarkingMode_,1); |
| | | if(isMark_==1){ |
| | | S7objectMarking.getinstance().plccontrol.writeString(drawingMark.getAddress(), tasking.getProgramId()); |
| | | } |
| | | //S7objectMarking.getinstance().plccontrol.writeUInt32 (mesSendID.getAddress(), 2); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(lengthOutOfService.getAddress(), tasking.getLength().intValue()); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(widthOutOfService.getAddress(), tasking.getWidth().intValue()); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(isMark.getAddress(), isMark_); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(markingMode.getAddress(), isMarkingMode_); |
| | | S7objectMarking.getinstance().plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | return; |
| | | } |
| | | } |
| | | //log.info("æ 坿§è¡çæ¡ä»¶"); |
| | | |
| | | } |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void markingTasks() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | Machine machine=machineMapper.selectById(11L); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObject.append("taskingList", taskingList); |
| | | jsonObject.append("machine", machine); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("marking"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // å°æåä¸ä¸ªæ¶æ¯è½¬æ¢ä¸ºæ´æ°ç±»åçå表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.md.entity.*; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.PrimitiveTaskMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.*; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.service.PlcAgreement; |
| | | import com.mes.service.PlcParameter; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.utils.HexUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.Socket; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PLCLoad { |
| | | |
| | | @Autowired |
| | | TaskingMapper taskingMapper; |
| | | @Autowired |
| | | MachineMapper machineMapper; |
| | | @Autowired |
| | | TaskingService taskingService; |
| | | @Autowired |
| | | ProjectService projectService; |
| | | @Autowired |
| | | PrimitiveTaskService primitiveTaskService; |
| | | @Autowired |
| | | KBBTJPDrawingBPService kBBTJPDrawingBPService; |
| | | @Autowired |
| | | LineConfigurationService lineConfigurationService; |
| | | |
| | | public static Long machineId1 = 1L; |
| | | public static Long machineId2 = 2L; |
| | | public ModbusTcp modbusTcp2 = new ModbusTcp(); |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | @Autowired |
| | | private PrimitiveTaskMapper primitiveTaskMapper; |
| | | |
| | | |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void plcLoad() { |
| | | Machine machine=machineMapper.selectById(machineId2); |
| | | ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),"PlcLoad"); |
| | | modbusTcp1.connect(); |
| | | PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcLoad"); |
| | | try { |
| | | if(!modbusTcp1.read(plcAgreement)){ |
| | | log.info("éè®¯è¯»åæ°æ°æ®å¤±è´¥"); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//åéå |
| | | PlcParameter mesSendCount =plcAgreement.getPlcParameter("mesSendCount");//åéæ°é |
| | | |
| | | PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//æ±æ¥å |
| | | PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//æ±æ¥ID |
| | | PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认å |
| | | PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID |
| | | if (machine.getIsLog()>0){ |
| | | modbusTcp1.consoleLogInfo(plcAgreement); |
| | | } |
| | | if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) { |
| | | //åéåç½®0 |
| | | String send= HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("1.åéåç½®é¶ åéå æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) { |
| | | //确认åç½®é¶ |
| | | String send=HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("2.确认åç½®é¶ ä»»å¡å®æ æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine); |
| | | List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId()); |
| | | |
| | | if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | for(PrimitiveTask primitiveTask:findPrimitiveTasking){ |
| | | log.info("æºæ¢°æä»»å¡å®æ åå§æ°éï¼{} æ¬æ¬¡æ°é:{}", primitiveTask.getReportCount(), plcReportID.getValueInt()); |
| | | if (plcReportID.getValueInt()>0){ |
| | | primitiveTask.setReportCount(primitiveTask.getReportCount()+ plcReportID.getValueInt()); |
| | | primitiveTaskMapper.updateById(primitiveTask); |
| | | } |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/ 2)); |
| | | log.info("ä»»å¡å®æ æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | log.info("3ãä»»å¡å®æ:"+plcReportID.getValueString()); |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ å¼å¸¸æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt()) |
| | | &&"å¼å·¥".equals(machine.getState())){ |
| | | int loadCount=0; |
| | | if(machine.getMode()==1){ |
| | | //æ 忍¡å¼ æ¾å·²é¢åæªå®æçç¬¬ä¸æ¡ä»»å¡ |
| | | for(PrimitiveTask primitiveTask:findPrimitiveTasking){ |
| | | // //任塿°>已䏿°é |
| | | // List<Tasking> taskingTopList=taskingMapper.selectList(new QueryWrapper<Tasking>().lambda() |
| | | // .eq(Tasking::getScanId,primitiveTask.getScanId()) |
| | | // ); |
| | | loadCount=primitiveTask.getTaskQuantity()-primitiveTask.getReportCount(); |
| | | loadCount=(loadCount>0?loadCount:0); |
| | | |
| | | break; |
| | | } |
| | | //loadCount=taskingCount.size(); |
| | | }else{ |
| | | //å®å¶æ¨¡å¼ |
| | | loadCount=1; |
| | | } |
| | | if(loadCount>0){ |
| | | log.info("4ãåéä»»å¡ ä»»å¡æ°æ®ï¼{}, 设å¤ç¶æ:{}, ",loadCount,machine); |
| | | String send=HexUtil.intTo2ByteHex(1)+ HexUtil.intTo2ByteHex(loadCount); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéä»»å¡å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | modbusTcp1.close(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+"1 "+ loadCount; |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | return; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("交äºé»è¾é误"); |
| | | } |
| | | modbusTcp1.close(); |
| | | //log.info("æ 坿§è¡çæ¡ä»¶"); |
| | | } |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void loadTasks() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | Machine machine=machineMapper.selectById(machineId2); |
| | | |
| | | |
| | | //æ 忍¡å¼ æ¾å·²é¢åæªå®æçç¬¬ä¸æ¡ä»»å¡ |
| | | LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine); |
| | | //æ¤çº¿è·¯å·²é¢åçä»»å¡ |
| | | List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId()); |
| | | //æ¤çº¿è·¯æªé¢åçä»»å¡ æ¬å° |
| | | //List<PrimitiveTask> findPrimitiveTask=primitiveTaskService.findPrimitiveTaskNotFinish(); |
| | | //æ¤çº¿è·¯æªé¢åçä»»å¡ å®¢æ·æ°æ®åº |
| | | List<KBBTJPDrawingBP> list =kBBTJPDrawingBPService.notReceiveKBBTJPDrawingBP(); |
| | | jsonObject.append("findPrimitiveTask", list); |
| | | jsonObject.append("findPrimitiveTasking", findPrimitiveTasking); |
| | | //jsonObject.append("findPrimitiveTask", findPrimitiveTask); |
| | | jsonObject.append("machine", machine); |
| | | jsonObject.append("sendRecords", sendRecords); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadTask"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // å°æåä¸ä¸ªæ¶æ¯è½¬æ¢ä¸ºæ´æ°ç±»åçå表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.common.S7objectMachine; |
| | | import com.mes.device.PlcParameterInfo; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.ProjectService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PLCRotate { |
| | | |
| | | PlcParameterObject plcParameterObject =null; |
| | | @Autowired |
| | | TaskingService taskingService; |
| | | @Autowired |
| | | MachineMapper machineMapper; |
| | | |
| | | public S7objectMachine s7objectMachine; |
| | | |
| | | @Autowired |
| | | ProjectService projectService; |
| | | |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void plcRotate() { |
| | | //æè½¬å° |
| | | Long machineId=20L; |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcRotate", EPlcType.S1200); |
| | | s7objectMachine.start(); |
| | | } |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请æ±ID |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//åéå |
| | | PlcParameterInfo mesSendId =plcParameterObject.getPlcParameter("mesSendID");//åéID |
| | | PlcParameterInfo length =plcParameterObject.getPlcParameter("length");//é¿ |
| | | PlcParameterInfo width =plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo rotateType =plcParameterObject.getPlcParameter("rotateType");//æè½¬ç±»å |
| | | String scan_id=""; |
| | | if (machine.getIsLog()>0){ |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if ("0".equals(plcRequest.getValue())&&!"0".equals(mesSend.getValue())) { |
| | | //åéåç½®0 |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("1.åéåç½®é¶,æ¸
é¤ä¸æ¬¡åéçæ°æ®{},{},{},{},{}" |
| | | ,finishCount |
| | | ,length.getValue() |
| | | ,width.getValue() |
| | | ,mesSendId.getValue() |
| | | ,mesSend.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue()) |
| | | &&"å¼å·¥".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | Tasking tasking; |
| | | if(machine.getMode()==1){ |
| | | //æ 忍¡å¼ |
| | | tasking=taskingService.startMachineTask(machine); |
| | | }else{ |
| | | //å®å¶æ¨¡å¼ |
| | | String PlcRequestID_=plcRequestID.getValue(); |
| | | scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1); |
| | | //æ è®°å½åå·¥åº ä»¥åçç»ç ç´æ¥å°å½åå·¥åº |
| | | tasking=taskingService.startScanIdMachineTask(machine,scan_id);//ä¸ç®¡é¡ºåºï¼ç´æ¥æ¾ä»ç¿»çå°æ«ç åå°æè½¬å°çæ°æ® |
| | | } |
| | | if(tasking!=null){ |
| | | log.info("4ãåéæ°æ®:{},{},{},{},{}" |
| | | ,tasking.getGlassId(),tasking.getProgramId() |
| | | ,tasking.getLength().intValue(),tasking.getWidth().intValue(),1); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getGlassId().toString()); |
| | | s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 1); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getGlassId()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getWidth(); |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | nullMachine(machine); |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | }else if(!scan_id.isEmpty()){ |
| | | taskingService.scanMachineAdd(machine,scan_id); |
| | | } |
| | | } |
| | | |
| | | } |
| | | public void nullMachine(Machine machine) { |
| | | if (!"".equals(machine.getRemark())){ |
| | | machine.setRemark(""); |
| | | machineMapper.updateById(machine); |
| | | } |
| | | } |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void rotateTask() { |
| | | //è·åæ¥è¦ç¶æ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | Machine machine=machineMapper.selectById(20L); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObject.append("taskingList", taskingList); |
| | | jsonObject.append("machine", machine); |
| | | jsonObject.append("sendRecords", sendRecords); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("rotate"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // å°æåä¸ä¸ªæ¶æ¯è½¬æ¢ä¸ºæ´æ°ç±»åçå表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.S7objectMarking; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.service.PlcAgreement; |
| | | import com.mes.service.PlcParameter; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.utils.HexUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.net.Socket; |
| | | import java.net.UnknownHostException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import static cn.hutool.core.io.FileUtil.writeString; |
| | | |
| | | /** |
| | | * èªå¨ä¸å°æº |
| | | * @Author : |
| | | * @Date: 2024/8/20 11:19 |
| | | * @Description: |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class SilkScreenTask { |
| | | |
| | | @Autowired |
| | | TaskingMapper taskingMapper; |
| | | @Autowired |
| | | MachineMapper machineMapper; |
| | | @Autowired |
| | | TaskingService taskingService; |
| | | public static Long machineId1 = 13L; |
| | | public static Long machineId2 = 14L; |
| | | //public ModbusTcp modbusTcp1 = null; |
| | | public ModbusTcp modbusTcp2 = new ModbusTcp(); |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void plcSilkScreenTask() { |
| | | Machine machine=machineMapper.selectById(machineId2); |
| | | String fileName="PlcSilkScreen"; |
| | | ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),fileName); |
| | | modbusTcp1.connect(); |
| | | PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement(fileName); |
| | | try { |
| | | //while(true){ |
| | | if(!modbusTcp1.read(plcAgreement)){ |
| | | log.info("éè®¯è¯»åæ°æ°æ®å¤±è´¥"); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameter plcRequestID =plcAgreement.getPlcParameter("plcRequestID");//请æ±ID |
| | | PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//åéå |
| | | PlcParameter mesSendID =plcAgreement.getPlcParameter("mesSendID");//åéID |
| | | PlcParameter length =plcAgreement.getPlcParameter("length");//é¿ |
| | | PlcParameter width =plcAgreement.getPlcParameter("width");//宽 |
| | | PlcParameter thickness =plcAgreement.getPlcParameter("thickness");//å |
| | | PlcParameter X =plcAgreement.getPlcParameter("X");//X |
| | | PlcParameter Y =plcAgreement.getPlcParameter("Y");//Y |
| | | //PlcParameter isSilkScreen =plcAgreement.getPlcParameter("isSilkScreen");//æ¯å¦ä¸å° |
| | | |
| | | PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//æ±æ¥å |
| | | PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//æ±æ¥ID |
| | | PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认å |
| | | PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID |
| | | PlcParameter machineStatusWord =plcAgreement.getPlcParameter("machineStatusWord"); |
| | | if (machine.getIsLog()>0){ |
| | | modbusTcp1.consoleLogInfo(plcAgreement); |
| | | } |
| | | |
| | | if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) { |
| | | log.info("1.åéåç½®é¶"); |
| | | //åéåç½®0 |
| | | String send=HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéå æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) { |
| | | log.info("2.确认åç½®é¶"); |
| | | //åéåç½®0 |
| | | String send=HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("ä»»å¡å®æ æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("3ãä»»å¡å®æ"); |
| | | if(finishCount>0) {//æä»»å¡ |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ å¼å¸¸æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(4==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.glassDownLineOne(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("4ã人工æ¿èµ°"); |
| | | String send=HexUtil.intTo2ByteHex(4); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("人工æ¿èµ°å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | String send=HexUtil.intTo2ByteHex(4); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("人工æ¿èµ°å¼å¸¸ å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(2==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.loseMachineTask(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("2ãéå"); |
| | | String send=HexUtil.intTo2ByteHex(2); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("éåå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | }else{ |
| | | log.info("2ãå¼å¸¸éå"); |
| | | String send=HexUtil.intTo2ByteHex(2); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("å¼å¸¸éåå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if(3==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("3ã设å¤ä¸äººå·¥ç¹ç ´æ"); |
| | | String send=HexUtil.intTo2ByteHex(3); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("人工ç¹ç ´æå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | }else{ |
| | | //æ¯å¦èªå¨æ¸
é¤ç ´æ |
| | | log.info("3ãæ æç ´æ ï¼æ²¡ææ¾å°æ¤IDçç»çï¼"); |
| | | String send=HexUtil.intTo2ByteHex(3); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | //modbusTcp1.close(); |
| | | return; |
| | | } |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt()) |
| | | &&"å¼å·¥".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | Tasking tasking=taskingService.startMachineTask(machine); |
| | | if(tasking!=null){ |
| | | log.info("4ãåéä»»å¡ ä»»å¡æ°æ®ï¼{}, 设å¤ç¶æ:{}, ",machine,tasking); |
| | | String send= |
| | | HexUtil.intTo2ByteHex(1)+ |
| | | HexUtil.intTo2ByteHex(tasking.getTaskSequence().intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getWidth()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getLength()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(tasking.getThickness().intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getSilkScreenX()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getSilkScreenY()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(tasking.getIsSilkScreen());//æ¯å¦ä¸å°ï¼ 0ä¸å° 1ä¸ä¸å° |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéä»»å¡å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getGlassId()+"-"+ |
| | | tasking.getWidth()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getThickness()+"-"+ |
| | | tasking.getSilkScreenX()+"-"+ |
| | | tasking.getSilkScreenX()+"-"+ |
| | | tasking.getSilkScreenY()+"-"+ |
| | | tasking.getIsSilkScreen(); |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | return; |
| | | } |
| | | } |
| | | //} |
| | | |
| | | } catch (Exception e) { |
| | | log.info("交äºé»è¾é误"); |
| | | } |
| | | |
| | | modbusTcp1.close(); |
| | | //log.info("æ 坿§è¡çæ¡ä»¶"); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void SilkScreenTasks() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | Machine machine=machineMapper.selectById(14L); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObject.append("taskingList", taskingList); |
| | | jsonObject.append("machine", machine); |
| | | jsonObject.append("sendRecords", sendRecords); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("silkScreenTask"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // å°æåä¸ä¸ªæ¶æ¯è½¬æ¢ä¸ºæ´æ°ç±»åçå表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.md.controller; |
| | | |
| | | |
| | | import com.mes.md.entity.KBBTJPDrawingBP; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.service.KBBTJPDrawingBPService; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.utils.Result; |
| | |
| | | @RestController |
| | | @RequestMapping("/primitiveTask") |
| | | public class PrimitiveTaskController { |
| | | |
| | | @Autowired |
| | | private PrimitiveTaskService primitiveTaskService; |
| | | @Autowired |
| | | private KBBTJPDrawingBPService kBBTJPDrawingBPService; |
| | | |
| | | @ApiOperation("æ¥è¯¢å½å设å¤ï¼æªå®å·¥ç¶æç线ä¸ä»»å¡") |
| | | @PostMapping("/selectPrimitiveTask") |
| | | @ResponseBody |
| | |
| | | return Result.build(200,"æå",list); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢å½å æ åï¼å¯é¢åçä»»å¡ï¼å®¢æ·è¡¨ï¼") |
| | | @PostMapping("/findKBBTJPDrawingBP") |
| | | @ResponseBody |
| | | public Result findKBBTJPDrawingBP() { |
| | | List<KBBTJPDrawingBP> list =kBBTJPDrawingBPService.notReceiveKBBTJPDrawingBP(); |
| | | return Result.build(200,"æå",list); |
| | | } |
| | | |
| | | @ApiOperation("é¢åæç»æ ") |
| | | @PostMapping("/startOrStopPrimitiveTasking") |
| | | @ResponseBody |
| | | public Result startOrStopPrimitiveTasking(@RequestBody PrimitiveTask primitiveTask) { |
| | | int list =primitiveTaskService.startOrStopPrimitiveTasking(primitiveTask); |
| | | return Result.build(200,"æå",list); |
| | | } |
| | | @ApiOperation("æ ¹æ®æ¹æ¬¡å·è¿è¡æå¨æ¥å·¥") |
| | | @PostMapping("/updatePrimitiveTask") |
| | | @ResponseBody |
| | |
| | | |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.ProjectService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | public class TaskingController { |
| | | @Autowired |
| | | private TaskingService taskingService; |
| | | |
| | | // @ApiOperation("åæ¢æ¨¡å¼") |
| | | // @PostMapping("/updateLoadState") //åæ¢æ¨¡å¼" |
| | | // @ResponseBody |
| | | // public Result<Boolean> updateStatus(@RequestBody Integer state) { |
| | | // if(state == 1){ |
| | | // boolean result =taskingService.updateStatus(state); |
| | | // return Result.build(1,"å®å¶æ¨¡å¼",result); |
| | | // }else { |
| | | // boolean result =taskingService.updateStatus(state); |
| | | // return Result.build(0,"æ 忍¡å¼",result); |
| | | // } |
| | | // } |
| | | // @ApiOperation("ç¹å»æå设å¤") |
| | | // @PostMapping("/updateLoadStatus") //ç¹å»æåè®¾å¤ |
| | | // @ResponseBody |
| | | // public Result<Boolean> updateLoadStatus(@RequestBody Integer state) { |
| | | // if(state == 1){ |
| | | // boolean result =taskingService.updateLoadState(state); |
| | | // return Result.build(1,"æå",result); |
| | | // }else { |
| | | // boolean result =taskingService.updateLoadState(state); |
| | | // return Result.build(0,"æå",result); |
| | | // } |
| | | // } |
| | | // @ApiOperation("ç¹å»ç ´æ") |
| | | // @PostMapping("/updateDamage") //æåä¸çä»»å¡ |
| | | // @ResponseBody |
| | | // public Result<Tasking> updateDamage(@RequestBody Tasking tasking) { |
| | | // |
| | | // boolean result =taskingService.updateDamage(tasking); |
| | | // return Result.build(1,"å®å¶æ¨¡å¼",null); |
| | | // |
| | | // |
| | | // } |
| | | // @ApiOperation("æ¥è¯¢å½å模å¼è¿å»çç»ç") |
| | | // @PostMapping("/selectTasking") //æåä¸çä»»å¡ |
| | | // @ResponseBody |
| | | // public Result<List<Tasking>> selectTasking() { |
| | | // |
| | | // List<Tasking> tasking =taskingService.selectTasking(); |
| | | // return Result.build(1,"å®å¶æ¨¡å¼",tasking); |
| | | // } |
| | | |
| | | |
| | | @Autowired |
| | | private ProjectService projectService; |
| | | @Autowired |
| | | private MachineMapper machineMapper; |
| | | |
| | | @ApiOperation("æ¥è¯¢å½å设å¤ï¼æªå®å·¥ç¶æç线ä¸ä»»å¡") |
| | | @PostMapping("/findMachineTask") |
| | |
| | | } |
| | | |
| | | @ApiOperation("ä¿®æ¹å½åè®¾å¤ ãä¸çº¿ã") |
| | | @PostMapping("/glassTopLineList") |
| | | @ResponseBody |
| | | public Result glassTopLineList(@RequestBody List<Tasking> taskingList) { |
| | | int count =taskingService.glassTopLine(taskingList); |
| | | return Result.build(200,"ä¿®æ¹æåï¼"+count,count); |
| | | } |
| | | |
| | | @ApiOperation("ä¿®æ¹å½åè®¾å¤ ãä¸çº¿ã") |
| | | @PostMapping("/glassTopLine") |
| | | @ResponseBody |
| | | public Result glassTopLine(@RequestBody List<Tasking> taskingList) { |
| | | int count =taskingService.glassTopLine(taskingList); |
| | | public Result glassTopLine(@RequestBody Tasking tasking) { |
| | | int count =taskingService.glassTopLine(tasking); |
| | | return Result.build(200,"ä¿®æ¹æåï¼"+count,count); |
| | | } |
| | | |
| | |
| | | int count =taskingService.glassDownLine(tasking); |
| | | return Result.build(200,"ä¿®æ¹æåï¼"+count,count); |
| | | } |
| | | |
| | | @ApiOperation("ç»ç ãä¸çº¿ã") |
| | | @PostMapping("/glassAgainTopLine") |
| | | @ResponseBody |
| | | public Result glassAgainTopLine(@RequestBody Tasking tasking) { |
| | | int count =taskingService.stopTasking(tasking); |
| | | return Result.build(200,"ä¿®æ¹æåï¼"+count,count); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.md.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * åå§ä»»å¡è¡¨ |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-08-28 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName(value = "KBB_T_JPDrawing_BP") |
| | | public class KBBTJPDrawingBP implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * åå§ä»»å¡è¡¨ä¸»é®(å®¢æ·æä¾æ ·æ¬) |
| | | */ |
| | | @TableId(value = "ID", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¹æ¬¡å· |
| | | */ |
| | | private String batchNumber; |
| | | |
| | | /** |
| | | * æ«ç ID (å¯ä¸)ãæ¿ä»¶IDã |
| | | */ |
| | | private String scanId; |
| | | |
| | | /** |
| | | * ç¨åºID |
| | | */ |
| | | private String programId; |
| | | |
| | | /** |
| | | * ä»»å¡ç±»åãå®å¶/æ åã |
| | | */ |
| | | private String taskType; |
| | | |
| | | /** |
| | | * ä»»å¡é¡ºåº |
| | | */ |
| | | private Integer taskSequence; |
| | | |
| | | /** |
| | | * 任塿°é |
| | | */ |
| | | private Integer taskQuantity; |
| | | |
| | | /** |
| | | * é¿ |
| | | */ |
| | | private Double length; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * å |
| | | */ |
| | | private Double thickness; |
| | | |
| | | // /** |
| | | // * ç¹è¶å¾çº¸ |
| | | // */ |
| | | // private String drawingGlue; |
| | | |
| | | /** |
| | | * ææ å¾çº¸ |
| | | */ |
| | | private String drawingMarking; |
| | | |
| | | /** |
| | | * ä¸å°X |
| | | */ |
| | | private Double silkScreenX; |
| | | |
| | | /** |
| | | * ä¸å°Y |
| | | */ |
| | | private Double silkScreenY; |
| | | |
| | | // /** |
| | | // * æ¯å¦ææ |
| | | // */ |
| | | // private Integer isMarking; |
| | | // |
| | | // /** |
| | | // * æ¯å¦ä¸å° |
| | | // */ |
| | | // private Integer isSilkScreen; |
| | | |
| | | /** |
| | | * æ¥å·¥æ°é |
| | | */ |
| | | private Integer reportCount; |
| | | |
| | | /** |
| | | * Rè§1-1(å³ä¸è§) |
| | | */ |
| | | private Double r_1_1; |
| | | |
| | | /** |
| | | * Rè§1-2(å³ä¸è§) |
| | | */ |
| | | private Double r_1_2; |
| | | |
| | | /** |
| | | * Rè§2-1(å³ä¸è§) |
| | | */ |
| | | private Double r_2_1; |
| | | |
| | | /** |
| | | * Rè§2-2(å³ä¸è§) |
| | | */ |
| | | private Double r_2_2; |
| | | |
| | | /** |
| | | * Rè§3-1(å·¦ä¸è§) |
| | | */ |
| | | private Double r_3_1; |
| | | |
| | | /** |
| | | * Rè§3-2(å·¦ä¸è§) |
| | | */ |
| | | private Double r_3_2; |
| | | |
| | | /** |
| | | * Rè§4-1(å·¦ä¸è§) |
| | | */ |
| | | private Double r_4_1; |
| | | |
| | | /** |
| | | * Rè§4-2(å·¦ä¸è§) |
| | | */ |
| | | private Double r_4_2; |
| | | |
| | | /** |
| | | * æ¯å¦é¢å |
| | | */ |
| | | private Integer isWorking; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @TableField(value = "CreateDate") |
| | | private Date createDate; |
| | | } |
| | |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * æ¯å¦å¯ç¨ |
| | | */ |
| | | private int isStart; |
| | | |
| | | } |
| | |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | /** |
| | | * æ¯å¦è¾åºåæ°æ¥å¿ |
| | | */ |
| | | private int isLog; |
| | | |
| | | /** |
| | | * 仿¥å·¥ä½æ¬¡æ° |
| | | */ |
| | | private Integer todayCount; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.md.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | |
| | | * æ¥å·¥æ°é |
| | | */ |
| | | private Integer reportCount; |
| | | |
| | | /** |
| | | * Rè§1-1(å³ä¸è§) |
| | | */ |
| | | private Double r_1_1; |
| | | |
| | | /** |
| | | * Rè§1-2(å³ä¸è§) |
| | | */ |
| | | private Double r_1_2; |
| | | |
| | | /** |
| | | * Rè§2-1(å³ä¸è§) |
| | | */ |
| | | private Double r_2_1; |
| | | |
| | | /** |
| | | * Rè§2-2(å³ä¸è§) |
| | | */ |
| | | private Double r_2_2; |
| | | |
| | | /** |
| | | * Rè§3-1(å·¦ä¸è§) |
| | | */ |
| | | private Double r_3_1; |
| | | |
| | | /** |
| | | * Rè§3-2(å·¦ä¸è§) |
| | | */ |
| | | private Double r_3_2; |
| | | |
| | | /** |
| | | * Rè§4-1(å·¦ä¸è§) |
| | | */ |
| | | private Double r_4_1; |
| | | |
| | | /** |
| | | * Rè§4-2(å·¦ä¸è§) |
| | | */ |
| | | private Double r_4_2; |
| | | |
| | | /** |
| | | * æ¯å¦å·¥ä½ |
| | | */ |
| | | private Integer isWorking; |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * é¢åæ¶é´ |
| | | */ |
| | | private Date beginTime; |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * ç»ææ¶ ä»»å¡æ§è¡ç¶æãçå¾
/å·¥ä½/宿ã |
| | | */ |
| | | private String workState; |
| | | |
| | | /** |
| | | * ç»ææ¶ æå¨å·¥èº id (线路ID) |
| | | */ |
| | | private Long lineConfigurationId; |
| | | |
| | | /** |
| | | * ç»ææ¶ çäº§ç¶æã线ä¸/线ä¸ã |
| | | */ |
| | | private String state; |
| | | |
| | | /** |
| | | * ç»ææ¶ ç»çç¶æãæ£å¸¸/ç ´æã |
| | | */ |
| | | private String glassState; |
| | | |
| | | /** |
| | | * é¢å线路 |
| | | */ |
| | | private Integer getLine; |
| | | |
| | | } |
| | |
| | | */ |
| | | private String glassState; |
| | | |
| | | /** |
| | | * Rè§1-1(å³ä¸è§) |
| | | */ |
| | | private Double r_1_1; |
| | | |
| | | /** |
| | | * Rè§1-2(å³ä¸è§) |
| | | */ |
| | | private Double r_1_2; |
| | | |
| | | /** |
| | | * Rè§2-1(å³ä¸è§) |
| | | */ |
| | | private Double r_2_1; |
| | | |
| | | /** |
| | | * Rè§2-2(å³ä¸è§) |
| | | */ |
| | | private Double r_2_2; |
| | | |
| | | /** |
| | | * Rè§3-1(å·¦ä¸è§) |
| | | */ |
| | | private Double r_3_1; |
| | | |
| | | /** |
| | | * Rè§3-2(å·¦ä¸è§) |
| | | */ |
| | | private Double r_3_2; |
| | | |
| | | /** |
| | | * Rè§4-1(å·¦ä¸è§) |
| | | */ |
| | | private Double r_4_1; |
| | | |
| | | /** |
| | | * Rè§4-2(å·¦ä¸è§) |
| | | */ |
| | | private Double r_4_2; |
| | | |
| | | /** |
| | | * æ»è¡¨ID |
| | | */ |
| | | private Long primitiveTaskId; |
| | | } |
New file |
| | |
| | | package com.mes.md.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.md.entity.KBBTJPDrawingBP; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | |
| | | /** |
| | | * <p> |
| | | * åå§ä»»å¡è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-08-28 |
| | | */ |
| | | @DS("salve_JomooKBB") |
| | | public interface KBBTJPDrawingBPMapper extends MPJBaseMapper<KBBTJPDrawingBP> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.md.service; |
| | | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.md.entity.EdgeGrindingLog; |
| | | import com.mes.md.entity.KBBTJPDrawingBP; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.Tasking; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 磨边æºè®¾å¤äº¤äºè®°å½è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-08-28 |
| | | */ |
| | | public interface KBBTJPDrawingBPService extends MPJBaseService<KBBTJPDrawingBP> { |
| | | |
| | | |
| | | /** |
| | | * @param scanId å®¢æ·æ°æ®ä¸ æ¥è¯¢æ«ç ID |
| | | * @return |
| | | */ |
| | | List<KBBTJPDrawingBP> findScanIdKBBTJPDrawingBP(String scanId); |
| | | |
| | | /** |
| | | * @param id |
| | | * @param getLine |
| | | * @return |
| | | */ |
| | | int receiveKBBTJPDrawingBP(Long id,Integer getLine); |
| | | |
| | | |
| | | /** |
| | | * 客æ·è¡¨æªé¢åçãæ åãä»»å¡ |
| | | * @return |
| | | */ |
| | | List<KBBTJPDrawingBP> notReceiveKBBTJPDrawingBP(); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param kBBTJPDrawingBP |
| | | * @return |
| | | */ |
| | | PrimitiveTask convertListPrimitiveTask(KBBTJPDrawingBP kBBTJPDrawingBP); |
| | | |
| | | /** |
| | | * @param kBBTJPDrawingBP |
| | | * @param LineConfigurationId |
| | | * @return |
| | | */ |
| | | Tasking convertListTasking(KBBTJPDrawingBP kBBTJPDrawingBP,Long LineConfigurationId); |
| | | } |
| | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.md.entity.Line; |
| | | import com.mes.md.entity.LineConfiguration; |
| | | import com.mes.md.entity.Machine; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-08-28 |
| | | */ |
| | | public interface LineConfigurationService extends MPJBaseService<LineConfiguration> { |
| | | |
| | | LineConfiguration machineLineConfiguration(Machine machine); |
| | | } |
| | |
| | | package com.mes.md.service; |
| | | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.md.entity.Tasking; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @since 2024-08-28 |
| | | */ |
| | | public interface PrimitiveTaskService extends MPJBaseService<PrimitiveTask> { |
| | | |
| | | Tasking convertListTasking(PrimitiveTask primitiveTask, Long LineConfigurationId); |
| | | /** |
| | | *æ¥è¯¢æ åæªå®æçä»»å¡ |
| | | * @return |
| | | */ |
| | | List<PrimitiveTask> findPrimitiveTaskNotFinish(); |
| | | |
| | | /** |
| | | *æ¥è¯¢æ åæ¤çº¿è·¯å·²é¢åçä»»å¡ |
| | | * @return |
| | | */ |
| | | List<PrimitiveTask> findPrimitiveTasking(Machine machine,Long line); |
| | | /** |
| | | * æ åï¼é¢åä»»å¡ /ç»æä»»å¡ |
| | | * @return |
| | | */ |
| | | int startOrStopPrimitiveTasking(PrimitiveTask primitiveTask); |
| | | |
| | | /** |
| | | *æ«ç æ´æ°å®å¶ç»ççæ¥å·¥æ°é |
| | | * @return |
| | |
| | | package com.mes.md.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.md.entity.KBBTJPDrawingBP; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.Project; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.md.mapper.KBBTJPDrawingBPMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface ProjectService extends MPJBaseService<Project> { |
| | | |
| | | //导å
¥å·¥ç¨ |
| | | boolean insertProjectStandard(); |
| | | |
| | | //导å
¥å·¥ç¨-æ«ç ID |
| | | int insertProjectCustomization(String scan_id); |
| | | } |
| | |
| | | * @since 2024-08-28 |
| | | */ |
| | | public interface TaskingService extends MPJBaseService<Tasking> { |
| | | // /** |
| | | // * æ´æ¹ä¸çæ¨¡å¼ |
| | | // * @return boolean |
| | | // */ |
| | | // boolean updateStatus(Integer state); |
| | | // /** |
| | | // *æ´æ¹èæºç¶æ |
| | | // * @return boolean |
| | | // */ |
| | | // boolean updateLoadState(Integer state); |
| | | // /** |
| | | // * ç¹å»ç ´æ |
| | | // * @return boolean |
| | | // */ |
| | | // boolean updateDamage(Tasking tasking); |
| | | // /** |
| | | // * æ¥è¯¢å½å模å¼è¿å»çç»ç |
| | | // * @return List<Tasking> |
| | | // */ |
| | | // List<Tasking> selectTasking(); |
| | | // /** |
| | | // * æ ¹æ®ä¸åå·¥èºæ¥è¯¢å³å°ä¸ççæ°æ® |
| | | // * @return List<Tasking> |
| | | // */ |
| | | // Tasking selectTasking(Tasking tasking); |
| | | |
| | | /** |
| | | * å®å¶æ¨¡å¼ä¸å°æ«ç åºæ¥idè·åæç»çæ°æ®èµå¼ç»å½åææ°çglassId |
| | | * @return List<Tasking> |
| | |
| | | boolean updateTaskingState(Tasking tasking); |
| | | |
| | | |
| | | /** |
| | | * @param machine |
| | | * æ«ç è®¾å¤æ·»å ä»»å¡ |
| | | * @return |
| | | */ |
| | | int scanMachineAdd(Machine machine, String scanId); |
| | | |
| | | |
| | | /** |
| | | * @param machine |
| | |
| | | * @return |
| | | */ |
| | | List<Tasking> findMachineWorkStateTask(Machine machine, String workState); |
| | | |
| | | /** |
| | | * |
| | | * æ¥è¯¢çº¿ä¸çç»ç |
| | | * @return |
| | | */ |
| | | List<Tasking> findDownLineTask(); |
| | | /** |
| | | * @param machine |
| | | * å½åè®¾å¤æ è®°æ£å¨å·¥ä½ï¼çº¿ä¸çå¾
çä»»å¡ç¬¬ä¸æ¡ (线ä¸/æ£å¸¸) |
| | | * @return |
| | | */ |
| | | Tasking startMachineTask(Machine machine); |
| | | |
| | | Tasking startMachineTask(Machine machine, String glassId); |
| | | |
| | | /** |
| | | * @param machine |
| | | * å½åè®¾å¤ çåå
¨é¨å·¥åº å°æ¬å·¥åºç scan_id ä»»å¡ç¶æä¸ºæ£å¨å·¥ä½ |
| | | * @return |
| | | */ |
| | | Tasking startScanIdMachineTask(Machine machine, String scan_id); |
| | | /** |
| | | * @param machine |
| | | * å½åè®¾å¤æ è®°å®æï¼æ£å¨å·¥ä½ç第ä¸ä¸ªä»»å¡ (线ä¸/æ£å¸¸) è¿å宿æ°é |
| | | * @return |
| | | */ |
| | | int finishMachineTask(Machine machine); |
| | | |
| | | int finishMachineTask(Machine machine,Integer taskSequence); |
| | | /** |
| | | * @param machine |
| | | * å½åè®¾å¤æ è®°å¤±è´¥ï¼æ£å¨å·¥ä½çæåä¸ä¸ªä»»å¡ (线ä¸/æ£å¸¸) è¿å失败æ°é |
| | |
| | | */ |
| | | int damagedTask(Tasking tasking); |
| | | /** |
| | | * @param machine |
| | | * ä¿®æ¹ç¶æ ãä¸çº¿ã |
| | | * @return |
| | | */ |
| | | int glassDownLineOne(Machine machine); |
| | | /** |
| | | * @param tasking |
| | | * ä¿®æ¹ç¶æ ãä¸çº¿ã |
| | | * @return |
| | |
| | | * @return |
| | | */ |
| | | int glassTopLine(List<Tasking> taskingList); |
| | | |
| | | /** |
| | | * @param tasking |
| | | * æ¹éä¿®æ¹ç¶æ ãä¸çº¿ã |
| | | * @return |
| | | */ |
| | | int glassTopLine(Tasking tasking); |
| | | |
| | | List<Tasking> findMachineTaskID(Machine machine,String scan_id); |
| | | /** |
| | | * @param tasking |
| | | * ä»»å¡ç»æ |
| | | * @return |
| | | */ |
| | | int stopTasking(Tasking tasking); |
| | | } |
New file |
| | |
| | | package com.mes.md.service.impl; |
| | | |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.md.entity.EdgeGrindingLog; |
| | | import com.mes.md.entity.KBBTJPDrawingBP; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.EdgeGrindingLogMapper; |
| | | import com.mes.md.mapper.KBBTJPDrawingBPMapper; |
| | | import com.mes.md.mapper.PrimitiveTaskMapper; |
| | | import com.mes.md.service.EdgeGrindingLogService; |
| | | import com.mes.md.service.KBBTJPDrawingBPService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 磨边æºè®¾å¤äº¤äºè®°å½è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-08-28 |
| | | */ |
| | | @Service |
| | | public class KBBTJPDrawingBPServiceImpl extends MPJBaseServiceImpl<KBBTJPDrawingBPMapper, KBBTJPDrawingBP> implements KBBTJPDrawingBPService { |
| | | |
| | | @Autowired |
| | | KBBTJPDrawingBPService kBBTJPDrawingBPService; |
| | | @Autowired |
| | | PrimitiveTaskMapper primitiveTaskMapper; |
| | | |
| | | /** |
| | | * @param scanId å®¢æ·æ°æ®ä¸ æ¥è¯¢æ«ç ID |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<KBBTJPDrawingBP> findScanIdKBBTJPDrawingBP(String scanId){ |
| | | List<KBBTJPDrawingBP> kBBTJPDrawingBP=baseMapper.selectJoinList(KBBTJPDrawingBP.class,new MPJLambdaWrapper<KBBTJPDrawingBP>() |
| | | .selectAll(KBBTJPDrawingBP.class) |
| | | .eq(KBBTJPDrawingBP::getScanId,scanId) |
| | | .orderByDesc(KBBTJPDrawingBP::getCreateDate) |
| | | .orderByAsc(KBBTJPDrawingBP::getTaskSequence)); |
| | | return kBBTJPDrawingBP; |
| | | } |
| | | |
| | | /** |
| | | * @param id |
| | | * @param getLine |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int receiveKBBTJPDrawingBP(Long id,Integer getLine){ |
| | | KBBTJPDrawingBP addKBBTJPDrawingBP=baseMapper.selectById(id); |
| | | addKBBTJPDrawingBP.setIsWorking(1); |
| | | PrimitiveTask primitiveTask= kBBTJPDrawingBPService.convertListPrimitiveTask(addKBBTJPDrawingBP); |
| | | primitiveTask.setIsWorking(addKBBTJPDrawingBP.getIsWorking()); |
| | | primitiveTask.setGetLine(getLine); |
| | | if(primitiveTaskMapper.insert(primitiveTask)>0){ |
| | | return baseMapper.updateById(addKBBTJPDrawingBP); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | | * 客æ·è¡¨æªé¢åçãæ åãä»»å¡ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<KBBTJPDrawingBP> notReceiveKBBTJPDrawingBP(){ |
| | | List<KBBTJPDrawingBP> kBBTJPDrawingBP=baseMapper.selectJoinList(KBBTJPDrawingBP.class,new MPJLambdaWrapper<KBBTJPDrawingBP>() |
| | | .selectAll(KBBTJPDrawingBP.class) |
| | | .eq(KBBTJPDrawingBP::getTaskType,"æ å") |
| | | .orderByDesc(KBBTJPDrawingBP::getCreateDate) |
| | | .orderByAsc(KBBTJPDrawingBP::getTaskSequence)); |
| | | return kBBTJPDrawingBP; |
| | | } |
| | | |
| | | //客æ·è¡¨æ ¼è½¬ æä»¬çæ°æ® |
| | | @Override |
| | | public PrimitiveTask convertListPrimitiveTask(KBBTJPDrawingBP kBBTJPDrawingBP) { |
| | | try { |
| | | PrimitiveTask primitiveTask=new PrimitiveTask(); |
| | | primitiveTask.setScanId(kBBTJPDrawingBP.getScanId()); |
| | | primitiveTask.setProgramId(kBBTJPDrawingBP.getProgramId()); |
| | | primitiveTask.setBatchNumber(kBBTJPDrawingBP.getBatchNumber()==null?"":kBBTJPDrawingBP.getBatchNumber()); |
| | | primitiveTask.setTaskType(kBBTJPDrawingBP.getTaskType()); |
| | | primitiveTask.setLength(kBBTJPDrawingBP.getLength()); |
| | | primitiveTask.setWidth(kBBTJPDrawingBP.getWidth()); |
| | | primitiveTask.setThickness(kBBTJPDrawingBP.getThickness()); |
| | | primitiveTask.setDrawingMarking(kBBTJPDrawingBP.getDrawingMarking()); |
| | | primitiveTask.setIsMarking((kBBTJPDrawingBP.getDrawingMarking()==null||kBBTJPDrawingBP.getDrawingMarking().isEmpty())?0:1);//æ¯å¦ææ ï¼0䏿æ 1ææ |
| | | primitiveTask.setIsSilkScreen(((kBBTJPDrawingBP.getSilkScreenX()==null||kBBTJPDrawingBP.getSilkScreenY()==null||kBBTJPDrawingBP.getSilkScreenX()==0||kBBTJPDrawingBP.getSilkScreenY()==0)?1:0)); |
| | | primitiveTask.setSilkScreenX(kBBTJPDrawingBP.getSilkScreenX()==null?0:kBBTJPDrawingBP.getSilkScreenX()); |
| | | primitiveTask.setSilkScreenY(kBBTJPDrawingBP.getSilkScreenY()==null?0:kBBTJPDrawingBP.getSilkScreenY()); |
| | | primitiveTask.setTaskSequence(kBBTJPDrawingBP.getTaskSequence()); |
| | | primitiveTask.setTaskQuantity(kBBTJPDrawingBP.getTaskQuantity()); |
| | | primitiveTask.setR_1_1(kBBTJPDrawingBP.getR_1_1()==null?0:kBBTJPDrawingBP.getR_1_1()); |
| | | primitiveTask.setR_1_2(kBBTJPDrawingBP.getR_1_2()==null?0:kBBTJPDrawingBP.getR_1_2()); |
| | | primitiveTask.setR_2_1(kBBTJPDrawingBP.getR_2_1()==null?0:kBBTJPDrawingBP.getR_2_1()); |
| | | primitiveTask.setR_2_2(kBBTJPDrawingBP.getR_2_2()==null?0:kBBTJPDrawingBP.getR_2_2()); |
| | | primitiveTask.setR_3_1(kBBTJPDrawingBP.getR_3_1()==null?0:kBBTJPDrawingBP.getR_3_1()); |
| | | primitiveTask.setR_3_2(kBBTJPDrawingBP.getR_3_2()==null?0:kBBTJPDrawingBP.getR_3_2()); |
| | | primitiveTask.setR_4_1(kBBTJPDrawingBP.getR_4_1()==null?0:kBBTJPDrawingBP.getR_4_1()); |
| | | primitiveTask.setR_4_2(kBBTJPDrawingBP.getR_4_2()==null?0:kBBTJPDrawingBP.getR_4_2()); |
| | | primitiveTask.setCreateTime(new Date()); |
| | | return primitiveTask; |
| | | }catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | //客æ·è¡¨æ ¼è½¬ æä»¬çä»»å¡è¡¨ |
| | | @Override |
| | | public Tasking convertListTasking(KBBTJPDrawingBP kBBTJPDrawingBP,Long LineConfigurationId) { |
| | | |
| | | try { |
| | | Tasking tasking=new Tasking(); |
| | | tasking.setLineConfigurationId(LineConfigurationId); |
| | | tasking.setState("线ä¸"); |
| | | tasking.setWorkState("çå¾
"); |
| | | tasking.setGlassState("æ£å¸¸"); |
| | | tasking.setScanId(kBBTJPDrawingBP.getScanId()); |
| | | tasking.setProgramId(kBBTJPDrawingBP.getProgramId()); |
| | | tasking.setBatchNumber(kBBTJPDrawingBP.getBatchNumber()==null?"":kBBTJPDrawingBP.getBatchNumber()); |
| | | tasking.setTaskType(kBBTJPDrawingBP.getTaskType()); |
| | | tasking.setLength(kBBTJPDrawingBP.getLength()); |
| | | tasking.setWidth(kBBTJPDrawingBP.getWidth()); |
| | | tasking.setThickness(kBBTJPDrawingBP.getThickness()); |
| | | tasking.setIsMarking((kBBTJPDrawingBP.getDrawingMarking()==null||kBBTJPDrawingBP.getDrawingMarking().isEmpty())?0:1);//æ¯å¦ææ ï¼0䏿æ 1ææ |
| | | tasking.setDrawingMarking(kBBTJPDrawingBP.getDrawingMarking()); |
| | | tasking.setIsSilkScreen(((kBBTJPDrawingBP.getSilkScreenX()==null||kBBTJPDrawingBP.getSilkScreenY()==null||kBBTJPDrawingBP.getSilkScreenX()==0||kBBTJPDrawingBP.getSilkScreenY()==0)?1:0));//æ¯å¦ææ ï¼1ä¸å° 0ä¸ä¸å° |
| | | tasking.setSilkScreenX(kBBTJPDrawingBP.getSilkScreenX()==null?0:kBBTJPDrawingBP.getSilkScreenX()); |
| | | tasking.setSilkScreenY(kBBTJPDrawingBP.getSilkScreenY()==null?0:kBBTJPDrawingBP.getSilkScreenY()); |
| | | tasking.setTaskSequence(kBBTJPDrawingBP.getTaskSequence()); |
| | | tasking.setTaskQuantity(kBBTJPDrawingBP.getTaskQuantity()); |
| | | tasking.setR_1_1(kBBTJPDrawingBP.getR_1_1()==null?0:kBBTJPDrawingBP.getR_1_1()); |
| | | tasking.setR_1_2(kBBTJPDrawingBP.getR_1_2()==null?0:kBBTJPDrawingBP.getR_1_2()); |
| | | tasking.setR_2_1(kBBTJPDrawingBP.getR_2_1()==null?0:kBBTJPDrawingBP.getR_2_1()); |
| | | tasking.setR_2_2(kBBTJPDrawingBP.getR_2_2()==null?0:kBBTJPDrawingBP.getR_2_2()); |
| | | tasking.setR_3_1(kBBTJPDrawingBP.getR_3_1()==null?0:kBBTJPDrawingBP.getR_3_1()); |
| | | tasking.setR_3_2(kBBTJPDrawingBP.getR_3_2()==null?0:kBBTJPDrawingBP.getR_3_2()); |
| | | tasking.setR_4_1(kBBTJPDrawingBP.getR_4_1()==null?0:kBBTJPDrawingBP.getR_4_1()); |
| | | tasking.setR_4_2(kBBTJPDrawingBP.getR_4_2()==null?0:kBBTJPDrawingBP.getR_4_2()); |
| | | return tasking; |
| | | }catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.mes.md.service.impl; |
| | | |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.md.entity.Line; |
| | | import com.mes.md.entity.LineConfiguration; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.mapper.LineConfigurationMapper; |
| | | import com.mes.md.mapper.LineMapper; |
| | | import com.mes.md.service.LineConfigurationService; |
| | | import com.mes.md.service.LineService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class LineConfigurationServiceImpl extends MPJBaseServiceImpl<LineConfigurationMapper, LineConfiguration> implements LineConfigurationService { |
| | | |
| | | @Override |
| | | public LineConfiguration machineLineConfiguration(Machine machine){ |
| | | List<LineConfiguration> machineLineConfiguration=baseMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>() |
| | | .selectAll(LineConfiguration.class) |
| | | .eq(LineConfiguration::getMachineId,machine.getId())); |
| | | if(machineLineConfiguration.isEmpty()){ |
| | | return null; |
| | | } |
| | | return machineLineConfiguration.get(0); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.md.entity.*; |
| | | import com.mes.md.mapper.PrimitiveTaskMapper; |
| | | import com.mes.md.service.KBBTJPDrawingBPService; |
| | | import com.mes.md.service.LineConfigurationService; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class PrimitiveTaskServiceImpl extends MPJBaseServiceImpl<PrimitiveTaskMapper, PrimitiveTask> implements PrimitiveTaskService { |
| | | |
| | | @Autowired |
| | | LineConfigurationService lineConfigurationService; |
| | | |
| | | @Autowired |
| | | KBBTJPDrawingBPService kBBTJPDrawingBPService; |
| | | |
| | | /** |
| | | *æ¥è¯¢æ åæªé¢åçä»»å¡ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PrimitiveTask> findPrimitiveTaskNotFinish(){ |
| | | return baseMapper.selectList(new QueryWrapper<PrimitiveTask>().lambda() |
| | | .eq(PrimitiveTask::getIsWorking,0) |
| | | .eq(PrimitiveTask::getTaskType,"æ å") |
| | | .orderByAsc(PrimitiveTask::getCreateTime) |
| | | .orderByAsc(PrimitiveTask::getTaskSequence)); |
| | | } |
| | | |
| | | /** |
| | | *æ¥è¯¢æ åæ¤çº¿è·¯å·²é¢åçä»»å¡ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PrimitiveTask> findPrimitiveTasking(Machine machine,Long line){ |
| | | return baseMapper.selectList(new MPJLambdaWrapper<PrimitiveTask>() |
| | | .eq(PrimitiveTask::getIsWorking,1) |
| | | .eq(PrimitiveTask::getGetLine,line) |
| | | .eq(PrimitiveTask::getTaskType,"æ å") |
| | | .orderByAsc(PrimitiveTask::getBeginTime)); |
| | | } |
| | | |
| | | /** |
| | | * æ åï¼é¢åä»»å¡ /ç»æä»»å¡ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int startOrStopPrimitiveTasking(PrimitiveTask primitiveTask){ |
| | | if (primitiveTask.getIsWorking()==1){//é¢å |
| | | return kBBTJPDrawingBPService.receiveKBBTJPDrawingBP(primitiveTask.getId(),primitiveTask.getGetLine()); |
| | | }else if (primitiveTask.getIsWorking()==2){//å®å·¥ |
| | | PrimitiveTask thisPrimitiveTask=baseMapper.selectById(primitiveTask); |
| | | thisPrimitiveTask.setIsWorking(primitiveTask.getIsWorking()); |
| | | thisPrimitiveTask.setEndTime(new Date()); |
| | | return baseMapper.updateById(thisPrimitiveTask); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateReportCount(String scanId) { |
| | |
| | | //æ¥è¯¢æ¥å·¥æ°æ® |
| | | return list(new QueryWrapper<>(task)) ; |
| | | } |
| | | |
| | | |
| | | //客æ·è¡¨æ ¼è½¬ æä»¬çä»»å¡è¡¨ |
| | | @Override |
| | | public Tasking convertListTasking(PrimitiveTask primitiveTask, Long LineConfigurationId) { |
| | | try { |
| | | Tasking tasking=new Tasking(); |
| | | tasking.setLineConfigurationId(LineConfigurationId); |
| | | tasking.setState("线ä¸"); |
| | | tasking.setWorkState("çå¾
"); |
| | | tasking.setGlassState("æ£å¸¸"); |
| | | tasking.setScanId(primitiveTask.getScanId()); |
| | | tasking.setProgramId(primitiveTask.getProgramId()); |
| | | tasking.setBatchNumber(primitiveTask.getBatchNumber()==null?"":primitiveTask.getBatchNumber()); |
| | | tasking.setTaskType(primitiveTask.getTaskType()); |
| | | tasking.setLength(primitiveTask.getLength()); |
| | | tasking.setWidth(primitiveTask.getWidth()); |
| | | tasking.setThickness(primitiveTask.getThickness()); |
| | | tasking.setIsMarking((primitiveTask.getDrawingMarking()==null||primitiveTask.getDrawingMarking().isEmpty())?0:1); |
| | | tasking.setDrawingMarking(primitiveTask.getDrawingMarking()); |
| | | tasking.setIsSilkScreen(((primitiveTask.getSilkScreenX()==null||primitiveTask.getSilkScreenY()==null||primitiveTask.getSilkScreenX()==0||primitiveTask.getSilkScreenY()==0)?1:0)); |
| | | tasking.setSilkScreenX(primitiveTask.getSilkScreenX()==null?0:primitiveTask.getSilkScreenX()); |
| | | tasking.setSilkScreenY(primitiveTask.getSilkScreenY()==null?0:primitiveTask.getSilkScreenY()); |
| | | tasking.setTaskSequence(primitiveTask.getTaskSequence()); |
| | | tasking.setTaskQuantity(primitiveTask.getTaskQuantity()); |
| | | tasking.setR_1_1(primitiveTask.getR_1_1()==null?0:primitiveTask.getR_1_1()); |
| | | tasking.setR_1_2(primitiveTask.getR_1_2()==null?0:primitiveTask.getR_1_2()); |
| | | tasking.setR_2_1(primitiveTask.getR_2_1()==null?0:primitiveTask.getR_2_1()); |
| | | tasking.setR_2_2(primitiveTask.getR_2_2()==null?0:primitiveTask.getR_2_2()); |
| | | tasking.setR_3_1(primitiveTask.getR_3_1()==null?0:primitiveTask.getR_3_1()); |
| | | tasking.setR_3_2(primitiveTask.getR_3_2()==null?0:primitiveTask.getR_3_2()); |
| | | tasking.setR_4_1(primitiveTask.getR_4_1()==null?0:primitiveTask.getR_4_1()); |
| | | tasking.setR_4_2(primitiveTask.getR_4_2()==null?0:primitiveTask.getR_4_2()); |
| | | return tasking; |
| | | }catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.mes.md.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.mes.md.entity.Project; |
| | | import com.mes.md.mapper.ProjectMapper; |
| | | import com.mes.md.service.ProjectService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.md.entity.*; |
| | | import com.mes.md.mapper.*; |
| | | import com.mes.md.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class ProjectServiceImpl extends MPJBaseServiceImpl<ProjectMapper, Project> implements ProjectService { |
| | | |
| | | @Autowired |
| | | KBBTJPDrawingBPMapper kBBTJPDrawingBPMapper; |
| | | |
| | | @Autowired |
| | | PrimitiveTaskService primitiveTaskService; |
| | | @Autowired |
| | | TaskingService taskingService; |
| | | |
| | | @Autowired |
| | | PrimitiveTaskMapper primitiveTaskMapper; |
| | | @Autowired |
| | | TaskingMapper taskingMapper; |
| | | |
| | | @Autowired |
| | | KBBTJPDrawingBPService kBBTJPDrawingBPService; |
| | | |
| | | @Autowired |
| | | LineConfigurationService lineConfigurationService; |
| | | |
| | | //æ å导å
¥å·¥ç¨ æ°æ® |
| | | @Override |
| | | public boolean insertProjectStandard() { |
| | | // |
| | | try { |
| | | //è·åææ°æ¬å°æªæ·»å çæ°æ® |
| | | List<KBBTJPDrawingBP> kBBTJPDrawingBP=kBBTJPDrawingBPMapper.selectJoinList(KBBTJPDrawingBP.class,new MPJLambdaWrapper<KBBTJPDrawingBP>() |
| | | .selectAll(KBBTJPDrawingBP.class) |
| | | .eq(KBBTJPDrawingBP::getIsWorking,0) |
| | | .eq(KBBTJPDrawingBP::getTaskType,"æ å") |
| | | .orderByAsc(KBBTJPDrawingBP::getCreateDate) |
| | | .orderByAsc(KBBTJPDrawingBP::getTaskSequence)); |
| | | List<PrimitiveTask> list=new ArrayList(); |
| | | for (KBBTJPDrawingBP item:kBBTJPDrawingBP){ |
| | | PrimitiveTask primitiveTask= kBBTJPDrawingBPService.convertListPrimitiveTask(item); |
| | | if(primitiveTask!=null){ |
| | | //primitiveTaskMapper.insert(primitiveTask); |
| | | list.add(primitiveTask); |
| | | } |
| | | } |
| | | if(list.size()>0){ |
| | | primitiveTaskService.saveBatch(list); |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * æ«ç çç»çæ·»å å°æ°æ®å°æ¬å° |
| | | * @param scan_id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int insertProjectCustomization(String scan_id) { |
| | | //æ¥è¯¢æ«ç æ°æ® æ·»å å°åæ°æ® |
| | | try { |
| | | List<KBBTJPDrawingBP> kBBTJPDrawingBP=kBBTJPDrawingBPService.findScanIdKBBTJPDrawingBP(scan_id); |
| | | for (KBBTJPDrawingBP item:kBBTJPDrawingBP){ |
| | | PrimitiveTask primitiveTask= kBBTJPDrawingBPService.convertListPrimitiveTask(item); |
| | | return primitiveTaskMapper.insert(primitiveTask); |
| | | } |
| | | }catch (Exception e){ |
| | | return 0; |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.md.entity.GlassInfo; |
| | | import com.mes.md.entity.LineConfiguration; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.GlassInfoMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.GlassInfoService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.md.entity.*; |
| | | import com.mes.md.mapper.*; |
| | | import com.mes.md.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | * @author wu |
| | | * @since 2024-08-28 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class TaskingServiceImpl extends MPJBaseServiceImpl<TaskingMapper, Tasking> implements TaskingService { |
| | | @Resource |
| | | GlassInfoMapper glassInfoMapper; |
| | | @Resource |
| | | LineConfigurationMapper lineConfigurationMapper; |
| | | @Autowired |
| | | GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private PrimitiveTaskService primitiveTaskService; |
| | | |
| | | @Autowired |
| | | private ProjectService projectService; |
| | | @Autowired |
| | | private PrimitiveTaskMapper primitiveTaskMapper; |
| | | |
| | | @Autowired |
| | | private MachineMapper machineMapper; |
| | | @Autowired |
| | | private LineConfigurationService lineConfigurationService; |
| | | |
| | | /** |
| | | * @param machine |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param machine |
| | | * æ¥è¯¢æ¤çº¿çº¿ä¸æªå®å·¥çä»»å¡ (线ä¸/æ£å¸¸) çææ«ç IDæ¥è¯¢ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Tasking> findMachineTaskID(Machine machine,String scan_id) { |
| | | List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>() |
| | | .selectAll(LineConfiguration.class) |
| | | .eq(LineConfiguration::getMachineId,machine.getId())); |
| | | if(!machineLineConfiguration.isEmpty()){ |
| | | //æ¤è®¾å¤çº¿è·¯æªå®å·¥ç çä»»å¡ |
| | | List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>() |
| | | .selectAll(Tasking.class) |
| | | .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId) |
| | | .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId()) |
| | | .eq(Tasking::getScanId,scan_id) |
| | | .eq(Tasking::getGlassState,"æ£å¸¸") |
| | | .eq(Tasking::getState,"线ä¸") |
| | | .ne(Tasking::getWorkState,"å®å·¥") |
| | | .orderByAsc(Tasking::getTaskSequence)); |
| | | return list; |
| | | }else{ |
| | | log.info("æ¤ä»»å¡IDåå¨ä½æ¡ä»¶ä¸æ»¡è¶³ï¼{}",scan_id); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * @param tasking |
| | | * ä»»å¡ç»æ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int stopTasking(Tasking tasking){ |
| | | //1.æ è®°æ»è¡¨ä»»å¡ç»æ 2.å é¤tasking 表 |
| | | tasking.setWorkState("å®å·¥"); |
| | | baseMapper.updateById(tasking); |
| | | //å®å·¥ /ç ´æ/æ¿èµ°çç»ç |
| | | List<Tasking> taskingList=baseMapper.selectList(new QueryWrapper<Tasking>().lambda() |
| | | .eq(Tasking::getScanId,tasking.getScanId()) |
| | | .and(wrapper->wrapper |
| | | .eq(Tasking::getWorkState,"å®å·¥") |
| | | .ne(Tasking::getState,"线ä¸") |
| | | .ne(Tasking::getGlassState,"ç ´æ")) |
| | | |
| | | ); |
| | | if(!taskingList.isEmpty()){ |
| | | List<PrimitiveTask> primitiveTask=primitiveTaskMapper.selectList(new QueryWrapper<PrimitiveTask>().lambda() |
| | | .eq(PrimitiveTask::getScanId,tasking.getScanId()) |
| | | .orderByDesc(PrimitiveTask::getId)); |
| | | for(PrimitiveTask task:primitiveTask){ |
| | | if (taskingList.size()==task.getTaskQuantity()){ |
| | | task.setReportCount(taskingList.size()); |
| | | task.setEndTime(new Date()); |
| | | primitiveTaskMapper.updateById(task); |
| | | return baseMapper.delete(new QueryWrapper<Tasking>().lambda().eq(Tasking::getScanId,tasking.getScanId())); |
| | | } |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | /** |
| | | * @param machineï¼workState |
| | | * æ¥è¯¢å½å设å¤ï¼çº¿ä¸ãçå¾
/å·¥ä½/å®å·¥ãçä»»å¡ ååº (线ä¸/æ£å¸¸) |
| | | * @return |
| | | * @return List<Tasking> |
| | | */ |
| | | @Override |
| | | public List<Tasking> findMachineWorkStateTask(Machine machine, String workState) { |
| | |
| | | .orderByAsc(Tasking::getTaskSequence)); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * æ¥è¯¢çº¿ä¸æ£å¸¸çç»ç |
| | | * @return List<Tasking> findDownLineTask(); |
| | | */ |
| | | @Override |
| | | public List<Tasking> findDownLineTask() { |
| | | List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>() |
| | | .selectAll(Tasking.class) |
| | | .eq(Tasking::getGlassState,"æ£å¸¸") |
| | | .eq(Tasking::getState,"线ä¸") |
| | | .orderByAsc(Tasking::getTaskSequence)); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * @param machine |
| | |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * @param machine |
| | | * å½åè®¾å¤æ è®°æ£å¨å·¥ä½ï¼éªè¯ç¬¬æ¤IDæ¯å¦æ¯ 线ä¸çå¾
çä»»å¡ç¬¬ä¸æ¡ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Tasking startMachineTask(Machine machine, String scan_id) { |
| | | List<Tasking> list=this.findMachineWorkStateTask(machine,"çå¾
"); |
| | | if(!list.isEmpty()){ |
| | | Tasking tasking=list.get(0); |
| | | if(scan_id.equals(tasking.getScanId())){ |
| | | tasking.setWorkState("æ£å¨å·¥ä½"); |
| | | if(baseMapper.updateById(tasking)>0){ |
| | | return tasking; |
| | | }; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * @param machine |
| | | * å½å æ«ç ID æ¯å¦å¨å½å设å¤ä»¥ååå¨ åå¨åç´æ¥è·³å°å½åè®¾å¤ å¹¶ä¸æ è®°å·¥ä½ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Tasking startScanIdMachineTask(Machine machine, String scan_id) { |
| | | //æ¾å½å设å¤çº¿è·¯ |
| | | List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>() |
| | | .selectAll(LineConfiguration.class) |
| | | .eq(LineConfiguration::getMachineId,machine.getId())); |
| | | if(!machineLineConfiguration.isEmpty()){ |
| | | //æ¤è®¾å¤çº¿è·¯æªå®å·¥ç çä»»å¡ |
| | | List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>() |
| | | .selectAll(Tasking.class) |
| | | .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId) |
| | | .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId()) |
| | | .eq(Tasking::getScanId,scan_id) |
| | | .eq(Tasking::getGlassState,"æ£å¸¸") |
| | | .eq(Tasking::getState,"线ä¸") |
| | | .le(LineConfiguration::getProcessSequence,machineLineConfiguration.get(0).getProcessSequence()) |
| | | .orderByAsc(Tasking::getTaskSequence)); |
| | | if(!list.isEmpty()){ |
| | | Tasking tasking=list.get(0); |
| | | Integer taskSequence=1; |
| | | if (machine.getTodayCount()>0&&machine.getTodayCount()<5000){ |
| | | taskSequence=machine.getTodayCount()+1; |
| | | }else{ |
| | | taskSequence=1; |
| | | } |
| | | machine.setTodayCount(taskSequence); |
| | | machineMapper.updateById(machine); |
| | | tasking.setTaskSequence(taskSequence); |
| | | tasking.setWorkState("æ£å¨å·¥ä½"); |
| | | tasking.setLineConfigurationId(machineLineConfiguration.get(0).getId()); |
| | | if(baseMapper.updateById(tasking)>0){ |
| | | finishMachineTask(machine); |
| | | return tasking; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * @param machine |
| | | * å½åè®¾å¤æ è®°å®æï¼æ£å¨å·¥ä½ç第ä¸ä¸ªä»»å¡ (线ä¸/æ£å¸¸) è¿å宿æ°é |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int finishMachineTask(Machine machine,Integer taskSequence) { |
| | | List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>() |
| | | .selectAll(Tasking.class) |
| | | .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId) |
| | | .innerJoin(Machine.class,Machine::getId,LineConfiguration::getMachineId) |
| | | .eq(LineConfiguration::getMachineId,machine.getId()) |
| | | .eq(Tasking::getGlassState,"æ£å¸¸") |
| | | .eq(Tasking::getState,"线ä¸") |
| | | .eq(Tasking::getTaskSequence,taskSequence) |
| | | .eq(Tasking::getWorkState,"æ£å¨å·¥ä½") |
| | | .orderByAsc(Tasking::getTaskSequence)); |
| | | //å½å设å¤ç线路é
ç½® |
| | | List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>() |
| | | .selectAll(LineConfiguration.class) |
| | | .eq(LineConfiguration::getMachineId,machine.getId())); |
| | | if(!machineLineConfiguration.isEmpty()){ |
| | | List<LineConfiguration> listLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>() |
| | | .selectAll(LineConfiguration.class) |
| | | .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId()) |
| | | .eq(LineConfiguration::getIsStart,1) |
| | | .gt(LineConfiguration::getProcessSequence,machineLineConfiguration.get(0).getProcessSequence()) |
| | | .orderByAsc(LineConfiguration::getProcessSequence) |
| | | .orderByAsc(LineConfiguration::getPrioritySequence) |
| | | ); |
| | | if(!list.isEmpty()){ |
| | | Tasking tasking=list.get(0); |
| | | if (!listLineConfiguration.isEmpty()){ |
| | | tasking.setLineConfigurationId(listLineConfiguration.get(0).getId()); |
| | | tasking.setWorkState("çå¾
"); |
| | | return baseMapper.updateById(tasking); |
| | | }else{ |
| | | return this.stopTasking(tasking); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | | * @param machine |
| | |
| | | @Override |
| | | public int finishMachineTask(Machine machine) { |
| | | List<Tasking> list=this.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | if(!list.isEmpty()){ |
| | | Tasking tasking=list.get(0); |
| | | tasking.setWorkState("å®å·¥"); |
| | | return baseMapper.updateById(tasking); |
| | | //å½å设å¤ç线路é
ç½® |
| | | List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>() |
| | | .selectAll(LineConfiguration.class) |
| | | .eq(LineConfiguration::getMachineId,machine.getId())); |
| | | if(!machineLineConfiguration.isEmpty()){ |
| | | List<LineConfiguration> listLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>() |
| | | .selectAll(LineConfiguration.class) |
| | | .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId()) |
| | | .eq(LineConfiguration::getIsStart,1) |
| | | .gt(LineConfiguration::getProcessSequence,machineLineConfiguration.get(0).getProcessSequence()) |
| | | .orderByAsc(LineConfiguration::getProcessSequence) |
| | | .orderByAsc(LineConfiguration::getPrioritySequence) |
| | | ); |
| | | if(!list.isEmpty()){ |
| | | Tasking tasking=list.get(0); |
| | | if (!listLineConfiguration.isEmpty()){ |
| | | tasking.setLineConfigurationId(listLineConfiguration.get(0).getId()); |
| | | tasking.setWorkState("çå¾
"); |
| | | return baseMapper.updateById(tasking); |
| | | }else{ |
| | | return this.stopTasking(tasking); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public int glassDownLineOne(Machine machine){ |
| | | List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>() |
| | | .selectAll(Tasking.class) |
| | | .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId) |
| | | .innerJoin(Machine.class,Machine::getId,LineConfiguration::getMachineId) |
| | | .eq(LineConfiguration::getMachineId,machine.getId()) |
| | | .eq(Tasking::getGlassState,"æ£å¸¸") |
| | | .eq(Tasking::getState,"线ä¸") |
| | | .eq(Tasking::getWorkState,"æ£å¨å·¥ä½") |
| | | .orderByDesc(Tasking::getTaskSequence)); |
| | | if(!list.isEmpty()){ |
| | | Tasking tasking=list.get(0); |
| | | tasking.setState("线ä¸"); |
| | | return baseMapper.updateById(tasking); |
| | | } |
| | | return 0; |
| | | } |
| | | /** |
| | | * @param tasking |
| | | * ç ´æç»çï¼ (线ä¸/æ£å¸¸) è¿åç ´ææ°é |
| | |
| | | public int glassDownLine(Tasking tasking) { |
| | | Tasking oldTasking=baseMapper.selectById(tasking); |
| | | if (!Objects.isNull(oldTasking)){ |
| | | oldTasking.setState(tasking.getState()); |
| | | oldTasking.setState("线ä¸"); |
| | | return baseMapper.updateById(oldTasking); |
| | | } |
| | | return 0; |
| | |
| | | return resultCount; |
| | | } |
| | | |
| | | public int test(List<Tasking> taskingList) { |
| | | int resultCount=0; |
| | | // |
| | | return resultCount; |
| | | /** |
| | | * @param taskingList |
| | | * æ¹éä¿®æ¹ç¶æ ãä¸çº¿ã |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int glassTopLine(Tasking taskingList) { |
| | | //å½å设å¤ç线路é
ç½® |
| | | Long machineId=taskingList.getLineConfigurationId(); |
| | | List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>() |
| | | .selectAll(LineConfiguration.class) |
| | | .eq(LineConfiguration::getMachineId,machineId)); |
| | | if(!machineLineConfiguration.isEmpty()){ |
| | | Tasking oldTasking=baseMapper.selectById(taskingList); |
| | | if (!Objects.isNull(oldTasking)){ |
| | | oldTasking.setLineConfigurationId(machineLineConfiguration.get(0).getId()); |
| | | oldTasking.setState("线ä¸"); |
| | | oldTasking.setWorkState("çå¾
"); |
| | | oldTasking.setGlassState("æ£å¸¸"); |
| | | return baseMapper.updateById(oldTasking); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | // |
| | | // @Override |
| | | // public boolean updateStatus(Integer state) { |
| | | // //æ´æ¹ä¸çæ¨¡å¼ |
| | | // //å设å¤åééæ©çç¶æ |
| | | // S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("Status").getAddress(), state); |
| | | // //åéåéæ°è¯»å夿æ¯å¦æ´æ¹æå |
| | | // String loadStatus = plcParameterObject.getPlcParameter("Status").getValue(); |
| | | // return state == Integer.parseInt(loadStatus); |
| | | // |
| | | // } |
| | | // |
| | | // /** |
| | | // * @param state |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public boolean updateLoadState(Integer state) { |
| | | // //æ´æ¹èæºç¶æ |
| | | // //å设å¤åééæ©çç¶æ |
| | | // S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("loadState").getAddress(), state); |
| | | // //åéåéæ°è¯»å夿æ¯å¦æ´æ¹æå |
| | | // String loadState = plcParameterObject.getPlcParameter("loadState").getValue(); |
| | | // return state == Integer.parseInt(loadState); |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean updateDamage(Tasking tasking) { |
| | | // UpdateWrapper<Tasking> queryWrapper = new UpdateWrapper<>(); |
| | | // queryWrapper.eq("glass_id",tasking.getGlassId()) |
| | | // .set("work_state",tasking.getWorkState()); |
| | | // return this.update(queryWrapper); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public List<Tasking> selectTasking() { |
| | | // QueryWrapper<Tasking> queryWrapper = new QueryWrapper<>(); |
| | | // queryWrapper.orderByDesc("task_sequence"); |
| | | // return list(queryWrapper); |
| | | // } |
| | | // @Override |
| | | // public Tasking selectTasking(Tasking tasking) { |
| | | // QueryWrapper<Tasking> queryWrapper = new QueryWrapper<>(); |
| | | // queryWrapper.eq("line_configuration_id",tasking.getLineConfigurationId()) |
| | | // .eq("state",tasking.getState()) |
| | | // .eq("work_state",tasking.getWorkState()) |
| | | // .orderByAsc("glass_id"); |
| | | // return getOne(queryWrapper); |
| | | // } |
| | | |
| | | /** |
| | | * @param machine |
| | | * æ«ç è®¾å¤ æ·»å ä»»å¡ |
| | | * æ¥çPrimitiveTask表æ¯å¦å卿¤æ«ç æ°æ® |
| | | * åå¨åæ ¹æ® å
容 å建 taskingä»»å¡ å¹¶æåº |
| | | * ä¸åå¨å æ¥è¯¢ä¹ç§æ°æ®åºæ·»å PrimitiveTask表 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int scanMachineAdd(Machine machine, String scanId){ |
| | | String errorStr=""; |
| | | if(!Objects.isNull(scanId)){ |
| | | List<PrimitiveTask> primitiveTaskList=primitiveTaskMapper.selectList(new QueryWrapper<PrimitiveTask>().lambda() |
| | | .eq(PrimitiveTask::getScanId,scanId)); |
| | | if(!primitiveTaskList.isEmpty()){ |
| | | PrimitiveTask primitiveTask=primitiveTaskList.get(0); |
| | | LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine); |
| | | List<Tasking> listTasking=baseMapper.selectList(new QueryWrapper<Tasking>().lambda() |
| | | .eq(Tasking::getScanId,scanId) |
| | | .ne(Tasking::getState,"线ä¸") |
| | | .ne(Tasking::getGlassState,"ç ´æ")); |
| | | if(listTasking.size()<primitiveTaskList.get(0).getTaskQuantity()){ |
| | | Tasking tasking=primitiveTaskService.convertListTasking(primitiveTask,lineConfiguration.getId()); |
| | | Integer taskSequence=1; |
| | | if (machine.getTodayCount()>0&&machine.getTodayCount()<5000){ |
| | | taskSequence=machine.getTodayCount()+1; |
| | | }else{ |
| | | taskSequence=1; |
| | | } |
| | | machine.setTodayCount(taskSequence); |
| | | tasking.setTaskSequence(taskSequence); |
| | | machineMapper.updateById(machine); |
| | | return baseMapper.insert(tasking); |
| | | } |
| | | errorStr="æ«ç IDï¼"+scanId+" 线ä¸ç»ç已达å°ä¸åä¸çº¿ ä¸å任塿°ï¼"+primitiveTaskList.get(0).getTaskQuantity()+" äº§çº¿ä»»å¡æ°:"+listTasking.size(); |
| | | if (!errorStr.equals(machine.getRemark())){ |
| | | machine.setRemark(errorStr); |
| | | machineMapper.updateById(machine); |
| | | } |
| | | }else{ |
| | | int insertCount=projectService.insertProjectCustomization(scanId); |
| | | errorStr="æ«ç IDï¼"+scanId+" ä¹ç§ITæ°æ®åºæªä¸å"; |
| | | if (insertCount<1&&!errorStr.equals(machine.getRemark())){ |
| | | machine.setRemark(errorStr); |
| | | machineMapper.updateById(machine); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean insertTasking(String status) { |
| | | Tasking tasking = new Tasking(); |
| | |
| | | return save(tasking); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean updateTasking(String scanId) { |
| | | Tasking glass=new Tasking(); |
New file |
| | |
| | | package com.mes.plcTaskThread; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.md.entity.LineConfiguration; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.LineConfigurationService; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.service.PlcAgreement; |
| | | import com.mes.service.PlcParameter; |
| | | import com.mes.utils.HexUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.Socket; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineEdging extends Thread{ |
| | | |
| | | TaskingMapper taskingMapper; |
| | | |
| | | MachineMapper machineMapper; |
| | | |
| | | TaskingService taskingService; |
| | | |
| | | PrimitiveTaskService primitiveTaskService; |
| | | |
| | | LineConfigurationService lineConfigurationService; |
| | | public static int thinness = 40; |
| | | public static int edgSpeed = 40; |
| | | public static Long machineId = 6L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | public MachineEdging(TaskingMapper taskingMapper, MachineMapper machineMapper, TaskingService taskingService, PrimitiveTaskService primitiveTaskService, LineConfigurationService lineConfigurationService){ |
| | | this.taskingMapper = taskingMapper; |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | this.primitiveTaskService = primitiveTaskService; |
| | | this.lineConfigurationService = lineConfigurationService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),"PlcEdging"); |
| | | try { |
| | | modbusTcp1.connect(); |
| | | PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcEdging"); |
| | | if(!modbusTcp1.read(plcAgreement)){ |
| | | log.info("éè®¯è¯»åæ°æ°æ®å¤±è´¥"); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | PlcParameter inputOrOut2 =plcAgreement.getPlcParameter("inputOrOut2"); |
| | | edgSpeed=inputOrOut2.getValueInt(); |
| | | |
| | | PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//åéå |
| | | |
| | | |
| | | PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//æ±æ¥å |
| | | PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//æ±æ¥ID |
| | | PlcParameter plcReport2 =plcAgreement.getPlcParameter("plcReport2");//æå¨æ±æ¥å |
| | | PlcParameter plcReportID2 =plcAgreement.getPlcParameter("plcReportID2");//æå¨æ±æ¥ID |
| | | |
| | | PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认å |
| | | PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID |
| | | PlcParameter mesConfirm2 =plcAgreement.getPlcParameter("mesConfirm2");//æå¨ç¡®è®¤å |
| | | PlcParameter mesConfirmID2 =plcAgreement.getPlcParameter("mesConfirmID2");//æå¨ç¡®è®¤ID |
| | | if (machine.getIsLog()>0){ |
| | | modbusTcp1.consoleLogInfo(plcAgreement); |
| | | } |
| | | if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) { |
| | | log.info("1.åéåç½®é¶"); |
| | | //åéåç½®0 |
| | | String send= HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéå æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) { |
| | | log.info("2.确认åç½®é¶"); |
| | | //åéåç½®0 |
| | | String send=HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("ä»»å¡å®æ æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if (0==plcReport2.getValueInt()&&0!=mesConfirm2.getValueInt()) { |
| | | log.info("2.确认åç½®é¶"); |
| | | //åéåç½®0 |
| | | String send=HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2)); |
| | | log.info("ä»»å¡å®æ æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("3ãä»»å¡å®æ"); |
| | | if(finishCount>0) {//æä»»å¡ |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ å¼å¸¸æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(4==plcReport2.getValueInt()&&0==mesConfirm2.getValueInt()){ |
| | | int finishCount=taskingService.glassDownLineOne(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("4ã人工æ¿èµ°"); |
| | | String send=HexUtil.intTo2ByteHex(4); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2)); |
| | | log.info("人工æ¿èµ°å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | String send=HexUtil.intTo2ByteHex(4); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2)); |
| | | log.info("人工æ¿èµ°å¼å¸¸ å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(2==plcReport2.getValueInt()&&0==mesConfirm2.getValueInt()){ |
| | | int finishCount=taskingService.loseMachineTask(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("2ãéå"); |
| | | String send=HexUtil.intTo2ByteHex(2); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2)); |
| | | log.info("éåå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | }else{ |
| | | log.info("2ãå¼å¸¸éå"); |
| | | String send=HexUtil.intTo2ByteHex(2); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2)); |
| | | log.info("å¼å¸¸éåå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if(3==plcReport2.getValueInt()&&0==mesConfirm2.getValueInt()){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("3ã设å¤ä¸äººå·¥ç¹ç ´æ"); |
| | | String send=HexUtil.intTo2ByteHex(3); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2)); |
| | | log.info("人工ç¹ç ´æå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | }else{ |
| | | //æ¯å¦èªå¨æ¸
é¤ç ´æ |
| | | log.info("3ãæ æç ´æ ï¼æ²¡ææ¾å°æ¤IDçç»çï¼"); |
| | | String send=HexUtil.intTo2ByteHex(3); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2)); |
| | | log.info("å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | |
| | | if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt()) |
| | | &&"å¼å·¥".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | Machine loadMachine=machineMapper.selectById(2L); |
| | | Tasking tasking; |
| | | String scan_id=""; |
| | | if(loadMachine.getMode()==1){ |
| | | //æ 忍¡å¼ æ¾å·²é¢åæªå®æçç¬¬ä¸æ¡ä»»å¡ |
| | | LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine); |
| | | List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId()); |
| | | //æ·»å æ°æ®: |
| | | for(PrimitiveTask primitiveTask:findPrimitiveTasking){ |
| | | List<Tasking> taskingTopList=taskingMapper.selectList(new QueryWrapper<Tasking>().lambda() |
| | | .eq(Tasking::getScanId,primitiveTask.getScanId()) |
| | | ); |
| | | //任塿°>已䏿°é |
| | | if(taskingTopList.size()<primitiveTask.getTaskQuantity()){ |
| | | Tasking taskingAdd=primitiveTaskService.convertListTasking(primitiveTask,lineConfiguration.getId()); |
| | | Integer taskSequence=1; |
| | | if (machine.getTodayCount()>0&&machine.getTodayCount()<5000){ |
| | | taskSequence=machine.getTodayCount()+1; |
| | | }else{ |
| | | taskSequence=1; |
| | | } |
| | | machine.setTodayCount(taskSequence); |
| | | taskingAdd.setTaskSequence(taskSequence); |
| | | machineMapper.updateById(machine); |
| | | taskingMapper.insert(taskingAdd); |
| | | } |
| | | break; |
| | | } |
| | | tasking=taskingService.startMachineTask(machine); |
| | | }else{ |
| | | //å®å¶æ¨¡å¼ |
| | | String PlcRequestID_=clientTCPSocket(); |
| | | //String PlcRequestID_=",,46607221"; |
| | | if (PlcRequestID_==null||PlcRequestID_.lastIndexOf(",")<0){ |
| | | modbusTcp1.close(); |
| | | errorMachine(machine,("æ«ä¸å°ç :"+PlcRequestID_)); |
| | | return; |
| | | } |
| | | scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1); |
| | | tasking=taskingService.startMachineTask(machine,scan_id); |
| | | } |
| | | if(tasking!=null){ |
| | | log.info("4ãåéä»»å¡ ä»»å¡æ°æ®ï¼{}, 设å¤ç¶æ:{}, ",machine,tasking); |
| | | String send= |
| | | HexUtil.intTo2ByteHex(1)+ |
| | | HexUtil.intTo2ByteHex(tasking.getGlassId().intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getLength()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getWidth()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getThickness()*10)).intValue()); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéä»»å¡å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | errorMachine(machine,""); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getGlassId()+"-"+ |
| | | tasking.getWidth()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getThickness(); |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | return; |
| | | }else if(!scan_id.isEmpty()){ |
| | | taskingService.scanMachineAdd(machine,scan_id); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | } |
| | | //} |
| | | |
| | | } catch (Exception e) { |
| | | log.info("交äºé»è¾é误"); |
| | | } |
| | | |
| | | modbusTcp1.close(); |
| | | //log.info("æ 坿§è¡çæ¡ä»¶"); |
| | | } |
| | | |
| | | |
| | | public void errorMachine(Machine machine,String error) { |
| | | if (!error.equals(machine.getRemark())){ |
| | | machine.setRemark(error); |
| | | machineMapper.updateById(machine); |
| | | } |
| | | } |
| | | public String clientTCPSocket() { |
| | | try { |
| | | Machine machine=machineMapper.selectById(4L); |
| | | Socket clientSocket = new Socket(machine.getIp(), machine.getPort()); |
| | | try { |
| | | clientSocket.setSoTimeout(1000); |
| | | // å建è¾å
¥æµåè¾åºæµ |
| | | InputStream inputStream = clientSocket.getInputStream(); |
| | | OutputStream outputStream = clientSocket.getOutputStream(); |
| | | // åéå¯å¨å½ä»¤ |
| | | String message = "start"; |
| | | outputStream.write(message.getBytes()); |
| | | // 读åæå¡å¨ååºçæ°æ® |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead = inputStream.read(buffer); |
| | | String receivedMessage = new String(buffer, 0, bytesRead); |
| | | System.out.println("æ¶å°æ«ç æªè¿åå
容ï¼" + receivedMessage); |
| | | // å
³éè¿æ¥ |
| | | String message2 = "stop"; |
| | | outputStream.write(message2.getBytes()); |
| | | clientSocket.close(); |
| | | return receivedMessage; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | clientSocket.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.plcTaskThread; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.common.S7objectMachine; |
| | | import com.mes.device.PlcParameterInfo; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.TaskingService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineFlipSlice extends Thread{ |
| | | |
| | | |
| | | private MachineMapper machineMapper; |
| | | private TaskingService taskingService; |
| | | private S7objectMachine s7objectMachine; |
| | | public static int thinness = 40; |
| | | public static int edgSpeed = 40; |
| | | public static Long machineId = 6L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | public MachineFlipSlice(MachineMapper machineMapper, TaskingService taskingService){ |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | Long machineId=26L; |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcFlipSlice", EPlcType.S1200); |
| | | s7objectMachine.start(); |
| | | } |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请æ±ID |
| | | PlcParameterInfo plcRequestType =plcParameterObject.getPlcParameter("plcRequestType");//PLCè¯·æ± |
| | | |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//åéå |
| | | PlcParameterInfo mesSendId =plcParameterObject.getPlcParameter("mesSendID");//åéID |
| | | PlcParameterInfo length =plcParameterObject.getPlcParameter("length");//é¿ |
| | | PlcParameterInfo width =plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo mesSendType =plcParameterObject.getPlcParameter("mesSendType");// æ«ç 1 䏿«ç 2 |
| | | |
| | | String scan_id=""; |
| | | if (machine.getIsLog()>0){ |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if ("0".equals(plcRequestType.getValue())&&!"0".equals(mesSendType.getValue())) { |
| | | //åéåç½®0 |
| | | log.info("1.åéç±»ååç½®é¶,æ¸
é¤ä¸æ¬¡åéçç±»åæ°æ®{}->0",mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("0".equals(plcRequest.getValue())&&!"0".equals(mesSend.getValue())) { |
| | | //åéåç½®0 |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("2.åéåç½®é¶,æ¸
é¤ä¸æ¬¡åéçæ°æ®{},{},{},{},{}" |
| | | ,finishCount |
| | | ,length.getValue() |
| | | ,width.getValue() |
| | | ,mesSendId.getValue() |
| | | ,mesSend.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("1".equals(plcRequestType.getValue())&&"0".equals(mesSendType.getValue())) { |
| | | //åéç±»å 1æ«ç 2䏿«ç |
| | | int type=machine.getMode()==1?2:1; |
| | | log.info("3.åéç±»åæ°æ®0->{}",mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), type); |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | if(("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue()) |
| | | &&"å¼å·¥".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount())){ |
| | | Tasking tasking; |
| | | if(machine.getMode()==1){ |
| | | //æ 忍¡å¼ |
| | | tasking=taskingService.startMachineTask(machine); |
| | | }else{ |
| | | //å®å¶æ¨¡å¼ |
| | | String PlcRequestID_=plcRequestID.getValue(); |
| | | //String PlcRequestID_=",,46403118"; |
| | | scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1); |
| | | tasking=taskingService.startScanIdMachineTask(machine,scan_id);//ä¸ç®¡é¡ºåºï¼ç´æ¥æ¾ä»ç£¨è¾¹æºæ«ç åå°ç¿»çå°çæ°æ® |
| | | } |
| | | if(tasking!=null){ |
| | | log.info("4ãåéæ°æ®:{},{},{},{},{}" |
| | | ,tasking.getGlassId(),tasking.getProgramId() |
| | | ,tasking.getLength().intValue(),tasking.getWidth().intValue(),1); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getGlassId().toString()); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getGlassId()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getWidth(); |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | nullMachine(machine); |
| | | return; |
| | | }else if(!scan_id.isEmpty()){ |
| | | taskingService.scanMachineAdd(machine,scan_id); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public void nullMachine(Machine machine) { |
| | | if (!"".equals(machine.getRemark())){ |
| | | machine.setRemark(""); |
| | | machineMapper.updateById(machine); |
| | | } |
| | | } |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.plcTaskThread; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.md.entity.LineConfiguration; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.PrimitiveTaskMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.LineConfigurationService; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.service.PlcAgreement; |
| | | import com.mes.service.PlcParameter; |
| | | import com.mes.utils.HexUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineLoad extends Thread{ |
| | | |
| | | TaskingMapper taskingMapper; |
| | | |
| | | MachineMapper machineMapper; |
| | | |
| | | TaskingService taskingService; |
| | | |
| | | PrimitiveTaskService primitiveTaskService; |
| | | |
| | | PrimitiveTaskMapper primitiveTaskMapper; |
| | | |
| | | LineConfigurationService lineConfigurationService; |
| | | |
| | | public Long machineId = 2L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | public MachineLoad(TaskingMapper taskingMapper, MachineMapper machineMapper, TaskingService taskingService, PrimitiveTaskService primitiveTaskService, LineConfigurationService lineConfigurationService){ |
| | | this.taskingMapper = taskingMapper; |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | this.primitiveTaskService = primitiveTaskService; |
| | | this.lineConfigurationService = lineConfigurationService; |
| | | } |
| | | public void plcStart() { |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),"PlcLoad"); |
| | | modbusTcp1.connect(); |
| | | PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcLoad"); |
| | | try { |
| | | if(!modbusTcp1.read(plcAgreement)){ |
| | | log.info("éè®¯è¯»åæ°æ°æ®å¤±è´¥"); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//åéå |
| | | PlcParameter mesSendCount =plcAgreement.getPlcParameter("mesSendCount");//åéæ°é |
| | | |
| | | PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//æ±æ¥å |
| | | PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//æ±æ¥ID |
| | | PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认å |
| | | PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID |
| | | if (machine.getIsLog()>0){ |
| | | modbusTcp1.consoleLogInfo(plcAgreement); |
| | | } |
| | | if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) { |
| | | //åéåç½®0 |
| | | String send= HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("1.åéåç½®é¶ åéå æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) { |
| | | //确认åç½®é¶ |
| | | String send=HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("2.确认åç½®é¶ ä»»å¡å®æ æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=plcReportID.getValueInt(); |
| | | if(finishCount>0) {//æä»»å¡ |
| | | if(machine.getMode()==1){ |
| | | //æ 忍¡å¼ æ¾å·²é¢åæªå®æçç¬¬ä¸æ¡ä»»å¡ |
| | | LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine); |
| | | List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId()); |
| | | for(PrimitiveTask primitiveTask:findPrimitiveTasking){ |
| | | primitiveTask.setReportCount(primitiveTask.getReportCount()+plcReportID.getValueInt()); |
| | | primitiveTaskMapper.updateById(primitiveTask); |
| | | break; |
| | | } |
| | | } |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/ 2)); |
| | | log.info("ä»»å¡å®æ æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ å¼å¸¸æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt()) |
| | | &&"å¼å·¥".equals(machine.getState())){ |
| | | int loadCount=0; |
| | | if(machine.getMode()==1){ |
| | | |
| | | //æ 忍¡å¼ æ¾å·²é¢åæªå®æçç¬¬ä¸æ¡ä»»å¡ |
| | | LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine); |
| | | List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId()); |
| | | for(PrimitiveTask primitiveTask:findPrimitiveTasking){ |
| | | //任塿°>已䏿°é |
| | | List<Tasking> taskingTopList=taskingMapper.selectList(new QueryWrapper<Tasking>().lambda() |
| | | .eq(Tasking::getScanId,primitiveTask.getScanId()) |
| | | ); |
| | | loadCount=primitiveTask.getTaskQuantity()-taskingTopList.size(); |
| | | loadCount=(loadCount>0?loadCount:0); |
| | | break; |
| | | } |
| | | }else{ |
| | | //å®å¶æ¨¡å¼ |
| | | loadCount=1; |
| | | } |
| | | if(loadCount>0){ |
| | | log.info("4ãåéä»»å¡ ä»»å¡æ°æ®ï¼{}, 设å¤ç¶æ:{}, ",loadCount,machine); |
| | | String send=HexUtil.intTo2ByteHex(1)+ HexUtil.intTo2ByteHex(loadCount); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéä»»å¡å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | modbusTcp1.close(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+"1 "+ loadCount; |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | return; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("交äºé»è¾é误"); |
| | | } |
| | | modbusTcp1.close(); |
| | | } |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.plcTaskThread; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.common.S7objectMachine; |
| | | import com.mes.device.PlcParameterInfo; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.TaskingService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineMarking extends Thread{ |
| | | |
| | | |
| | | private MachineMapper machineMapper; |
| | | private TaskingService taskingService; |
| | | private S7objectMachine s7objectMachine; |
| | | public static int thinness = 40; |
| | | public static int edgSpeed = 40; |
| | | public static Long machineId = 6L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | public MachineMarking(MachineMapper machineMapper, TaskingService taskingService){ |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | Long machineId=12L; |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcMarking", EPlcType.S1500); |
| | | s7objectMachine.start(); |
| | | } |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请æ±ID |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//åéå |
| | | PlcParameterInfo isMark =plcParameterObject.getPlcParameter("isMark");//åéIDã0 䏿æ ï¼1æ 忍¡å¼ï¼2å®å¶æ¨¡å¼ã |
| | | PlcParameterInfo drawingMark =plcParameterObject.getPlcParameter("drawingMark");//ææ å¾çº¸å°å |
| | | PlcParameterInfo lengthOutOfService =plcParameterObject.getPlcParameter("length(OutOfService)");//é¿ |
| | | PlcParameterInfo widthOutOfService =plcParameterObject.getPlcParameter("width(OutOfService)");//宽 |
| | | PlcParameterInfo markingMode =plcParameterObject.getPlcParameter("markingMode");// |
| | | |
| | | PlcParameterInfo plcReport =plcParameterObject.getPlcParameter("plcReport");//æ±æ¥å |
| | | PlcParameterInfo plcReportID =plcParameterObject.getPlcParameter("plcReportID");//æ±æ¥ID |
| | | PlcParameterInfo mesConfirm =plcParameterObject.getPlcParameter("mesConfirm");//确认å |
| | | PlcParameterInfo mesConfirmID =plcParameterObject.getPlcParameter("mesConfirmID");//确认ID |
| | | if (machine.getIsLog()>0){ |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if ("0".equals(plcRequest.getValue())&&"1".equals(mesSend.getValue())) { |
| | | //åéåç½®0 |
| | | log.info("1.åéåç½®é¶,æ¸
é¤ä¸æ¬¡åéçæ°æ®{},{},{},{},{}" |
| | | ,markingMode.getValue() |
| | | ,isMark.getValue() |
| | | ,lengthOutOfService.getValue() |
| | | ,widthOutOfService.getValue() |
| | | ,mesSend.getValue()); |
| | | //S7objectMarking.getinstance().plccontrol.writeString(drawingMark.getAddress(),""); |
| | | s7objectMachine.plccontrol.writeWord(markingMode.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(lengthOutOfService.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(widthOutOfService.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(isMark.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("0".equals(plcReport.getValue())&&"1".equals(mesConfirm.getValue())) { |
| | | log.info("2.确认åç½®é¶"); |
| | | //åéåç½®0 |
| | | s7objectMachine.plccontrol.writeWord(mesConfirm.getAddress(), 0); |
| | | return; |
| | | } |
| | | if("1".equals(plcReport.getValue())&&"0".equals(mesConfirm.getValue())){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("3ãä»»å¡å®æ"); |
| | | if(finishCount>0){//æä»»å¡ |
| | | s7objectMachine.plccontrol.writeWord(mesConfirm.getAddress(), 1); |
| | | return; |
| | | } |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue())&& !plcRequestID.getValue().isEmpty() |
| | | &&"å¼å·¥".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | Tasking tasking=taskingService.startMachineTask(machine); |
| | | if(tasking!=null){ |
| | | //模å¼ï¼1å®å¶ 0 æ¹é æ¯å¦ææ ï¼0䏿æ 1ææ |
| | | int isMark_=(tasking.getDrawingMarking()==null||tasking.getDrawingMarking().isEmpty())?0:1; |
| | | int isMarkingMode_="å®å¶".equals(tasking.getTaskType()) ?1:0; |
| | | log.info("4ãåéæ°æ®:{},{},{},{},{},{}" |
| | | ,tasking.getProgramId() |
| | | ,tasking.getLength().intValue(),tasking.getWidth().intValue(),isMark_,isMarkingMode_,1); |
| | | if(isMark_==1){ |
| | | s7objectMachine.plccontrol.writeString(drawingMark.getAddress(), tasking.getProgramId()); |
| | | } |
| | | s7objectMachine.plccontrol.writeWord(lengthOutOfService.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(widthOutOfService.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(isMark.getAddress(), isMark_); |
| | | s7objectMachine.plccontrol.writeWord(markingMode.getAddress(), isMarkingMode_); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getScanId()+"-"+ |
| | | tasking.getProgramId()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getWidth()+"-"+ |
| | | isMark_+"-"+ |
| | | isMarkingMode_; |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.plcTaskThread; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.common.S7objectMachine; |
| | | import com.mes.device.PlcParameterInfo; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.TaskingService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineRotate extends Thread{ |
| | | |
| | | |
| | | private MachineMapper machineMapper; |
| | | private TaskingService taskingService; |
| | | private S7objectMachine s7objectMachine; |
| | | public static Long machineId = 6L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | public MachineRotate(MachineMapper machineMapper, TaskingService taskingService){ |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | public void plcStart() { |
| | | //æè½¬å° |
| | | Long machineId=20L; |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcRotate", EPlcType.S1200); |
| | | s7objectMachine.start(); |
| | | } |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请æ±ID |
| | | PlcParameterInfo plcRequestType =plcParameterObject.getPlcParameter("plcRequestType");//PLCè¯·æ± |
| | | |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//åéå |
| | | PlcParameterInfo mesSendId =plcParameterObject.getPlcParameter("mesSendID");//åéID |
| | | PlcParameterInfo length =plcParameterObject.getPlcParameter("length");//é¿ |
| | | PlcParameterInfo width =plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo rotateType =plcParameterObject.getPlcParameter("rotateType");//æè½¬ç±»å |
| | | |
| | | PlcParameterInfo mesSendType =plcParameterObject.getPlcParameter("mesSendType");// æ«ç 1 䏿«ç 2 |
| | | String scan_id=""; |
| | | if (machine.getIsLog()>0){ |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if ("0".equals(plcRequestType.getValue())&&!"0".equals(mesSendType.getValue())) { |
| | | //åéåç½®0 |
| | | log.info("1.åéç±»ååç½®é¶,æ¸
é¤ä¸æ¬¡åéçç±»åæ°æ®{}->0",mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("0".equals(plcRequest.getValue())&&!"0".equals(mesSend.getValue())) { |
| | | //åéåç½®0 |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("1.åéåç½®é¶,æ¸
é¤ä¸æ¬¡åéçæ°æ®{},{},{},{},{}" |
| | | ,finishCount |
| | | ,length.getValue() |
| | | ,width.getValue() |
| | | ,mesSendId.getValue() |
| | | ,mesSend.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("1".equals(plcRequestType.getValue())&&"0".equals(mesSendType.getValue())) { |
| | | //åéç±»å 1æ«ç 2䏿«ç |
| | | int type=machine.getMode()==1?2:1; |
| | | log.info("3.åéç±»åæ°æ®0->{}",mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), type); |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue()) |
| | | &&"å¼å·¥".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | Tasking tasking; |
| | | if(machine.getMode()==1){ |
| | | //æ 忍¡å¼ |
| | | tasking=taskingService.startMachineTask(machine); |
| | | }else{ |
| | | //å®å¶æ¨¡å¼ |
| | | String PlcRequestID_=plcRequestID.getValue(); |
| | | scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1); |
| | | //æ è®°å½åå·¥åº ä»¥åçç»ç ç´æ¥å°å½åå·¥åº |
| | | tasking=taskingService.startScanIdMachineTask(machine,scan_id);//ä¸ç®¡é¡ºåºï¼ç´æ¥æ¾ä»ç¿»çå°æ«ç åå°æè½¬å°çæ°æ® |
| | | } |
| | | if(tasking!=null){ |
| | | log.info("4ãåéæ°æ®:{},{},{},{},{}" |
| | | ,tasking.getGlassId(),tasking.getProgramId() |
| | | ,tasking.getLength().intValue(),tasking.getWidth().intValue(),1); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getGlassId().toString()); |
| | | s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 1); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getGlassId()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getWidth(); |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | nullMachine(machine); |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | }else if(!scan_id.isEmpty()){ |
| | | taskingService.scanMachineAdd(machine,scan_id); |
| | | } |
| | | } |
| | | |
| | | } |
| | | public void nullMachine(Machine machine) { |
| | | if (!"".equals(machine.getRemark())){ |
| | | machine.setRemark(""); |
| | | machineMapper.updateById(machine); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.plcTaskThread; |
| | | |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.service.PlcAgreement; |
| | | import com.mes.service.PlcParameter; |
| | | import com.mes.utils.HexUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineSilkScreen extends Thread{ |
| | | |
| | | |
| | | private MachineMapper machineMapper; |
| | | private TaskingService taskingService; |
| | | public static Long machineId = 14L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | public MachineSilkScreen(MachineMapper machineMapper, TaskingService taskingService){ |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | String fileName="PlcSilkScreen"; |
| | | ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),fileName); |
| | | modbusTcp1.connect(); |
| | | PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement(fileName); |
| | | try { |
| | | if(!modbusTcp1.read(plcAgreement)){ |
| | | log.info("éè®¯è¯»åæ°æ°æ®å¤±è´¥"); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameter plcRequestID =plcAgreement.getPlcParameter("plcRequestID");//请æ±ID |
| | | PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//åéå |
| | | PlcParameter mesSendID =plcAgreement.getPlcParameter("mesSendID");//åéID |
| | | PlcParameter length =plcAgreement.getPlcParameter("length");//é¿ |
| | | PlcParameter width =plcAgreement.getPlcParameter("width");//宽 |
| | | PlcParameter thickness =plcAgreement.getPlcParameter("thickness");//å |
| | | PlcParameter X =plcAgreement.getPlcParameter("X");//X |
| | | PlcParameter Y =plcAgreement.getPlcParameter("Y");//Y |
| | | //PlcParameter isSilkScreen =plcAgreement.getPlcParameter("isSilkScreen");//æ¯å¦ä¸å° |
| | | |
| | | PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//æ±æ¥å |
| | | PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//æ±æ¥ID |
| | | PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认å |
| | | PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID |
| | | PlcParameter machineStatusWord =plcAgreement.getPlcParameter("machineStatusWord"); |
| | | if (machine.getIsLog()>0){ |
| | | modbusTcp1.consoleLogInfo(plcAgreement); |
| | | } |
| | | |
| | | if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) { |
| | | log.info("1.åéåç½®é¶"); |
| | | //åéåç½®0 |
| | | String send= HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéå æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) { |
| | | log.info("2.确认åç½®é¶"); |
| | | //åéåç½®0 |
| | | String send=HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("ä»»å¡å®æ æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("3ãä»»å¡å®æ"); |
| | | if(finishCount>0) {//æä»»å¡ |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ å¼å¸¸æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(4==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.glassDownLineOne(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("4ã人工æ¿èµ°"); |
| | | String send=HexUtil.intTo2ByteHex(4); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("人工æ¿èµ°å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | String send=HexUtil.intTo2ByteHex(4); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("人工æ¿èµ°å¼å¸¸ å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(2==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.loseMachineTask(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("2ãéå"); |
| | | String send=HexUtil.intTo2ByteHex(2); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("éåå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | }else{ |
| | | log.info("2ãå¼å¸¸éå"); |
| | | String send=HexUtil.intTo2ByteHex(2); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("å¼å¸¸éåå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if(3==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | if(finishCount>0){//æä»»å¡ |
| | | log.info("3ã设å¤ä¸äººå·¥ç¹ç ´æ"); |
| | | String send=HexUtil.intTo2ByteHex(3); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("人工ç¹ç ´æå鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | }else{ |
| | | //æ¯å¦èªå¨æ¸
é¤ç ´æ |
| | | log.info("3ãæ æç ´æ ï¼æ²¡ææ¾å°æ¤IDçç»çï¼"); |
| | | String send=HexUtil.intTo2ByteHex(3); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | //modbusTcp1.close(); |
| | | return; |
| | | } |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt()) |
| | | &&"å¼å·¥".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | Tasking tasking=taskingService.startMachineTask(machine); |
| | | if(tasking!=null){ |
| | | log.info("4ãåéä»»å¡ ä»»å¡æ°æ®ï¼{}, 设å¤ç¶æ:{}, ",machine,tasking); |
| | | String send= |
| | | HexUtil.intTo2ByteHex(1)+ |
| | | HexUtil.intTo2ByteHex(tasking.getTaskSequence().intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getWidth()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getLength()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(tasking.getThickness().intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getSilkScreenX()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(((Double)(tasking.getSilkScreenY()*10)).intValue())+ |
| | | HexUtil.intTo2ByteHex(tasking.getIsSilkScreen());//æ¯å¦ä¸å°ï¼ 0ä¸å° 1ä¸ä¸å° |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéä»»å¡å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getGlassId()+"-"+ |
| | | tasking.getWidth()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getThickness()+"-"+ |
| | | tasking.getSilkScreenX()+"-"+ |
| | | tasking.getSilkScreenX()+"-"+ |
| | | tasking.getSilkScreenY()+"-"+ |
| | | tasking.getIsSilkScreen(); |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | return; |
| | | } |
| | | } |
| | | //} |
| | | |
| | | } catch (Exception e) { |
| | | log.info("交äºé»è¾é误"); |
| | | } |
| | | |
| | | modbusTcp1.close(); |
| | | //log.info("æ 坿§è¡çæ¡ä»¶"); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.plcTaskThread; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.md.entity.LineConfiguration; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.TaskingMapper; |
| | | import com.mes.md.service.*; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.service.PlcAgreement; |
| | | import com.mes.service.PlcParameter; |
| | | import com.mes.utils.HexUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineThread extends Thread{ |
| | | |
| | | TaskingMapper taskingMapper; |
| | | |
| | | MachineMapper machineMapper; |
| | | |
| | | TaskingService taskingService; |
| | | |
| | | PrimitiveTaskService primitiveTaskService; |
| | | |
| | | LineConfigurationService lineConfigurationService; |
| | | |
| | | public MachineThread(TaskingMapper taskingMapper, MachineMapper machineMapper, TaskingService taskingService, PrimitiveTaskService primitiveTaskService, LineConfigurationService lineConfigurationService){ |
| | | this.taskingMapper = taskingMapper; |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | this.primitiveTaskService = primitiveTaskService; |
| | | this.lineConfigurationService = lineConfigurationService; |
| | | } |
| | | |
| | | |
| | | public Long machineId = 2L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | public void plcStart() { |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),"PlcLoad"); |
| | | modbusTcp1.connect(); |
| | | PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcLoad"); |
| | | try { |
| | | if(!modbusTcp1.read(plcAgreement)){ |
| | | log.info("éè®¯è¯»åæ°æ°æ®å¤±è´¥"); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请æ±å |
| | | PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//åéå |
| | | PlcParameter mesSendCount =plcAgreement.getPlcParameter("mesSendCount");//åéæ°é |
| | | |
| | | PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//æ±æ¥å |
| | | PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//æ±æ¥ID |
| | | PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认å |
| | | PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID |
| | | if (machine.getIsLog()>0){ |
| | | modbusTcp1.consoleLogInfo(plcAgreement); |
| | | } |
| | | if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) { |
| | | //åéåç½®0 |
| | | String send= HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("1.åéåç½®é¶ åéå æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) { |
| | | //确认åç½®é¶ |
| | | String send=HexUtil.intTo2ByteHex(0); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2)); |
| | | log.info("2.确认åç½®é¶ ä»»å¡å®æ æ¸
空æåï¼å
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | log.info("3ãä»»å¡å®æ:"+plcReportID.getValueString()); |
| | | if(finishCount>0) {//æä»»å¡ |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/ 2)); |
| | | log.info("ä»»å¡å®æ æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | String send = HexUtil.intTo2ByteHex(1); |
| | | modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2)); |
| | | log.info("ä»»å¡å®æ å¼å¸¸æå å
容ï¼{},åéèµ·å§å°å:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart())); |
| | | modbusTcp1.close(); |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"æ£å¨å·¥ä½"); |
| | | if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt()) |
| | | &&"å¼å·¥".equals(machine.getState())){ |
| | | int loadCount=0; |
| | | if(machine.getMode()==1){ |
| | | //æ 忍¡å¼ æ¾å·²é¢åæªå®æçç¬¬ä¸æ¡ä»»å¡ |
| | | LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine); |
| | | List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId()); |
| | | for(PrimitiveTask primitiveTask:findPrimitiveTasking){ |
| | | //任塿°>已䏿°é |
| | | List<Tasking> taskingTopList=taskingMapper.selectList(new QueryWrapper<Tasking>().lambda() |
| | | .eq(Tasking::getScanId,primitiveTask.getScanId()) |
| | | ); |
| | | loadCount=primitiveTask.getTaskQuantity()-taskingTopList.size(); |
| | | loadCount=(loadCount>0?loadCount:0); |
| | | break; |
| | | } |
| | | //loadCount=taskingCount.size(); |
| | | }else{ |
| | | //å®å¶æ¨¡å¼ |
| | | loadCount=1; |
| | | } |
| | | if(loadCount>0){ |
| | | log.info("4ãåéä»»å¡ ä»»å¡æ°æ®ï¼{}, 设å¤ç¶æ:{}, ",loadCount,machine); |
| | | String send=HexUtil.intTo2ByteHex(1)+ HexUtil.intTo2ByteHex(loadCount); |
| | | modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | log.info("åéä»»å¡å鿥æå
容ï¼{},åéèµ·å§å°å:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2)); |
| | | modbusTcp1.close(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+"1 "+ loadCount; |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | return; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("交äºé»è¾é误"); |
| | | } |
| | | modbusTcp1.close(); |
| | | } |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | log.info("111"); |
| | | plcStart(); |
| | | //plcStart(); |
| | | // if ("å¼å·¥".equals(machine.getState()) ){ |
| | | // |
| | | // } |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | strict: false #è®¾ç½®ä¸¥æ ¼æ¨¡å¼,é»è®¤falseä¸å¯å¨. å¯å¨å卿ªå¹é
尿宿°æ®æºæ¶ååæåºå¼å¸¸,ä¸å¯å¨ä¼ä½¿ç¨é»è®¤æ°æ®æº. |
| | | datasource: |
| | | jiumumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/jiumumes?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&rewriteBatchedStatements=true |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_JomooKBB: |
| | | url: jdbc:sqlserver://localhost:1433;databasename=JomooKBB |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | # salve_JomooKBB: |
| | | # url: jdbc:sqlserver://172.18.19.85:1433;databasename=JomooKBB |
| | | # username: thok |
| | | # password: jomoo@123 |
| | | # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.44:8848 |
| | | server-addr: localhost:8848 |
| | | application: |
| | | name: deviceInteraction |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.44 |
| | | host: localhost |
| | | port: 6379 |
| | | password: 123456 |
| | |
| | | package com.mes; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.md.entity.*; |
| | | import com.mes.md.mapper.AccountMapper; |
| | | import com.mes.md.mapper.KBBTJPDrawingBPMapper; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.mapper.PrimitiveTaskMapper; |
| | | import com.mes.md.service.AccountService; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.ProjectService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.tools.HexConversion; |
| | | import com.mes.utils.HexUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import java.io.DataInputStream; |
| | | import java.io.DataOutputStream; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.Socket; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Autowired |
| | | AccountService accountService; |
| | | |
| | | @Autowired |
| | | KBBTJPDrawingBPMapper kBBTJPDrawingBPMapper; |
| | | |
| | | @Autowired |
| | | PrimitiveTaskMapper primitiveTaskMapper; |
| | | |
| | | @Autowired |
| | | PrimitiveTaskService primitiveTaskService; |
| | | |
| | | @Autowired |
| | | TaskingService taskingService; |
| | | |
| | | |
| | | @Autowired |
| | | ProjectService projectService; |
| | | |
| | | @Autowired |
| | | MachineMapper machineMapper; |
| | | |
| | | @Test |
| | | public void testStr() { |
| | | String str=new String("4ãåéä»»å¡ ä»»å¡æ°æ®ï¼{}, ".getBytes(),StandardCharsets.UTF_8); |
| | | int a=1; |
| | | log.info(str,1); |
| | | } |
| | | |
| | | @Test |
| | | public void testSaoMa3() { |
| | | try { |
| | | // å建TCP客æ·ç«¯å¹¶è¿æ¥å°æå¡å¨ |
| | | String serverAddress = "192.168.1.8"; |
| | | int serverPort = 2001; |
| | | Socket clientSocket = new Socket(serverAddress, serverPort); |
| | | // å建è¾å
¥æµåè¾åºæµ |
| | | InputStream inputStream = clientSocket.getInputStream(); |
| | | OutputStream outputStream = clientSocket.getOutputStream(); |
| | | // åéæ°æ®ç»æå¡å¨ |
| | | String message = "start"; |
| | | outputStream.write(message.getBytes()); |
| | | // 读åæå¡å¨ååºçæ°æ® |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead = inputStream.read(buffer); |
| | | String receivedMessage = new String(buffer, 0, bytesRead); |
| | | System.out.println("æ¶å°æå¡å¨ååºï¼" + receivedMessage); |
| | | // å
³éè¿æ¥ |
| | | clientSocket.close(); |
| | | }catch (Exception e){ |
| | | log.info("æ«ç å¼å¸¸"); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void testSaoMa() { |
| | | try { |
| | | // å建TCP客æ·ç«¯å¹¶è¿æ¥å°æå¡å¨ |
| | | String serverAddress = "192.168.1.8"; |
| | | int serverPort = 2001; |
| | | Socket clientSocket = new Socket(serverAddress, serverPort); |
| | | // å建è¾å
¥æµåè¾åºæµ |
| | | InputStream inputStream = clientSocket.getInputStream(); |
| | | OutputStream outputStream = clientSocket.getOutputStream(); |
| | | // åéæ°æ®ç»æå¡å¨ |
| | | String message = "start"; |
| | | outputStream.write(message.getBytes()); |
| | | // 读åæå¡å¨ååºçæ°æ® |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead = inputStream.read(buffer); |
| | | String receivedMessage = new String(buffer, 0, bytesRead); |
| | | System.out.println("æ¶å°æå¡å¨ååºï¼" + receivedMessage); |
| | | // åéæ°æ®ç»æå¡å¨ |
| | | String message2 = "stop"; |
| | | outputStream.write(message2.getBytes()); |
| | | |
| | | // å
³éè¿æ¥ |
| | | clientSocket.close(); |
| | | }catch (Exception e){ |
| | | log.info("æ«ç å¼å¸¸"); |
| | | } |
| | | } |
| | | @Test |
| | | public void conncet(){ |
| | | try { |
| | | int bufSizes = 0; |
| | | byte[] msgs = new byte[2048]; |
| | | //åå»ºè¿æ¥ 172.17.125.200 192.168.10.101 |
| | | Socket socket = new Socket("10.36.164.100", 1099); |
| | | try { |
| | | socket.setSoTimeout(3000); |
| | | //åå
¥éè¦æ°æ® |
| | | DataOutputStream outToServer = new DataOutputStream(socket.getOutputStream()); |
| | | outToServer.write(HexUtil.stringToInt("000100000006010300000028")); |
| | | outToServer.flush(); |
| | | //è¯»åæ°æ® |
| | | DataInputStream in = new DataInputStream(socket.getInputStream()); |
| | | bufSizes = in.read(msgs); |
| | | String message = HexUtil.byteToHexString(bufSizes, msgs); |
| | | System.out.println(message); |
| | | } catch (Exception e) { |
| | | System.out.println("读å失败"); |
| | | try { |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//è®¾ç½®æ¥ææ ¼å¼ |
| | | } catch (Exception e2) { |
| | | // TODO: handle exception |
| | | |
| | | } |
| | | } |
| | | socket.close(); |
| | | } catch (Exception e) { |
| | | System.out.println("å¼å¸¸"); |
| | | } |
| | | } |
| | | @Test |
| | | public void testFindPath() { |
| | | //String url = getClass().getResource("").getPath(); |
| | |
| | | log.info("{}",Account); |
| | | } |
| | | |
| | | //è¿æ¥å®¢æ·è¡¨ |
| | | @Test |
| | | public void testInput() { |
| | | Machine machine=machineMapper.selectById(14); |
| | | taskingService.scanMachineAdd(machine, "46594135"); |
| | | log.info("å
容{}",2); |
| | | } |
| | | |
| | | //è¿æ¥å®¢æ·è¡¨ |
| | | @Test |
| | | public void testSqlServerInput() { |
| | | |
| | | boolean is=projectService.insertProjectStandard(); |
| | | |
| | | |
| | | log.info("å
容{}",is); |
| | | } |
| | | //è¿æ¥å®¢æ·è¡¨ |
| | | @Test |
| | | public void testMachineFinsh() { |
| | | Machine machine=machineMapper.selectById(14); |
| | | int a=taskingService.finishMachineTask(machine); |
| | | log.info("å
容{}",a); |
| | | } |
| | | //å®å¶æ¥æ¾ä»»å¡ |
| | | @Test |
| | | public void testSqlServer() { |
| | | Machine machine=machineMapper.selectById(26); |
| | | String scan_id=""; |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | if(!taskingList.isEmpty()){ |
| | | Tasking tasking=taskingList.get(0); |
| | | if (scan_id.equals(tasking.getScanId())){ |
| | | |
| | | }else{ |
| | | List<Tasking> isExist=taskingService.findMachineTaskID(machine,scan_id); |
| | | if(isExist.isEmpty()){ |
| | | //读åå®¢æ·æ°æ®åº |
| | | projectService.insertProjectCustomization(scan_id); |
| | | } |
| | | } |
| | | } |
| | | // insertProjectCustomization(); |
| | | log.info("å
容{}",taskingList); |
| | | } |
| | | |
| | | //å®å¶æ¥æ¾ä»»å¡ |
| | | @Test |
| | | public void testSqlServeraa() { |
| | | Machine machine=machineMapper.selectById(12); |
| | | String scan_id="46399819"; |
| | | projectService.insertProjectCustomization(scan_id); |
| | | log.info("å
容{}",machine); |
| | | } |
| | | //ä¿®æ¹å®¢æ·è¡¨ |
| | | @Test |
| | | public void testSqlServerUpdate() { |
| | | UpdateWrapper updateWrapper=new UpdateWrapper(); |
| | | KBBTJPDrawingBP kBBTJPDrawingBPs=new KBBTJPDrawingBP(); |
| | | kBBTJPDrawingBPMapper.update(kBBTJPDrawingBPs,updateWrapper); |
| | | List<KBBTJPDrawingBP> kBBTJPDrawingBP=kBBTJPDrawingBPMapper.selectJoinList(KBBTJPDrawingBP.class,new MPJLambdaWrapper<KBBTJPDrawingBP>() |
| | | .selectAll(KBBTJPDrawingBP.class) |
| | | .eq(KBBTJPDrawingBP::getScanId,"011045108661010000") |
| | | .orderByAsc(KBBTJPDrawingBP::getCreateDate) |
| | | .orderByAsc(KBBTJPDrawingBP::getTaskSequence)); |
| | | kBBTJPDrawingBP.get(0).setIsWorking(1); |
| | | kBBTJPDrawingBPMapper.updateById(kBBTJPDrawingBP.get(0)); |
| | | //kBBTJPDrawingBPMapper.update(kBBTJPDrawingBP,new QueryWrapper<>()); |
| | | // log.info("å
容{}",KBBTJPDrawingBP); |
| | | } |
| | | |
| | | //ä¿®æ¹å®¢æ·è¡¨ |
| | | @Test |
| | | public void testSqlServerUpdate2() { |
| | | UpdateWrapper<KBBTJPDrawingBP> updateWrapper=new UpdateWrapper<KBBTJPDrawingBP>(); |
| | | updateWrapper.lambda().eq(KBBTJPDrawingBP::getScanId,"011045108661010000"); |
| | | |
| | | KBBTJPDrawingBP kBBTJPDrawingBPs=new KBBTJPDrawingBP(); |
| | | kBBTJPDrawingBPs.setIsWorking(2); |
| | | kBBTJPDrawingBPMapper.update(kBBTJPDrawingBPs,updateWrapper); |
| | | |
| | | // log.info("å
容{}",KBBTJPDrawingBP); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | strict: false #è®¾ç½®ä¸¥æ ¼æ¨¡å¼,é»è®¤falseä¸å¯å¨. å¯å¨å卿ªå¹é
尿宿°æ®æºæ¶ååæåºå¼å¸¸,ä¸å¯å¨ä¼ä½¿ç¨é»è®¤æ°æ®æº. |
| | | datasource: |
| | | jiumumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/jiumumes?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&rewriteBatchedStatements=true |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_JomooKBB: |
| | | url: jdbc:sqlserver://localhost:1433;databasename=JomooKBB |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | # salve_JomooKBB: |
| | | # url: jdbc:sqlserver://172.18.19.85:1433;databasename=JomooKBB |
| | | # username: thok |
| | | # password: jomoo@123 |
| | | # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.44:8848 |
| | | server-addr: localhost:8848 |
| | | application: |
| | | name: deviceInteraction |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.44 |
| | | host: localhost |
| | | port: 6379 |
| | | password: 123456 |
| | |
| | | com\mes\md\mapper\TaskingMapper.class |
| | | com\mes\md\entity\Machine.class |
| | | com\mes\md\mapper\RoleMapper.class |
| | | com\mes\md\service\impl\ProjectServiceImpl.class |
| | | com\mes\job\PLCRinse.class |
| | | com\mes\md\service\impl\OrderOriginalPieceServiceImpl.class |
| | | com\mes\md\service\AccountService.class |
| | | com\mes\DeviceInteractionModuleApplication.class |
| | | com\mes\job\PLCScanQRVerify.class |
| | | com\mes\md\service\ProjectService.class |
| | | com\mes\md\service\WorkTaskDetailService.class |
| | | com\mes\common\S7objectMachine.class |
| | | com\mes\md\service\impl\EquipmentLogServiceImpl.class |
| | | com\mes\job\PLCRotate.class |
| | | com\mes\md\controller\WorkTaskDetailController.class |
| | | com\mes\md\controller\MenuController.class |
| | | com\mes\md\entity\OrderOriginalPiece.class |
| | | com\mes\md\service\MenuService.class |
| | | com\mes\md\mapper\KBBTJPDrawingBPMapper.class |
| | | com\mes\md\controller\GlassInfoController.class |
| | | com\mes\job\PLCTurn.class |
| | | com\mes\md\mapper\PageMapper.class |
| | | com\mes\md\service\ProjectLogService.class |
| | | com\mes\md\entity\Project.class |
| | | com\mes\md\mapper\PrimitiveTaskMapper.class |
| | | com\mes\md\service\impl\EdgeGrindingLogServiceImpl.class |
| | | com\mes\job\AddTask.class |
| | | com\mes\md\entity\LineConfiguration.class |
| | | com\mes\edgstoragecage\controller\EdgStorageCageController.class |
| | | com\mes\edgstoragecage\entity\EdgStorageCage.class |
| | | com\mes\md\mapper\RoleMenuMapper.class |
| | | com\mes\md\mapper\TaskLogMapper.class |
| | | com\mes\md\service\impl\AccountServiceImpl.class |
| | | com\mes\edgstoragecage\service\EdgStorageCageService.class |
| | | com\mes\common\CommunicationProtocol.class |
| | | com\mes\md\entity\Line.class |
| | | com\mes\plcTaskThread\MachineEdging.class |
| | | com\mes\md\entity\EdgeGrindingLog.class |
| | | com\mes\md\service\OrderOriginalPieceService.class |
| | | com\mes\md\service\impl\GlassInfoServiceImpl.class |
| | | com\mes\plcTaskThread\MachineSilkScreen.class |
| | | com\mes\md\entity\EquipmentLog.class |
| | | com\mes\md\service\KBBTJPDrawingBPService.class |
| | | com\mes\plcTaskThread\MachineRotate.class |
| | | com\mes\md\controller\PrimitiveTaskController.class |
| | | com\mes\md\controller\RoleMenuController.class |
| | | com\mes\md\entity\WorkTaskDetail.class |
| | |
| | | com\mes\md\service\impl\WorkTaskDetailServiceImpl.class |
| | | com\mes\md\service\impl\TaskLogServiceImpl.class |
| | | com\mes\md\controller\EdgeGrindingLogController.class |
| | | com\mes\md\service\LineConfigurationService.class |
| | | com\mes\md\entity\GlassInfo.class |
| | | com\mes\md\service\GlassInfoService.class |
| | | com\mes\md\entity\Page.class |
| | | com\mes\job\PLCCleaning.class |
| | | com\mes\md\controller\RoleController.class |
| | | com\mes\job\MarkingTask.class |
| | | com\mes\md\mapper\MachineMapper.class |
| | | com\mes\md\mapper\AccountMapper.class |
| | | com\mes\common\S7objectCleaning.class |
| | | com\mes\common\tcpIp.class |
| | | com\mes\md\service\EquipmentLogService.class |
| | | com\mes\md\service\impl\PrimitiveTaskServiceImpl.class |
| | | com\mes\md\controller\OrderOriginalPieceController.class |
| | |
| | | com\mes\md\entity\ProjectLog.class |
| | | com\mes\md\service\EdgeGrindingLogService.class |
| | | com\mes\AppRunnerConfig.class |
| | | com\mes\job\PLCFlipSlice.class |
| | | com\mes\plcTaskThread\MachineFlipSlice.class |
| | | com\mes\md\controller\TaskingController.class |
| | | com\mes\md\controller\AccountController.class |
| | | com\mes\md\service\TaskLogService.class |
| | | com\mes\job\PLCScanQR.class |
| | | com\mes\job\SilkScreenTask.class |
| | | com\mes\md\service\PrimitiveTaskService.class |
| | | com\mes\plcTaskThread\MachineLoad.class |
| | | com\mes\md\entity\Account.class |
| | | com\mes\job\PLCScanQRWorks.class |
| | | com\mes\md\service\impl\MenuServiceImpl.class |
| | | com\mes\md\controller\PageController.class |
| | | com\mes\md\entity\TaskLog.class |
| | | com\mes\md\mapper\LineConfigurationMapper.class |
| | | com\mes\md\mapper\EquipmentLogMapper.class |
| | | com\mes\job\PLCMechanicalArm.class |
| | | com\mes\md\entity\RoleMenu.class |
| | | com\mes\md\controller\TaskLogController.class |
| | | com\mes\md\service\impl\TaskingServiceImpl.class |
| | | com\mes\md\service\impl\KBBTJPDrawingBPServiceImpl.class |
| | | com\mes\md\mapper\ProjectMapper.class |
| | | com\mes\job\PLCScanQrCodesReport.class |
| | | com\mes\md\controller\EquipmentLogController.class |
| | | com\mes\common\SmbTool.class |
| | | com\mes\md\mapper\ProjectLogMapper.class |
| | | com\mes\job\PLCManualReporting.class |
| | | com\mes\plcTaskThread\MachineMarking.class |
| | | com\mes\md\mapper\OrderOriginalPieceMapper.class |
| | | com\mes\edgstoragecage\entity\EdgStorageCageDetails.class |
| | | com\mes\md\service\impl\RoleServiceImpl.class |
| | | com\mes\md\controller\MachineController.class |
| | | com\mes\md\entity\Role.class |
| | | com\mes\md\entity\KBBTJPDrawingBP.class |
| | | com\mes\md\service\impl\LineServiceImpl.class |
| | | com\mes\md\mapper\LineMapper.class |
| | | com\mes\md\mapper\EdgeGrindingLogMapper.class |
| | | com\mes\common\S7objectMarking.class |
| | | com\mes\md\entity\PrimitiveTask.class |
| | | com\mes\job\MachineTask.class |
| | | com\mes\md\entity\Menu.class |
| | | com\mes\md\service\impl\LineConfigurationServiceImpl.class |
| | | com\mes\common\S7object.class |
| | | com\mes\md\mapper\MenuMapper.class |
| | | com\mes\md\service\RoleMenuService.class |
| | | com\mes\edgstoragecage\service\impl\EdgStorageCageServiceImpl.class |
| | | com\mes\common\S7objectFlipSlice.class |
| | | com\mes\edgstoragecage\mapper\EdgStorageCageMapper.class |
| | | com\mes\md\service\impl\ProjectLogServiceImpl.class |
| | | com\mes\md\service\impl\RoleMenuServiceImpl.class |
| | | com\mes\md\service\TaskingService.class |
| | | com\mes\plcTaskThread\MachineThread.class |
| | | com\mes\md\service\RoleService.class |
| | | com\mes\md\service\MachineService.class |
| | | com\mes\md\service\PageService.class |
| | | com\mes\md\controller\ProjectLogController.class |
| | | com\mes\job\PLCEdging.class |
| | | com\mes\job\PLCLoad.class |
| | | com\mes\md\mapper\GlassInfoMapper.class |
| | | com\mes\md\entity\Tasking.class |
| | | com\mes\md\service\impl\MachineServiceImpl.class |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCMechanicalArm.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\LineConfiguration.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\mapper\EdgStorageCageMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\LineMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\CommunicationProtocol.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\DeviceInteractionModuleApplication.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCEdging.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\ProjectLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\MarkingTask.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Role.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Tasking.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\PageMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\MenuController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\ProjectLogMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PageService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\GlassInfoServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\WorkTaskDetailController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\MachineTask.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineThread.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\WorkTaskDetailServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\TaskLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\GlassInfo.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\OrderOriginalPieceMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\AccountService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\WorkTaskDetailService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCScanQRWorks.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\KBBTJPDrawingBPMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\AccountServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\RoleService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\MenuServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\RoleMenuServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\entity\EdgStorageCage.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCTurn.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\LineConfigurationServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Project.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\PrimitiveTaskMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\PrimitiveTaskServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\service\EdgStorageCageService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCScanQR.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EdgeGrindingLogController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\EdgeGrindingLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Account.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\TaskingController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EdgeGrindingLogService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\TaskLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PrimitiveTaskService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\TaskingServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCLoad.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\LineConfigurationService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\AppRunnerConfig.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7object.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\AccountMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\EdgeGrindingLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\SilkScreenTask.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\ProjectMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\TaskingService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\PageController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\ProjectController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\GlassInfoMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\WorkTaskDetailMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\OrderOriginalPieceService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMenuMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Line.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\EquipmentLogMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\EquipmentLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\MachineMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\EdgeGrindingLogMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\LineServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\PrimitiveTaskController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\PageServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\controller\EdgStorageCageController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\MenuMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\KBBTJPDrawingBPService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\SmbTool.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\AccountController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\MenuService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Menu.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCRotate.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Page.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\LineService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EquipmentLogService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectFlipSlice.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineLoad.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCCleaning.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\ProjectLogService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleMenuController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineSilkScreen.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCScanQRVerify.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\GlassInfoController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\OrderOriginalPieceServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\MachineController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\entity\EdgStorageCageDetails.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\ProjectService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\TaskingMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineFlipSlice.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\ProjectLogController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\OrderOriginalPieceController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectMarking.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\WorkTaskDetail.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCRinse.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\TaskLogController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\TaskLogService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\PrimitiveTask.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EquipmentLogController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\RoleServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\RoleMenu.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\GlassInfoService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\OrderOriginalPiece.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\TaskLogMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\EquipmentLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\RoleMenuService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\AddTask.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCMechanicalArm.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\LineMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\ProjectLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\KBBTJPDrawingBP.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PageService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineMarking.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\TaskLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\GlassInfo.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\OrderOriginalPieceMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\tcpIp.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\WorkTaskDetailService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\RoleService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\MachineServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\entity\EdgStorageCage.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\PrimitiveTaskMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\MachineService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EdgeGrindingLogController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Account.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineRotate.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EdgeGrindingLogService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PrimitiveTaskService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7object.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\EdgeGrindingLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\KBBTJPDrawingBPServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\PageController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\ProjectController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\OrderOriginalPieceService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMenuMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\EquipmentLogMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCFlipSlice.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\EquipmentLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\LineConfigurationMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\LineServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCScanQrCodesReport.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\AccountController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\MenuService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Menu.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\LineService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EquipmentLogService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleMenuController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectMachine.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Machine.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\GlassInfoController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\OrderOriginalPieceServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\ProjectService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\TaskingMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\OrderOriginalPieceController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectCleaning.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCManualReporting.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineEdging.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\PrimitiveTask.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EquipmentLogController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\RoleServiceImpl.java |
| | |
| | | com\mes\DeviceInteractionModuleApplicationTest.class |
| | | com\mes\TaskingModuleApplicationTest.class |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\test\java\com\mes\TaskingModuleApplicationTest.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\test\java\com\mes\DeviceInteractionModuleApplicationTest.java |
| | |
| | | export default { |
| | | // serverUrl: "10.153.19.29:88/api", |
| | | serverUrl: "10.153.19.44:88/api", |
| | | // serverUrl: "192.168.1.199:88/api", |
| | | //serverUrl: "10.36.164.201:88/api", |
| | | serverUrl: "localhost:88/api", |
| | | // serverUrl: "127.0.0.1:88/api", |
| | | // serverUrl2: "10.153.19.29:88" |
| | | serverUrl2: "10.153.19.44:88" |
| | | // serverUrl2: "192.168.1.199:88" |
| | | //serverUrl2: "10.36.164.201:88" |
| | | serverUrl2: "localhost:88" |
| | | // serverUrl2: "127.0.0.1:88" |
| | | |
| | | //serverUrl:"res.abeim.cn" |
| | |
| | | "version": "0.0.0", |
| | | "private": true, |
| | | "scripts": { |
| | | "dev": "vite", |
| | | "build": "vite build", |
| | | "preview": "vite preview" |
| | | "dev": "vite --host 0.0.0.0", |
| | | "build": "vite build", |
| | | "serve": "vite preview --host 0.0.0.0" |
| | | }, |
| | | "dependencies": { |
| | | "@element-plus/icons-vue": "^2.3.1", |
| | |
| | | silkScreenY: 'ä¸å°Y', |
| | | isMarking: 'æ¯å¦ææ ', |
| | | isSilkScreen: 'æ¯å¦ä¸å°', |
| | | isWorking: 'é¢åç¶æ', |
| | | workState: 'ä»»å¡ç¶æ', |
| | | lineConfigurationId: 'æå¨ä½ç½®', |
| | | state: 'çäº§ç¶æ', |
| | | glassState: 'ç»çç¶æ', |
| | | reportCount: 'æ¥å·¥æ°é', |
| | | sendTime: 'åéæ¶é´', |
| | | sendContent: 'åéå
容', |
| | | }, |
| | | machine: { |
| | | upperSlice:'èªå¨ä¸çæº', |
| | | mechanicalArm:'èªå¨ä¸çæº', |
| | | scanQrCodesIdentify:'æ«ç è¯å«', |
| | | scanQredging:'æ«ç 磨边', |
| | | edging:'磨边æº', |
| | |
| | | tips:'æ¯å¦ç¡®è®¤ï¼', |
| | | yes:'æ¯', |
| | | sure :'确认', |
| | | sureStart :'确认补å', |
| | | cancel :'åæ¶', |
| | | canceled :'失败', |
| | | anew :'éå', |
| | | finish :'å®å·¥', |
| | | stopTask :'ç»æä»»å¡', |
| | | lose :'ç ´æ', |
| | | downLine :'ä¸çº¿', |
| | | topLine :'ä¸çº¿', |
| | | getTask :'é¢å', |
| | | start :'å¼å·¥', |
| | | stop :'æå', |
| | | modeD :'å®å¶', |
| | | modeB :'æ å', |
| | | bound:'ç»å®', |
| | | reporting:'æ¥å·¥', |
| | | reportingcount:'æ¥å·¥æ°é', |
| | |
| | | // } |
| | | // ] |
| | | // }, |
| | | // { |
| | | // /*----------- èªå¨ææ æº ----------------*/ |
| | | // path: 'Marking', |
| | | // name: 'marking', |
| | | // component: () => import('../views/Marking/marking.vue'), |
| | | // children: [ |
| | | // { |
| | | // path: '/Marking/marking', |
| | | // name: 'marking', |
| | | // component: () => import('../views/Marking/marking.vue'), |
| | | // } |
| | | // ] |
| | | // }, |
| | | // { |
| | | // /*----------- èªå¨ä¸å°æº ----------------*/ |
| | | // path: 'SilkScreen', |
| | | // name: 'silkScreen', |
| | | // component: () => import('../views/SilkScreen/silkScreen.vue'), |
| | | // children: [ |
| | | // { |
| | | // path: '/SilkScreen/silkScreen', |
| | | // name: 'silkScreen', |
| | | // component: () => import('../views/SilkScreen/silkScreen.vue'), |
| | | // } |
| | | // ] |
| | | // }, |
| | | { |
| | | /*----------- èªå¨ææ æº ----------------*/ |
| | | path: 'Marking', |
| | | name: 'marking', |
| | | component: () => import('../views/Marking/marking.vue'), |
| | | children: [ |
| | | { |
| | | path: '/Marking/marking', |
| | | name: 'marking', |
| | | component: () => import('../views/Marking/marking.vue'), |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | /*----------- èªå¨ä¸å°æº ----------------*/ |
| | | path: 'SilkScreen', |
| | | name: 'silkScreen', |
| | | component: () => import('../views/SilkScreen/silkScreen.vue'), |
| | | children: [ |
| | | { |
| | | path: '/SilkScreen/silkScreen', |
| | | name: 'silkScree', |
| | | component: () => import('../views/SilkScreen/silkScreen.vue'), |
| | | } |
| | | ] |
| | | }, |
| | | // { |
| | | // /*----------- èªå¨ç¹è¶æº ----------------*/ |
| | | // path: 'GlueDispenser', |
| | |
| | | // } |
| | | // ] |
| | | // }, |
| | | // { |
| | | // /*----------- æè½¬å° ----------------*/ |
| | | // path: 'Rotate', |
| | | // name: 'rotate', |
| | | // component: () => import('../views/Rotate/rotate.vue'), |
| | | // children: [ |
| | | // { |
| | | // path: '/Rotate/rotate', |
| | | // name: 'rotate', |
| | | // component: () => import('../views/Rotate/rotate.vue'), |
| | | // } |
| | | // ] |
| | | // }, |
| | | { |
| | | /*----------- æè½¬å° ----------------*/ |
| | | path: 'Rotate', |
| | | name: 'rotate', |
| | | component: () => import('../views/Rotate/rotate.vue'), |
| | | children: [ |
| | | { |
| | | path: '/Rotate/rotate', |
| | | name: 'rotate', |
| | | component: () => import('../views/Rotate/rotate.vue'), |
| | | } |
| | | ] |
| | | }, |
| | | // { |
| | | // /*----------- èªå¨è´´èæº ----------------*/ |
| | | // path: 'Lamination', |
| | |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | { |
| | | path: '', |
| | | redirect: '/User/userlist' |
| | | } |
| | | redirect: '/MechanicalArm/mechanicalArm'//ç»éæååé»è®¤è¿å
¥çé¢ |
| | | }, |
| | | // { |
| | | // path: '', |
| | | // redirect: '/User/userlist'//ç»éæååé»è®¤è¿å
¥çé¢ |
| | | // } |
| | | ] |
| | | }, |
| | | { |
| | |
| | | // export const WebSocketHost = "192.168.1.199"; |
| | | export const WebSocketHost = "10.153.19.44"; |
| | | export const WebSocketHost = "localhost"; |
| | | //export const WebSocketHost = "10.36.164.201"; |
| | | // export const WebSocketHost = "10.153.19.29"; |
| | | // export const WebSocketHost = "127.0.0.1"; |
| | | export const host = "88"; |
New file |
| | |
| | | <template> |
| | | |
| | | <FancyButton> |
| | | Click me! |
| | | </FancyButton> |
| | | </template> |
| | | |
| | |
| | | <!-- ææ æº --> |
| | | <!-- ç£¨è¾¹æº --> |
| | | <script setup> |
| | | import request from "@/utils/request"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { reactive, ref, onMounted, onBeforeUnmount,onUnmounted } from 'vue' |
| | | import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import { WebSocketHost, host } from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const { t } = useI18n() |
| | |
| | | account: '', |
| | | password: '', |
| | | }); |
| | | const blind = ref(false) |
| | | const errorInfo = ref(true) |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const machineId=5;//å½å页é¢ç设å¤ID |
| | | const sendRecords = ref([]); |
| | | const downLineTask = ref([]); |
| | | |
| | | const machineId = 6;//å½å页é¢ç设å¤ID |
| | | var errorScanId; |
| | | var errorOpen=false; |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/edging`; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/edgingTask`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage = (data) => { |
| | | // æ´æ° tableData çæ°æ® |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | sendRecords.value = data.sendRecords[0].reverse(); |
| | | |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //ææ°æ®å°±å¼¹çª |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | |
| | | }; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | |
| | | onMounted(async () => { |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | |
| | | //ä½¿ç¨æ¥å£æ¹å¼å±ç¤ºæ°æ® |
| | | //load(); |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | }); |
| | | |
| | | // //è·åæ°æ® |
| | | // const load = async() => { |
| | | // //è·å设å¤ä»»å¡æ°æ® |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/tasking/findMachineTask', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // loadData.value.findTaskingData= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // //è·å设å¤ç¶æ |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/machine/findMachine', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // findMachine.value= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // } |
| | | //æ¥è¦æç¤º |
| | | const errorInfoFuntion = async (info) => { |
| | | let infoScancode=info; |
| | | ElMessageBox.confirm( |
| | | infoScancode, |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¿®æ¹å·¥ä½ç¶æ ã失败/æ£å¨å·¥ä½/å®å·¥ã |
| | | const workStatus = async(row,state) => { |
| | | const workStatus = async (row, state) => { |
| | | let url; |
| | | if(state=="éå"){ |
| | | url="/deviceInteraction/tasking/loseMachineTask"; |
| | | }else if(state=="æ£å¨å·¥ä½"){ |
| | | url="/deviceInteraction/tasking/startMachineTask"; |
| | | }else if(state=="å®å·¥"){ |
| | | url="/deviceInteraction/tasking/finishMachineTask"; |
| | | }else{ |
| | | if (state == "éå") { |
| | | url = "/deviceInteraction/tasking/loseMachineTask"; |
| | | } else if (state == "æ£å¨å·¥ä½") { |
| | | url = "/deviceInteraction/tasking/startMachineTask"; |
| | | } else if (state == "å®å·¥") { |
| | | url = "/deviceInteraction/tasking/finishMachineTask"; |
| | | } else { |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('delivery.prompt'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //å¼å§ä¿®æ¹ |
| | | request.post(url, |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //å¼å§ä¿®æ¹ |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | "id": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | }) |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | //å¼å·¥/æå |
| | | const machineStatus = async(state) => { |
| | | const machineStatus = async (state) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('delivery.prompt'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | }) |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ç ´æ |
| | | const damagedTask = async(row) => { |
| | | const damagedTask = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('delivery.prompt'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | "glassId": row.glassId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | }) |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¸çº¿(æ¿èµ°) |
| | | const glassDownLine = async(row) => { |
| | | const glassDownLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('delivery.prompt'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | }) |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const topLineShow = async () => { |
| | | blind.value = true; |
| | | } |
| | | //ä¸çº¿ |
| | | const topLine = async() => { |
| | | |
| | | const topLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassTopLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | "lineConfigurationId": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else {n |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | const handleDialogClose = () => { |
| | | |
| | | } |
| | | </script> |
| | | <template> |
| | | <div ref="content" style="padding:0 20px;"> |
| | | <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;"> |
| | | {{$t('machine.edging')}} |
| | | {{ $t('machine.edging') }} |
| | | </div> |
| | | <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose"> |
| | | <!-- 线ä¸ç»ç --> |
| | | <el-table :data="downLineTask" stripe style="height:260px" :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="topLine(scope.row)">{{ |
| | | $t('functionState.topLine') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-dialog> |
| | | <hr /> |
| | | <br> |
| | | <div id="search" > |
| | | <div id="search"> |
| | | <!-- åè½ --> |
| | | <el-button type="primary" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='æå'?'å¼å·¥':'æå'))">{{findMachine['state']=='å¼å·¥'?$t('functionState.start'):$t('functionState.stop')}}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button> |
| | | <el-button :type="(findMachine['state'] == 'æå' ? 'danger' : 'success')" id="ButtonMachineStatus" |
| | | @click="machineStatus((findMachine['state'] == 'æå' ? 'å¼å·¥' : 'æå'))">{{ findMachine['state'] == 'å¼å·¥' ? |
| | | $t('functionState.start') : $t('functionState.stop') }}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.topLine') }}</el-button> |
| | | <!-- <el-button type="primary" id="searchButton" @click="downLine('ä¸çº¿')">ä¸çº¿</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('ç ´æ')">ç ´æ</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('å®å·¥')">å®å·¥</el-button> --> |
| | | </div> |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <el-table :data="loadData" stripe |
| | | <el-table :data="loadData" stripe style="height:260px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')"/> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')"/> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')"/> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" /> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'éå')" >{{$t('functionState.anew')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'å®å·¥')">{{$t('functionState.finish')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'éå')">{{ |
| | | $t('functionState.anew') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'å®å·¥')">{{ |
| | | $t('functionState.finish') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose') |
| | | }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{ |
| | | $t('functionState.downLine') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div id="main-body" |
| | | style="width: 50%; height: 460px; margin: auto;background-image: url(../../src/assets/æ«ç è¯å«.png) ;background-size: 100% 100%;"> |
| | | <!-- ç»å¾å
容 --> |
| | | <div style="width: 150px; height: 100px; background-color: red; position: relative; top: 171px; left: 328px"> |
| | | <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;"> |
| | | <!-- <div style="width: 70%;min-width: 900px; height: 460px;float: left;"> |
| | | <img src="../../assets/磨边æº.png"> |
| | | </div> --> |
| | | <img style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../assets/磨边æº.png"> |
| | | <!-- <img style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/磨边æº.png" /> --> |
| | | <!-- <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/磨边æº.png"></el-image> --> |
| | | <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url(../../src/assets/磨边æº.png) ;background-size: 100% 100%;float: left;"> |
| | | |
| | | </div> --> |
| | | <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;"> |
| | | <el-table :data="sendRecords" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" /> |
| | | </el-table> |
| | | </div> |
| | | <div style="clearï¼both"></div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | border: none; |
| | | cursor: pointer; |
| | | } |
| | | .dotClass { |
| | | width:10px; |
| | | height:10px; |
| | | border-radius: 50%; |
| | | display: block; |
| | | margin-left: 10px; |
| | | } |
| | | </style> |
| | |
| | | account: '', |
| | | password: '', |
| | | }); |
| | | const blind = ref(false) |
| | | const errorInfo = ref(true) |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const machineId = 25;//å½å页é¢ç设å¤ID |
| | | const sendRecords = ref([]); |
| | | const downLineTask = ref([]); |
| | | |
| | | const machineId = 26;//å½å页é¢ç设å¤ID |
| | | var errorScanId; |
| | | var errorOpen=false; |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/flipSlice`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage = (data) => { |
| | | // æ´æ° tableData çæ°æ® |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | sendRecords.value = data.sendRecords[0].reverse(); |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //ææ°æ®å°±å¼¹çª |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | |
| | | }; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | |
| | | onMounted(async () => { |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | |
| | | |
| | | //ä½¿ç¨æ¥å£æ¹å¼å±ç¤ºæ°æ® |
| | | //load(); |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | }); |
| | | |
| | | // //è·åæ°æ® |
| | | // const load = async() => { |
| | | // //è·å设å¤ä»»å¡æ°æ® |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/tasking/findMachineTask', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // loadData.value.findTaskingData= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // //è·å设å¤ç¶æ |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/machine/findMachine', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // findMachine.value= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // } |
| | | //æ¥è¦æç¤º |
| | | const errorInfoFuntion = async (info) => { |
| | | let infoScancode=info; |
| | | ElMessageBox.confirm( |
| | | infoScancode, |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sureStart'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¿®æ¹å·¥ä½ç¶æ ã失败/æ£å¨å·¥ä½/å®å·¥ã |
| | | const workStatus = async (row, state) => { |
| | | let url; |
| | |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //å®å¶/æ å |
| | | const machineMode = async (mode) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/toggleModeMachine", |
| | | { |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | |
| | | }) |
| | | }) |
| | | } |
| | | //ä¸çº¿ |
| | | const topLine = async () => { |
| | | |
| | | const topLineShow = async () => { |
| | | blind.value = true; |
| | | } |
| | | |
| | | //ä¸çº¿ |
| | | const topLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassTopLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | "lineConfigurationId": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else {n |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const handleDialogClose = () => { |
| | | |
| | | } |
| | | </script> |
| | | <template> |
| | | <div ref="content" style="padding:0 20px;"> |
| | | <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;"> |
| | | {{ $t('machine.flipSlice') }} |
| | | </div> |
| | | <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose"> |
| | | <!-- 线ä¸ç»ç --> |
| | | <el-table :data="downLineTask" stripe :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="topLine(scope.row)">{{ |
| | | $t('functionState.topLine') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-dialog> |
| | | <hr /> |
| | | <br> |
| | | <div id="search"> |
| | | <!-- åè½ --> |
| | | <el-button :type="(findMachine['state'] == 'æå' ? 'danger' : 'success')" id="ButtonMachineStatus" |
| | | @click="machineStatus((findMachine['state'] == 'æå' ? 'å¼å·¥' : 'æå'))">{{ findMachine['state'] == 'å¼å·¥' ? $t('functionState.start') : $t('functionState.stop') }}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLine">{{ $t('functionState.topLine') }}</el-button> |
| | | @click="machineStatus((findMachine['state'] == 'æå' ? 'å¼å·¥' : 'æå'))">{{ findMachine['state'] == 'å¼å·¥' ? |
| | | $t('functionState.start') : $t('functionState.stop') }}</el-button> |
| | | |
| | | <el-button :type="(findMachine['mode'] == 'å®å¶' ? 'danger' : 'success')" id="ButtonMachineMode" |
| | | @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ? |
| | | $t('functionState.modeD') : $t('functionState.modeB') }}</el-button> |
| | | |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.topLine') }}</el-button> |
| | | <!-- <el-button type="primary" id="searchButton" @click="downLine('ä¸çº¿')">ä¸çº¿</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('ç ´æ')">ç ´æ</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('å®å·¥')">å®å·¥</el-button> --> |
| | | </div> |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <div id="main-body"> |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <el-table :data="loadData" stripe |
| | | <el-table :data="loadData" stripe style="height:260px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" /> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain |
| | | @click="workStatus(scope.row, 'éå')">{{ $t('functionState.anew') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain |
| | | @click="workStatus(scope.row, 'å®å·¥')">{{ $t('functionState.finish') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain |
| | | @click="damagedTask(scope.row)">{{ $t('functionState.lose') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain |
| | | @click="glassDownLine(scope.row)">{{ $t('functionState.downLine') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'éå')">{{ |
| | | $t('functionState.anew') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'å®å·¥')">{{ |
| | | $t('functionState.finish') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose') |
| | | }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{ |
| | | $t('functionState.downLine') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div id="main-body" |
| | | style="width: 70%; height: 400px;margin:20px auto;background-image: url(../../src/assets/ç¿»çå°.png) ;background-size: 100% 100%;"> |
| | | <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;"> |
| | | <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/ç¿»çå°.png"></el-image> |
| | | <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url(../../src/assets/ç¿»çå°.png) ;background-size: 100% 100%;float: left;"> |
| | | |
| | | </div> --> |
| | | <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;"> |
| | | <el-table :data="sendRecords" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" /> |
| | | </el-table> |
| | | </div> |
| | | <div style="clearï¼both"></div> |
| | | <!-- ç»å¾å
容 --> |
| | | <div :style="{ |
| | | <!-- <div :style="{ |
| | | width: loadData.length > 0 ? loadData[0]['length'] + 'px' : '200px', |
| | | height: loadData.length > 0 ? loadData[0]['width'] + 'px' : '100px', |
| | | backgroundColor: 'red', |
| | |
| | | <p v-if="loadData.length > 0"> |
| | | {{ loadData[0]['length'] }} * {{ loadData[0]['width'] }} |
| | | </p> |
| | | <p v-else>ææ æ°æ®</p> <!-- å¯éï¼æ¾ç¤ºé»è®¤æ¶æ¯ --> |
| | | <p v-else>ææ æ°æ®</p> |
| | | </div> |
| | | <div :style="{ |
| | | width: loadData.length > 0 ? loadData[1]['length'] + 'px' : '200px', |
| | |
| | | <p v-if="loadData.length > 0"> |
| | | {{ loadData[1]['length'] }} * {{ loadData[1]['width'] }} |
| | | </p> |
| | | <p v-else>ææ æ°æ®</p> <!-- å¯éï¼æ¾ç¤ºé»è®¤æ¶æ¯ --> |
| | | </div> |
| | | <p v-else>ææ æ°æ®</p> |
| | | </div> --> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | border: none; |
| | | cursor: pointer; |
| | | } |
| | | .dotClass { |
| | | width:10px; |
| | | height:10px; |
| | | border-radius: 50%; |
| | | display: block; |
| | | margin-left: 10px; |
| | | } |
| | | </style> |
New file |
| | |
| | | searcheh<!-- ä¸çæº --> |
| | | <script setup> |
| | | import request from "@/utils/request"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { WebSocketHost, host } from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const { t } = useI18n() |
| | | const requestData = reactive({ |
| | | account: '', |
| | | password: '', |
| | | }); |
| | | const blind = ref(false) |
| | | const errorInfo = ref(true) |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const sendRecords = ref([]); |
| | | const downLineTask = ref([]); |
| | | const scanCode = ref([]); |
| | | const scanCodeOld = ref([]); |
| | | const searcheh = ref(); |
| | | |
| | | const machineId = 2;//å½å页é¢ç设å¤ID |
| | | var errorScanId; |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/manualReporting`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage = (data) => { |
| | | // æ´æ° tableData çæ°æ® |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | scanCode.value = data.scanCode[0]; |
| | | sendRecords.value = data.sendRecords[0].reverse(); |
| | | |
| | | if(scanCode.value.length>0&&scanCode.value[0].scanId.toString()!=errorScanId){ |
| | | //ææ°æ®å°±å¼¹çª |
| | | errorScanId=scanCode.value[0].scanId.toString(); |
| | | errorInfoFuntion(scanCode.value[0]); |
| | | } |
| | | |
| | | }; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("å
³éäº") |
| | | closeWebSocket(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | }); |
| | | //æ¥è¦æç¤º |
| | | const errorInfoFuntion = async (info) => { |
| | | let infoScancode='æ«ç IDï¼'+info.scanId+' '+info.scanCode; |
| | | ElMessageBox.confirm( |
| | | infoScancode, |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sureStart'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //éæ°è¡¥å |
| | | request.post("/deviceInteraction/tasking/glassAgainTopLine", |
| | | { |
| | | "scanId": info.scanId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¿®æ¹å·¥ä½ç¶æ ã失败/æ£å¨å·¥ä½/å®å·¥ã |
| | | const workStatus = async (row, state) => { |
| | | let url; |
| | | if (state == "éå") { |
| | | url = "/deviceInteraction/tasking/loseMachineTask"; |
| | | } else if (state == "æ£å¨å·¥ä½") { |
| | | url = "/deviceInteraction/tasking/startMachineTask"; |
| | | } else if (state == "å®å·¥") { |
| | | url = "/deviceInteraction/tasking/finishMachineTask"; |
| | | } else { |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //å¼å§ä¿®æ¹ |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | //å¼å·¥/æå |
| | | const machineStatus = async (state) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ç ´æ |
| | | const damagedTask = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¸çº¿(æ¿èµ°) |
| | | const glassDownLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const topLineShow = async () => { |
| | | blind.value = true; |
| | | } |
| | | const fetchData = async () => { |
| | | //æ«ç å车æäº¤ |
| | | alert(searcheh.value); |
| | | searcheh.value=""; |
| | | } |
| | | //ä¸çº¿ |
| | | const topLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassTopLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | "lineConfigurationId": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else {n |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const handleDialogClose = () => { |
| | | |
| | | } |
| | | </script> |
| | | <template> |
| | | <div ref="content" style="padding:0 20px;"> |
| | | <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;"> |
| | | {{ $t('machine.manualReporting') }} |
| | | </div> |
| | | |
| | | <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose"> |
| | | <!-- å·²æ¥å·¥ --> |
| | | |
| | | </el-dialog> |
| | | |
| | | <hr /> |
| | | <br> |
| | | <div id="search" style="height:35px;line-height: 35px;"> |
| | | <!-- åè½ --> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.reporting') }}</el-button> |
| | | |
| | | <el-input v-model="searcheh" type="primary" id="ReportSubmission" @keyup.enter="fetchData" |
| | | style="width:1000px;height:35px;line-height: 35px;font-size: 35px;float: right;"></el-input> |
| | | |
| | | </div> |
| | | |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <el-table :data="loadData" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" > |
| | | <template #header> |
| | | <div> |
| | | <div>{{ $t('glassInfo.taskType') }} |
| | | <el-icon @click="fetchData"><CaretTop /></el-icon> |
| | | <el-icon @click="fetchData"><CaretBottom /></el-icon> |
| | | <el-icon color="#409efc"><Filter /></el-icon> |
| | | </div> |
| | | |
| | | |
| | | <!-- <el-input size="small" placeholder="Type to search" /> --> |
| | | |
| | | </div> |
| | | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="taskQuantity" :label="$t('glassInfo.taskQuantity')" /> |
| | | <el-table-column prop="reportCount" :label="$t('glassInfo.reportCount')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'å®å·¥')">{{ |
| | | $t('functionState.finish') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose') |
| | | }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;"> |
| | | <!-- è¡¨æ ¼å
容详æ
--> |
| | | <el-table :data="loadData" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'å®å·¥')">{{ |
| | | $t('functionState.finish') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose') |
| | | }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | table { |
| | | text-align: center; |
| | | width: 100%; |
| | | height: 100%; |
| | | border-collapse: collapse; |
| | | border-spacing: 0; |
| | | } |
| | | |
| | | table td { |
| | | text-align: center; |
| | | } |
| | | |
| | | #main-body { |
| | | width: 100%; |
| | | height: 100%; |
| | | border: 1px solid #ccc; |
| | | margin-top: 25px; |
| | | } |
| | | |
| | | #searchButton { |
| | | width: 100px; |
| | | height: 40px; |
| | | font-size: 16px; |
| | | border-radius: 5px; |
| | | background-color: #409EFF; |
| | | color: #fff; |
| | | border: none; |
| | | cursor: pointer; |
| | | } |
| | | .dotClass { |
| | | width:10px; |
| | | height:10px; |
| | | border-radius: 50%; |
| | | display: block; |
| | | margin-left: 10px; |
| | | } |
| | | </style> |
| | |
| | | }); |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const machineId=11;//å½å页é¢ç设å¤ID |
| | | const sendRecords = ref([]); |
| | | const machineId=12;//å½å页é¢ç设å¤ID |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/marking`; |
| | |
| | | // æ´æ° tableData çæ°æ® |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | sendRecords.value = data.sendRecords[0]; |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | |
| | | <el-button type="primary" id="searchButton" @click="workStatus('ç ´æ')">ç ´æ</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('å®å·¥')">å®å·¥</el-button> --> |
| | | </div> |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <div id="main-body"> |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <el-table :data="loadData" stripe |
| | | <el-table :data="loadData" stripe style="height:260px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')"/> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')"/> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/> |
| | |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div id="main-body" |
| | | style="width: 100%; height: 460px;background-image: url(../../src/assets/èªå¨ææ æº.png) ;background-size: 100% 100%;"> |
| | | <!-- ç»å¾å
容 --> |
| | | <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px"> |
| | | <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;"> |
| | | <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/èªå¨ææ æº.png"></el-image> |
| | | <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url('../../src/assets/èªå¨ææ æº.png') ;background-size: 100% 100%;float: left;"> |
| | | |
| | | </div> --> |
| | | <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;"> |
| | | <!-- <div style="text-align: center;height: 30px;line-height: 30px;font-size: 20px;padding: 20px;">æ°æ®äº¤äºè®°å½</div> --> |
| | | <el-table :data="sendRecords" stripe :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center',height:'30px'}" :cell-style="{ textAlign: 'center' }"> |
| | | <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')"/> |
| | | </el-table> |
| | | </div> |
| | | <div style="clearï¼both"></div> |
| | | <!-- ç»å¾å
容 |
| | | <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px"> |
| | | </div>--> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | <!-- ææ æº --> |
| | | <!-- ä¸çæº --> |
| | | <script setup> |
| | | import request from "@/utils/request"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { reactive, ref, onMounted, onBeforeUnmount,onUnmounted } from 'vue' |
| | | import { computed,reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import { WebSocketHost, host } from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const { t } = useI18n() |
| | |
| | | account: '', |
| | | password: '', |
| | | }); |
| | | const blind = ref(false) |
| | | const errorInfo = ref(true) |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const machineId=1;//å½å页é¢ç设å¤ID |
| | | const sendRecords = ref([]); |
| | | const downLineTask = ref([]); |
| | | const findPrimitiveTask = ref([]); |
| | | const scanCodeOld = ref([]); |
| | | const searchs = ref(); |
| | | const machineId = 2;//å½å页é¢ç设å¤ID |
| | | var errorScanId; |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/mechanicalArm`; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/loadTask`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage = (data) => { |
| | | // æ´æ° tableData çæ°æ® |
| | | loadData.value = data.taskingList[0]; |
| | | loadData.value = data.findPrimitiveTasking[0]; |
| | | findPrimitiveTask.value = data.findPrimitiveTask[0]; |
| | | findMachine.value = data.machine[0]; |
| | | sendRecords.value = data.sendRecords[0].reverse(); |
| | | }; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | |
| | | onMounted(async () => { |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | |
| | | |
| | | //ä½¿ç¨æ¥å£æ¹å¼å±ç¤ºæ°æ® |
| | | //load(); |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | }); |
| | | |
| | | // //è·åæ°æ® |
| | | // const load = async() => { |
| | | // //è·å设å¤ä»»å¡æ°æ® |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/tasking/findMachineTask', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // loadData.value.findTaskingData= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // //è·å设å¤ç¶æ |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/machine/findMachine', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // findMachine.value= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // } |
| | | //æ¥è¦æç¤º |
| | | const errorInfoFuntion = async (info) => { |
| | | let infoScancode='æ«ç IDï¼'+info.scanId+' '+info.scanCode; |
| | | ElMessageBox.confirm( |
| | | infoScancode, |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sureStart'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //éæ°è¡¥å |
| | | request.post("/deviceInteraction/tasking/glassAgainTopLine", |
| | | { |
| | | "scanId": info.scanId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¿®æ¹å·¥ä½ç¶æ ã失败/æ£å¨å·¥ä½/å®å·¥ã |
| | | const workStatus = async(row,state) => { |
| | | const workStatus = async (row, state) => { |
| | | let url; |
| | | if(state=="éå"){ |
| | | url="/deviceInteraction/tasking/loseMachineTask"; |
| | | }else if(state=="æ£å¨å·¥ä½"){ |
| | | url="/deviceInteraction/tasking/startMachineTask"; |
| | | }else if(state=="å®å·¥"){ |
| | | url="/deviceInteraction/tasking/finishMachineTask"; |
| | | }else{ |
| | | if (state == "éå") { |
| | | url = "/deviceInteraction/tasking/loseMachineTask"; |
| | | } else if (state == "æ£å¨å·¥ä½") { |
| | | url = "/deviceInteraction/tasking/startMachineTask"; |
| | | } else if (state == "å®å·¥") { |
| | | url = "/deviceInteraction/tasking/finishMachineTask"; |
| | | } else { |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //å¼å§ä¿®æ¹ |
| | | request.post(url, |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //å¼å§ä¿®æ¹ |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | "id": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | //å¼å·¥/æå |
| | | const machineStatus = async(state) => { |
| | | //å®å¶/æ å |
| | | const machineMode = async (mode) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/toggleModeMachine", |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //å¼å·¥/æå |
| | | const machineStatus = async (state) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ç ´æ |
| | | const damagedTask = async(row) => { |
| | | const damagedTask = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | "glassId": row.glassId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¸çº¿(æ¿èµ°) |
| | | const glassDownLine = async(row) => { |
| | | const glassDownLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¸çº¿ |
| | | const topLine = async() => { |
| | | |
| | | const topLineShow = async () => { |
| | | blind.value = true; |
| | | } |
| | | //é¢åä»»å¡/ç»æä»»å¡ |
| | | const startOrStopTask = async (row,line,isWorking) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //é¢åä»»å¡ |
| | | request.post("/deviceInteraction/primitiveTask/startOrStopPrimitiveTasking", |
| | | { |
| | | "id": row.id, |
| | | "getLine": line, |
| | | "isWorking": isWorking |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else {n |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const handleDialogClose = () => { |
| | | |
| | | } |
| | | |
| | | |
| | | const fetchData = async () => { |
| | | //æ«ç å车æäº¤ |
| | | alert(searchs.value); |
| | | searchs.value=""; |
| | | } |
| | | const filterTableData = computed(() => |
| | | loadData.value.filter( |
| | | (data) => |
| | | !searchs.value ||data.scanId.toLowerCase().includes(searchs.value.toLowerCase()) |
| | | ) |
| | | ) |
| | | </script> |
| | | <template> |
| | | <div ref="content" style="padding:0 20px;"> |
| | | <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;"> |
| | | {{$t('machine.upperSlice')}} |
| | | {{ $t('machine.mechanicalArm') }} |
| | | </div> |
| | | <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose"> |
| | | <!-- æªé¢åçæ åä»»å¡ --> |
| | | |
| | | <el-table :data="findPrimitiveTask" stripe style="height:260px" :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="taskQuantity" :label="$t('glassInfo.taskQuantity')" /> |
| | | <el-table-column prop="reportCount" :label="$t('glassInfo.reportCount')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row,2,1)">{{ |
| | | $t('functionState.getTask') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-dialog> |
| | | <hr /> |
| | | <br> |
| | | <div id="search" > |
| | | <div id="search"> |
| | | <!-- åè½ --> |
| | | <el-button :type="(findMachine['state']=='æå'?'danger':'success')" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='æå'?'å¼å·¥':'æå'))">{{findMachine['state']=='å¼å·¥'?$t('functionState.start'):$t('functionState.stop')}}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button> |
| | | <!-- <el-button type="primary" id="searchButton" @click="downLine('ä¸çº¿')">ä¸çº¿</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('ç ´æ')">ç ´æ</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('å®å·¥')">å®å·¥</el-button> --> |
| | | |
| | | <el-button :type="(findMachine['state'] == 'æå' ? 'danger' : 'success')" id="ButtonMachineStatus" |
| | | @click="machineStatus((findMachine['state'] == 'æå' ? 'å¼å·¥' : 'æå'))">{{ findMachine['state'] == 'å¼å·¥' ? |
| | | $t('functionState.start') : $t('functionState.stop') }}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.getTask') }}</el-button> |
| | | |
| | | <el-button :type="(findMachine['mode'] == 'å®å¶' ? 'danger' : 'success')" id="ButtonMachineMode" |
| | | @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ? |
| | | $t('functionState.modeD') : $t('functionState.modeB') }}</el-button> |
| | | </div> |
| | | |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <el-table :data="loadData" stripe |
| | | <el-table :data="filterTableData" stripe style="height:260px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')"/> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')"/> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')"/> |
| | | <el-table-column prop="batchNumber" sortable :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" sortable :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="scanId" sortable :label="$t('glassInfo.scanId')" > |
| | | <template #header> |
| | | <div> |
| | | <div>{{ $t('glassInfo.taskType') }} |
| | | <el-icon @click="fetchData"><CaretTop /></el-icon> |
| | | <el-icon @click="fetchData"><CaretBottom /></el-icon> |
| | | <el-icon color="#409efc"><Filter /></el-icon> |
| | | </div> |
| | | <el-input v-model="searchs" type="primary" id="ReportSubmission" @keyup.enter="fetchData"></el-input> |
| | | <!-- <el-input size="small" placeholder="Type to search" /> --> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="length" sortable :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" sortable :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" sortable :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="taskQuantity" sortable :label="$t('glassInfo.taskQuantity')" /> |
| | | <el-table-column prop="isWorking" sortable :label="$t('glassInfo.isWorking')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'éå')" >{{$t('functionState.anew')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'å®å·¥')">{{$t('functionState.finish')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row,2,2)">{{ |
| | | $t('functionState.stopTask') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div id="main-body" |
| | | style="width: 45%; height: 400px;margin: 50px 0 0 50px;background-image: url(../../src/assets/ä¸çæº.png) ;background-size: 100% 100%;"> |
| | | <!-- ç»å¾å
容 --> |
| | | <div style="width: 200px; height: 100px; background-color: red; position: relative; top: 271px; left: 158px"> |
| | | <div style="width: 500px; height: 300px; position: relative; top: -250PX; left: 800px"> |
| | | <el-table :data="loadData" stripe class="custom-table" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center',height: '80px'}" |
| | | :cell-style="{ textAlign: 'center',height: '80px'}"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="55" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" min-width="55"/> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" min-width="55"/> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')"/> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="100"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" style="min-width: 100px;" link type="primary" plain @click="workStatus(scope.row, 'ç»å®')" >{{$t('functionState.bound')}}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;"> |
| | | <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/æ«ç è¯å«.png"></el-image> |
| | | <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url(../../src/assets/æ«ç è¯å«.png) ;background-size: 100% 100%;float: left;"> |
| | | |
| | | </div> --> |
| | | <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;"> |
| | | <el-table :data="sendRecords" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" /> |
| | | </el-table> |
| | | </div> |
| | | <div style="clearï¼both"></div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | |
| | | table { |
| | | text-align: center; |
| | | width: 100%; |
| | |
| | | border: none; |
| | | cursor: pointer; |
| | | } |
| | | .dotClass { |
| | | width:10px; |
| | | height:10px; |
| | | border-radius: 50%; |
| | | display: block; |
| | | margin-left: 10px; |
| | | } |
| | | </style> |
New file |
| | |
| | | <!-- ææ æº --> |
| | | <script setup> |
| | | import request from "@/utils/request"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { reactive, ref, onMounted, onBeforeUnmount,onUnmounted } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const { t } = useI18n() |
| | | const requestData = reactive({ |
| | | account: '', |
| | | password: '', |
| | | }); |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const machineId=1;//å½å页é¢ç设å¤ID |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/mechanicalArm`; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage = (data) => { |
| | | // æ´æ° tableData çæ°æ® |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | // console.log(data); |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("å
³éäº") |
| | | closeWebSocket(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | |
| | | |
| | | //ä½¿ç¨æ¥å£æ¹å¼å±ç¤ºæ°æ® |
| | | //load(); |
| | | }); |
| | | |
| | | // //è·åæ°æ® |
| | | // const load = async() => { |
| | | // //è·å设å¤ä»»å¡æ°æ® |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/tasking/findMachineTask', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // loadData.value.findTaskingData= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // //è·å设å¤ç¶æ |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/machine/findMachine', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // findMachine.value= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // } |
| | | //ä¿®æ¹å·¥ä½ç¶æ ã失败/æ£å¨å·¥ä½/å®å·¥ã |
| | | const workStatus = async(row,state) => { |
| | | let url; |
| | | if(state=="éå"){ |
| | | url="/deviceInteraction/tasking/loseMachineTask"; |
| | | }else if(state=="æ£å¨å·¥ä½"){ |
| | | url="/deviceInteraction/tasking/startMachineTask"; |
| | | }else if(state=="å®å·¥"){ |
| | | url="/deviceInteraction/tasking/finishMachineTask"; |
| | | }else{ |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //å¼å§ä¿®æ¹ |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | //å¼å·¥/æå |
| | | const machineStatus = async(state) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ç ´æ |
| | | const damagedTask = async(row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¸çº¿(æ¿èµ°) |
| | | const glassDownLine = async(row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¸çº¿ |
| | | const topLine = async() => { |
| | | |
| | | } |
| | | |
| | | </script> |
| | | <template> |
| | | <div ref="content" style="padding:0 20px;"> |
| | | <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;"> |
| | | {{$t('machine.upperSlice')}} |
| | | </div> |
| | | <hr /> |
| | | <br> |
| | | <div id="search" > |
| | | <!-- åè½ --> |
| | | <el-button :type="(findMachine['state']=='æå'?'danger':'success')" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='æå'?'å¼å·¥':'æå'))">{{findMachine['state']=='å¼å·¥'?$t('functionState.start'):$t('functionState.stop')}}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button> |
| | | <!-- <el-button type="primary" id="searchButton" @click="downLine('ä¸çº¿')">ä¸çº¿</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('ç ´æ')">ç ´æ</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('å®å·¥')">å®å·¥</el-button> --> |
| | | </div> |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <el-table :data="loadData" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')"/> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')"/> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')"/> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'éå')" >{{$t('functionState.anew')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'å®å·¥')">{{$t('functionState.finish')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div id="main-body" |
| | | style="width: 45%; height: 400px;margin: 50px 0 0 50px;background-image: url(../../src/assets/ä¸çæº.png) ;background-size: 100% 100%;"> |
| | | <!-- ç»å¾å
容 --> |
| | | <div style="width: 200px; height: 100px; background-color: red; position: relative; top: 271px; left: 158px"> |
| | | <div style="width: 500px; height: 300px; position: relative; top: -250PX; left: 800px"> |
| | | <el-table :data="loadData" stripe class="custom-table" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center',height: '80px'}" |
| | | :cell-style="{ textAlign: 'center',height: '80px'}"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="55" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" min-width="55"/> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" min-width="55"/> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')"/> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="100"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" style="min-width: 100px;" link type="primary" plain @click="workStatus(scope.row, 'ç»å®')" >{{$t('functionState.bound')}}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | |
| | | table { |
| | | text-align: center; |
| | | width: 100%; |
| | | height: 100%; |
| | | border-collapse: collapse; |
| | | border-spacing: 0; |
| | | } |
| | | |
| | | table td { |
| | | text-align: center; |
| | | } |
| | | |
| | | #main-body { |
| | | width: 100%; |
| | | height: 100%; |
| | | border: 1px solid #ccc; |
| | | margin-top: 25px; |
| | | } |
| | | |
| | | #searchButton { |
| | | width: 100px; |
| | | height: 40px; |
| | | font-size: 16px; |
| | | border-radius: 5px; |
| | | background-color: #409EFF; |
| | | color: #fff; |
| | | border: none; |
| | | cursor: pointer; |
| | | } |
| | | </style> |
New file |
| | |
| | | <!-- æè½¬å° --> |
| | | <script setup> |
| | | import request from "@/utils/request"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { WebSocketHost, host } from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const { t } = useI18n() |
| | | const requestData = reactive({ |
| | | account: '', |
| | | password: '', |
| | | }); |
| | | const blind = ref(false) |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const sendRecords = ref([]); |
| | | const downLineTask = ref([]); |
| | | |
| | | const machineId = 20;//å½å页é¢ç设å¤ID |
| | | var errorScanId; |
| | | var errorOpen=false; |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/rotate`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage = (data) => { |
| | | // æ´æ° tableData çæ°æ® |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | sendRecords.value = data.sendRecords[0].reverse(); |
| | | |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //ææ°æ®å°±å¼¹çª |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | |
| | | }; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("å
³éäº") |
| | | closeWebSocket(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åå§å WebSocketï¼å¹¶ä¼ éæ¶æ¯å¤ç彿° |
| | | }); |
| | | //æ¥è¦æç¤º |
| | | const errorInfoFuntion = async (info) => { |
| | | let infoScancode=info; |
| | | ElMessageBox.confirm( |
| | | infoScancode, |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sureStart'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¿®æ¹å·¥ä½ç¶æ ã失败/æ£å¨å·¥ä½/å®å·¥ã |
| | | const workStatus = async (row, state) => { |
| | | let url; |
| | | if (state == "éå") { |
| | | url = "/deviceInteraction/tasking/loseMachineTask"; |
| | | } else if (state == "æ£å¨å·¥ä½") { |
| | | url = "/deviceInteraction/tasking/startMachineTask"; |
| | | } else if (state == "å®å·¥") { |
| | | url = "/deviceInteraction/tasking/finishMachineTask"; |
| | | } else { |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //å¼å§ä¿®æ¹ |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | //å¼å·¥/æå |
| | | const machineStatus = async (state) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //å®å¶/æ å |
| | | const machineMode = async (mode) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/machine/toggleModeMachine", |
| | | { |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ç ´æ |
| | | const damagedTask = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //ä¸çº¿(æ¿èµ°) |
| | | const glassDownLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const topLineShow = async () => { |
| | | blind.value = true; |
| | | } |
| | | //ä¸çº¿ |
| | | const topLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //ä¸çº¿æ¥å£ |
| | | request.post("/deviceInteraction/tasking/glassTopLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | "lineConfigurationId": machineId |
| | | }).then((res) => { // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else {n |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const handleDialogClose = () => { |
| | | |
| | | } |
| | | </script> |
| | | <template> |
| | | <div ref="content" style="padding:0 20px;"> |
| | | <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;"> |
| | | {{ $t('machine.rotate') }} |
| | | </div> |
| | | <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose"> |
| | | <!-- 线ä¸ç»ç --> |
| | | <el-table :data="downLineTask" stripe style="height:260px" :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="topLine(scope.row)">{{ |
| | | $t('functionState.topLine') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-dialog> |
| | | <hr /> |
| | | <br> |
| | | <div id="search"> |
| | | <!-- åè½ --> |
| | | <el-button :type="(findMachine['state'] == 'æå' ? 'danger' : 'success')" id="ButtonMachineStatus" |
| | | @click="machineStatus((findMachine['state'] == 'æå' ? 'å¼å·¥' : 'æå'))">{{ findMachine['state'] == 'å¼å·¥' ? |
| | | $t('functionState.start') : $t('functionState.stop') }}</el-button> |
| | | |
| | | <el-button :type="(findMachine['mode'] == 'å®å¶' ? 'danger' : 'success')" id="ButtonMachineMode" |
| | | @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ? |
| | | $t('functionState.modeD') : $t('functionState.modeB') }}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.topLine') }}</el-button> |
| | | <!-- <el-button type="primary" id="searchButton" @click="downLine('ä¸çº¿')">ä¸çº¿</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('ç ´æ')">ç ´æ</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('å®å·¥')">å®å·¥</el-button> --> |
| | | </div> |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <el-table :data="loadData" stripe style="height:680px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" /> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'éå')">{{ |
| | | $t('functionState.anew') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, 'å®å·¥')">{{ |
| | | $t('functionState.finish') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose') |
| | | }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{ |
| | | $t('functionState.downLine') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!-- |
| | | <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;"> |
| | | <div style="width: 70%;min-width: 900px; height: 460px;background-size: 100% 100%;float: left;"> |
| | | |
| | | </div> |
| | | <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;"> |
| | | <el-table :data="sendRecords" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" /> |
| | | </el-table> |
| | | </div> |
| | | <div style="clearï¼both"></div> |
| | | </div> --> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | table { |
| | | text-align: center; |
| | | width: 100%; |
| | | height: 100%; |
| | | border-collapse: collapse; |
| | | border-spacing: 0; |
| | | } |
| | | |
| | | table td { |
| | | text-align: center; |
| | | } |
| | | |
| | | #main-body { |
| | | width: 100%; |
| | | height: 100%; |
| | | border: 1px solid #ccc; |
| | | margin-top: 25px; |
| | | } |
| | | |
| | | #searchButton { |
| | | width: 100px; |
| | | height: 40px; |
| | | font-size: 16px; |
| | | border-radius: 5px; |
| | | background-color: #409EFF; |
| | | color: #fff; |
| | | border: none; |
| | | cursor: pointer; |
| | | } |
| | | .dotClass { |
| | | width:10px; |
| | | height:10px; |
| | | border-radius: 50%; |
| | | display: block; |
| | | margin-left: 10px; |
| | | } |
| | | </style> |
| | |
| | | //load(); |
| | | }); |
| | | |
| | | // //è·åæ°æ® |
| | | // const load = async() => { |
| | | // //è·å设å¤ä»»å¡æ°æ® |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/tasking/findMachineTask', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // loadData.value.findTaskingData= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // //è·å设å¤ç¶æ |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/machine/findMachine', |
| | | // { |
| | | // "id": 11 |
| | | // }); // æ¿æ¢ä¸ºä½ çAPIç«¯ç¹ |
| | | // if (response.code === 200) { |
| | | // findMachine.value= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // } |
| | | //ä¿®æ¹å·¥ä½ç¶æ ã失败/æ£å¨å·¥ä½/å®å·¥ã |
| | | const workStatus = async(row,state) => { |
| | | let url; |
| | |
| | | }); |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const machineId=13;//å½å页é¢ç设å¤ID |
| | | const sendRecords = ref([]); |
| | | const machineId=14;//å½å页é¢ç设å¤ID |
| | | //使ç¨WebSocketæ¹å¼å±ç¤ºæ°æ® |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/silkScreen`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/silkScreenTask`; |
| | | // å®ä¹æ¶æ¯å¤ç彿°ï¼æ´æ° receivedData åé |
| | | const handleMessage = (data) => { |
| | | // æ´æ° tableData çæ°æ® |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | sendRecords.value = data.sendRecords[0]; |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | |
| | | {{findMachine['state']=='å¼å·¥'?$t('functionState.start'):$t('functionState.stop')}}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button> |
| | | </div> |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <div id="main-body" style="height:240px; min-height:240px;"> |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <el-table :data="loadData" stripe |
| | | <el-table :data="loadData" stripe style="height:680px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')"/> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')"/> |
| | | <el-table-column prop="silkScreenX" :label="$t('glassInfo.silkScreenX')"/> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div id="main-body" |
| | | style="width: 100%; height: 460px;background-image: url(../../src/assets/a.png) ;background-size: 100% 100%;"> |
| | | <!-- ç»å¾å
容 --> |
| | | <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px"> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </template> |
| | | |