From d1fbb993455b9ce7e820f3eb10a77bfe74e9d7ad Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Thu, 14 Aug 2025 14:54:17 +0800 Subject: [PATCH] 1.MES增加多语言翻译 --- src/components/Common/CommonTable/index.js | 13 +++++++------ src/components/Common/commonFunc.js | 14 +++++++++++++- src/mes/common/buttonComponent/index.js | 10 ++++++---- src/mes/common/commonModelComponent/index.js | 20 ++++++++++++++------ src/mes/common/commonOperationBarComponent/index.js | 37 ++++++++++++------------------------- src/mes/common/faceCollectionComponent/index.js | 24 +++++++++++++++++------- src/mes/common/siderInfoComponent/index.js | 28 ++++++++++++++++++++-------- src/mes/indexMes/index.js | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- src/mes/login/index.js | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------- src/mes/login/index.less | 28 ++++++++++++++++++++++++++++ src/mes/operationGuide/component/BroadsideCard.js | 32 +++++++++++++++++++------------- src/mes/operationGuide/component/FlowChart.js | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------ src/mes/operationGuide/index.js | 2 +- src/mes/productionExec/productionExecMain/index.js | 18 ++++++++++++++---- src/mes/productionExec/quickSwitchTabComponent/index.js | 33 ++++++++++++++++++++++++++++++++- src/mes/queryTracking/index.js | 2 +- src/mes/scheduledTasks/machineTasks/index.js | 2208 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/mes/teamInfo/index.js | 34 ++++++++++++++++++++++------------ 18 files changed, 1682 insertions(+), 1341 deletions(-) diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index e80de6a..93265fa 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -4719,7 +4719,7 @@ class CommonTableRc extends React.Component { } tableBtnsWidth += "px"; } - + const setOperation = commonFunc.showMessage(props.app.commonConst, 'operation') || '操作'; const operationCol = { dataIndex: "operation", render: (text, record, index) => { @@ -4826,7 +4826,7 @@ class CommonTableRc extends React.Component { }, title: () => (
- 操作 + {setOperation}
{/* 班组报工行车记录 */} {["12710101117087404588200", "12710101117260270570210"].includes( @@ -5061,6 +5061,7 @@ class CommonTableRc extends React.Component { const delIcon = props.tableProps.setDelete; /* 删除操作 */ const materialIcon = props.tableProps.setMaterial; /* 材料操作 */ const processIcon = props.tableProps.setProcess; /* 工序操作 */ + const setOperation = commonFunc.showMessage(props.app.commonConst, 'operation') || '操作'; const materailremarkIcon = props.tableProps.setMaterialRemark; /* 材料备注 */ let uploadIcon = props.tableProps.setUpload; /* 上传 */ @@ -5935,7 +5936,7 @@ class CommonTableRc extends React.Component { textDecoration: "none" }} > - 操作{" "} + {setOperation}{" "} {uploadIcon ? ( {" "} - 操作{" "} + {setOperation}{" "} {headPopup ? ( e.sBoardName) || []; - + // 如果版号已存在则过滤 // const result = selectData.filter(item1 =>!newTableData.some(item2 => item2.sBoardName === item1.sBoardName)); let newSelectData = selectData.map((item, index) => { @@ -6974,7 +6975,7 @@ class CommonTableRc extends React.Component { - + selectData.forEach((item, index) => { const newCopyTo = {}; diff --git a/src/components/Common/commonFunc.js b/src/components/Common/commonFunc.js index 394c176..236609c 100644 --- a/src/components/Common/commonFunc.js +++ b/src/components/Common/commonFunc.js @@ -509,7 +509,19 @@ export function showMessage(gdsformconst, sName) { } return ''; } - +export function showLocalMessage(props, sName, sChineseName) { + let sTitle = ''; + if(commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) && commonUtils.isNotEmptyArr(props.app.commonConst)) { + const gdsformconst = props.app.commonConst; + sTitle = showMessage(gdsformconst, sName) + } else { + sTitle = sChineseName; + } + if (sTitle === '') { + sTitle = sChineseName + } + return sTitle; +} /** 获取配置showName */ export function getConfigShowName(config, sName) { const iIndex = config.gdsconfigformslave.findIndex(item => item.sName === sName); diff --git a/src/mes/common/buttonComponent/index.js b/src/mes/common/buttonComponent/index.js index ef96693..ef71f35 100644 --- a/src/mes/common/buttonComponent/index.js +++ b/src/mes/common/buttonComponent/index.js @@ -3,6 +3,7 @@ import { Image, Badge, Modal } from "antd"; import termClass from "classnames/bind"; import { DoubleRightOutlined } from "@ant-design/icons"; import styles from "./index.less"; +import * as commonFunc from "@/components/Common/commonFunc"; // 通用方法 import * as commonUtils from "@/utils/utils"; // 菜单图标 @@ -14,6 +15,7 @@ const getNavIcon = (bActive, iconName = 2) => { const ButtonComponent = props => { const { app, sModelsId, currentContent, menuMap } = props; const { managementData, userinfo = {} } = app; + console.log('3managementData3', managementData); const { iTeamType, sWorkshopId } = userinfo; if ([3, 4, 5, 6].includes(iTeamType)) { @@ -126,7 +128,7 @@ const ButtonComponent = props => { // 是否为维修保养模块和查询追踪模块 setProcessReport( props.currentContent === 'queryTracking' || - props.currentContent === "serviceUpkeep" || + props.currentContent === "serviceUpkeep" || (props.currentContent === "productionExec" && [3, 4, 5, 6].includes(iTeamType)) ); }, @@ -272,7 +274,7 @@ const ButtonComponent = props => { } else if (e.name === "其它机台日报") { count = table3; } - + const workFirst = commonFunc.showLocalMessage(props, 'workFirst!', '请先上班后再操作'); return (
{ if (bStartWorkLimit) { Modal.warning({ title: "温馨提示:", - content:
请先上班后再操作!
, + content:
{workFirst}
, okText: "确认" }); return; @@ -321,7 +323,7 @@ const ButtonComponent = props => {
); }; - + console.log(menuList, '1menuList '); return (
{ const pageLayoutConfig = gdsconfigformslave.find( item => item.sControlName === "pageLayout" ); + console.log('pageLayoutConfig', pageLayoutConfig); if (pageLayoutConfig) { pageLayout = commonUtils.convertStrToObj( pageLayoutConfig.sDefault, @@ -677,7 +678,6 @@ const useCommonModelEvent = props => { const { refreshTableListCount = 0 } = props; let addState = { refreshTableList: [], - refreshTableListCount: refreshTableListCount + 1, ...(await handleGetData(refreshTableList, true)) }; @@ -1211,7 +1211,9 @@ const CommonModel = baseProps => { }; const CommonModelComponent = props => { - const { tabConfig = [], level, modelStyle } = props; + const { tabConfig = [], level, modelStyle, app } = props; + const { userinfo } = app; + const sLanguage = userinfo.sLanguage; const getComponent = (config, index = 0) => { const { sName, @@ -1273,10 +1275,14 @@ const CommonModelComponent = props => { const { configList = [], sEntireTabName, + sEnglishEntireTabName, + sBig5EntireTabName, mode, width = "100%", height = "100%" } = item; + const sEntireTabNameNew = sLanguage === 'sEnglish' ? sEnglishEntireTabName : + sLanguage === 'sBig5EntireTabName' ? sBig5EntireTabName : sEntireTabName; const advancedStyle = mode === "advanced" ? { @@ -1345,7 +1351,7 @@ const CommonModelComponent = props => { style={advancedStyle} > {sEntireTabName && ( - + )} { !props.hideTabList.includes(item.sName) ) .map((config, index) => { - const { sName, sTabName } = config; + const { sName, sEnglishTabName, sBig5TabName, sTabName } = config; + const sTabNewName = sLanguage ==='sEnglish' ? sEnglishTabName : sLanguage ==='sBig5' ? + sBig5TabName : sTabName; let disabled = false; if (sTabName === "拼接列表" && sName === "slaveWypj3") { @@ -1419,7 +1427,7 @@ const CommonModelComponent = props => { return ( @@ -1576,7 +1584,7 @@ const CommonViewTableComponent = props => { const handleReportInfo = (config = null) => { reportRef.current = config; setReportInfoVisible(!reportInfoVisible); - }; + }; return ( <> diff --git a/src/mes/common/commonOperationBarComponent/index.js b/src/mes/common/commonOperationBarComponent/index.js index ade08d5..7a76e52 100644 --- a/src/mes/common/commonOperationBarComponent/index.js +++ b/src/mes/common/commonOperationBarComponent/index.js @@ -78,26 +78,6 @@ const useCommonOperationBarComponentEvent = props => { // 按钮点击事件 const clickRef = useRef(null); const handleBtnClick = async (config, searchField) => { - if (config?.sMinValue === "99") { // 二次确认 - const result = await new Promise(resolve => { - Modal.confirm({ - title: "温馨提示:", - content: "是否确认此操作?", - okText: "确认", - cancelText: "取消", - onOk() { - setTimeout(() => { - resolve(true); - }, 500); - }, - onCancel() { - resolve(false); - } - }); - }); - if (!result) return; - } - // 限制半秒内只能点一次 if (clickRef.current) return; clickRef.current = true; @@ -109,6 +89,9 @@ const useCommonOperationBarComponentEvent = props => { const { sName } = props; const { sActiveId, sButtonParam, sInstruct, sControlName } = config; + const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); + const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班'); + // 自定义按钮事件 if ( costomPageFun({ @@ -254,7 +237,7 @@ const useCommonOperationBarComponentEvent = props => { }, btnConfig: { sId: config.sId, - showName: !bDelayedOvertime ? "延迟加班" : "取消延迟加班", + showName: !bDelayedOvertime ? delayedOvertime : cancelDelayedOvertime, sInstruct: JSON.stringify([ { opr: "procedure", @@ -491,6 +474,10 @@ const useCommonOperationBarComponentEvent = props => { const { sDefault } = config; + const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); + const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班'); + + // 根据sDefault配置控制按钮是否可以操作 if (sDefault && sDefault.includes("${")) { // 当前页面全部数据 @@ -617,7 +604,6 @@ const useCommonOperationBarComponentEvent = props => { } defaultProps.style = style; } - // 隐藏salveWydm2表的新增托盘 if (props.sName === "salveWydm2" && config.sControlName === "BtnLeft.Add") { defaultProps.style = defaultProps.style || {}; @@ -651,7 +637,7 @@ const useCommonOperationBarComponentEvent = props => { defaultProps.id = "salveWybz2Print1"; } else if (config.sControlName === "BtnRight.DelayWork") { const { bDelayedOvertime } = commonUtils.getAppData("userinfo"); - config.showName = bDelayedOvertime ? "取消延迟加班" : "延迟加班"; + config.showName = bDelayedOvertime ? cancelDelayedOvertime : delayedOvertime; let style = { width: "150px" }; defaultProps.style = style; } @@ -1007,8 +993,9 @@ const CommonOperationBarComponent = basProps => { return ""; } + const btnSearch = commonFunc.showLocalMessage(props, 'btnSearch', '查询'); return ( -
+
{btnLeftConfig.map(item => { @@ -1078,7 +1065,7 @@ const CommonOperationBarComponent = basProps => { <> )} diff --git a/src/mes/common/faceCollectionComponent/index.js b/src/mes/common/faceCollectionComponent/index.js index c197feb..0c7afa2 100644 --- a/src/mes/common/faceCollectionComponent/index.js +++ b/src/mes/common/faceCollectionComponent/index.js @@ -4,6 +4,7 @@ import * as commonUtils from "@/utils/utils"; import FaceDetect from "@/components/FaceDetect"; import ShowType from "@/components/Common/CommonComponent"; import useCommonBase from "@/components/Common/CommonHooks/useCommonBase"; +import * as commonFunc from "@/components/Common/commonFunc"; import styles from "./index.less"; @@ -50,6 +51,15 @@ const FaceCollectionComponent = baseProps => { ); const { faceCollectionData = [] } = props; + const faceCollection = commonFunc.showLocalMessage(props, 'faceCollection', '人脸采集'); + + const faceCollectionSucess = commonFunc.showLocalMessage(props, 'faceCollectionSucess', '人脸采集成功'); + + const selectUser = commonFunc.showLocalMessage(props, 'selectUser', '请选择用户'); + + const BtnCancel = commonFunc.showLocalMessage(props, 'BtnCancel', '取消'); + const BtnNext = commonFunc.showLocalMessage(props, 'BtnNext', '下一步'); + const showDropDown = faceCollectionData.reduce((pre, item) => { return { @@ -94,7 +104,7 @@ const FaceCollectionComponent = baseProps => { const handleNexStep = async () => { if (!dataValue) { - message.error("请先选择用户!"); + message.error({selectUser}); return; } @@ -104,7 +114,7 @@ const FaceCollectionComponent = baseProps => { ); const modal = Modal.info({ - title: "人脸识别", + title: faceCollection, keyboard: false, content: ( { }} loginAfterInit onSaveFaceSuccess={() => { - message.success("人脸采集成功!"); + message.success(faceCollectionSucess); modal.destroy(); onCancel(); }} @@ -124,7 +134,7 @@ const FaceCollectionComponent = baseProps => { /> ), wrapClassName: "xlyFaceAuthModal", - okText: "取消", + okText: BtnCancel, onOk() { modal.destroy(); } @@ -134,20 +144,20 @@ const FaceCollectionComponent = baseProps => { return ( - 下一步 + {BtnNext} } onCancel={onCancel} >
- + diff --git a/src/mes/common/siderInfoComponent/index.js b/src/mes/common/siderInfoComponent/index.js index feb333f..82be672 100644 --- a/src/mes/common/siderInfoComponent/index.js +++ b/src/mes/common/siderInfoComponent/index.js @@ -239,6 +239,8 @@ const useSiderInfoComponentEvent = props => { const SiderInfoComponent = baseProps => { const props = useSiderInfoComponentEvent(baseProps); + const workLoading = commonFunc.showLocalMessage(props, 'workLoading', '工单数据加载中...'); + const waitWorkLoading = commonFunc.showLocalMessage(props, 'waitWorkLoading', '工单数据加载中...'); const leftClass = cx({ siderInfoComponent: true }); @@ -255,7 +257,7 @@ const SiderInfoComponent = baseProps => {
) : ( @@ -350,12 +352,14 @@ const WorkOrderTypeComponent = () => { const [productionDivId] = useState( `productionDivId_${commonUtils.createSid()}` ); + const task= commonFunc.showLocalMessage(props, 'task', '任务:工单信息'); + const specialFocus= commonFunc.showLocalMessage(props, 'specialFocus', '任务:工单信息'); return (
- 任务:工单信息 + {task}
{/* { @@ -488,7 +492,7 @@ const WorkOrderTypeComponent = () => { flex={"160px"} className={styles.productionTitle} > - 特别关注: + {specialFocus} { enabled: false }; }; + const equipmentTargetInformation = commonFunc.showLocalMessage(props, 'equipmentTargetInformation', '设备及目标信息'); return (
- 设备及目标信息 + {equipmentTargetInformation}
{showConfig.map((config, index) => { if (index > 4) return ""; @@ -756,6 +761,13 @@ const TeamInfoComponent = () => { const teamShiftInfo = props.teamShiftInfoData?.[0] || {}; const { sEmployeeName = "", sEmployeeNo = "" } = teamShiftInfo; + const teamInformation= commonFunc.showLocalMessage(props, 'teamInformation', '班组信息'); + + const captain = commonFunc.showLocalMessage(props, 'captain', '机长'); + + const shift = commonFunc.showLocalMessage(props, 'shift', '班次'); + + const classGroup = commonFunc.showLocalMessage(props, 'classGroup', '班组'); // 当前上班机长人员 const { sActualEmployeeName, sActualEmployeeNo } = tableProps.data[0] || {}; @@ -765,7 +777,7 @@ const TeamInfoComponent = () => {
- 班组信息 + {teamInformation}
@@ -784,15 +796,15 @@ const TeamInfoComponent = () => { )}
- 机长: + {captain}: {sActualEmployeeName || sEmployeeName}
- 班组: + {classGroup}: {sTeamNo}
- 班次: + {shift}: {sShift == 1 ? "白班" : "夜班"}
diff --git a/src/mes/indexMes/index.js b/src/mes/indexMes/index.js index d25fe80..a8629c1 100644 --- a/src/mes/indexMes/index.js +++ b/src/mes/indexMes/index.js @@ -30,7 +30,10 @@ import { SwapOutlined, AppstoreOutlined } from "@ant-design/icons"; +import * as commonFunc from "@/components/Common/commonFunc"; import zhCN from "antd/lib/locale-provider/zh_CN"; +import enUS from 'antd/lib/locale-provider/en_US'; // 导入英文语言包 +import zhTW from 'antd/lib/locale-provider/zh_TW'; // 导入繁体中文语言包 import Draggable from 'react-draggable'; @@ -100,6 +103,10 @@ const OpenModalEditPwd = props => { sUserPwdAgain: "", sId: props.app.userinfo.sId }); + const oldPassword = commonFunc.showLocalMessage(props, 'oldPassword', '请输入原密码'); + const newPassword = commonFunc.showLocalMessage(props, 'newPassword', '请输入新密码'); + const passswordAgain = commonFunc.showLocalMessage(props, 'passswordAgain', '请再次输入密码'); + const ModifyPassword = commonFunc.showLocalMessage(props, 'ModifyPassword','修改密码');/* 修改 */ // 确认修改密码 const handleOk = () => { const url = `${ @@ -127,24 +134,24 @@ const OpenModalEditPwd = props => { return ( dispatch(["saveState", { isEditPwd: false }])} > setPwdForm({ ...pwdForm, sOldPwd: e.target.value })} /> setPwdForm({ ...pwdForm, sUserPwd: e.target.value })} /> setPwdForm({ ...pwdForm, sUserPwdAgain: e.target.value }) } @@ -431,9 +438,24 @@ const IndexMes = baseProps => { const getServiceError = async returnData => { props.dispatch({ type: "app/throwErrorMes", payload: returnData }); }; + const currentLanguage = props?.app?.userinfo?.sLanguage || 'zhCN'; // 默认为中文 + const getLocale = () => { + switch(currentLanguage) { + case 'sEnglish': + return enUS; + case 'sBig5': + return zhTW; + default: + { + moment.locale('zh-cn'); + return zhCN; + } + } + }; + const bExsitLogin = commonFunc.showLocalMessage(props, 'bExsitLogin', '是否退出登录'); return ( - + { {logoutShow && ( { handleColseOee(); setLogoutShow(false); @@ -474,15 +496,20 @@ const IndexMes = baseProps => { // 头部 const HeaderConponent = () => { const { props } = useContext(myContext); + const { app } = props; + const { userinfo, sMachineNameStr, sTeamNameSName } = app; + const { sUserNameBak: sUserName, sShift } = userinfo; - const weekday = ["日", "一", "二", "三", "四", "五", "六"]; + const sLanguage = userinfo.sLanguage; + let weekday = ["日", "一", "二", "三", "四", "五", "六"]; + const sunTitle = sLanguage ==='sChinese' ? '星期' : ''; const [time, setTime] = useState("0000-00-00 00:00:00"); const { logout } = useContext(myContext); useEffect(() => { const getTime = () => { const currentTime = moment().format("YYYY-MM-DD HH:mm:ss"); const currentWeek = moment().weekday(); - setTime(`${currentTime}${" "}${" "}星期${weekday[currentWeek]}`); + setTime(`${currentTime}${" "}${" "}${sunTitle}${weekday[currentWeek]}`); }; getTime(); @@ -495,9 +522,50 @@ const HeaderConponent = () => { }; }, []); - const { app } = props; - const { userinfo, sMachineNameStr, sTeamNameSName } = app; - const { sUserNameBak: sUserName, sShift } = userinfo; + + const logoTitle = commonFunc.showLocalMessage(props, 'EBC-MES', '小羚羊生产执行系统'); + const account= commonFunc.showLocalMessage(props, 'account', '账号'); + const machine= commonFunc.showLocalMessage(props, 'machine', '机台'); + const classGroup = commonFunc.showLocalMessage(props, 'classGroup', '班组'); + const dayShift = commonFunc.showLocalMessage(props, 'dayShift', '白班'); + const nightShift = commonFunc.showLocalMessage(props, 'nightShift', '夜班'); + const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); + + function translateWeekdays() { + // 中文星期数组 + let weekday = ["日", "一", "二", "三", "四", "五", "六"]; + + // 定义中英文和繁体中文星期的映射关系 + const translations = { + sEnglish: { + "日": "Sunday", + "一": "Monday", + "二": "Tuesday", + "三": "Wednesday", + "四": "Thursday", + "五": "Friday", + "六": "Saturday" + }, + sBig5: { + "日": "日", + "一": "一", + "二": "二", + "三": "三", + "四": "四", + "五": "五", + "六": "六" + } + }; + + // 根据用户语言设置进行转换(默认为中文) + if (userinfo.sLanguage === 'sEnglish' || userinfo.sLanguage === 'sBig5') { + return weekday.map(day => translations[userinfo.sLanguage][day] || day); + } + + return weekday; + } + weekday = translateWeekdays(sLanguage); + @@ -521,25 +589,25 @@ const HeaderConponent = () => { logo
- 劲嘉生产执行系统(EBC-MES) + {logoTitle}
- 账号: + {account}: {sUserName}
- 机台: + {machine}: {sMachineNameStr}
- 班组: + {classGroup}: {sTeamNameSName} - ({sShift == 1 ? "白班" : "夜班"}) + ({sShift == 1 ? dayShift : nightShift})
- {userinfo.bDelayedOvertime ? "延时加班" : ""} + {userinfo.bDelayedOvertime ? delayedOvertime : ""}
@@ -550,17 +618,17 @@ const HeaderConponent = () => {
- @@ -583,30 +651,30 @@ const MachineMessageComponent = ({ e , shutDown }) => { 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: "温馨提示:", @@ -621,7 +689,7 @@ const MachineMessageComponent = ({ e , shutDown }) => { }); }; - + const isMinMax = useRef('max'); const draggleRef = useRef(null); const [bounds, setBounds] = useState({ left: 0, top: 0, bottom: 0, right: 0 }); @@ -639,7 +707,7 @@ const MachineMessageComponent = ({ e , shutDown }) => { }); }; - + return (
@@ -689,53 +757,67 @@ const MachineMessageComponent = ({ e , shutDown }) => {
); }; - -// 左侧侧边栏 + + // 左侧侧边栏 const SiderComponent = () => { const { dispatch, hooksProps, props, ...rest } = useContext(myContext); const { currentContent, menuMap } = hooksProps; + + const teamInformation= commonFunc.showLocalMessage(props, 'teamInformation', '班组信息'); + console.log('2222', teamInformation); + + const scheduledTask= commonFunc.showLocalMessage(props, 'scheduledTask', '计划任务'); + + const productionExecution= commonFunc.showLocalMessage(props, 'productionExecution', '生产执行'); + + const maintenanceRepair= commonFunc.showLocalMessage(props, 'maintenanceRepair', '维修保养'); + + const queryTracing= commonFunc.showLocalMessage(props, 'queryTracing', '查询追踪'); + + const operationGuide= commonFunc.showLocalMessage(props, 'teamInformation', '操作指南'); + const menuList = [ { id: "teamInfo", - title: "班组信息", + title: teamInformation, path: "/indexMes/teamInfo", icon: teamIcon, c_icon: c_teamIcon }, { id: "scheduledTasks", - title: "计划任务", + title: scheduledTask, path: "/indexMes/scheduledTasks", icon: planTaskIcon, c_icon: c_planTaskIcon }, { id: "productionExec", - title: "生产执行", + title: productionExecution, path: "/indexMes/productionExec", icon: proExeIcon, c_icon: c_proExeIcon }, { id: "serviceUpkeep", - title: "维修保养", + title: maintenanceRepair, path: "/indexMes/serviceUpkeep", icon: serviceIcon, c_icon: c_serviceIcon }, { id: "queryTracking", - title: "查询追踪", + title: queryTracing, path: "/indexMes/queryTracking", icon: queryTraceIcon, c_icon: c_queryTraceIcon }, { id: "operationGuide", - title: "操作指南", + title: operationGuide, path: "/indexMes/operationGuide", icon: guideIcon, c_icon: c_guideIcon @@ -805,6 +887,7 @@ const SystemFunComponent = () => { const [popoverVisible, setPopoverVisible] = useState(false); const [popoverVisible1, setPopoverVisible1] = useState(false); const { props, dispatch } = useContext(myContext); + const systemFunctions = commonFunc.showLocalMessage(props, 'systemFunctions', '系统功能'); const stopRef = useRef(false); const stopClose = useRef(false); @@ -841,7 +924,7 @@ const SystemFunComponent = () => { const handleProcedureCall = async (params, iFlag) => { const { onSuccess } = params; const { app } = props; - + const FriendlyReminder = commonFunc.showLocalMessage(this.props, 'FriendlyReminder', '温馨提示'); const { sMachineNameSId, sTeamNameSId, sShift, token, sModelsId } = app; const value = { @@ -888,10 +971,8 @@ const SystemFunComponent = () => { onSuccess && onSuccess(); } else if (code === -7) { Modal.confirm({ - title: "温馨提示:", + title: FriendlyReminder, content:
{handleGetMsg(msg)}
, - okText: "确认", - cancelText: "取消", onOk() { handleProcedureCall(params, 1); }, @@ -899,9 +980,8 @@ const SystemFunComponent = () => { }); } else if (code === -8) { Modal.info({ - title: "温馨提示:", + title: FriendlyReminder, content:
{handleGetMsg(msg)}
, - okText: "确认", onOk() { onSuccess && onSuccess(); } @@ -917,6 +997,8 @@ const SystemFunComponent = () => { const { onSuccess } = params; const { app } = props; + const FriendlyReminder = commonFunc.showLocalMessage(props, 'FriendlyReminder', '温馨提示'); + const { sMachineNameSId, sTeamNameSId, sShift, token, sModelsId } = app; const userinfo = commonUtils.getAppData("userinfo"); @@ -965,10 +1047,8 @@ const SystemFunComponent = () => { onSuccess && onSuccess(); } else if (code === -7) { Modal.confirm({ - title: "温馨提示:", + title: FriendlyReminder, content:
{handleGetMsg(msg)}
, - okText: "确认", - cancelText: "取消", onOk() { handleProcedureCall1(params, 1); }, @@ -976,9 +1056,8 @@ const SystemFunComponent = () => { }); } else if (code === -8) { Modal.info({ - title: "温馨提示:", + title: FriendlyReminder, content:
{handleGetMsg(msg)}
, - okText: "确认", onOk() { onSuccess && onSuccess(); } @@ -990,6 +1069,7 @@ const SystemFunComponent = () => { }; const handleSystemFunClick = type => { + const underDevelop = commonFunc.showLocalMessage(props, 'underDevelop', '功能开发中,敬请期待!'); switch (type) { case "changePwd": dispatch(["saveState", { isEditPwd: true }]); @@ -1000,7 +1080,7 @@ const SystemFunComponent = () => { case "logout": break; case "shutdown": - message.info("功能开发中,敬请期待..."); + message.info(underDevelop); break; case "restDailyReport": handleProcedureCall({ @@ -1030,6 +1110,16 @@ const SystemFunComponent = () => { const getSystemFunContent = () => { const userinfo = commonUtils.getAppData("userinfo"); + const ModifyPassword = commonFunc.showLocalMessage(props, 'ModifyPassword','修改密码');/* 修改密码 */ + const faceCollection = commonFunc.showLocalMessage(props, 'faceCollection', '人脸采集'); + const moreFunctions = commonFunc.showLocalMessage(props, 'moreFunctions', '更多功能'); + const Logout = commonFunc.showLocalMessage(props, 'Logout', '退出登录'); + const shutDown= commonFunc.showLocalMessage(props, 'shutDown', '关机'); + const resetDailyReport= commonFunc.showLocalMessage(props, 'resetDailyReport', '关机'); + const switchToManual= commonFunc.showLocalMessage(props, 'switchToManual', '切换手动'); + const SwitchAuto= commonFunc.showLocalMessage(props, 'SwitchAuto', '切换自动'); + + const { bPlcSd } = userinfo; return (
@@ -1040,7 +1130,7 @@ const SystemFunComponent = () => { }} > - 人脸采集 + {faceCollection}
{ handleSystemFunClick("changePwd"); }} > - 修改密码 + {ModifyPassword}
{ handleSystemFunClick("logout"); }} > - 退出登录 + {Logout}
{ handleSystemFunClick("shutdown"); }} > - 关机 + {shutDown}
{ }} > - 重置日报 + {resetDailyReport}
{ }} > - {bPlcSd ? "切换自动" : "切换手动"} + {bPlcSd ? SwitchAuto : switchToManual}
} @@ -1108,7 +1198,7 @@ const SystemFunComponent = () => { }} > - 更多功能 + {moreFunctions}
@@ -1138,7 +1228,7 @@ const SystemFunComponent = () => {
-
系统功能
+
{systemFunctions}
); diff --git a/src/mes/login/index.js b/src/mes/login/index.js index 6116b92..f484ad0 100644 --- a/src/mes/login/index.js +++ b/src/mes/login/index.js @@ -19,6 +19,7 @@ const initValue = { // 事件层 const useLoginEvent = props => { + const [companys, setCompanys] = useState([]); // 添加这行 // 清除浏览器缓存 useEffect(() => { const ipAddress = localStorage.ipAddress; @@ -91,6 +92,12 @@ const useLoginEvent = props => { "mesSysbrands", JSON.stringify({ sBrandsId: sParentId, sSubsidiaryId: sId }) ); + /* 测试英文版本 默认英文 */ + if(companysConfigReturn.dataset.rows) { + companysConfigReturn.dataset.rows[0].sLanguage = 'sEnglish'; + } + setCompanys(companysConfigReturn.dataset.rows); // 修改这行2 + props.onSaveState({ masterData: { sBrandsId: sParentId, sSubsidiaryId: sId } }); @@ -125,13 +132,32 @@ const useLoginEvent = props => { }; // 登录事件 - const handleSubmit = async ({ faceLoginValue = {}, sEmployeeNo } = {}) => { + const handleSubmit = async ({ faceLoginValue = {}, sEmployeeNo } = {}, configsData) => { const bFaceLogin = commonUtils.isNotEmptyObject(faceLoginValue); let dataReturn = {}; if (!bFaceLogin) { // 账号密码登录 - const { masterData } = props; + const { masterData, companys } = props; + // 新增方法:根据sName过滤configs + const getConfigByName = (name, configs, sLanguage) => { + const configObj = configs.find(item => item.sName === name); + const showName = sLanguage === 'sChinese' ? configObj.sChinese : sLanguage ==='sEnglish' ? configObj.sEnglish : + sLanguage === 'sBig5' ? configObj.sBig5 : configObj.sChinese; + return showName; + }; + const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'sEnglish'; + + const pleaseSelectUser = getConfigByName('pleaseSelectUser', configsData, sLanguage); + + const pleaseInputPassword = getConfigByName('pleaseInputPassword', configsData, sLanguage); + + const pleaseSelectTeam = getConfigByName('pleaseSelectTeam', configsData, sLanguage); + + const pleaseselectShift = getConfigByName('pleaseselectShift', configsData, sLanguage); + + const pleaseSelectMachine = getConfigByName('pleaseSelectMachine', configsData, sLanguage); + const { sUserId: userId, @@ -172,23 +198,23 @@ const useLoginEvent = props => { } if (!username) { - message.error("请选择用户!"); + message.error(pleaseSelectUser); return; } if (!sEmployeeNo && !password) { - message.error("请输入密码!"); + message.error(pleaseInputPassword); return; } if (sShift === undefined) { - message.error("请选择班次!"); + message.error(pleaseselectShift); return; } if (!sTeamId) { - message.error("请选择班组!"); + message.error(pleaseSelectTeam); return; } if (!sMachineId) { - message.error("请选择机台!"); + message.error(pleaseSelectMachine); return; } @@ -321,6 +347,7 @@ const useLoginEvent = props => { return { ...props, + companys, // 确保返回companys configs, onSubmit: handleSubmit, onFaceLogin: handleFaceLogin, @@ -331,8 +358,12 @@ const useLoginEvent = props => { // 遍历登录文本组件 const handleGetFormItem = (props, item) => { const { sModelsId } = initValue; - const { masterData = {} } = props; + const { masterData = {}, companys } = props; + const sLanguage = commonUtils.isNotEmptyArr(companys) && companys[0].sLanguage || 'sEnglish'; let enabledNew = true; + if(item.sName?.includes('please') || item.sName?.includes('请')) { + return; + } if (item.iTag === 1) { enabledNew = false; } else if (item.iTag === 3) { @@ -374,8 +405,10 @@ const handleGetFormItem = (props, item) => { bPassWord: item.sName === "sPassWord", style: { backgroundColor: "#eaeaea" } }; + const showName = sLanguage === 'sChinese' ? item.sChinese : sLanguage ==='sEnglish' ? item.sEnglish + : item.sBig5; return ( - + ); @@ -384,14 +417,82 @@ const handleGetFormItem = (props, item) => { // 主入口 const login = baseProps => { const props = useLoginEvent(useCommonBase(baseProps)); - const { configs } = props; + const { configs , app, companys } = props; + const sysObj = commonUtils.isNotEmptyArr(companys) ? companys[0] : []; + console.log('222', sysObj); + const sLanguage = sysObj?.sLanguage || 'sEnglish'; + + const oeeTitle = + sLanguage === "sChinese" ? "小羚羊生产执行系统" : sLanguage === "sEnglish" ? "Manufacturing Execution System" : "小羚羊生產執行系統"; + + const bannerTitle = + sLanguage === "sChinese" ? "小羚羊生产执行系统" : sLanguage === "sEnglish" ? "XLY Manufacturing Execution System" : "小羚羊生產執行系統"; + + const pleaseInputUserName = + sLanguage === "sChinese" + ? "用户名" + : sLanguage === "sEnglish" + ? "UserName" + : "用戶名"; /* 用戶名 */ + const pleaseInputPassword = + sLanguage === "sChinese" + ? "密码" + : sLanguage === "sEnglish" + ? "Password" + : "密碼"; /* 密码 */ + const teamName = + sLanguage === "sChinese" + ? "班组名称" + : sLanguage === "sEnglish" + ? "Team Name" + : "班組名稱"; /* 班组名称 */ + const equipmentName = + sLanguage === "sChinese" + ? "设备名称" + : sLanguage === "sEnglish" + ? "Equipment Name" + : "設備名稱"; /* 班组名称 */ + const btnLogin = + sLanguage === "sChinese" + ? "登 录" + : sLanguage === "sEnglish" + ? "Login" + : "登 錄"; /* 登 陆 */ + const btnClose = + sLanguage === "sChinese" + ? "关 闭" + : sLanguage === "sEnglish" + ? "Close" + : "關 閉"; /* 关 闭 */ + const btnFace = sLanguage === "sChinese"? "人 脸 登 录" : sLanguage === "sEnglish" ? "FaceLogin" : "人 臉 登 錄"; /* 人 脸 */ + + const btnNormal = + sLanguage === "sChinese" + ? "普 通 登 录" + : sLanguage === "sEnglish" + ? "CommonLogin" + : "普 通 人 臉"; /* 普 通 */ + + const chooseBranchCompany = + sLanguage === "sChinese" + ? "请选择分公司名称" + : sLanguage === "sEnglish" + ? "Please select branch name" + : "請選擇分公司名稱"; /* 请选择分公司名称 */ + + const [form] = Form.useForm(); return (
+ {/*
*/} + {/*
Enterprise Business Capability MES
*/} + {/*
{bannerTitle}
*/} + {/*
EBC-MES
*/} + {/*
*/}
-
劲嘉生产执行系统(EBC-MES)
+
{oeeTitle}
{configs.map(item => handleGetFormItem(props, item))} @@ -400,10 +501,10 @@ const login = baseProps => { type="primary" block onClick={() => { - props.onSubmit(); + props.onSubmit({}, configs); }} > - 登录 + {btnLogin}
@@ -420,7 +521,7 @@ const login = baseProps => { props.onFaceLogin(); }} > - 人脸登录 + {btnFace}
{/*
*/} @@ -436,10 +537,13 @@ const FaceLoginModal = props => { const { faceLoginModalVisible } = props; if (!faceLoginModalVisible) return ""; + const { companys } = props; + const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'English'; + const btnFace = sLanguage === "sChinese"? "人 脸 登 录" : sLanguage === "sEnglish" ? "FaceLogin" : "人 臉 登 錄"; /* 人 脸 */ return ( { // 人脸弹窗后选择其他内容 const FaceLoginAfterModal = props => { - const { faceLoginAfterModalVisible } = props; + const { faceLoginAfterModalVisible , companys } = props; if (!faceLoginAfterModalVisible) return ""; + const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'English'; + const sLoginConfirm = sLanguage === "sChinese"? "登陆信息确认" : sLanguage === "sEnglish" ? "Login Information Confirmation" : "登陸信息確認"; /* 人 脸 */ + const btnConfirm = sLanguage === "sChinese"? "确认" : sLanguage === "sEnglish" ? "Confirm" : "確認"; /* 人 脸 */ + const btnCancel = sLanguage === "sChinese"? "确认" : sLanguage === "sEnglish" ? "Cancel" : "取消"; /* 取消 */ + + const { configs: configOld = [], masterData = {}, @@ -522,7 +632,7 @@ const FaceLoginAfterModal = props => { const [form] = Form.useForm(); return ( { props.onSubmit({ sEmployeeNo }); }} > - 确认 + {btnConfirm} } diff --git a/src/mes/login/index.less b/src/mes/login/index.less index 280a9ac..84798af 100644 --- a/src/mes/login/index.less +++ b/src/mes/login/index.less @@ -13,6 +13,34 @@ font-family: Microsoft YaHei, Microsoft YaHei; } + .loginTitle { + position: absolute; + top: 0; + left: 0; + .size(auto, 100%); + display: flex; + flex-direction: column; + // align-items: center; + justify-content: center; + color: #FFF; + font-weight: bold; + padding-left: 6%; + + .loginTitle1 { + font-size: 34px; + } + + .loginTitle2 { + font-size: 60px; + margin-top: -8px; + } + + .loginTitle3 { + font-size: 116px; + margin-top: -57px; + } + } + .loginBox { width: 35%; height: auto; diff --git a/src/mes/operationGuide/component/BroadsideCard.js b/src/mes/operationGuide/component/BroadsideCard.js index 6db01af..0278afb 100644 --- a/src/mes/operationGuide/component/BroadsideCard.js +++ b/src/mes/operationGuide/component/BroadsideCard.js @@ -1,5 +1,6 @@ import React from "react"; import { Tooltip } from "antd"; +import * as commonFunc from "@/components/Common/commonFunc"; import styles from "../index.less"; const OperationGuide = props => { @@ -10,13 +11,18 @@ const OperationGuide = props => { }); }; + const operationGuide = commonFunc.showLocalMessage(props, 'operationGuide', '操作指引'); + const digitalFactoryMES = commonFunc.showLocalMessage(props, 'digitalFactoryMES', '数字工厂MES系统操作指引.pdf'); + const keyOperationMES = commonFunc.showLocalMessage(props, 'keyOperationMES', 'MES关键操作说明.xlsx'); + const MESPrinterSolutions = commonFunc.showLocalMessage(props, 'MESPrinterSolutions', 'MES打印机更换纸张后亮红灯解决方法.pdf'); + const workshopMESPrinters = commonFunc.showLocalMessage(props, 'workshopMESPrinters', '车间MES打印机更换纸张.pdf'); return (
-
操作指引
+
{operationGuide}
数字工厂MES系统操作指引.pdf
+
{digitalFactoryMES}
} placement="left" > @@ -28,7 +34,7 @@ const OperationGuide = props => { /> MES关键操作说明.xlsx
} + title={
{keyOperationMES}
} placement="left" >
{ 数字工厂MES系统操作指引.pdf
+
{digitalFactoryMES}
} > -
数字工厂MES系统操作指引.pdf
+
{digitalFactoryMES}
MES关键操作说明.xlsx
} + title={
{keyOperationMES}
} > -
MES关键操作说明.xlsx
+
{keyOperationMES}
- MES打印机更换纸张后亮红灯解决方法.pdf + {MESPrinterSolutions}
} placement="left" @@ -72,7 +78,7 @@ const OperationGuide = props => { /> 车间MES打印机更换纸张.pdf
} + title={
{workshopMESPrinters}
} placement="left" >
{ placement="left" title={
- MES打印机更换纸张后亮红灯解决方法.pdf + {MESPrinterSolutions }
} > -
MES打印机更换纸张后亮红灯解决方法.pdf
+
{MESPrinterSolutions}
车间MES打印机更换纸张.pdf
} + title={
{workshopMESPrinters}
} > -
车间MES打印机更换纸张.pdf
+
{workshopMESPrinters}
diff --git a/src/mes/operationGuide/component/FlowChart.js b/src/mes/operationGuide/component/FlowChart.js index 40acd97..5e5791e 100644 --- a/src/mes/operationGuide/component/FlowChart.js +++ b/src/mes/operationGuide/component/FlowChart.js @@ -4,14 +4,84 @@ import styles from "../index.less"; import { setTimeout } from "core-js"; +const resources = { + sChinese: { + teamLogin: "班组登录", + registerWork: "登记上班", + teamHandover: "班组交接", + planTask: "计划任务", + productionExec: "生产执行", + qualityInspection: "质量巡检", + processInspection: "工艺巡检", + equipmentInspection: "设备巡检", + disassembleBoard: "拆合板", + currentTask: "当前任务", + taskCompletion: "任务完工", + trayScan: "托盘扫码", + trayUnloading: "托盘下料", + completionClearance: "完工清场", + teamReport: "班组报工", + registerOffWork: "登记下班", + working: "作业中", + afterWork: "作业后" + }, + sEnglish: { + teamLogin: "Team Login", + registerWork: "Register Work", + teamHandover: "Team Handover", + planTask: "Plan Task", + productionExec: "Production Execution", + qualityInspection: "Quality Inspection", + processInspection: "Process Inspection", + equipmentInspection: "Equipment Inspection", + disassembleBoard: "Disassemble Board", + currentTask: "Current Task", + taskCompletion: "Task Completion", + trayScan: "Tray Scan", + trayUnloading: "Tray Unloading", + completionClearance: "Completion Clearance", + teamReport: "Team Report", + registerOffWork: "Register Off Work", + beforeWork: "BeforeWork", + working: "Working", + afterWork: "After Work" + }, + sBig5: { + teamLogin: "班組登錄", + registerWork: "登記上班", + teamHandover: "班組交接", + planTask: "計劃任務", + productionExec: "生產執行", + qualityInspection: "質量巡檢", + processInspection: "工藝巡檢", + equipmentInspection: "設備巡檢", + disassembleBoard: "拆合板", + currentTask: "當前任務", + taskCompletion: "任務完工", + trayScan: "托盤掃碼", + trayUnloading: "托盤下料", + completionClearance: "完工清場", + teamReport: "班組報工", + registerOffWork: "登記下班", + beforeWork: "作業中", + working: "作業中", + afterWork: "作業後" + } +}; -const BroadsideCardRender = () => { +const BroadsideCardRender = (props) => { + // 获取语言设置,默认为中文 + const sLanguage = props?.app?.userinfo?.sLanguage || 'sChinese'; + console.log(sLanguage, sLanguage); + console.log(3888, props); + const teamLogin = resources[sLanguage].teamLogin; + console.log(teamLogin, 'teamLogin'); const [ loading , setloading ] = useState(true) const [ flowData , setFlowData ] = useState([ { work:"front", - name:"班组登录", + name:resources[sLanguage].teamLogin, cellSite:"1-1", x6:[ ()=>({ @@ -19,11 +89,11 @@ const BroadsideCardRender = () => { target: { x: getOffset('front-2-1' , 'x-domStart') , y: getOffset('front-2-1' , 'y-domCenter') }, }) ] - + }, { work:"front", - name:"登记上班", + name:resources[sLanguage].registerWork, cellSite:"2-1", x6:[ ()=>({ @@ -34,13 +104,13 @@ const BroadsideCardRender = () => { }, { work:"front", - name:"班组交接", + name:resources[sLanguage].teamHandover, cellSite:"4-1", x6:[] }, { work:"front", - name:"计划任务", + name:resources[sLanguage].planTask, cellSite:"2-2", x6:[ ()=>({ @@ -52,7 +122,7 @@ const BroadsideCardRender = () => { { work:"centre", - name:"生产执行", + name:resources[sLanguage].productionExec, cellSite:"2-2", x6:[ ()=>({ @@ -63,27 +133,27 @@ const BroadsideCardRender = () => { source: { x: getOffset('centre-2-2' , 'x-domStart') , y: getOffset('centre-2-2' , 'y-domCenter') }, target: { x: getOffset('centre-1-1' , 'x-domEnd') , y: getOffset('centre-1-1' , 'y-domCenter') }, vertices: [ - { - x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-1' , 'x-domEnd'))/2), - y: getOffset('centre-2-2' , 'y-domCenter') + { + x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-1' , 'x-domEnd'))/2), + y: getOffset('centre-2-2' , 'y-domCenter') }, - { - x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-1' , 'x-domEnd'))/2), + { + x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-1' , 'x-domEnd'))/2), y: getOffset('centre-1-1' , 'y-domCenter') }, ], }), ()=>({ - source: { - x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-2' , 'x-domEnd'))/2) , - y: getOffset('centre-1-2' , 'y-domCenter') + source: { + x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-2' , 'x-domEnd'))/2) , + y: getOffset('centre-1-2' , 'y-domCenter') }, target: { x: getOffset('centre-1-2' , 'x-domEnd') , y: getOffset('centre-1-2' , 'y-domCenter') }, }), ()=>({ - source: { - x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-3' , 'x-domEnd'))/2) , - y: getOffset('centre-1-3' , 'y-domCenter') + source: { + x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-3' , 'x-domEnd'))/2) , + y: getOffset('centre-1-3' , 'y-domCenter') }, target: { x: getOffset('centre-1-3' , 'x-domEnd') , y: getOffset('centre-1-3' , 'y-domCenter') }, }), @@ -91,13 +161,13 @@ const BroadsideCardRender = () => { source: { x: getOffset('centre-2-2' , 'x-domStart') , y: getOffset('centre-2-2' , 'y-domCenter') }, target: { x: getOffset('centre-1-4' , 'x-domEnd') , y: getOffset('centre-1-4' , 'y-domCenter') }, vertices: [ - { - x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-4' , 'x-domEnd'))/2), - y: getOffset('centre-2-2' , 'y-domCenter') + { + x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-4' , 'x-domEnd'))/2), + y: getOffset('centre-2-2' , 'y-domCenter') }, - { - x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-4' , 'x-domEnd'))/2) , - y: getOffset('centre-1-4' , 'y-domCenter') + { + x: getOffset('centre-2-2' , 'x-domStart') - ((getOffset('centre-2-2' , 'x-domStart') - getOffset('centre-1-4' , 'x-domEnd'))/2) , + y: getOffset('centre-1-4' , 'y-domCenter') }, ], }) @@ -106,31 +176,31 @@ const BroadsideCardRender = () => { { work:"centre", - name:"质量巡检", + name:resources[sLanguage].qualityInspection, cellSite:"1-1", x6:[] }, { work:"centre", - name:"工艺巡检", + name:resources[sLanguage].processInspection, cellSite:"1-2", x6:[] }, { work:"centre", - name:"设备巡检", + name:resources[sLanguage].equipmentInspection, cellSite:"1-3", x6:[] }, { work:"centre", - name:"拆合板", + name:resources[sLanguage].disassembleBoard, cellSite:"1-4", x6:[] }, { work:"centre", - name:"当前任务", + name:resources[sLanguage].currentTask, cellSite:"2-1", x6:[ ()=>({ @@ -139,10 +209,10 @@ const BroadsideCardRender = () => { }) ] }, - + { work:"centre", - name:"任务完工", + name:resources[sLanguage].taskCompletion, cellSite:"2-3", x6:[ ()=>({ @@ -153,7 +223,7 @@ const BroadsideCardRender = () => { }, { work:"centre", - name:"托盘扫码", + name:resources[sLanguage].trayScan, cellSite:"3-2", x6:[ ()=>({ @@ -164,7 +234,7 @@ const BroadsideCardRender = () => { }, { work:"centre", - name:"托盘下料", + name:resources[sLanguage].trayUnloading, cellSite:"3-3", x6:[ ()=>({ @@ -180,7 +250,7 @@ const BroadsideCardRender = () => { { work:"later", - name:"完工清场", + name:resources[sLanguage].completionClearance, cellSite:"2-1", x6:[ ()=>({ @@ -191,7 +261,7 @@ const BroadsideCardRender = () => { }, { work:"later", - name:"班组报工", + name:resources[sLanguage].teamReport, cellSite:"3-1", x6:[ ()=>({ @@ -202,7 +272,7 @@ const BroadsideCardRender = () => { }, { work:"later", - name:"登记下班", + name:resources[sLanguage].registerOffWork, cellSite:"4-1", x6:[ ()=>({ @@ -262,7 +332,7 @@ const BroadsideCardRender = () => { // 渲染x6线条 const lineRender = () =>{ - + const graph = new window.X6.Graph({ container:document.getElementById('container'), width: document.querySelector('#flowBody').offsetWidth, @@ -298,7 +368,7 @@ const BroadsideCardRender = () => { }, } }) - + }) @@ -319,8 +389,8 @@ const BroadsideCardRender = () => { return (
itemClickEvent(rows)} - className="cellBox hasShow" + onClick={()=>itemClickEvent(rows)} + className="cellBox hasShow" cell={cell}> {rows.name} {/* {rows.cellSite} */} @@ -338,10 +408,10 @@ const BroadsideCardRender = () => {
{ newList.map((e,i)=>( -
itemClickEvent(e)} - className="cellBox hasShow" +
itemClickEvent(e)} + className="cellBox hasShow" cell={`${work}-${e.cellSite}`}> {e.name} {/* {e.cellSite} */} @@ -377,7 +447,7 @@ const BroadsideCardRender = () => {
-
作业前
+
{resources[sLanguage].beforeWork}
{ itemRender(2,'front') @@ -385,7 +455,7 @@ const BroadsideCardRender = () => {
-
作业中
+
{resources[sLanguage].working}
{ itemRender(3,'centre') @@ -393,12 +463,12 @@ const BroadsideCardRender = () => {
-
作业后
+
{resources[sLanguage].afterWork}
{ itemRender(1,'later') } -
+
diff --git a/src/mes/operationGuide/index.js b/src/mes/operationGuide/index.js index d76d5a1..f7aaec0 100644 --- a/src/mes/operationGuide/index.js +++ b/src/mes/operationGuide/index.js @@ -6,7 +6,7 @@ import BroadsideCard from "./component/BroadsideCard"; const OperationGuide = props => { return (
- +
); diff --git a/src/mes/productionExec/productionExecMain/index.js b/src/mes/productionExec/productionExecMain/index.js index 614bcec..bd5c893 100644 --- a/src/mes/productionExec/productionExecMain/index.js +++ b/src/mes/productionExec/productionExecMain/index.js @@ -36,6 +36,12 @@ const list = [ const useProductionExecMainEvent = props => { const { formData = [] } = props; + const noProduction= commonFunc.showLocalMessage(props, 'noProduction', '暂无生产执行数据,请先开工一条任务!'); + + const waitWorkLoading = commonFunc.showLocalMessage(props, 'waitWorkLoading', '等待工单数据加载中...'); + + const productionLoading = commonFunc.showLocalMessage(props, 'productionLoading', '生产执行数据加载中...'); + const [refreshCount, setRefreshCount] = useState(0); const [pageloading, setPagesLoading] = useState(true); @@ -44,10 +50,10 @@ const useProductionExecMainEvent = props => { const { sSrcSlaveId, iInterface: iInterfaceOld } = workOrderInfoRowData; const bNoWorkOrderInfo = props.bFinish1 && !sSrcSlaveId; const pageloadingMsg = sSrcSlaveId - ? "生产执行数据加载中..." + ? productionLoading : props.bFinish1 - ? "暂无生产执行数据,请先开工一条任务!" - : "等待工单数据加载中..."; + ? noProduction + : waitWorkLoading; const { app } = props; const { userinfo = {} } = app; @@ -395,8 +401,9 @@ const useProductionExecMainEvent = props => { const ProductionExecMain = baseProps => { const bStartWork = commonUtils.getAppData("userinfo", "bStartWork"); + const workFirst = commonFunc.showLocalMessage(baseProps, 'workFirst', '请先上班后再操作'); if (!bStartWork) { - return
请先上班后再操作!
; + return
{workFirst}
; } const props = useProductionExecMainEvent(useCommonBase(baseProps)); @@ -939,6 +946,9 @@ const ProductionExecContent0 = props => { config.gdsconfigformslave.find( item => item.sControlName === sControlName ) || {}; + if (!btnConfig.bVisible) { + btnConfig.style = { display: "none" }; + } return { ...btnConfig, disabled: props.onGetBtnStatus(tableName, btnConfig), diff --git a/src/mes/productionExec/quickSwitchTabComponent/index.js b/src/mes/productionExec/quickSwitchTabComponent/index.js index 94f6abf..b3020ad 100644 --- a/src/mes/productionExec/quickSwitchTabComponent/index.js +++ b/src/mes/productionExec/quickSwitchTabComponent/index.js @@ -63,7 +63,7 @@ const QuickSwitchTabComponent = baseProps => { } }, []); - const list = ["生产执行", "质量巡检", "拼版图", "产品图", "报工任务"]; + let list = ["生产执行", "质量巡检", "拼版图", "产品图", "报工任务"]; const listId = [ "12710101117087374661080", "12710101117089395856660", @@ -71,6 +71,37 @@ const QuickSwitchTabComponent = baseProps => { "", "12710101117087404588200" ]; + function translateList(language) { + // 原始中文列表 + const list = ["生产执行", "质量巡检", "拼版图", "产品图", "报工任务"]; + + // 定义多语言映射 + const translations = { + sEnglish: { + "生产执行": "Production Execution", + "质量巡检": "Quality Inspection", + "拼版图": "Assembly Drawing", + "产品图": "Product Drawing", + "报工任务": "Work Reporting Task" + }, + sBig5: { + "生产执行": "生產執行", + "质量巡检": "質量巡檢", + "拼版图": "拼版圖", + "产品图": "產品圖", + "报工任务": "報工任務" + } + }; + + // 根据语言设置进行转换 + if (translations[language]) { + return list.map(item => translations[language][item] || item); + } + // 默认返回原始列表 + return list; + } + const sLanguage = props.app.userinfo.sLanguage || 'sChinese'; + list = translateList(sLanguage); return (
diff --git a/src/mes/queryTracking/index.js b/src/mes/queryTracking/index.js index a0f7d16..d8ece9d 100644 --- a/src/mes/queryTracking/index.js +++ b/src/mes/queryTracking/index.js @@ -2,7 +2,7 @@ * @Author: varcms * @LastEditors: varcms * @Date: 2025-06-04 11:06:14 - * @Description: + * @Description: */ import React from "react"; import styles from "./index.less"; diff --git a/src/mes/scheduledTasks/machineTasks/index.js b/src/mes/scheduledTasks/machineTasks/index.js index d2b67bd..9aca10d 100644 --- a/src/mes/scheduledTasks/machineTasks/index.js +++ b/src/mes/scheduledTasks/machineTasks/index.js @@ -4,1161 +4,1115 @@ * @Date: 2024-02-28 9:55:04 * @Description: 计划任务 ---- 机台任务 */ - import React, { useEffect, useRef, useState } from "react"; - import moment from "moment"; - import { - Carousel, - Col, - Row, - Button, - Input, - Modal, - Space, - Dropdown, - message, - Tooltip - } from "antd"; - import { SettingTwoTone } from "@ant-design/icons"; - import * as commonFunc from "@/components/Common/commonFunc"; - import * as commonUtils from "@/utils/utils"; - import * as commonConfig from "@/utils/config"; - import * as commonBusiness from "@/components/Common/commonBusiness"; - import * as commonServices from "@/services/services"; - import useCommonBase from "@/components/Common/CommonHooks/useCommonBase"; - import StaticEditTable from "@/components/Common/CommonTable"; - import CommonViewTable from "@/components/Common/CommonViewTable"; - import styles from "./index.less"; - import taskInfoIcon from "../assets/taskInfo2.png"; - import statusIcon from "../assets/status.png"; - import taskIcon from "../assets/task.png"; - import timeIcon from "../assets/time.png"; - import { handleOeeBtnEent } from "./common/handlePause"; - import { operationFetch } from "../../productionExec/productionExecMain/operationFetch"; - - // 业务层 - const useInfoEvent = props => { - const { formData } = props; - const [refreshCount, setRefreshCount] = useState(0); - - useEffect( - async () => { - if (commonUtils.isNotEmptyArr(formData)) { - const colunmData = handleGetColumnData(formData, true); - const result = await handleGetData(formData, true); - const addState = { - ...colunmData, - ...result - }; - props.onSaveState(addState); - } - }, - [formData, refreshCount] - ); - - // 获取表头数据 - const handleGetColumnData = (formData = [], isWait) => { - let addState = {}; - for (let i = 0; i < formData.length; i++) { - const config = formData[i]; - const column = commonFunc.getHeaderConfig(config); - addState = { - ...addState, - [`slave${i}Column`]: column, - [`slave${i}Config`]: config - }; - } - if (isWait) { - return addState; - } else { - props.onSaveState(addState); - } - }; - - // 获取数据集 - const handleGetData = async (formData = [], isWait, filter) => { - let addState = {}; - for (let i = 0; i < formData.length; i++) { - const config = formData[i]; - if (!config) continue; - - const conditonValues = props.onGetSqlConditionValues(config); - - if (config.sSqlStr === "Sp_OEE_ProductionReport") { - conditonValues.sMachineId_s_pro = props.app.sMachineNameSId; - } - - // 前期生产或反馈问题表必须有非空过滤条件 - if ( - (i === 1 && Object.values(conditonValues).includes("")) || - Object.values(conditonValues).includes(undefined) - ) { - continue; - } - - const bFilter = []; - if (filter) { - Object.keys(filter).forEach(key => { - bFilter.push({ - bFilterName: key, - bFilterCondition: "like", - bFilterValue: filter[key] - }); - }); - } - - const result = - (await props.onGetDataSet({ - name: `slave${i}`, - configData: config, - condition: { - bFilter, - sSqlCondition: { ...conditonValues } - }, - isWait: true - })) || {}; - props.setTempRef(result); - addState = { ...addState, ...result }; - } - props.setTempRef({}, true); - if (isWait) { - return addState; - } else { - props.onSaveState(addState); - } +import React, { useEffect, useRef, useState } from "react"; +import moment from "moment"; +import { + Carousel, + Col, + Row, + Button, + Input, + Modal, + Space, + Dropdown, + message, + Tooltip +} from "antd"; +import { SettingTwoTone } from "@ant-design/icons"; +import * as commonFunc from "@/components/Common/commonFunc"; +import * as commonUtils from "@/utils/utils"; +import * as commonConfig from "@/utils/config"; +import * as commonBusiness from "@/components/Common/commonBusiness"; +import * as commonServices from "@/services/services"; +import useCommonBase from "@/components/Common/CommonHooks/useCommonBase"; +import StaticEditTable from "@/components/Common/CommonTable"; +import styles from "./index.less"; +import taskInfoIcon from "../assets/taskInfo2.png"; +import statusIcon from "../assets/status.png"; +import taskIcon from "../assets/task.png"; +import timeIcon from "../assets/time.png"; +import { handleOeeBtnEent } from "./common/handlePause"; +import { operationFetch } from "../../productionExec/productionExecMain/operationFetch"; + +// 业务层 +const useInfoEvent = props => { + const { formData } = props; + const [refreshCount, setRefreshCount] = useState(0); + + useEffect( + async () => { + if (commonUtils.isNotEmptyArr(formData)) { + const colunmData = handleGetColumnData(formData, true); + const result = await handleGetData(formData, true); + const addState = { + ...colunmData, + ...result + }; + props.onSaveState(addState); + } + }, + [formData, refreshCount] + ); + + // 获取表头数据 + const handleGetColumnData = (formData = [], isWait) => { + let addState = {}; + for (let i = 0; i < formData.length; i++) { + const config = formData[i]; + const column = commonFunc.getHeaderConfig(config); + addState = { + ...addState, + [`slave${i}Column`]: column, + [`slave${i}Config`]: config }; - - // 查询 - const handleSearch = sWorkOrderNo => { - handleGetData([formData[0]], false, { - sWorkOrderNo + } + if (isWait) { + return addState; + } else { + props.onSaveState(addState); + } + }; + + // 获取数据集 + const handleGetData = async (formData = [], isWait, filter) => { + let addState = {}; + for (let i = 0; i < formData.length; i++) { + const config = formData[i]; + if (!config) continue; + + const conditonValues = props.onGetSqlConditionValues(config); + + if (config.sSqlStr === "Sp_OEE_ProductionReport") { + conditonValues.sMachineId_s_pro = props.app.sMachineNameSId; + } + + // 前期生产或反馈问题表必须有非空过滤条件 + if ( + (i === 1 && Object.values(conditonValues).includes("")) || + Object.values(conditonValues).includes(undefined) + ) { + continue; + } + + const bFilter = []; + if (filter) { + Object.keys(filter).forEach(key => { + bFilter.push({ + bFilterName: key, + bFilterCondition: "like", + bFilterValue: filter[key] + }); }); - }; - - // 开工事件 - const handleStartWork = async params => { - const { sModelsId, token, app } = props; - const { name, record, config, tableData, iFlag, pauseValue } = params; - const { sMachineId, sId, sSlaveId } = record; - - // /* 若设置了禁止跳单 选择数据不是第一条时进行提示 */ - // const iIndex = app.systemData.findIndex(item => item.sName === "CkxNoSkip"); - // if (iIndex > -1) { - // const sValue = app.systemData[iIndex].sValue; - // if (sValue === "1") { - // /* 如果设置了进制跳单 */ - // const indexFirst = tableData.findIndex( - // item => sId === item.sId || sSlaveId === item.sSlaveId - // ); - // if (indexFirst > 0) { - // message.warn("禁止跳单!"); - // return; - // } - // } - // } - // // 验证是否单据是否被使用 - // const dataUrl = `${ - // commonConfig.server_host - // }bill/billCopyToCheckWork?sModelsId=${sModelsId}`; - // const values = { sMachineId }; - // const dataReturn = (await commonServices.postValueService( - // token, - // values, - // dataUrl - // )).data; - // if (dataReturn.code !== 1) { - // props.getServiceError(dataReturn); - // return; - // } - - // 单据可以使用 - const { startWorkConfig = {} } = config; - const { sAssignField } = startWorkConfig; - const allTableData = { - [name]: record - }; - let rowData = commonFunc.getDefaultData(config, allTableData); // 取默认值 - rowData = { - ...rowData, - ...commonFunc.getAssignFieldValue(sAssignField, record, allTableData), - handleType: "add", - sId: commonUtils.createSid(), - sTeamId: app.sTeamNameSId, - sMachineId: app.sMachineNameSId, - sParentId: record.sId, - tCreateDate: new Date() - }; - - const valuesNew = {}; - valuesNew.data = []; - valuesNew.data.push( - commonBusiness.mergeData(name, "plc_machinedata", [rowData], []) - ); - - if ((iFlag || Object.is(iFlag, 0)) && valuesNew.data[0]) { - valuesNew.data[0].iFlag = iFlag; + } + + const result = + (await props.onGetDataSet({ + name: `slave${i}`, + configData: config, + condition: { + bFilter, + sSqlCondition: { ...conditonValues } + }, + isWait: true + })) || {}; + props.setTempRef(result); + addState = { ...addState, ...result }; + } + props.setTempRef({}, true); + if (isWait) { + return addState; + } else { + props.onSaveState(addState); + } + }; + + // 查询 + const handleSearch = sWorkOrderNo => { + handleGetData([formData[0]], false, { + sWorkOrderNo + }); + }; + + // 开工事件 + const handleStartWork = async params => { + const { sModelsId, token, app } = props; + const { name, record, config, tableData, iFlag, pauseValue } = params; + const { sMachineId, sId, sSlaveId } = record; + + // /* 若设置了禁止跳单 选择数据不是第一条时进行提示 */ + // const iIndex = app.systemData.findIndex(item => item.sName === "CkxNoSkip"); + // if (iIndex > -1) { + // const sValue = app.systemData[iIndex].sValue; + // if (sValue === "1") { + // /* 如果设置了进制跳单 */ + // const indexFirst = tableData.findIndex( + // item => sId === item.sId || sSlaveId === item.sSlaveId + // ); + // if (indexFirst > 0) { + // message.warn("禁止跳单!"); + // return; + // } + // } + // } + // // 验证是否单据是否被使用 + // const dataUrl = `${ + // commonConfig.server_host + // }bill/billCopyToCheckWork?sModelsId=${sModelsId}`; + // const values = { sMachineId }; + // const dataReturn = (await commonServices.postValueService( + // token, + // values, + // dataUrl + // )).data; + // if (dataReturn.code !== 1) { + // props.getServiceError(dataReturn); + // return; + // } + + // 单据可以使用 + const { startWorkConfig = {} } = config; + const { sAssignField } = startWorkConfig; + const allTableData = { + [name]: record + }; + let rowData = commonFunc.getDefaultData(config, allTableData); // 取默认值 + rowData = { + ...rowData, + ...commonFunc.getAssignFieldValue(sAssignField, record, allTableData), + handleType: "add", + sId: commonUtils.createSid(), + sTeamId: app.sTeamNameSId, + sMachineId: app.sMachineNameSId, + sParentId: record.sId, + tCreateDate: new Date() + }; + + const valuesNew = {}; + valuesNew.data = []; + valuesNew.data.push( + commonBusiness.mergeData(name, "plc_machinedata", [rowData], []) + ); + + if ((iFlag || Object.is(iFlag, 0)) && valuesNew.data[0]) { + valuesNew.data[0].iFlag = iFlag; + } + + if (pauseValue) { + valuesNew.data[0].sWorkOrderChangeMemo = pauseValue; + } + + const BtnSave = commonFunc.showMessage( + app.commonConst, + "BtnSave" + ); /* 保存 */ + params.optName = BtnSave; + params.sClientType = "1"; + const returnData = await commonBusiness.saveData({ + token, + value: valuesNew, + sModelsId, + bMachineTask: true + }); + + return returnData; + // if (commonUtils.isEmptyObject(returnData)) return; + + // props.onSaveState( + // { + // [`${name}SelectedRowKeys`]: [record.sId] + // }, + // () => { + // props.dispatch({ + // type: "app/saveGlobalData", + // payload: { + // currentStartWorkMachineTaskDataRow: rowData + // } + // }); + // handleRefresh(); + // setTimeout(() => { + // props.onChangeRouter({ + // type: "name", + // path: ["生产执行", "生产执行"] + // }); + // }, 500); + // } + // ); + // this.props.onSaveCurrentState(slaveData, true, undefined, undefined, 1); + }; + + // 更新工单状态 + const handleUpdateStatus = async params => { + const { doWorkState, record } = params; + + const { sModelsId, app } = props; + + const value = { + plcMachinedata: record + }; + + const url = `${ + commonConfig.server_host + }oee/doUpdateStatus/${doWorkState}?sModelsId=${sModelsId}&sMachineId=${ + record.sMachineId + }`; + const returnData = (await commonServices.postValueService( + app.token, + value, + url + )).data; + + if (returnData.code !== 1) { + props.getServiceError(returnData); + return false; + } + + return true; + }; + + // 监听机台任务选中行变化 + const { slave0SelectedRowKeys = [], slave0Data = [], sModelsId } = props; + useEffect( + () => { + if (!slave0Data.length) return; + + const globalData = commonUtils.convertStrToObj( + localStorage.xlybusinessglobalData + ); + const { currentSelectedMachineTaskDataRow = {} } = globalData; + + // 当前选中行sId,默认取缓存数据 + let currentSelectedRowKey = slave0SelectedRowKeys[0]; + if ( + !currentSelectedRowKey && + sModelsId === currentSelectedMachineTaskDataRow?.sModelsId + ) { + currentSelectedRowKey = currentSelectedMachineTaskDataRow.sId; + } + if (!currentSelectedRowKey) { + currentSelectedRowKey = slave0Data[0].sId; + } + + // 默认选中第一行 + if (!slave0SelectedRowKeys.length) { + props.onSaveState({ + slave0SelectedRowKeys: [currentSelectedRowKey] + }); + } + + // 将当前选中行保存到全局 + props.dispatch({ + type: "app/saveGlobalData", + payload: { + currentSelectedMachineTaskDataRow: { + ...(slave0Data.find(item => item.sId === currentSelectedRowKey) || + {}), + sModelsId + } } - - if (pauseValue) { - valuesNew.data[0].sWorkOrderChangeMemo = pauseValue; + }); + + // 前期生产或反馈问题数据根据机台任务选中行变化 + handleGetData(["", formData[1]], false); + }, + [slave0SelectedRowKeys[0], slave0Data.length] + ); + + // 监听开工任务变化 + useEffect( + () => { + if (commonUtils.isEmptyObject(props.slave0Data)) return; + const startRowData = props.slave0Data.find(item => item.iStar === 1); + if (!startRowData) return; + props.dispatch({ + type: "app/saveGlobalData", + payload: { + currentStartWorkMachineTaskDataRow: startRowData } - - const BtnSave = commonFunc.showMessage( - app.commonConst, - "BtnSave" - ); /* 保存 */ - params.optName = BtnSave; - params.sClientType = "1"; - const returnData = await commonBusiness.saveData({ - token, - value: valuesNew, - sModelsId, - bMachineTask: true - }); - - return returnData; - // if (commonUtils.isEmptyObject(returnData)) return; - - // props.onSaveState( - // { - // [`${name}SelectedRowKeys`]: [record.sId] - // }, - // () => { - // props.dispatch({ - // type: "app/saveGlobalData", - // payload: { - // currentStartWorkMachineTaskDataRow: rowData - // } - // }); - // handleRefresh(); - // setTimeout(() => { - // props.onChangeRouter({ - // type: "name", - // path: ["生产执行", "生产执行"] - // }); - // }, 500); - // } - // ); - // this.props.onSaveCurrentState(slaveData, true, undefined, undefined, 1); - }; - - // 更新工单状态 - const handleUpdateStatus = async params => { - const { doWorkState, record } = params; - - const { sModelsId, app } = props; - - const value = { - plcMachinedata: record - }; - - const url = `${ - commonConfig.server_host - }oee/doUpdateStatus/${doWorkState}?sModelsId=${sModelsId}&sMachineId=${ - record.sMachineId - }`; - const returnData = (await commonServices.postValueService( - app.token, - value, - url - )).data; - - if (returnData.code !== 1) { - props.getServiceError(returnData); - return false; + }); + }, + [JSON.stringify(props.slave0Data)] + ); + + // 刷新页面 + const handleRefresh = () => { + setRefreshCount(refreshCount + 1); + }; + + const itemClickRef = useRef(); + + // 开工、暂停事件 + const handleTableBtnClick = async item => { + const { tableName, index, record, tableData, config, iFlag } = item; + const { showName } = config; + if (showName === "完工") { + Modal.confirm({ + title: "温馨提示:", + content:
确认完工?
, + okText: "确认", + cancelText: "取消", + onOk() { + handleUpdateProductionplan({ item, iFlag: 4 }); } - - return true; - }; - - // 监听机台任务选中行变化 - const { slave0SelectedRowKeys = [], slave0Data = [], sModelsId } = props; - useEffect( - () => { - if (!slave0Data.length) return; - - const globalData = commonUtils.convertStrToObj( - localStorage.xlybusinessglobalData - ); - const { currentSelectedMachineTaskDataRow = {} } = globalData; - - // 当前选中行sId,默认取缓存数据 - let currentSelectedRowKey = slave0SelectedRowKeys[0]; - if ( - !currentSelectedRowKey && - sModelsId === currentSelectedMachineTaskDataRow?.sModelsId - ) { - currentSelectedRowKey = currentSelectedMachineTaskDataRow.sId; - } - if (!currentSelectedRowKey) { - currentSelectedRowKey = slave0Data[0].sId; - } - - // 默认选中第一行 - if (!slave0SelectedRowKeys.length) { - props.onSaveState({ - slave0SelectedRowKeys: [currentSelectedRowKey] - }); - } - - // 将当前选中行保存到全局 - props.dispatch({ - type: "app/saveGlobalData", - payload: { - currentSelectedMachineTaskDataRow: { - ...(slave0Data.find(item => item.sId === currentSelectedRowKey) || - {}), - sModelsId - } - } - }); - - // 前期生产或反馈问题数据根据机台任务选中行变化 - handleGetData(["", formData[1]], false); - }, - [slave0SelectedRowKeys[0], slave0Data.length] - ); - - // 监听开工任务变化 - useEffect( - () => { - if (commonUtils.isEmptyObject(props.slave0Data)) return; - const startRowData = props.slave0Data.find(item => item.iStar === 1); - if (!startRowData) return; - props.dispatch({ - type: "app/saveGlobalData", - payload: { - currentStartWorkMachineTaskDataRow: startRowData - } - }); - }, - [JSON.stringify(props.slave0Data)] - ); - - // 刷新页面 - const handleRefresh = () => { - setRefreshCount(pre => pre + 1); - }; - - const itemClickRef = useRef(); - - // 开工、暂停事件 - const handleTableBtnClick = async item => { - const { tableName, index, record, tableData, config, iFlag } = item; - const { showName } = config; - if (showName === "完工") { + }); + return; + } + // const iStar = index === 0 ? 1 : 2; + const { iStar } = record; + + if (iStar === 1) { + // 如果只剩一条数据,询问是暂停还是完工 + if (tableData.length === 1) { + const result = await new Promise(resolve => { Modal.confirm({ title: "温馨提示:", - content:
确认完工?
, - okText: "确认", - cancelText: "取消", + content:
请选择要变更的状态
, + okText: "完工", + cancelText: "暂停", onOk() { - handleUpdateProductionplan({ item, iFlag: 4 }); + resolve(true); + }, + onCancel() { + resolve(false); } }); + }); + if (result) { + // 走完工接口 + handleUpdateProductionplan({ item, iFlag: 4 }); return; } - // const iStar = index === 0 ? 1 : 2; - const { iStar } = record; - - if (iStar === 1) { - // 如果只剩一条数据,询问是暂停还是完工 - if (tableData.length === 1) { - const result = await new Promise(resolve => { - Modal.confirm({ - title: "温馨提示:", - content:
请选择要变更的状态
, - okText: "完工", - cancelText: "暂停", - onOk() { - resolve(true); - }, - onCancel() { - resolve(false); - } - }); - }); - if (result) { - // 走完工接口 - handleUpdateProductionplan({ item, iFlag: 4 }); - return; - } - } - - // 开工中,走暂停接口 + } + + // 开工中,走暂停接口 + props.onSaveState({ + taskConfirmModalVisible: true, + taskConfirmModalMsg: "请填写暂停原因", + tempTaskId: record.sId, + bPauseOnly: true, + pauseCallback: pauseValue => { props.onSaveState({ - taskConfirmModalVisible: true, - taskConfirmModalMsg: "请选择暂停原因", - tempTaskId: record.sId, - bPauseOnly: true, - pauseCallback: pauseValue => { - props.onSaveState({ - taskConfirmModalVisible: false, - taskConfirmModalMsg: "", - tempTaskId: "", - bPauseOnly: false, - pauseCallback: null - }); - handleUpdateProductionplan({ item, iFlag: 3, pauseValue }); - } + taskConfirmModalVisible: false, + taskConfirmModalMsg: "", + tempTaskId: "", + bPauseOnly: false, + pauseCallback: null }); - } else if (iStar === 2 || iStar === 3) { - // 暂停中,走开工接口 - const dataReturn = await handleStartWork(item); - const { code, msg } = dataReturn; - if (code === 1) { - // 成功开工 - itemClickRef.current = null; - message.success(dataReturn.msg); - if (props.taskConfirmModalVisible) { - props.onSaveState({ - taskConfirmModalVisible: false, - taskConfirmModalMsg: "", - tempTaskId: "" - }); - } - props.onChangeRouter({ - type: "name", - path: ["生产执行", "生产执行"] - }); - } else if (code === -7) { - // 如果有开工中的任务,即接口返回-7,弹出确认窗体 - itemClickRef.current = { data: item }; - props.onSaveState({ - taskConfirmModalVisible: true, - taskConfirmModalMsg: msg, - tempTaskId: record.sId - }); - } else { - // 报错 - message.error(msg); - } - } - }; - - // 更新机台状态 - const handleUpdateProductionplan = async ({ item, iFlag, pauseValue }) => { - const { app } = props; - const { sId } = item.record; - const { token } = app; - const url = `${ - commonConfig.server_host - }oee/updateProductionplan/${sId}/${iFlag}${ - pauseValue - ? `?sWorkOrderChangeMemo=${encodeURIComponent(pauseValue)}` - : "" - }`; - const dataReturn = (await commonServices.getService(token, url)).data; - if (dataReturn.code === 1) { - dataReturn.msg && message.success(dataReturn.msg, 3); - handleRefresh(); - } else { - message.error(dataReturn.msg, 3); + handleUpdateProductionplan({ item, iFlag: 3, pauseValue }); } - }; - - return { - ...props, - // 其他对象 - itemClickRef, - onSearch: handleSearch, - onStartWork: handleStartWork, // 开工事件 - onRefresh: handleRefresh, // 刷新页面 - onTableBtnClick: handleTableBtnClick, // 开工、暂停事件 - onUpdateProductionplan: handleUpdateProductionplan // 更新机台状态 - }; - }; - - /** - * 暂停按钮 - * @param {*} params - */ - const handlePause = async params => { - const { item, props } = params; - const { record, config } = item; - await operationFetch( - { ...props, workOrderInfoData: [record] }, - config, - config.sName || "fileError" - ); - await handleOeeBtnEent({ props, item }); - }; - - const MachineTasks = baseProps => { - const props = useInfoEvent(useCommonBase({ ...baseProps })); - const { - app, - slave0Config, - slave1Column, - slave1Data = [], - slave2Column, - slave2Data = [] - } = props; - - const bStartWork = commonUtils.getAppData("userinfo", "bStartWork"); - - const [isTableLoading, setTableLoading] = useState(false); - - // const BtnTableCopyTo.startWork - // 开工按钮配置 - const startWorkConfig = - slave0Config?.gdsconfigformslave?.find( - item => item.sControlName === "BtnTableCopyTo.startWork" - ) || {}; - const pauseWorkConfig = - slave0Config?.gdsconfigformslave?.find( - item => item.sControlName === "BtnTableCopyTo.pauseWork" - ) || {}; - - // 表格业务 - const [sSrcNo, setSSrcNo] = useState(""); - // 顶部表格配置 - const tableProps = { - ...commonBusiness.getTableTypes("slave0", props), - tableProps: { - onChange: () => {}, - loading: isTableLoading - }, - tableBtnsConfig: params => { - const { record, index } = params; - const { iStar } = record; - // const iStar = index === 0 ? 1 : 2; - - // const bStart = iStar === 1; - // const bPause = iStar === 2; - - // 1 :开工状态(显示暂停) 2: 暂停状态(显示开工) 3: 完工状态(显示完工,灰色) - // 开工:开工接口(现在)1:正常, -7:有开工,要有提示, -1: 错误提示 - // -7 :完工: iFlag:3 (完工上一条) 暂停:iFlag:2 (暂停上一条) - // 暂停:新接口 - - let showName, btnBgColor, sDefault; - if (iStar === 1) { - showName = "暂停"; - btnBgColor = "#FAAD14"; - } else if (iStar === 2 || iStar === 3) { - showName = "开工"; - btnBgColor = "#1890FF"; - } else { - showName = "完工"; - btnBgColor = "#AAA"; - sDefault = "${false}"; - } - - if (!bStartWork) { - sDefault = "${false}"; - } - - return [ - { showName, btnBgColor, sDefault, startWorkConfig, pauseWorkConfig }, - { showName: "完工", btnBgColor: "#1890FF", sDefault } - ]; - - // return [ - // { - // ...startWorkConfig, - // showName: "开工", - // btnBgColor: bStart ? "#1890FF" : "#AAA" - // }, - // { - // ...pauseWorkConfig, - // showName: "暂停", - // btnBgColor: bPause ? "#FAAD14" : "#AAA" - // } - // ]; - }, - onTableBtnClick: item => { - props.onTableBtnClick(item); - return; - // 通用按钮操作 - // props.onTableBtnClick(item); - const { tableName, index, record, tableData, config } = item; - const { iStar } = record; - const { showName } = config; - if (iStar === 1 && showName === "开工") { - setTableLoading(true); - props.onStartWork(item).finally(() => { - setTableLoading(false); - }); - } else if (iStar === 2 && showName === "暂停") { - setTableLoading(true); - handlePause({ item, props }).finally(() => { - setTableLoading(false); - props.onRefresh(); - }); - } - }, - tableBtnsWidth: "190px", - fixedHeight: "335px" - }; - // 全部按钮事件 - const tableAll = () => { - setSSrcNo(""); - props.onSearch(); - }; - // 查询按钮事件 - const tableQuery = () => { - props.onSearch(sSrcNo); - }; - - // 前期生产或反馈问题业务 - const [issueType, setIssueType] = useState(4); - const issueObj = slave1Column?.reduce((acc, item) => { - const chineseKey = item.title.replace(/[0-9]/g, ""); - if (acc[chineseKey]) { - acc[chineseKey].push(item); - } else { - acc[chineseKey] = [item]; + }); + } else if (iStar === 2 || iStar === 3) { + // 暂停中,走开工接口 + const dataReturn = await handleStartWork(item); + const { code, msg } = dataReturn; + if (code === 1) { + // 成功开工 + itemClickRef.current = null; + message.success(dataReturn.msg); + if (props.taskConfirmModalVisible) { + props.onSaveState({ + taskConfirmModalVisible: false, + taskConfirmModalMsg: "", + tempTaskId: "" + }); } - return acc; - }, {}); - - let issue = []; - - if (issueObj) { - issue = Object.keys(issueObj)?.map((key, i) => { - return { name: key, items: issueObj[key], id: i }; + props.onChangeRouter({ + type: "name", + path: ["生产执行", "生产执行"] + }); + } else if (code === -7) { + // 如果有开工中的任务,即接口返回-7,弹出确认窗体 + itemClickRef.current = { data: item }; + props.onSaveState({ + taskConfirmModalVisible: true, + taskConfirmModalMsg: msg, + tempTaskId: record.sId }); + } else { + // 报错 + message.error(msg); } - - const component = id => { - if (issue?.length > 0) { - return ( -
- {issue[id].items.map(item => ( -

- {item.title}: - {slave1Data[0] ? ( - - {slave1Data[0][item.dataIndex]} - - } - > - {slave1Data[0][item.dataIndex]} - - ) : ( - "" - )} -

- ))} -
- ); - } - }; - - const [carouselData, setCarouselData] = useState([ - { - title: "暂无通告", - content: "暂无通告", - id: 999 - } - ]); - - const { slave3Data = [] } = props; - - useEffect( - () => { - if (!slave3Data.length) return; - - const tempData = slave3Data.map((item, index) => ({ - title: `车间通告${index + 1}`, - content: item.sNoticeMemo, - id: index - })); - - setCarouselData(tempData); - }, - [slave3Data.length] - ); - - // 设备信息业务 - const slave2OneData = slave2Data[0] || {}; - const { countMapJsON } = slave2OneData; - const countMap = commonUtils.convertStrToObj(countMapJsON); - - const taskInfoData = {}; - slave2Column?.forEach(obj => { - taskInfoData[`${obj.dataIndex}Title`] = obj.title; - taskInfoData[`${obj.dataIndex}Conent`] = countMap[obj.dataIndex]; - }); - + } + }; + + // 更新机台状态 + const handleUpdateProductionplan = async ({ item, iFlag, pauseValue }) => { + const { app } = props; + const { sId } = item.record; + const { token } = app; + const url = `${ + commonConfig.server_host + }oee/updateProductionplan/${sId}/${iFlag}${ + pauseValue + ? `?sWorkOrderChangeMemo=${encodeURIComponent(pauseValue)}` + : "" + }`; + const dataReturn = (await commonServices.getService(token, url)).data; + if (dataReturn.code === 1) { + handleRefresh(); + } else { + message.error(dataReturn.msg); + } + }; + + return { + ...props, + // 其他对象 + itemClickRef, + onSearch: handleSearch, + onStartWork: handleStartWork, // 开工事件 + onRefresh: handleRefresh, // 刷新页面 + onTableBtnClick: handleTableBtnClick, // 开工、暂停事件 + onUpdateProductionplan: handleUpdateProductionplan // 更新机台状态 + }; +}; + +/** + * 暂停按钮 + * @param {*} params + */ +const handlePause = async params => { + const { item, props } = params; + const { record, config } = item; + await operationFetch( + { ...props, workOrderInfoData: [record] }, + config, + config.sName || "fileError" + ); + await handleOeeBtnEent({ props, item }); +}; + +const MachineTasks = baseProps => { + const props = useInfoEvent(useCommonBase({ ...baseProps })); + const { + app, + slave0Config, + slave1Column, + slave1Data = [], + slave2Column, + slave2Data = [] + } = props; + + const bStartWork = commonUtils.getAppData("userinfo", "bStartWork"); + + const [isTableLoading, setTableLoading] = useState(false); + + // const BtnTableCopyTo.startWork + // 开工按钮配置 + const startWorkConfig = + slave0Config?.gdsconfigformslave?.find( + item => item.sControlName === "BtnTableCopyTo.startWork" + ) || {}; + const pauseWorkConfig = + slave0Config?.gdsconfigformslave?.find( + item => item.sControlName === "BtnTableCopyTo.pauseWork" + ) || {}; + + // 表格业务 + const [sSrcNo, setSSrcNo] = useState(""); + // 顶部表格配置 + const tableProps = { + ...commonBusiness.getTableTypes("slave0", props), + tableProps: { + onChange: () => {}, + loading: isTableLoading + }, + tableBtnsConfig: params => { + const { record, index } = params; + const { iStar } = record; + // const iStar = index === 0 ? 1 : 2; + + // const bStart = iStar === 1; + // const bPause = iStar === 2; + + // 1 :开工状态(显示暂停) 2: 暂停状态(显示开工) 3: 完工状态(显示完工,灰色) + // 开工:开工接口(现在)1:正常, -7:有开工,要有提示, -1: 错误提示 + // -7 :完工: iFlag:3 (完工上一条) 暂停:iFlag:2 (暂停上一条) + // 暂停:新接口 + + let showName, btnBgColor, sDefault; + if (iStar === 1) { + showName = "暂1停"; + btnBgColor = "#FAAD14"; + } else if (iStar === 2 || iStar === 3) { + showName = "开1工"; + btnBgColor = "#1890FF"; + } else { + showName = "完1工"; + btnBgColor = "#AAA"; + sDefault = "${false}"; + } + + if (!bStartWork) { + sDefault = "${false}"; + } + + return [ + { showName, btnBgColor, sDefault, startWorkConfig, pauseWorkConfig }, + { showName: "完工", btnBgColor: "#1890FF", sDefault } + ]; + + // return [ + // { + // ...startWorkConfig, + // showName: "开工", + // btnBgColor: bStart ? "#1890FF" : "#AAA" + // }, + // { + // ...pauseWorkConfig, + // showName: "暂停", + // btnBgColor: bPause ? "#FAAD14" : "#AAA" + // } + // ]; + }, + onTableBtnClick: item => { + props.onTableBtnClick(item); + return; + // 通用按钮操作 + // props.onTableBtnClick(item); + const { tableName, index, record, tableData, config } = item; + const { iStar } = record; + const { showName } = config; + if (iStar === 1 && showName === "开工") { + setTableLoading(true); + props.onStartWork(item).finally(() => { + setTableLoading(false); + }); + } else if (iStar === 2 && showName === "暂停") { + setTableLoading(true); + handlePause({ item, props }).finally(() => { + setTableLoading(false); + props.onRefresh(); + }); + } + }, + tableBtnsWidth: "190px", + fixedHeight: "335px" + }; + // 全部按钮事件 + const tableAll = () => { + setSSrcNo(""); + props.onSearch(); + }; + // 查询按钮事件 + const tableQuery = () => { + props.onSearch(sSrcNo); + }; + + // 前期生产或反馈问题业务 + const [issueType, setIssueType] = useState(4); + const issueObj = slave1Column?.reduce((acc, item) => { + const chineseKey = item.title.replace(/[0-9]/g, ""); + if (acc[chineseKey]) { + acc[chineseKey].push(item); + } else { + acc[chineseKey] = [item]; + } + return acc; + }, {}); + + let issue = []; + + if (issueObj) { + issue = Object.keys(issueObj)?.map((key, i) => { + return { name: key, items: issueObj[key], id: i }; + }); + } + + const component = id => { + if (issue?.length > 0) { return ( -
- - -
- -
-
- - setSSrcNo(e.target.value)} - /> - -
- -
- - -
-

前期生产或反馈问题

- {issue?.map(item => ( - - ))} - {component(issueType)} -
- - -
- - {carouselData.map(item => ( -
-

{item.title}

-

{item.content}

-
- ))} -
-
- -
- -

设备信息

- -
- {taskInfoData.sMachineNameTitle} -
-

{taskInfoData.sMachineNameTitle}:

-

{taskInfoData.sMachineNameConent}

+
+ {issue[id].items.map(item => ( +

+ {item.title}: + {slave1Data[0] ? ( + + {slave1Data[0][item.dataIndex]} + + } + > + {slave1Data[0][item.dataIndex]} + + ) : ( + "" + )} +

+ ))} +
+ ); + } + }; + const NoAnnouncements = commonFunc.showLocalMessage(props, 'NoAnnouncements', '暂无通告'); + + const [carouselData, setCarouselData] = useState([ + { + title: NoAnnouncements, + content: NoAnnouncements, + id: 999 + } + ]); + + const { slave3Data = [] } = props; + + useEffect( + () => { + if (!slave3Data.length) return; + + const tempData = slave3Data.map((item, index) => ({ + title: `车间通告${index + 1}`, + content: item.sNoticeMemo, + id: index + })); + + setCarouselData(tempData); + }, + [slave3Data.length] + ); + + // 设备信息业务 + const slave2OneData = slave2Data[0] || {}; + const { countMapJsON } = slave2OneData; + const countMap = commonUtils.convertStrToObj(countMapJsON); + + const taskInfoData = {}; + slave2Column?.forEach(obj => { + taskInfoData[`${obj.dataIndex}Title`] = obj.title; + taskInfoData[`${obj.dataIndex}Conent`] = countMap[obj.dataIndex]; + }); + const feedbackIssues = commonFunc.showLocalMessage(props, 'feedbackIssues', '前期生产或反馈问题'); + const btnsearch = commonFunc.showLocalMessage(props, 'BtnSearch', '查询111'); + console.log('3333', btnsearch); + const btnAll = commonFunc.showLocalMessage(props, 'btnAll', '全部'); + const sWorkOrderNo = commonFunc.showLocalMessage(props, 'sWorkOrderNo', '工单编号'); + + + return ( +
+ + +
+ +
+
+ + setSSrcNo(e.target.value)} + /> + +
+ +
+ + +
+

{feedbackIssues}

+ {issue?.map(item => ( + + ))} + {component(issueType)} +
+ + +
+ + {carouselData.map(item => ( +
+

{item.title}

+

{item.content}

+ ))} +
+
+ +
+ +

设备信息

+ +
+ {taskInfoData.sMachineNameTitle} +
+

{taskInfoData.sMachineNameTitle}:

+

{taskInfoData.sMachineNameConent}

+
+
+ + +
+ {taskInfoData.sStatusNameTitle} +
+

{taskInfoData.sStatusNameTitle}:

+

{taskInfoData.sStatusNameConent}

+
+ +
+ + +
+ {taskInfoData.tStartingUpTimeTitle} +
+

{taskInfoData.tStartingUpTimeTitle}:

+

{taskInfoData.tStartingUpTimeConent}

+
+
+
+

{taskInfoData.tNorRunTimeTitle}:

+ {taskInfoData.tNorRunTimeConent}
- - -
- {taskInfoData.sStatusNameTitle} -
-

{taskInfoData.sStatusNameTitle}:

-

{taskInfoData.sStatusNameConent}

-
- +
+

{taskInfoData.tExeWaitTimeTitle}:

+ {taskInfoData.tExeWaitTimeConent}
- - -
- {taskInfoData.tStartingUpTimeTitle} -
-

{taskInfoData.tStartingUpTimeTitle}:

-

{taskInfoData.tStartingUpTimeConent}

-
-
-
-

{taskInfoData.tNorRunTimeTitle}:

- {taskInfoData.tNorRunTimeConent} -
-
-

{taskInfoData.tExeWaitTimeTitle}:

- {taskInfoData.tExeWaitTimeConent} -
-
-
-
-

{taskInfoData.tNorWaitTimeTitle}:

- {taskInfoData.tNorWaitTimeConent} -
-
-

{taskInfoData.tMaintenceTimeTitle}:

- {taskInfoData.tMaintenceTimeConent} -
-
+
+
+
+

{taskInfoData.tNorWaitTimeTitle}:

+ {taskInfoData.tNorWaitTimeConent}
- - -
- {taskInfoData.tStartingUpTimeTitle} -
-

今日完成任务批次/产量(个):

-

- {taskInfoData.iFinishTaskBatchConent} /{" "} - {taskInfoData.iFinishProductionNumConent} -

-
+
+

{taskInfoData.tMaintenceTimeTitle}:

+ {taskInfoData.tMaintenceTimeConent}
- - - -
- ); - }; - - const TaskConfirmModal = props => { - const { - taskConfirmModalVisible, - taskConfirmModalMsg, - bPauseOnly, - slave0Config - } = props; - if (!taskConfirmModalVisible) return ""; - - const handleClose = () => { - props.itemClickRef.current = null; - props.onSaveState({ - taskConfirmModalVisible: false, - bPauseOnly: false, - pauseCallback: null - }); - }; - - const [pauseValue, setPauseValue] = useState(""); - - const viewConfigs = slave0Config?.gdsconfigformslave.filter( - item => item.sName === "sPausereason" - ); +
+
+ + +
+ {taskInfoData.tStartingUpTimeTitle} +
+

今日完成任务批次/产量(个):

+

+ {taskInfoData.iFinishTaskBatchConent} /{" "} + {taskInfoData.iFinishProductionNumConent} +

+
+
+ + + +
+ ); +}; - const sIdRef = useRef(commonUtils.createSid()); - - const viewProps = { - ...props, - viewConfigs, - tableConfig: { ...slave0Config, gdsconfigformslave: viewConfigs }, - iColValueView: 24, - viewRow: { sId: sIdRef.current, sPausereason: pauseValue }, - tableName: "slave0", - enabled: true, - onDataChange: (...args) => { - setPauseValue(args[2].sPausereason); - } - }; - - return ( - 提示!} - open={taskConfirmModalVisible} - width={500} - height={320} - className="mesCommonModal" - footer={ +const TaskConfirmModal = props => { + const { taskConfirmModalVisible, taskConfirmModalMsg, bPauseOnly } = props; + if (!taskConfirmModalVisible) return ""; + + const handleClose = () => { + props.itemClickRef.current = null; + props.onSaveState({ + taskConfirmModalVisible: false, + bPauseOnly: false, + pauseCallback: null + }); + }; + + const [pauseValue, setPauseValue] = useState(""); + + return ( + 提示!} + open={taskConfirmModalVisible} + width={500} + height={370} + className="mesCommonModal" + footer={ + + {bPauseOnly ? ( + + ) : ( <> - {bPauseOnly ? ( - - - - ) : ( - - - - - )} + + + )} + + } + onCancel={handleClose} + > +
{taskConfirmModalMsg}
+
+
暂停原因
+ setPauseValue(e.target.value)} + /> +
+
+ ); +}; + +// 全屏状态 +const StatusBtnComponent = () => { + const items = [ + { + key: "4", + label: 转产, + value: { + conent2: "转产", + backgroundColor: "#752AFE" + } + }, + { + key: "1", + label: 测试, + value: { + conent2: "转产", + backgroundColor: "#21C9FE" + }, + children: [ + { + key: "1-1", + label: 产品打样, + value: { + conent2: "产品打样", + backgroundColor: "#21C9FE" } - onCancel={handleClose} - > -
{taskConfirmModalMsg}
-
- {/*
暂停原因
*/} - - {/* setPauseValue(e.target.value)} - /> */} -
-
+ }, + { + key: "1-2", + label: 工艺测试, + value: { + conent2: "工艺测试", + backgroundColor: "#21C9FE" + } + } + ] + }, + { + key: "2", + label: 保养, + value: { + conent2: "保养", + backgroundColor: "#FF6600" + }, + children: [ + { + key: "2-1", + label: 日常保养, + value: { + conent2: "日常保养", + backgroundColor: "#FF6600" + } + }, + { + key: "2-2", + label: 一级保养, + value: { + conent2: "一级保养", + backgroundColor: "#FF6600" + } + }, + { + key: "2-3", + label: 二级保养, + value: { + conent2: "二级保养", + backgroundColor: "#FF6600" + } + }, + { + key: "2-4", + label: 一级+二级保养, + value: { + conent2: "一级+二级保养", + backgroundColor: "#FF6600", + fontSize: 130 + } + }, + { + key: "2-5", + label: 年度保养, + value: { + conent2: "年度保养", + backgroundColor: "#FF6600" + } + } + ] + } + ]; + + const handleMenuClick = e => { + message.success({ + top: 0, + duration: 0, + className: styles.machineStatus, + content: + }); + }; + + return ( +
+ + + +
+ ); +}; + +const MachineMessageComponent = ({ e }) => { + 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); + const flagRef = useRef(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); + setDiffMins(minutes); + setDiffSecs(seconds); }; - - // 全屏状态 - const StatusBtnComponent = () => { - - const items = [ - { - key: "4", - label: 转产, - value: { - conent2: "转产", - backgroundColor: "#752AFE" - } - }, - { - key: "1", - label: 测试, - value: { - conent2: "转产", - backgroundColor: "#21C9FE" - }, - children: [ - { - key: "1-1", - label: 产品打样, - value: { - conent2: "产品打样", - backgroundColor: "#21C9FE" - } - }, - { - key: "1-2", - label: 工艺测试, - value: { - conent2: "工艺测试", - backgroundColor: "#21C9FE" - } - } - ] - }, - { - key: "2", - label: 保养, - value: { - conent2: "保养", - backgroundColor: "#FF6600" - }, - children: [ - { - key: "2-1", - label: 日常保养, - value: { - conent2: "日常保养", - backgroundColor: "#FF6600" - } - }, - { - key: "2-2", - label: 一级保养, - value: { - conent2: "一级保养", - backgroundColor: "#FF6600" - } - }, - { - key: "2-3", - label: 二级保养, - value: { - conent2: "二级保养", - backgroundColor: "#FF6600" - } - }, - { - key: "2-4", - label: 一级+二级保养, - value: { - conent2: "一级+二级保养", - backgroundColor: "#FF6600", - fontSize: 130 - } - }, - { - key: "2-5", - label: 年度保养, - value: { - conent2: "年度保养", - backgroundColor: "#FF6600" - } - } - ] - } - ]; - - // 全屏 - const handleMenuClick = item2 => { - const newObj = { - ...item2, - item: item2.item - }; - window.$wkcFullStatus(newObj , true) - }; - - - return ( - <> -
- - - -
- - ); + + getTime(); + const timer = setInterval(() => { + getTime(); + }, 1000); + + const handleMenuClose = () => { + if (flagRef.current) return; + flagRef.current++; + Modal.confirm({ + title: "温馨提示:", + content:
确认退出该页面?
, + okText: "确认", + cancelText: "取消", + zIndex: 2000, + onOk() { + message.destroy(); + }, + onCancel() { + setTimeout(() => { + flagRef.current = 0; + }, 500); + } + }); }; - - // const MachineMessageComponent = ({ e , shutDown , minimize}) => { - // 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); - // const flagRef = useRef(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); - // setDiffMins(minutes); - // setDiffSecs(seconds); - // }; - - // getTime(); - // const timer = setInterval(() => { - // getTime(); - // }, 1000); - - // // const handleMenuClose = () => { - // // if (flagRef.current) return; - // // flagRef.current++; - // // Modal.confirm({ - // // title: "温馨提示:", - // // content:
确认退出该页面?
, - // // okText: "确认", - // // cancelText: "取消", - // // zIndex: 2000, - // // onOk() { - // // message.destroy(); - // // }, - // // onCancel() { - // // setTimeout(() => { - // // flagRef.current = 0; - // // }, 500); - // // } - // // }); - // // }; - - // // setInterval(() => { - // // document.addEventListener("click", handleMenuClose); - // // }, 1000); - - // return () => { - // clearInterval(timer); - // // document.removeEventListener("click", handleMenuClose); - // }; - // }, []); - - // const handleMenuClose = () => { - // if (flagRef.current) return; - // flagRef.current++; - // Modal.confirm({ - // title: "温馨提示:", - // content:
确认退出该页面?
, - // okText: "确认", - // cancelText: "取消", - // zIndex: 2000, - // onOk() { - // // message.destroy(); - // shutDown() - // }, - // onCancel() { - // setTimeout(() => { - // flagRef.current = 0; - // }, 500); - // } - // }); - // }; - - // return ( - //
- //
设备停机状态告知
- //
- // {conent2} - //
- //
- // 停机开始时间: - // {startTime} - //
- //
- // 系统当前时间: - // {currentTime} - //
- //
- // 此次停机耗时: - // - // 约: - // {diffHours}时 {diffMins}分 {diffSecs}秒 - // - //
- //
- // - // - //
- //
- // ); - // }; - - export default MachineTasks; - \ No newline at end of file + + setInterval(() => { + document.addEventListener("click", handleMenuClose); + }, 1000); + + return () => { + clearInterval(timer); + document.removeEventListener("click", handleMenuClose); + }; + }, []); + + return ( +
+
设备停机状态告知
+
+ {conent2} +
+
+ 停机开始时间: + {startTime} +
+
+ 系统当前时间: + {currentTime} +
+
+ 此次停机耗时: + + 约: + {diffHours}时 {diffMins}分 {diffSecs}秒 + +
+
+ ); +}; + +export default MachineTasks; diff --git a/src/mes/teamInfo/index.js b/src/mes/teamInfo/index.js index f16275e..b2ba4f7 100644 --- a/src/mes/teamInfo/index.js +++ b/src/mes/teamInfo/index.js @@ -500,8 +500,8 @@ const TeamInfo = baseProps => { tableName: "slave", viewRow: props.slaveData && props.slaveData.length !== 0 ? props.slaveData[0] : {}, onDataChange: (tableName, sName, returnValue , sId , dropDownData , isWait ) => { - props.onSaveState({ - [`slaveData`]: [ {...props.slaveData[0] , ...returnValue} ] + props.onSaveState({ + [`slaveData`]: [ {...props.slaveData[0] , ...returnValue} ] }); setTimeout(()=>{ // 调用指令集保存 @@ -522,8 +522,8 @@ const TeamInfo = baseProps => { }; // 清空临时IPQC const clearTempIpqc = () => { - props.onSaveState({ - [`slaveData`]: [ {...props.slaveData[0] , sIpqcId2:'' , sIpqcName2: '' } ] + props.onSaveState({ + [`slaveData`]: [ {...props.slaveData[0] , sIpqcId2:'' , sIpqcName2: '' } ] }); props.onExecInstructSet({ nextProps: { ...props , slaveData : [ {...props.slaveData[0] , sIpqcId2:'',sIpqcName2:''} ] }, @@ -533,6 +533,16 @@ const TeamInfo = baseProps => { } }) } + const teamInformation= commonFunc.showLocalMessage(props, 'teamInformation', '班组信息'); + + const captain = commonFunc.showLocalMessage(props, 'captain', '机长'); + + const shift = commonFunc.showLocalMessage(props, 'shift', '班次'); + + const classGroup = commonFunc.showLocalMessage(props, 'classGroup', '班组'); + + const foreman = commonFunc.showLocalMessage(props, 'foreman', '领班'); + console.log('2222', teamInformation); return ( @@ -541,7 +551,7 @@ const TeamInfo = baseProps => {

- 班组信息 + {teamInformation}

@@ -564,15 +574,15 @@ const TeamInfo = baseProps => { )}
  • - + { sActualEmployeeName || sEmployeeName}
  • - + {props.app.userinfo?.sTeamNo}
  • - + {props.app.userinfo?.sShift == "1" ? "白班" @@ -585,7 +595,7 @@ const TeamInfo = baseProps => {
  • - + {sForemanName}
  • @@ -601,7 +611,7 @@ const TeamInfo = baseProps => {
- +
@@ -710,13 +720,13 @@ const TeamJoinInfo = props => { }); props.onChangeRouter({ type: "name", path: ["计划任务", "机台任务"] }); }; - + const workHandoverInformation= commonFunc.showLocalMessage(props, 'workHandoverInformation', '上班交接信息'); return (

- 上班交接信息 + {workHandoverInformation}

-- libgit2 0.22.2