From f5675e248c3b728efaf050388206f66326b7c4b7 Mon Sep 17 00:00:00 2001 From: qmj <37242163+qmj666@users.noreply.github.com> Date: Mon, 22 Dec 2025 11:27:47 +0800 Subject: [PATCH] init --- package.json | 2 +- src/components/Common/CommonHooks/useCommonBase.js | 45 +++++++++++++++++++++++++++++++++++++-------- src/components/Common/CommonInstructSet.js | 16 +++++++++++++++- src/components/Common/CommonTable/index.js | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------- src/components/Common/commonFunc.js | 1 + src/indexNew.less | 4 ++++ src/mes/common/RunningStatus/index.js | 197 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------- src/mes/common/RunningStatus/index.less | 13 +++++++++---- src/mes/common/commonModelComponent/index.js | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------- src/mes/common/siderInfoComponent/clockComponent/index.js | 8 ++++++-- src/mes/indexMes/index.js | 467 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ src/mes/productionExec/productionExecMain/index.js | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------- src/mes/scheduledTasks/machineTasks/index.js | 9 ++++++++- src/mes/scheduledTasks/machineTasks/index.less | 10 ++++++++-- src/mes/teamInfo/index.js | 2 ++ src/models/app.js | 12 +++++++++++- src/utils/config.js | 10 +++++----- 17 files changed, 799 insertions(+), 290 deletions(-) diff --git a/package.json b/package.json index cadc844..0353b57 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.5", "private": true, "scripts": { - "start": "set port=8543&roadhog server --progress --watch --colors --profile", + "start": "set port=9005&roadhog server --progress --watch --colors --profile", "build": "roadhog build", "lint": "eslint --ext .js src test", "precommit": "npm run lint" diff --git a/src/components/Common/CommonHooks/useCommonBase.js b/src/components/Common/CommonHooks/useCommonBase.js index 7274af1..789cbee 100644 --- a/src/components/Common/CommonHooks/useCommonBase.js +++ b/src/components/Common/CommonHooks/useCommonBase.js @@ -428,20 +428,20 @@ const useCommonBase = props => { return {}; }; - const getSqlCondition = (showConfig, name, record) => { + const getSqlCondition = (showConfig, name, record, props = state) => { const conditonValues = {}; if (commonUtils.isNotEmptyStr(showConfig.sSqlCondition)) { const conditon = showConfig.sSqlCondition.split(","); conditon.forEach(item => { // 特殊处理 if (item === "sBoardNo.sBoardNo") { - if (commonUtils.isNotEmptyArr(state["qztable0Data"])) { + if (commonUtils.isNotEmptyArr(props["qztable0Data"])) { item = "qztable0.sBoardNo"; - } else if (commonUtils.isNotEmptyArr(state["jytable0Data"])) { + } else if (commonUtils.isNotEmptyArr(props["jytable0Data"])) { item = "jytable0.sBoardNo"; - } else if (commonUtils.isNotEmptyArr(state["wytable0Data"])) { + } else if (commonUtils.isNotEmptyArr(props["wytable0Data"])) { item = "wytable0.sBoardNo"; - } else if (commonUtils.isNotEmptyArr(state["wytgtable0Data"])) { + } else if (commonUtils.isNotEmptyArr(props["wytgtable0Data"])) { item = "wytgtable0.sBoardNo"; } } @@ -457,7 +457,7 @@ const useCommonBase = props => { item.split(".").length > 2 ? item.split(".")[2] : fieldName; if (fieldName.indexOf("&Search") > -1) { // 参数为&Search时认为是查找数据集中取数据 - const data = state[`${tableName}Data`]; + const data = props[`${tableName}Data`]; if (typeof data === "object" && data.constructor === Object) { Object.keys(data).forEach(dataItem => { if (`&Search${data[dataItem]}` === fieldName) { @@ -488,6 +488,7 @@ const useCommonBase = props => { if ( [ "userinfo", + "changeExecInfo", "currentSelectedMachineTask", "currentStartWorkMachineTask", "currentWorkOrderInfo" @@ -500,6 +501,7 @@ const useCommonBase = props => { ); const tempProps = { userinfo: app.userinfo, + changeExecInfo: commonUtils.getAppData("changeExecInfo"), currentSelectedMachineTask: globalData?.currentSelectedMachineTask, currentStartWorkMachineTask: @@ -511,8 +513,8 @@ const useCommonBase = props => { const data = record; conditonValues[fieldNameFilter] = data[fieldName]; } else { - const data = state[`${tableName}Data`]; - const selectedRowKeys = state[`${tableName}SelectedRowKeys`]; + const data = props[`${tableName}Data`]; + const selectedRowKeys = props[`${tableName}SelectedRowKeys`]; if (typeof data === "object" && data.constructor === Object) { conditonValues[fieldNameFilter] = data[fieldName]; } else if (commonUtils.isNotEmptyArr(selectedRowKeys)) { @@ -1939,6 +1941,8 @@ const useCommonBase = props => { // 调用通用过程 const handleProcedureCall = async (params, iFlag) => { const { + bForemanCheck, + getFaceResult, btnConfig = {}, // 按钮配置 sValue = {}, // 额外参数 tableData: tableDataSelected, // 传过来的数据 @@ -2013,6 +2017,7 @@ const useCommonBase = props => { if ( [ "userinfo", + "changeExecInfo", "currentSelectedMachineTask", "currentStartWorkMachineTask", "currentWorkOrderInfo" @@ -2022,6 +2027,7 @@ const useCommonBase = props => { const globalData = commonUtils.getAppData("globalData"); const tempProps = { userinfo: app.userinfo, + changeExecInfo: commonUtils.getAppData("changeExecInfo"), currentSelectedMachineTask: globalData.currentSelectedMachineTask, currentStartWorkMachineTask: globalData.currentStartWorkMachineTask, @@ -2128,6 +2134,29 @@ const useCommonBase = props => { message.success(msg); onSuccess && onSuccess(true); } else if (code === -7) { + if (bForemanCheck && getFaceResult) { + Modal.confirm({ + title: "温馨提示:", + content:
{handleGetMsg(msg)}
, + okText: "领班认证", + cancelText: "取消", + async onOk() { + Modal.destroyAll(); + const faceResult = await getFaceResult(); + if (!faceResult) { + onError && onError(); + return; + }; + const paramsNew = { ...params, faceData: { ...faceData, sForemanNo: faceResult.sEmployeeNo } }; + handleProcedureCall(paramsNew, 1); + }, + onCancel() { + onError && onError(); + } + }); + return; + } + Modal.confirm({ title: "温馨提示:", content:
{handleGetMsg(msg)}
, diff --git a/src/components/Common/CommonInstructSet.js b/src/components/Common/CommonInstructSet.js index 65d97d1..563df75 100644 --- a/src/components/Common/CommonInstructSet.js +++ b/src/components/Common/CommonInstructSet.js @@ -821,7 +821,7 @@ const handlePopup = (props, instruct) => { const record = filterData[0]; sParentConditions = { ...sParentConditions, - ...props.getSqlCondition(props.btnConfig, tableName, record) + ...props.getSqlCondition(props.btnConfig, tableName, record, props) }; }); } @@ -1514,6 +1514,12 @@ const handleOpenSql = async (props, instruct) => { ...userinfo }; } + if (sSqlCondition.includes("changeExecInfo")) { + srcDatasetRow = { + ...srcDatasetRow, + ...commonUtils.getAppData("changeExecInfo") + }; + } if (sSqlCondition.includes("currentWorkOrderInfo")) { srcDatasetRow = { ...srcDatasetRow, @@ -2277,6 +2283,7 @@ const handleComputeData = (props, str, datasetList) => { [fordosetName]: fordosetData, ...datasetList, userinfo, + changeExecInfo: commonUtils.getAppData("changeExecInfo"), currentSelectedMachineTask, currentStartWorkMachineTask, currentWorkOrderInfo @@ -2290,6 +2297,7 @@ const handleComputeData = (props, str, datasetList) => { key.includes("@") || [ "userinfo", + "changeExecInfo", "currentSelectedMachineTask", "currentStartWorkMachineTask", "currentWorkOrderInfo" @@ -2454,6 +2462,9 @@ const utils = { if (tableName === "userinfo") { return [props.app.userinfo]; } + if (tableName === "changeExecInfo") { + return [commonUtils.getAppData("changeExecInfo")]; + } let _props = props; @@ -2799,6 +2810,7 @@ const utils = { [fordosetName]: fordosetData, ...datasetListExtra, userinfo, + changeExecInfo: commonUtils.getAppData("changeExecInfo"), currentSelectedMachineTask, currentStartWorkMachineTask, currentWorkOrderInfo @@ -2812,6 +2824,7 @@ const utils = { key.includes("@") || [ "userinfo", + "changeExecInfo", "currentSelectedMachineTask", "currentStartWorkMachineTask", "currentWorkOrderInfo" @@ -3046,6 +3059,7 @@ const utils = { // 全局参数 let allData = { userinfo, + changeExecInfo: commonUtils.getAppData("changeExecInfo"), currentSelectedMachineTask, currentStartWorkMachineTask, currentWorkOrderInfo, diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index e80de6a..fa9f5a1 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -4552,7 +4552,7 @@ class CommonTableRc extends React.Component { // 人检-产量上报信息-上报数量 复制第一行到全部功能 if ( this.props.name === "table131" && - ["dProcessCalQty", "dWageHour", "dTimeHour"].includes( + ["dProcessCalQty", "dWageHour", "dOvertimeHour", "dTimeHour"].includes( column.dataIndex ) ) { @@ -4707,13 +4707,13 @@ class CommonTableRc extends React.Component { tableBtnsWidth = Math.max(75, tableBtnsWidth); } if ( - ["12710101117087404588200", "12710101117260270570210"].includes( + (["12710101117087404588200", "12710101117260270570210"].includes( props.formId ) && - props.name === "table0" - // || - // (props.formId === "12710101117087371044360" && - // props.name === "slave0") + props.name === "table0") + || + (props.formId === "12710101117087371044360" && + props.name === "slave0") ) { tableBtnsWidth = Math.max(110, tableBtnsWidth); } @@ -4829,15 +4829,13 @@ class CommonTableRc extends React.Component { 操作
{/* 班组报工行车记录 */} - {["12710101117087404588200", "12710101117260270570210"].includes( + {(["12710101117087404588200", "12710101117260270570210"].includes( props.formId - ) && props.name === "table0" ? ( - // || - // (props.formId === "12710101117087371044360" && - // props.name === "slave0") + ) && props.name === "table0") || + (props.formId === "12710101117087371044360" && props.name === "slave0") ? ( @@ -538,13 +620,16 @@ const RunningContent = props => { status: [ ...group.filter((_, index) => index >= i * 6 && index < i * 6 + 6) ].map(rowData => { - const { sStatusName, sId } = rowData; + const { sStatusName, sId, sResponsibilityType, sResponsibilityColor } = rowData; const [name, status] = sStatusName.split(" "); return { name, status, className: selectedRowKeys.includes(sId) ? classNameTd : "", - rowData: { ...rowData, sClassifyName1: title } + rowData: { ...rowData, sClassifyName1: title }, + // 添加停机原因字段 + responsibilityType: sResponsibilityType || "", + responsibilityColor: sResponsibilityColor || "" }; }) }; @@ -563,6 +648,55 @@ const RunningContent = props => { [JSON.stringify(dataList), JSON.stringify(selectedRowKeys)] ); + + // 计算停机原因的rowspan + const calculateResponsibilityRowspan = (data) => { + const rowspans = []; + const colors = []; // 存储每行的颜色 + let currentValue = null; + let currentColor = null; + let currentCount = 0; + let startIndex = 0; + + // 遍历所有行,计算连续的相同responsibilityType的行数 + for (let i = 0; i < data.length; i++) { + const trData = data[i]; + const responsibilityType = trData.status[0]?.responsibilityType || ""; + const responsibilityColor = trData.status[0]?.responsibilityColor || ""; + + if (responsibilityType === currentValue) { + currentCount++; + } else { + // 处理前一段相同值 + if (currentValue !== null) { + for (let j = startIndex; j < startIndex + currentCount; j++) { + rowspans[j] = j === startIndex ? currentCount : 0; + colors[j] = currentColor; // 设置颜色 + } + } + + // 开始新的计数 + currentValue = responsibilityType; + currentColor = responsibilityColor; + currentCount = 1; + startIndex = i; + } + } + + // 处理最后一段 + if (currentValue !== null) { + for (let j = startIndex; j < startIndex + currentCount; j++) { + rowspans[j] = j === startIndex ? currentCount : 0; + colors[j] = currentColor; // 设置颜色 + } + } + + return { rowspans, colors }; + }; + + + + const pattern = title => { const regex = /(.+?)\((.+)\)/; const result = title.match(regex); @@ -578,14 +712,31 @@ const RunningContent = props => { return title; } }; + // 计算停机原因的rowspan数组和颜色数组 + const { rowspans: responsibilityRowspans, colors: responsibilityColors } = calculateResponsibilityRowspan(data); return (
- {data.map(trData => ( + {data.map((trData, trIndex) => ( + {/* 第一列:停机原因列 */} + {responsibilityRowspans[trIndex] > 0 && ( + + )} {trData.type === 1 && (
+
+

{trData.status[0]?.responsibilityType || ""}

+
+
{ delete tabConfigFilter[0].configList[1].children[2].configList[7]; } catch (error) {} } + + tabConfigFilter[0].configList[0].children[1].configList = tabConfigFilter[0].configList[0].children[1].configList.filter(item => !!item); + + [ + tabConfigFilter[0].configList[0].children[1].configList[0], + tabConfigFilter[0].configList[0].children[1].configList[1] + ] = + [ + tabConfigFilter[0].configList[0].children[1].configList[1], + tabConfigFilter[0].configList[0].children[1].configList[0] + ]; + return [tableListFilter, tabConfigFilter]; }; @@ -574,10 +586,12 @@ const useCommonModelEvent = props => { runningTime = isBefore8AM ? now.subtract(1, "days").format("YYYY-MM-DD") : now.format("YYYY-MM-DD"), - runningShift = props.app?.userinfo?.sShift.toString() + runningShift = props.app?.userinfo?.sShift.toString(), + iShowType = 1 } = props; conditonValues.tCreateTime = runningTime; conditonValues.sShiftNew = runningShift; + conditonValues.iShowType = iShowType; } //【班组报工特殊处理】历史日报查看详情如果班组报工没查到数据,用sSReserve1当历史日报的sId @@ -698,9 +712,9 @@ const useCommonModelEvent = props => { //【班组报工特殊处理】历史日报查看详情如果班组报工没查到数据,用sSReserve1当历史日报的sId if ( - refreshTableList.length === 1 && + refreshTableList?.length === 1 && refreshTableList[0] === "table0" && - !addState.table0Data.length && + !addState.table0Data?.length && props.sSReserve1 ) { addState.refreshTableList = ["tableS0"]; @@ -1106,7 +1120,7 @@ const useComputedCommonDivHeight = props => { ) { returnHeight = `calc(${returnHeight} - 40px)`; } - + // 下料界面板材信息 if(sTabName=='版材信息'){ returnHeight = `calc(100% - 10px)`; @@ -1253,7 +1267,11 @@ const CommonModelComponent = props => { bFirstComponent: level === 0 && index === -1 }; - const commonDivHeight = useComputedCommonDivHeight(componentProps); + let commonDivHeight = useComputedCommonDivHeight(componentProps); + + if(sName === 'table1'){ + commonDivHeight = "calc(calc(100% - 50px))"; + } return (
{ const config = props.onMergeTableConfig(configOld); const { gdsconfigformslave: gdsconfigformslaveOld = [] } = config; - const gdsconfigformslave = cloneDeep(gdsconfigformslaveOld); + let gdsconfigformslave = cloneDeep(gdsconfigformslaveOld); // 展示的数据 let viewRow = {}; @@ -1538,6 +1556,8 @@ const CommonViewTableComponent = props => { }); } }); + + gdsconfigformslave = props.onMergeTableConfig({ ...configOld, gdsconfigformslave }).gdsconfigformslave; } } @@ -1601,7 +1621,7 @@ const CommonViewTableComponent = props => { if(viewProps.tableS0Data && viewProps.tableS0Data.length!==0){ viewProps.reportPeopleSelectedRowKeys = viewProps.tableS0Data[0].sMainAssistantTransId?.split(",") - + } if (commonUtils.isEmptyObject(viewRow)) { @@ -1619,8 +1639,8 @@ const CommonViewTableComponent = props => { reportRef={reportRef.current || {}} hasShowInfo={viewProps.viewRow} /> - - + + ); })} @@ -1926,7 +1946,15 @@ const CommonRepairComponent = props => { const viewProps = { ...props, enabled, - viewConfigs: filterConfig.map(item => ({ ...item, iColValue: 24 })), + viewConfigs: filterConfig.map(item => { + if (item.sName === 'dAdvanceReportQty') { + return { + ...item, + iTag: viewRow.bAutoReport ? 1 : 3 + } + } + return item; + }).map(item => ({ ...item, iColValue: 24 })), tableConfig: config, iColValueView: 24, viewRow, @@ -2098,6 +2126,8 @@ const RunningStatusConditionComponent = props => { : now ); + const [iShowType, setShowType] = useState(1); + const flag = useRef(false); useEffect( () => { @@ -2106,12 +2136,13 @@ const RunningStatusConditionComponent = props => { props.onSaveState({ runningTime: dateValue.format("YYYY-MM-DD"), runningShift: value, + iShowType, refreshTableList: ["table0"], runningStatusConditionFlag: true // 行车记录修改时间标记 }); } }, - [value, dateValue] + [value, dateValue, iShowType] ); const [visible, setVisible] = useState(false); @@ -2193,9 +2224,19 @@ const RunningStatusConditionComponent = props => { } }; + const handleSwitchShowType = (e) => { + const { value } = e.target; + flag.current = true; + setShowType(value); + } + return (
+ + 未上报 + 全部 + { const [disabled, setDisabled] = useState(true); const [bounds, setBounds] = useState({ left: 0, top: 0, bottom: 0, right: 0 }); const draggleRef = useRef(null); + const [freshCount, setFreshCount] = useState(0); const [data, setData] = useState([]); useEffect( () => { if (ModalVisible) { + const changeExecInfoNew = commonUtils.getAppData("changeExecInfo"); const deviceTargetInfoDataPart = [ - { ...(props.deviceTargetInfoData?.[0] || {}) }, + { ...(props.deviceTargetInfoData?.[0] || {}), ...changeExecInfoNew }, ...(data || []) ].slice(0, 30); // 弹框展示内容 setData(deviceTargetInfoDataPart); } }, - [props.deviceTargetInfoData, ModalVisible] + [props.deviceTargetInfoData, freshCount, ModalVisible] ); const timer = useRef(null); @@ -33,6 +36,7 @@ const ClockComponent = ({ num: numNew = 0, ...props }) => { if (numNew === 0) return; if (num === numNew) return; + setFreshCount(pre => pre + 1); if (num === 0 && numNew > 0) { setNum(numNew); return; diff --git a/src/mes/indexMes/index.js b/src/mes/indexMes/index.js index d25fe80..cf113c9 100644 --- a/src/mes/indexMes/index.js +++ b/src/mes/indexMes/index.js @@ -22,10 +22,13 @@ import { Input, Divider, message, - Button + Button, + Form, + DatePicker, + Select, } from "antd"; import { - UndoOutlined, + CloseOutlined, UserAddOutlined, SwapOutlined, AppstoreOutlined @@ -102,9 +105,8 @@ const OpenModalEditPwd = props => { }); // 确认修改密码 const handleOk = () => { - const url = `${ - commonConfig.server_host - }sftlogininfo/updatePasswordUserName/update?sModelsId=${100}`; + const url = `${commonConfig.server_host + }sftlogininfo/updatePasswordUserName/update?sModelsId=${100}`; props.dispatch({ type: "app/editPwd", payload: { @@ -330,26 +332,54 @@ const useIndexMesEvent = props => { [currentContent, sModelsId, sModelType] ); + const { webSocket: ws } = props.app; + const { url } = ws || {}; + const wsRef = useRef(ws); + useEffect(() => { + if (url) { + wsRef.current = ws; + } + }, [url]); + useEffect(() => { const connectWs = () => { - if ( - props.app.webSocket === null || - props.app.webSocket?.readyState !== WebSocket.OPEN - ) { - console.log("================webSocket连接======================"); + if (!wsRef.current) { + console.log("================webSocket不存在,创建webSocket连接======================"); props.dispatch({ type: "app/createWebSocket", payload: { reStart: true, dispatch: props.dispatch } }); + return; } + if (wsRef.current.readyState !== WebSocket.OPEN) return; + const message = { + connectTest: 'test', + key: 'test', + flag: 'test', + msg: 'test', + sId: 'test', + showType: 'test', + sendFrom: props.app.userinfo.sId, + }; + wsRef.current.send(JSON.stringify(message)); + window.wsTimer = setTimeout(() => { + console.log("================未收到Test返回消息,webSocket重新连接======================"); + props.dispatch({ + type: "app/createWebSocket", + payload: { reStart: true, dispatch: props.dispatch } + }); + }, 3000); }; connectWs(); const timer = setInterval(() => { connectWs(); - }, 50000); + }, 20000); - return () => clearInterval(timer); + return () => { + clearInterval(timer); + clearTimeout(window.wsTimer); + } }, []); useEffect(() => { @@ -414,9 +444,8 @@ const IndexMes = baseProps => { token, sModelsId ) => { - const url = `${ - commonConfig.server_host - }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; + const url = `${commonConfig.server_host + }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; const returnData = (await commonServices.postValueService( token, value, @@ -501,16 +530,16 @@ const HeaderConponent = () => { - const [ isModalOpen, setIsModalOpen ] = useState(false); - const objRef = useRef({}); - const handleCancel = () => setIsModalOpen(false); - window.$wkcFullStatus = (item , is) =>{ - objRef.current = { - ...objRef.current, - ...item - } - setIsModalOpen(is); + const [isModalOpen, setIsModalOpen] = useState(false); + const objRef = useRef({}); + const handleCancel = () => setIsModalOpen(false); + window.$wkcFullStatus = (item, is) => { + objRef.current = { + ...objRef.current, + ...item } + setIsModalOpen(is); + } @@ -550,20 +579,20 @@ const HeaderConponent = () => {
- - - + + +
); @@ -571,125 +600,125 @@ const HeaderConponent = () => { // 停机状态栏 -const MachineMessageComponent = ({ e , shutDown }) => { - const value = e.item?.props?.value || {}; - const { current: startTime } = useRef(moment().format("YYYY-MM-DD HH:mm:ss")); - const { backgroundColor, conent2, fontSize } = value; - const [currentTime, setCurrentTime] = useState(""); - const [diffHours, setDiffHours] = useState(0); - const [diffMins, setDiffMins] = useState(0); - const [diffSecs, setDiffSecs] = useState(0); - useEffect(() => { - const getTime = () => { - const currentTimeNew = moment().format("YYYY-MM-DD HH:mm:ss"); - setCurrentTime(currentTimeNew); - - const duration = moment.duration( - moment(currentTimeNew).diff(moment(startTime)) - ); - const hours = duration.asHours().toString().split(".")[0]; - const minutes = (duration.asMinutes() % 60).toString().split(".")[0]; - const seconds = duration.asSeconds() % 60; - - setDiffHours(hours<=9? `0${hours}`: hours); - setDiffMins(minutes<=9? `0${minutes}`: minutes ); - setDiffSecs(seconds<=9? `0${seconds}`: seconds); - }; - - getTime(); - const timer = setInterval(() => { - console.log('定时器状态') - getTime(); - }, 1000); - - return () => { - clearInterval(timer); - }; - }, []); - - const handleMenuClose = () => { - Modal.confirm({ - title: "温馨提示:", - content:
确认退出该状态?
, - okText: "确认", - cancelText: "取消", - zIndex: 2000, - onOk() { - shutDown() - }, - onCancel() {} - }); +const MachineMessageComponent = ({ e, shutDown }) => { + const value = e.item?.props?.value || {}; + const { current: startTime } = useRef(moment().format("YYYY-MM-DD HH:mm:ss")); + const { backgroundColor, conent2, fontSize } = value; + const [currentTime, setCurrentTime] = useState(""); + const [diffHours, setDiffHours] = useState(0); + const [diffMins, setDiffMins] = useState(0); + const [diffSecs, setDiffSecs] = useState(0); + useEffect(() => { + const getTime = () => { + const currentTimeNew = moment().format("YYYY-MM-DD HH:mm:ss"); + setCurrentTime(currentTimeNew); + + const duration = moment.duration( + moment(currentTimeNew).diff(moment(startTime)) + ); + const hours = duration.asHours().toString().split(".")[0]; + const minutes = (duration.asMinutes() % 60).toString().split(".")[0]; + const seconds = duration.asSeconds() % 60; + + setDiffHours(hours <= 9 ? `0${hours}` : hours); + setDiffMins(minutes <= 9 ? `0${minutes}` : minutes); + setDiffSecs(seconds <= 9 ? `0${seconds}` : seconds); }; - - const isMinMax = useRef('max'); - const draggleRef = useRef(null); - const [bounds, setBounds] = useState({ left: 0, top: 0, bottom: 0, right: 0 }); - const onStart = (_event, uiData) => { - const { clientWidth, clientHeight } = window.document.documentElement; - const targetRect = draggleRef.current?.getBoundingClientRect(); - if (!targetRect) { - return; - } - setBounds({ - left: -targetRect.left + uiData.x, - right: clientWidth - (targetRect.right - uiData.x), - top: -targetRect.top + uiData.y, - bottom: clientHeight - (targetRect.bottom - uiData.y), - }); + getTime(); + const timer = setInterval(() => { + console.log('定时器状态') + getTime(); + }, 1000); + + return () => { + clearInterval(timer); }; + }, []); - - return ( -
- - { - isMinMax.current == 'min'? - onStart(event, uiData)}> -
-
isMinMax.current = 'max'}> -

{conent2}

-
开始时间 {startTime}
-
停机耗时:{diffHours}时 {diffMins}分 {diffSecs}秒
-
- - -
-
-
-
- : -
-
设备停机状态告知
-
- {conent2} -
-
- 停机开始时间: - {startTime} -
-
- 系统当前时间: - {currentTime} -
-
- 此次停机耗时: - - 约: - {diffHours}时 {diffMins}分 {diffSecs}秒 - -
-
- - -
+ const handleMenuClose = () => { + Modal.confirm({ + title: "温馨提示:", + content:
确认退出该状态?
, + okText: "确认", + cancelText: "取消", + zIndex: 2000, + onOk() { + shutDown() + }, + onCancel() { } + }); + }; + + + const isMinMax = useRef('max'); + const draggleRef = useRef(null); + const [bounds, setBounds] = useState({ left: 0, top: 0, bottom: 0, right: 0 }); + const onStart = (_event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + + + return ( +
+ + { + isMinMax.current == 'min' ? + onStart(event, uiData)}> +
+
isMinMax.current = 'max'}> +

{conent2}

+
开始时间 {startTime}
+
停机耗时:{diffHours}时 {diffMins}分 {diffSecs}秒
+
+ +
- } +
+
+
+ : +
+
设备停机状态告知
+
+ {conent2} +
+
+ 停机开始时间: + {startTime} +
+
+ 系统当前时间: + {currentTime} +
+
+ 此次停机耗时: + + 约: + {diffHours}时 {diffMins}分 {diffSecs}秒 + +
+
+ + +
+
+ } -
- ); +
+ ); }; - + @@ -838,28 +867,75 @@ const SystemFunComponent = () => { }; // 调用通用过程 + const [form] = Form.useForm(); const handleProcedureCall = async (params, iFlag) => { + + const extraValues = await new Promise(resolve => { + form.setFieldsValue({ + tReportDate: moment(), + sTeamType: props.app.sShift + }); + Modal.confirm({ + title: "切换手动", + content: ( + +
+ + + + + + +
+
+ ), + wrapClassName: "mesCommonModal mesLoginForm", + cancelText: "取消", + okText: "确定", + onOk() { + const values = form.getFieldsValue(); + const tReportDate = values?.tReportDate.format("YYYY-MM-DD") || ""; + const sTeamType = values.sTeamType; + resolve({ tReportDate, sTeamType }); + }, + onCancel() { + resolve(false); + } + }); + }); + + if (!extraValues) return; + const { onSuccess } = params; const { app } = props; const { sMachineNameSId, sTeamNameSId, sShift, token, sModelsId } = app; const value = { - sBtnName: "restDailyReport", + sBtnName: "BtnEventAuto", sProName: "sp_ResetDailyReport", sProInParam: JSON.stringify({ changeValue: {}, sButtonParam: { sproName: "sp_ResetDailyReport", - inMap: "userinfo.sMachineGuid,userinfo.sTeamId" + inMap: "userinfo.sMachineGuid,userinfo.sTeamId,userinfo.tReportDate,userinfo.sTeamType" }, params: [ { key: "userinfo", value: [ { + ...extraValues, sMachineGuid: sMachineNameSId, sTeamGuid: sTeamNameSId, + tOperationDate: moment().format("YYYY-MM-DD HH:mm:ss"), sShift, sTeamId: sTeamNameSId, iFlag: iFlag @@ -874,9 +950,8 @@ const SystemFunComponent = () => { value.iFlag = iFlag; } - const url = `${ - commonConfig.server_host - }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; + const url = `${commonConfig.server_host + }procedureCall/doGenericProcedureCall?sModelsId=12710101117241578202960`; const returnData = (await commonServices.postValueService( token, value, @@ -895,7 +970,7 @@ const SystemFunComponent = () => { onOk() { handleProcedureCall(params, 1); }, - onCancel() {} + onCancel() { } }); } else if (code === -8) { Modal.info({ @@ -914,11 +989,53 @@ const SystemFunComponent = () => { // 切换手动/切换自动 const handleProcedureCall1 = async (params = {}, iFlag) => { + const extraValues = await new Promise(resolve => { + form.setFieldsValue({ + tReportDate: moment(), + sTeamType: props.app.sShift + }); + Modal.confirm({ + title: "取消手动", + content: ( + +
+ + + + + + +
+
+ ), + wrapClassName: "mesCommonModal mesLoginForm", + cancelText: "取消", + okText: "确定", + onOk() { + const values = form.getFieldsValue(); + const tReportDate = values?.tReportDate.format("YYYY-MM-DD") || ""; + const sTeamType = values.sTeamType; + resolve({ tReportDate, sTeamType }); + }, + onCancel() { + resolve(false); + } + }); + }); + + if (!extraValues) return; + const { onSuccess } = params; const { app } = props; const { sMachineNameSId, sTeamNameSId, sShift, token, sModelsId } = app; - const userinfo = commonUtils.getAppData("userinfo"); const value = { sBtnName: "switchReportType", @@ -927,18 +1044,19 @@ const SystemFunComponent = () => { changeValue: {}, sButtonParam: { sproName: "sp_SwitchReportType", - inMap: "userinfo.sMachineGuid,userinfo.sTeamId,userinfo.bPlcSd" + inMap: "userinfo.sMachineGuid,userinfo.sTeamId,userinfo.tReportDate,userinfo.sTeamType" }, params: [ { key: "userinfo", value: [ { + ...extraValues, sMachineGuid: sMachineNameSId, sTeamGuid: sTeamNameSId, + tOperationDate: moment().format("YYYY-MM-DD HH:mm:ss"), sShift, sTeamId: sTeamNameSId, - bPlcSd: userinfo.bPlcSd, iFlag: iFlag } ] @@ -951,9 +1069,8 @@ const SystemFunComponent = () => { value.iFlag = iFlag; } - const url = `${ - commonConfig.server_host - }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; + const url = `${commonConfig.server_host + }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; const returnData = (await commonServices.postValueService( token, value, @@ -970,9 +1087,9 @@ const SystemFunComponent = () => { okText: "确认", cancelText: "取消", onOk() { - handleProcedureCall1(params, 1); + handleProcedureCall(params, 1); }, - onCancel() {} + onCancel() { } }); } else if (code === -8) { Modal.info({ @@ -1005,10 +1122,12 @@ const SystemFunComponent = () => { case "restDailyReport": handleProcedureCall({ onSuccess: () => { - location.reload(); + message.success("操作成功, 请等待页面刷新", 2); + setTimeout(() => { + location.reload(); + }, 1500); } }); - break; case "faceCollection": dispatch(["saveState", { faceCollectionModalVisible: true }]); @@ -1016,10 +1135,10 @@ const SystemFunComponent = () => { case "switchStatus": handleProcedureCall1({ onSuccess: () => { - const userInfoNew = commonUtils.getAppData("userinfo"); - userInfoNew.bPlcSd = !userInfoNew.bPlcSd; - commonUtils.setAppData("userinfo", userInfoNew); - location.reload(); + message.success("操作成功, 请等待页面刷新", 2); + setTimeout(() => { + location.reload(); + }, 1500); } }); break; @@ -1078,8 +1197,8 @@ const SystemFunComponent = () => { handleSystemFunClick("restDailyReport"); }} > - - 重置日报 + + 切换手动
{ handleSystemFunClick("switchStatus"); }} > - - {bPlcSd ? "切换自动" : "切换手动"} + + 取消手动
} diff --git a/src/mes/productionExec/productionExecMain/index.js b/src/mes/productionExec/productionExecMain/index.js index 614bcec..a57b4ea 100644 --- a/src/mes/productionExec/productionExecMain/index.js +++ b/src/mes/productionExec/productionExecMain/index.js @@ -1,8 +1,10 @@ -import React, { useEffect, useState, useRef, useMemo } from "react"; -import { Button, Spin, Row, Col } from "antd"; -import { operationFetch } from "./operationFetch"; +import React, {useEffect, useMemo, useRef, useState} from "react"; +import {Button, Col, Input, message, Modal, Row, Select, Space, Spin} from "antd"; +import {operationFetch} from "./operationFetch"; import * as commonUtils from "@/utils/utils"; +import * as commonConfig from "@/utils/config"; +import * as commonServices from "@/services/services"; import useCommonBase from "@/components/Common/CommonHooks/useCommonBase"; import SiderInfoComponent from "@/mes/common/siderInfoComponent"; import * as commonBusiness from "@/components/Common/commonBusiness"; @@ -12,20 +14,9 @@ import CommonViewTable from "@/components/Common/CommonViewTable"; import CommonOperationBarComponent from "@/mes/common/commonOperationBarComponent"; import styles from "./index.less"; -import { - DoubleLeftOutlined, - LeftOutlined, - MinusOutlined, - PlusOutlined, - RightOutlined -} from "@ant-design/icons"; -import { Space } from "antd"; +import {DoubleLeftOutlined, LeftOutlined, MinusOutlined, PlusOutlined, RightOutlined} from "@ant-design/icons"; import CommonModelComponent from "../../common/commonModelComponent"; -import { message } from "antd"; -import { Modal } from "antd"; -import { Select } from "antd"; -import { Input } from "antd"; -import { cloneDeep } from "lodash"; +import {cloneDeep} from "lodash"; const list = [ { sName: "qztable0", sGrd: "qztable0" }, // 切纸生产执行 @@ -408,8 +399,20 @@ const ProductionExecMain = baseProps => { const getValue = () => { const changeExecInfo = commonUtils.getAppData("changeExecInfo"); if (changeExecInfo.dReplyPalletERp === 1) { - props.onRefresh(); - setRefreshCount(pre => pre + 1); + try { + const { sId } = changeExecInfo; + const url = `${commonConfig.server_host}mqtt/updateFlushmes/${sId}`; + commonServices.postValueService(null, {}, url).then(() => { + props.onRefresh(); + setRefreshCount(pre => pre + 1); + }) + } catch (error) { + console.log("=====updateFlushmes报错", { + error, changeExecInfo, + }); + props.onRefresh(); + setRefreshCount(pre => pre + 1); + } } }; @@ -905,19 +908,43 @@ const ProductionExecContent0 = props => { tableProps: {} }; - const viewConfigs = config.gdsconfigformslave - .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) - // .filter((_, index) => index < 8) - .map(item => ({ - ...item, - iColValue: 24 - })); - const viewRow = (selectedRowKeys[0] ? data.find(item => item.sId === selectedRowKeys[0]) : data[0]) || {}; + const viewConfigs = config.gdsconfigformslave + .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) + // .filter((_, index) => index < 8) + .map(item => { + let iTag = item.iTag; + if (item.sName === 'dReportQty' && (viewRow.bAutoReport || viewRow.bReport)) { + iTag = 1; + } + if (['dLockUpFei', 'dMadeUpFei', 'iLaminatingPaper'].includes(item.sName) && (viewRow.bReport|| viewRow.iJobStatus != 3)) { + iTag = 1; + } + if (["dAdvanceMadeUpFei", "dAdvanceLockUpFei", "iAdvanceLaminatingPaper"].includes(item.sName)) { + if (!viewRow.bAdvanceReport && viewRow.iJobStatus && viewRow.bAdvance) { + iTag = 3; + } else { + iTag = 1; + } + } + if (item.sName === "dAdvanceReportQty") { + if (!viewRow.bAdvanceReport && !viewRow.bAutoReport && viewRow.iJobStatus && viewRow.bAdvance) { + iTag = 3; + } else { + iTag = 1; + } + } + return { + ...item, + iColValue: 24, + iTag + } + }); + const viewProps = { ...props, viewConfigs, @@ -939,9 +966,11 @@ const ProductionExecContent0 = props => { config.gdsconfigformslave.find( item => item.sControlName === sControlName ) || {}; + const { showName = '' } = btnConfig; return { ...btnConfig, disabled: props.onGetBtnStatus(tableName, btnConfig), + style: { width: showName.length <= 4 ? 80 : showName.length * 20 }, onClick: async () => { if (!props.onGetBtnContinue()) return; await props.awaitPromiseReturn(); @@ -1029,7 +1058,13 @@ const ProductionExecContent0 = props => { {...btnProps} {...getBtnConfigByControlName("BtnEventBlanking")} > - 下料 + { getBtnConfigByControlName("BtnEventBlanking").showName } + + @@ -1056,7 +1091,13 @@ const ProductionExecContent0 = props => { {...btnProps} {...getBtnConfigByControlName("BtnCancel")} > - 撤销 + { getBtnConfigByControlName("BtnCancel").showName } + + @@ -1166,19 +1207,44 @@ const ProductionExecContent1 = props => { tableProps: {} }; - const viewConfigs = config.gdsconfigformslave - .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) - // .filter((_, index) => index < 8) - .map(item => ({ - ...item, - iColValue: 24 - })); - const viewRow = (selectedRowKeys[0] ? data.find(item => item.sId === selectedRowKeys[0]) : data[0]) || {}; + const viewConfigs = config.gdsconfigformslave + .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) + // .filter((_, index) => index < 8) + .map(item => { + let iTag = item.iTag; + if (item.sName === 'dReportQty' && (viewRow.bAutoReport || viewRow.bReport)) { + iTag = 1; + } + if (['dLockUpFei', 'dMadeUpFei', 'iLaminatingPaper'].includes(item.sName) && (viewRow.bReport || viewRow.iJobStatus != 3)) { + iTag = 1; + } + if (["dAdvanceMadeUpFei", "dAdvanceLockUpFei", "iAdvanceLaminatingPaper"].includes(item.sName)) { + if (!viewRow.bAdvanceReport && viewRow.iJobStatus && viewRow.bAdvance) { + iTag = 3; + } else { + iTag = 1; + } + } + if (item.sName === "dAdvanceReportQty") { + if (!viewRow.bAdvanceReport && !viewRow.bAutoReport && viewRow.iJobStatus && viewRow.bAdvance) { + iTag = 3; + } else { + iTag = 1; + } + } + return { + ...item, + iColValue: 24, + iTag + } + }); + + const viewProps = { ...props, viewConfigs, @@ -1226,7 +1292,7 @@ const ProductionExecContent1 = props => { }; const getBtnProps = btnConfig => { - const { sFontColor } = btnConfig; + const { sFontColor, showName = '' } = btnConfig; const style = sFontColor ? { backgroundColor: sFontColor, borderColor: sFontColor } @@ -1234,7 +1300,7 @@ const ProductionExecContent1 = props => { return { type: "primary", size: "large", - style: { width: 80, ...style }, + style: { width: showName.length <= 4 ? 80 : showName.length * 20, ...style }, disabled: props.onGetBtnStatus(tableName, btnConfig), onClick: async () => { if (!props.onGetBtnContinue()) return; diff --git a/src/mes/scheduledTasks/machineTasks/index.js b/src/mes/scheduledTasks/machineTasks/index.js index d2b67bd..20e706c 100644 --- a/src/mes/scheduledTasks/machineTasks/index.js +++ b/src/mes/scheduledTasks/machineTasks/index.js @@ -733,7 +733,14 @@ {carouselData.map(item => (

{item.title}

-

{item.content}

+

{ + if (item.id === 999) return; + Modal.info({ + width: "40vw", + title: item.title, + content: item.content + }); + }}>{item.content}

))} diff --git a/src/mes/scheduledTasks/machineTasks/index.less b/src/mes/scheduledTasks/machineTasks/index.less index 61dd262..e3fc2c8 100644 --- a/src/mes/scheduledTasks/machineTasks/index.less +++ b/src/mes/scheduledTasks/machineTasks/index.less @@ -172,7 +172,9 @@ } .tasksCarousel { - height: calc(100% - 8px); + height: 100%; + display: flex !important; + flex-direction: column; h2 { padding-left: 30px; @@ -184,9 +186,13 @@ } p { - margin-top: @margin-top; + flex: 1; + overflow: auto; + margin: @margin-top 0 0 0; line-height: 28px; font-size: 18px; + cursor: default; + user-select: none; } } } diff --git a/src/mes/teamInfo/index.js b/src/mes/teamInfo/index.js index f16275e..5399109 100644 --- a/src/mes/teamInfo/index.js +++ b/src/mes/teamInfo/index.js @@ -332,6 +332,8 @@ const useTeamInfoEvent = props => { const { config, record, name } = params; props.onProcedureCall({ + bForemanCheck: true, + getFaceResult, btnConfig: config, tableData: [record], faceData: { sEmployeeNo: faceResult.sEmployeeNo }, diff --git a/src/models/app.js b/src/models/app.js index edea1df..fabd7f5 100644 --- a/src/models/app.js +++ b/src/models/app.js @@ -584,7 +584,7 @@ export default { // } url = `${config.ws_host}websocket/${userinfo.sId}?reStart=true`; if (userinfo.sUserLoginType) { - url = `${config.ws_host}websocket/${userinfo.sId}?reStart=true&sLoginType=${userinfo.sUserLoginType}`; + url = `${config.ws_host}websocket/${userinfo.sId}?reStart=true&createTime=${new Date().getTime()}&sLoginType=${userinfo.sUserLoginType}`; } } const reset = (ws, config1) => { @@ -598,13 +598,23 @@ export default { ws.send(JSON.stringify(message)); }, config1.timeoutServer); }; + const oldWebSocket = yield select(state => state.app.webSocket); const ws = new WebSocket(url); ws.onopen = function (e) { console.log('连接上 webscoket 服务端了', e); start(ws, config); + if (oldWebSocket && oldWebSocket !== ws) { + try { + oldWebSocket.close(); + console.log('================已关闭旧的WebSocket连接======================'); + } catch (error) { + console.log('================关闭旧WebSocket连接时出错======================', error); + } + } }; // 全局通用的自定义onmessage的方法 ws.homeAction = (msg) => { + clearTimeout(window.wsTimer); const rtmsg = JSON.parse(msg.data); if (false && rtmsg.action === 'showImg' && location.pathname.indexOf('/indexOee') < 0) { const msgData = JSON.parse(msg.data); diff --git a/src/utils/config.js b/src/utils/config.js index b84b48d..0c04605 100644 --- a/src/utils/config.js +++ b/src/utils/config.js @@ -1,13 +1,13 @@ /* eslint-disable */ const isDev = process.env.NODE_ENV === 'development'; -const bHttps = location.protocol === 'https:' ; +const bHttps = location.protocol === 'https:'; export const webSite = { // ipAddress: '//t0.xlyprint.com:8000/xlyEntry/', /* 服务器地址 */ // faceAddress: isDev ? '//192.168.11.22:8080/xlyFace' : '//' + location.host + '/xlyFace', fileAddress: isDev ? '//127.0.0.1:8080/xlyEntry/' : '//' + location.host + '/xlyReport/', // 接口地址 - faceAddress: isDev ? '//172.19.18.26:8080/xlyFace' : '//' + location.host + '/xlyFace', - ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//127.0.0.1:8080/xlyEntry/' : '//' + location.host + '/xlyMes/', - interfaceAddress: isDev ? '//127.0.0.1:8088/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 + faceAddress: isDev ? '//172.19.18.50:8543/xlyFace' : '//' + location.host + '/xlyFace', + ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//127.0.0.1:8080/xlyEntry/' : '//' + location.host + '/xlyEntry/', + interfaceAddress: isDev ? '//172.19.18.50:8543/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 // ipAddress: isDev ? '//ebc.jinjia.com:8091/xlyEntry/' : '//' + location.host + '/xlyEntry/', // interfaceAddress: isDev ? '//ebc.jinjia.com:8091/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 // ipAddress: isDev ? '//192.168.11.26:8080/xlyEntry/' : '//' + location.host + '/xlyEntry/', @@ -24,7 +24,7 @@ module.exports = { hasSum: false, isWeiXin: false, server_host: bHttps && !localStorage.ipAddress ? `https:${webSite.ipAddress}` : `http:${webSite.ipAddress}`, /* 外网连内网服务器地址 */ -// server_host: bHttps && !localStorage.ipAddress ? `http://172.19.18.21:8543/xlyMes/` : `http://172.19.18.21:8543/xlyMes/`, /* 外网连内网服务器地址 */ +// server_host: bHttps && !localStorage.ipAddress ? `http://172.19.18.50:8543:8543/xlyMes/` : `http://172.19.18.50:8543:8543/xlyMes/`, /* 外网连内网服务器地址 */ ws_host: bHttps && !localStorage.ipAddress ? `wss:${webSite.ipAddress}` : `ws:${webSite.ipAddress}`, file_host: bHttps ? `https:${webSite.fileAddress}` : `http:${webSite.fileAddress}`, /* 外网连内网服务器地址 */ face_host: bHttps ? `https:${webSite.faceAddress}` : `http:${webSite.faceAddress}`, /* 外网连内网服务器地址 */ -- libgit2 0.22.2