From 35b66650672d30fdff621f5a9db1f21a4f3b65bb Mon Sep 17 00:00:00 2001 From: zhangzhen <525765282@qq.com> Date: Wed, 19 Nov 2025 13:32:53 +0800 Subject: [PATCH] 回滚生产执行代码; --- src/mes/productionExec/productionExecMain/index.js | 1711 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------- 1 file changed, 1589 insertions(+), 122 deletions(-) diff --git a/src/mes/productionExec/productionExecMain/index.js b/src/mes/productionExec/productionExecMain/index.js index a7ad994..c71d56a 100644 --- a/src/mes/productionExec/productionExecMain/index.js +++ b/src/mes/productionExec/productionExecMain/index.js @@ -31,8 +31,7 @@ const list = [ { sName: "qztable0", sGrd: "qztable0" }, // 切纸生产执行 { sName: "jytable0", sGrd: "jytable0" }, // 胶印生产执行 { sName: "wytable0", sGrd: "wytable0" }, // 凹印生产执行 - { sName: "wytgtable0", sGrd: "wytgtable0" }, // 凹印挑规生产执行 - { sName: "zztable0", sGrd: "zztable0" } + { sName: "wytgtable0", sGrd: "wytgtable0" } // 凹印挑规生产执行 ]; const useProductionExecMainEvent = props => { @@ -58,8 +57,8 @@ const useProductionExecMainEvent = props => { const { app } = props; const { userinfo = {} } = app; - const iInterface = 1; - // iInterfaceOld === undefined ? userinfo.iInterface : iInterfaceOld; + const iInterface = + iInterfaceOld === undefined ? userinfo.iInterface : iInterfaceOld; useEffect( async () => { if (commonUtils.isEmptyArr(formData)) return; @@ -69,8 +68,6 @@ const useProductionExecMainEvent = props => { ? list : list.filter((_, index) => iInterface == index); - listFilter.push({ sName: "zztable0", sGrd: "zztable0" }); - // 页面表明和配置表名对应关系 const tableNameCompareJson = {}; [...listFilter, ...props.execListExtra].forEach(item => { @@ -413,19 +410,11 @@ const ProductionExecMain = baseProps => { const { app = {} } = baseProps; const [refreshCount, setRefreshCount] = useState(0); - const [sStatusNew, setStatusNew] = useState(undefined); useEffect(() => { const getValue = () => { const changeExecInfo = commonUtils.getAppData("changeExecInfo"); - setStatusNew(changeExecInfo.sStatus); - - const refreshExecInfo = commonUtils.getAppData("refreshExecInfo"); - if (refreshExecInfo.dReplyPalletERp === 1) { - commonUtils.setAppData("refreshExecInfo", { - ...refreshExecInfo, - dReplyPalletERp: 0 - }); + if (changeExecInfo.dReplyPalletERp === 1) { props.onRefresh(); setRefreshCount(pre => pre + 1); } @@ -515,7 +504,6 @@ const ProductionExecMain = baseProps => { {...props} changeExecInfo={app.changeExecInfo} refreshCount={refreshCount} - sStatusNew={sStatusNew} /> )} @@ -546,8 +534,7 @@ const ProductionExecContentByType = props => { deviceTargetInfoConfig = {}, deviceTargetInfoData = [], setPagesLoading, - refreshCount = 0, - sStatusNew + refreshCount = 0 } = props; /** @@ -555,34 +542,36 @@ const ProductionExecContentByType = props => { */ const sStatusNameProcess = useMemo( () => { - // if ( - // !Array.isArray(deviceTargetInfoData) || - // !deviceTargetInfoData[0] || - // !deviceTargetInfoData[0]?.sStatus - // ) - // return; - const viewRow = deviceTargetInfoData[0] || {}; - if (sStatusNew) { - viewRow.sStatus = sStatusNew; - } - const sStatusNameValue = viewRow.sStatus?.includes("adjustment") ? 0 : 1; + if ( + !Array.isArray(deviceTargetInfoData) || + !deviceTargetInfoData[0] || + !deviceTargetInfoData[0]?.sStatus + ) + return; + const sStatusNameValue = deviceTargetInfoData[0]?.sStatus?.includes( + "adjustment" + ) + ? 0 + : 1; const showValue = { stop: { showName: "调机结束", onClick: config => operationFetch(props, config, undefined, () => { - setPagesLoading(false); - props.onChangeRouter({ - type: "name", - path: ["生产执行", "质量检验"] + props.onSaveState({ + refreshDeviceTargetInfo: true }); + setPagesLoading(false); }) }, again: { showName: "调机开始", onClick: config => operationFetch(props, config, "again", () => { + props.onSaveState({ + refreshDeviceTargetInfo: true + }); setPagesLoading(false); }) } @@ -595,7 +584,7 @@ const ProductionExecContentByType = props => { return showValue[flag]; }, - [deviceTargetInfoConfig, deviceTargetInfoData, sStatusNew] + [deviceTargetInfoConfig, deviceTargetInfoData] ); props = { ...props, sStatusNameProcess }; @@ -605,28 +594,34 @@ const ProductionExecContentByType = props => { message.warning("未获取到iInterface字段!"); return ""; } - const type0 = - props.workOrderInfoData?.[0]?.bZZ - ? "type10" - : "type0"; - // const type0 = - // window.execTest && productionExecType - // ? productionExecType - // : `type${iInterface === 0 ? "" : iInterface - 1}`; + + const type0 = + window.execTest && productionExecType + ? productionExecType + : `type${iInterface === 0 ? "" : iInterface - 1}`; const type = `${type0}-${refreshCount}`; const content = { + type: , type0: , - type10: + type1: , + type2: , + type3: , + type4: , + type5: , + type6: , + type7: , + type8: , + type9: }; return content[type0] || ""; }; -// 胶印 -const ProductionExecContent0 = props => { - const tableName = "jytable0"; +// 类型-切纸 +const ProductionExecContent = props => { + const tableName = "qztable0"; const tableTypes = commonBusiness.getTableTypes(tableName, props); const { config: configOld = {}, @@ -635,19 +630,16 @@ const ProductionExecContent0 = props => { name } = tableTypes; const config = props.onMergeTableConfig(configOld); + const sIdGroupStr = data.map(item => item.sId).toString(); - const timer = useRef(null); useEffect( () => { if (!data.length) return; // 让第一条选中 - clearTimeout(timer.current); - timer.current = setTimeout(() => { - props.onSaveState({ - [`${tableName}SelectedRowKeys`]: [data[0].sId] - }); - }, 200); + props.onSaveState({ + [`${tableName}SelectedRowKeys`]: [data[0].sId] + }); }, [sIdGroupStr] ); @@ -661,32 +653,10 @@ const ProductionExecContent0 = props => { const viewConfigs = config.gdsconfigformslave .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) // .filter((_, index) => index < 8) - .map(item => { - const addState = {}; - if (item.sName === "dReportQty") { - if ( - props.workOrderInfoData?.[0]?.sProcessName?.includes("切纸") || - props.workOrderInfoData?.[0]?.sProcessName?.includes("胶印") || - props.workOrderInfoData?.[0]?.sProcessName === "大切张F" - ) { - addState.showName = `${item.showName}(张)`; - } else if ( - ["大模压F", "UV模压F", "蒸镀F", "大分条F", "贴合F"].includes( - props.workOrderInfoData?.[0]?.sProcessName - ) - ) { - addState.showName = `${item.showName}(米)`; - } else { - addState.showName = `${item.showName}(个)`; - } - } - - return { - ...item, - ...addState, - iColValue: 24 - }; - }); + .map(item => ({ + ...item, + iColValue: 24 + })); const viewRow = (selectedRowKeys[0] @@ -727,7 +697,7 @@ const ProductionExecContent0 = props => { ...props, btnConfig, tableLineParams: { - name: "jytable0", + name: "qztable0", record: viewRow, index: data.findIndex(item => item.sId === viewRow.sId) } @@ -746,12 +716,6 @@ const ProductionExecContent0 = props => { }); return; } - - props.onTableBtnClick({ - name: tableName, - record: viewRow, - config: btnConfig - }); } }; }; @@ -766,7 +730,7 @@ const ProductionExecContent0 = props => { const btnTableList = [ "palletBatchMaterial", "workerOrderBatchMaterial", - "plateInfo", + // "plateInfo", "jpfpbtable0" ]; const formDataNew = props.formData.filter( @@ -778,6 +742,7 @@ const ProductionExecContent0 = props => { ...props, costomModal: true, formData: formDataNew, + hideTabList: ["plateInfo"], sFilterConditions: { sId: selectedRowKeys[0], sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId, @@ -816,18 +781,15 @@ const ProductionExecContent0 = props => { - {/* */} @@ -847,7 +809,6 @@ const ProductionExecContent0 = props => { @@ -877,10 +838,8 @@ const ProductionExecContent0 = props => { {...btnProps} {...getBtnConfigByControlName(sControlName)} className={`${styles.print4} print4`} - // style={{display: 'none'}} > - 打印标条 - {/* {btnConfig.showName} */} + {btnConfig.showName} ); })} @@ -919,9 +878,9 @@ const ProductionExecContent0 = props => { ); }; -// 成品组装 -const ProductionExecContent10 = props => { - const tableName = "zztable0"; +// 类型0-胶印 +const ProductionExecContent0 = props => { + const tableName = "jytable0"; const tableTypes = commonBusiness.getTableTypes(tableName, props); const { config: configOld = {}, @@ -955,6 +914,7 @@ const ProductionExecContent10 = props => { const viewConfigs = config.gdsconfigformslave .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) + // .filter((_, index) => index < 8) .map(item => ({ ...item, iColValue: 24 @@ -986,6 +946,9 @@ const ProductionExecContent10 = props => { config.gdsconfigformslave.find( item => item.sControlName === sControlName ) || {}; + if (!btnConfig.bVisible) { + btnConfig.style = { display: "none" }; + } return { ...btnConfig, disabled: props.onGetBtnStatus(tableName, btnConfig), @@ -999,7 +962,7 @@ const ProductionExecContent10 = props => { ...props, btnConfig, tableLineParams: { - name: tableName, + name: "jytable0", record: viewRow, index: data.findIndex(item => item.sId === viewRow.sId) } @@ -1018,12 +981,6 @@ const ProductionExecContent10 = props => { }); return; } - - props.onTableBtnClick({ - name: tableName, - record: viewRow, - config: btnConfig - }); } }; }; @@ -1038,7 +995,8 @@ const ProductionExecContent10 = props => { const btnTableList = [ "palletBatchMaterial", "workerOrderBatchMaterial", - "assembletray" + "plateInfo", + "jpfpbtable0" ]; const formDataNew = props.formData.filter( item => item.sGrd && btnTableList.includes(item.sGrd) @@ -1050,11 +1008,19 @@ const ProductionExecContent10 = props => { costomModal: true, formData: formDataNew, sFilterConditions: { - // sId: selectedRowKeys[0], + sId: selectedRowKeys[0], sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId, sProductId: workOrderInfoData[0]?.sProductId - } - // noGetData: !selectedRowKeys.length + }, + noGetData: !selectedRowKeys.length + }; + + const tabRef = useRef(); + const changeTab = index => { + if (!tabRef.current) return; + const oNavList = tabRef.current.querySelector(".ant-tabs-nav-list"); + if (!oNavList) return; + oNavList.childNodes[index].click(); }; return ( @@ -1075,22 +1041,25 @@ const ProductionExecContent10 = props => { > 下料 + - {/* */} @@ -1110,7 +1079,6 @@ const ProductionExecContent10 = props => { @@ -1140,10 +1108,8 @@ const ProductionExecContent10 = props => { {...btnProps} {...getBtnConfigByControlName(sControlName)} className={`${styles.print4} print4`} - // style={{display: 'none'}} > - 打印标条 - {/* {btnConfig.showName} */} + {btnConfig.showName} ); })} @@ -1156,12 +1122,1513 @@ const ProductionExecContent10 = props => {
-
+
+
+ + + + +
); }; +// 类型1-凹印 +const ProductionExecContent1 = props => { + const tableName = "wytable0"; + const tableTypes = commonBusiness.getTableTypes(tableName, props); + const { + config: configOld = {}, + data = [], + selectedRowKeys = [], + name + } = tableTypes; + const config = props.onMergeTableConfig(configOld); + const sIdGroupStr = data.map(item => item.sId).toString(); + + const timer = useRef(null); + useEffect( + () => { + if (!data.length) return; + // 让第一条选中 + clearTimeout(timer.current); + timer.current = setTimeout(() => { + props.onSaveState({ + [`${tableName}SelectedRowKeys`]: [data[0].sId] + }); + }, 200); + }, + [sIdGroupStr] + ); + + const tableProps = { + ...tableTypes, + footer: "hidden", // 合计栏 + tableProps: {} + }; + + const viewConfigs = config.gdsconfigformslave + .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) + // .filter((_, index) => index < 8) + .map(item => ({ + ...item, + iColValue: 24 + })); + + const viewRow = + (selectedRowKeys[0] + ? data.find(item => item.sId === selectedRowKeys[0]) + : data[0]) || {}; + + const viewProps = { + ...props, + viewConfigs, + tableConfig: config, + iColValueView: 24, + viewRow, + tableName: name, + enabled: commonUtils.isNotEmptyObject(viewRow) + }; + + const btnProps = { + type: "primary", + size: "large", + style: { width: 80 } + }; + + const operationBarProps = { + ...props, + sName: name, + bCostom: true, + onRefresh: props.onRefresh // 刷新页面 + }; + + const btnTableList = [ + "palletBatchMaterial", + "workerOrderBatchMaterial", + "plateInfo", + "jpfpbtable0" + ]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const { workOrderInfoData = [] } = props; + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew, + sFilterConditions: { + sId: selectedRowKeys[0], + sSrcSlaveId: workOrderInfoData[0]?.sSrcSlaveId, + sProductId: workOrderInfoData[0]?.sProductId + }, + noGetData: !selectedRowKeys.length + }; + + const getBtnProps = btnConfig => { + const { sFontColor } = btnConfig; + + const style = sFontColor + ? { backgroundColor: sFontColor, borderColor: sFontColor } + : {}; + return { + type: "primary", + size: "large", + style: { width: 80, ...style }, + disabled: props.onGetBtnStatus(tableName, btnConfig), + onClick: async () => { + if (!props.onGetBtnContinue()) return; + const { sActiveId, sButtonParam, sInstruct } = btnConfig; + // 调用指令集 + if (sInstruct) { + await props.awaitPromiseReturn(); + props.onExecInstructSet({ + ...props, + btnConfig, + tableLineParams: { + name: "wytable0", + record: viewRow, + index: data.findIndex(item => item.sId === viewRow.sId) + } + }); + return; + } + // 调用存储过程 + if (sButtonParam) { + props.onProcedureCall({ + btnConfig, + onSuccess: () => { + props.onRefresh && props.onRefresh(); + }, + onConfirm: () => {}, + onError: () => {} + }); + return; + } + } + }; + }; + + const rightFormBtn0List = new Array(10).fill(
); + const btnsLeftList = config.gdsconfigformslave.filter( + item => + item.bVisible && + item.sControlName && + item.sControlName.includes("BtnLeft1.") + ); + + const leftMap = [0, 5, 1, 6]; + btnsLeftList.forEach((item, index) => { + rightFormBtn0List[leftMap[index]] = ( +
+ +
+ ); + }); + + const rightMap = [4, 9, 3, 8]; + const btnsRightList = config.gdsconfigformslave.filter( + item => + item.bVisible && + item.sControlName && + item.sControlName.includes("BtnRight1.") + ); + + btnsRightList.forEach((item, index) => { + rightFormBtn0List[rightMap[index]] = ( +
+ +
+ ); + }); + const tabRef = useRef(); + const changeTab = index => { + if (!tabRef.current) return; + const oNavList = tabRef.current.querySelector(".ant-tabs-nav-list"); + if (!oNavList) return; + oNavList.childNodes[index].click(); + }; + + return ( +
+
+
+
+ +
+
+ +
+ {rightFormBtn0List.map(item => item)} +
+
+
+ + ); + })} +
+
+
+
+
+ +
+
+
+
+ +
+
+ + + + +
+
+
+ ); +}; + +// 类型2-凹印挑规 +const ProductionExecContent2 = props => { + const tableName = "wytgtable0"; + const tableTypes = commonBusiness.getTableTypes(tableName, props); + const { + config: configOld = {}, + data = [], + selectedRowKeys = [], + name + } = tableTypes; + const config = props.onMergeTableConfig(configOld); + const sIdGroupStr = data.map(item => item.sId).toString(); + + const timer = useRef(null); + useEffect( + () => { + if (!data.length) return; + // 让第一条选中 + clearTimeout(timer.current); + timer.current = setTimeout(() => { + props.onSaveState({ + [`${tableName}SelectedRowKeys`]: [data[0].sId] + }); + }, 200); + }, + [sIdGroupStr] + ); + + const tableProps = { + ...tableTypes, + footer: "hidden", // 合计栏 + tableProps: {} + }; + + const viewConfigs = config.gdsconfigformslave + .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) + // .filter((_, index) => index < 8) + .map(item => ({ + ...item, + iColValue: 24 + })); + + const viewRow = + (selectedRowKeys[0] + ? data.find(item => item.sId === selectedRowKeys[0]) + : data[0]) || {}; + + const viewProps = { + ...props, + viewConfigs, + tableConfig: config, + iColValueView: 24, + viewRow, + tableName: name, + enabled: commonUtils.isNotEmptyObject(viewRow), + onCostomChange: (name, showConfig) => { + if (commonUtils.isNotEmptyObject(viewRow)) { + const { sControlName = "" } = showConfig; + const sName = sControlName.split(".")[1]; + if (sName === "sPosition") { + const value = viewRow[sName]; + props.onSaveState({ + positionValue: value, + positionModalVisible: true + }); + } + } + } + }; + + const btnProps = { + type: "primary", + size: "large", + style: { width: 80 } + }; + + const operationBarProps = { + ...props, + sName: name, + bCostom: true, + onRefresh: props.onRefresh // 刷新页面 + }; + + const btnTableList = [ + "palletBatchMaterial", + "workerOrderBatchMaterial", + // "plateInfo", + "jpfpbtable0" + ]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const { workOrderInfoData = [] } = props; + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew, + hideTabList: ["plateInfo"], + sFilterConditions: { + sId: selectedRowKeys[0], + sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId, + sProductId: workOrderInfoData[0]?.sProductId + }, + noGetData: !selectedRowKeys.length + }; + + const getBtnProps = btnConfig => { + const { sFontColor } = btnConfig; + + const style = sFontColor + ? { backgroundColor: sFontColor, borderColor: sFontColor } + : {}; + return { + type: "primary", + size: "large", + style: { width: 80, ...style }, + disabled: props.onGetBtnStatus(tableName, btnConfig), + onClick: () => { + if (!props.onGetBtnContinue()) return; + const { sActiveId, sButtonParam, sInstruct } = btnConfig; + // 调用指令集 + if (sInstruct) { + props.onExecInstructSet({ + ...props, + btnConfig, + tableLineParams: { + name: "wytgtable0", + record: viewRow, + index: data.findIndex(item => item.sId === viewRow.sId) + } + }); + return; + } + // 调用存储过程 + if (sButtonParam) { + props.onProcedureCall({ + btnConfig, + onSuccess: () => { + props.onRefresh && props.onRefresh(); + }, + onConfirm: () => {}, + onError: () => {} + }); + return; + } + } + }; + }; + + const rightFormBtn0List = new Array(10).fill(
); + const btnsLeftList = config.gdsconfigformslave.filter( + item => + item.bVisible && + item.sControlName && + item.sControlName.includes("BtnLeft1.") + ); + + const leftMap = [0, 5, 1, 6]; + btnsLeftList.forEach((item, index) => { + rightFormBtn0List[leftMap[index]] = ( +
+ +
+ ); + }); + + const rightMap = [4, 9, 3, 8]; + const btnsRightList = config.gdsconfigformslave.filter( + item => + item.bVisible && + item.sControlName && + item.sControlName.includes("BtnRight1.") + ); + + btnsRightList.forEach((item, index) => { + rightFormBtn0List[rightMap[index]] = ( +
+ +
+ ); + }); + const tabRef = useRef(); + const changeTab = index => { + if (!tabRef.current) return; + const oNavList = tabRef.current.querySelector(".ant-tabs-nav-list"); + if (!oNavList) return; + oNavList.childNodes[index].click(); + }; + + return ( +
+
+
+
+ +
+
+ +
+ {rightFormBtn0List.map(item => item)} +
+
+
+ + ); + })} +
+
+
+
+
+ +
+
+
+
+ +
+
+ + + + +
+
+ +
+ ); +}; + +// 类型3-凹印分切 +const ProductionExecContent3 = props => { + const btnTableList = ["slaveWyfq1", "slaveWyfq2", "jpfpbtable0"]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const formDataNew1 = cloneDeep(formDataNew); + formDataNew1.forEach(item => { + if (item.sGrd === "slaveWyfq2") { + new Array(5).fill("").map((_, index) => { + item.gdsconfigformslave.push({ + sId: commonUtils.createSid(), + sName: `sWt${index + 1}`, + sControlName: `sWt${index + 1}`, + showName: `描述${index + 1}` + }); + }); + } + }); + + const [currentStep, setCurrentStep] = useState(1); + const [currentSelectedStep, setCurrentSelectedStep] = useState(1); + const { slaveWyfq2Data = [], slaveWyfq2SelectedRowkeys = [] } = props; + + // 根据数据判断当前轮数 + useEffect( + () => { + if (!slaveWyfq2Data.length) { + setCurrentStep(1); + return; + } + + const iRoundList = slaveWyfq2Data.map(item => item.iRound); + const iRoundMax = Math.max(...iRoundList); + setCurrentStep(iRoundMax); + }, + [JSON.stringify(slaveWyfq2Data)] + ); + + useEffect( + () => { + setCurrentSelectedStep(currentStep); + }, + [currentStep] + ); + + // 根据sWt1-5组成sWasteType + // useEffect(() => { + // if (!slaveWyfq2Data.length) return; + + // }, [JSON.stringify(slaveWyfq2Data)]) + + const costomTitle = ( +
+ {new Array(8).fill("").map((_, index) => { + const filterData = slaveWyfq2Data.filter( + item => item.iRound === index + 1 + ); + const bXialiao = filterData?.[0]?.iJobStatus === 3; + return ( +
{ + if (index <= currentStep - 1) { + setCurrentSelectedStep(index + 1); + } + }} + > + 第{index + 1}轮 +
+ ); + })} +
+ ); + + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew1, + costomTitle: costomTitle, + onFilterData: (tableName, tableData) => { + if (tableName === "slaveWyfq2") { + return tableData.filter(item => item.iRound === currentSelectedStep); + } else { + return tableData; + } + }, + currentSelectedStep + // onTableEnabled: tableName => { + // if (tableName === "slaveWyfq2") { + // return currentStep === currentSelectedStep; + // } else { + // return undefined; + // } + // } + }; + + return ; +}; + +// 类型4-剔废 +const ProductionExecContent4 = props => { + const btnTableList = ["slaveWytf1", "slaveWytf2", "jpfpbtable0"]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const { [`${btnTableList[0]}Data`]: data = [] } = props; + const sIdGroupStr = data.map(item => item.sId).toString(); + + const timer = useRef(null); + useEffect( + () => { + if (!data.length) return; + // 让第一条选中 + clearTimeout(timer.current); + timer.current = setTimeout(() => { + props.onSaveState({ + [`${btnTableList[0]}SelectedRowKeys`]: [data[0].sId] + }); + }, 200); + }, + [sIdGroupStr] + ); + + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew + }; + + return ; +}; + +// 类型5-拼接 +const ProductionExecContent5 = props => { + const btnTableList = [ + "slaveWypj1", + "slaveWypj2", + "slaveWypj3", + "jpfpbtable0" + ]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew + }; + + return ; +}; + +// 类型6-倒卷 +const ProductionExecContent6 = props => { + const btnTableList = ["slaveWydj", "jpfpbtable0"]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew + }; + + return ; +}; + +// 类型7-读码 +const ProductionExecContent7 = props => { + const btnTableList = [ + "salveWydm1", + "salveWydm2", + "salveWydm3", + "salveWydm4", + "jpfpbtable0" + ]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const [bllbVisible, setBllbVisible] = useState(false); + + let bllbModalProps = { + ...props, + bllbVisible, + setBllbVisible, + record: props.salveWydm2Data?.[0], + sFieldName: "dLittleReportQty" + }; + + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew, + onBllbClick: () => { + if (props.salveWydm2Data?.length) { + props.onGetBllbData(props.salveWydm2Data[0].sId, () => { + setBllbVisible(true); + }); + } + } + }; + + return ( +
+ + +
+ ); +}; + +// 类型8-品检 +const ProductionExecContent8 = props => { + const btnTableList = [ + "slaveWyrj1", + "slaveWyrj2", + "slaveWyrj3", + "jpfpbtable0" + ]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const { + slaveWyrj2SelectedRowKeys = [], + slaveWyrj2Data = [], + slaveWyrj2Config: config = {} + } = props; + const iIndex = slaveWyrj2Data.findIndex( + item => item.sId === slaveWyrj2SelectedRowKeys[0] + ); + const viewRow = iIndex !== -1 ? slaveWyrj2Data[iIndex] : {}; + + const getBtnConfigByControlName = sControlName => { + if (!config.gdsconfigformslave) return {}; + const btnConfig = + config.gdsconfigformslave.find( + item => item.sControlName === sControlName + ) || {}; + return { + ...btnConfig, + disabled: props.onGetBtnStatus("slaveWyrj2", btnConfig), + onClick: async () => { + if (!props.onGetBtnContinue()) return; + await props.awaitPromiseReturn(); + const { sButtonParam, sInstruct } = btnConfig; + // 调用指令集 + if (sInstruct) { + props.onExecInstructSet({ + ...props, + btnConfig, + tableLineParams: { + name: "slaveWyrj2", + record: viewRow, + index: iIndex + } + }); + return; + } + // 调用存储过程 + if (sButtonParam) { + props.onProcedureCall({ + btnConfig, + onSuccess: () => { + props.onRefresh && props.onRefresh(); + }, + onConfirm: () => {}, + onError: () => {} + }); + return; + } + } + }; + }; + + // const getBtnProps = (sName, color) => { + // const style = color + // ? { + // backgroundColor: color, + // borderColor: color + // } + // : {}; + + // const extraProps = sName ? getBtnConfigByControlName(sName) : {}; + + // return { + // type: "primary", + // size: "large", + // style: { + // ...style, + // width: 75, + // paddingLeft: 0, + // paddingRight: 0 + // }, + // ...extraProps + // }; + // }; + + const [bllbVisible, setBllbVisible] = useState(false); + + let bllbModalProps = { + ...props, + bllbVisible, + setBllbVisible, + record: props.slaveWyrj2Data?.[0] + }; + + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew, + // costomFormOperationBar: ( + //
+ //
+ //
+ //
+ //
+ // + //
+ //
+ // + //
+ //
+ // + //
+ //
+ //
+ //
+ //
+ // + //
+ //
+ // + //
+ //
+ // {/* */} + //
+ //
+ // ) + onBllbClick: () => { + if (props.slaveWyrj2Data?.length) { + props.onGetBllbData(props.slaveWyrj2Data[0].sId, () => { + setBllbVisible(true); + }); + } + } + }; + + return ( +
+ + +
+ ); +}; + +// 类型9-包装 +const ProductionExecContent9 = props => { + const btnTableList = [ + "salveWybz1", + "salveWybz2", + "salveWybz3", + "palletBatchMaterial", + "workerOrderBatchMaterial", + "jpfpbtable0" + ]; + const formDataNew = props.formData.filter( + item => item.sGrd && btnTableList.includes(item.sGrd) + ); + + const [bllbVisible, setBllbVisible] = useState(false); + + let bllbModalProps = { + ...props, + bllbVisible, + setBllbVisible, + record: props.salveWybz2Data?.[0] + }; + + const commonModelProps = { + ...props, + costomModal: true, + formData: formDataNew, + onBllbClick: () => { + if (props.salveWybz2Data?.length) { + props.onGetBllbData(props.salveWybz2Data[0].sId, () => { + setBllbVisible(true); + }); + } + } + }; + + return ( +
+ + +
+ ); +}; + +// 成品不良类比弹窗 +const BllbModalComponent = props => { + const { bllbVisible, setBllbVisible } = props; + if (!bllbVisible) return ""; + + const { + bllbtable0Config = {}, + bllbtable0Data = [], + record, + refreshTime, + sFieldName = "dReportQty" + } = props; + const { [sFieldName]: dReportQtyOld = 0, sId: sParentId } = record; + const dReportQty = dReportQtyOld; // Number((dReportQtyOld).toFixed(4)); + const [restQty, setRestQty] = useState(dReportQty); + const [bllbConfig, setBllbConfig] = useState([]); + const [options, setOptions] = useState([]); + const [optionsList, setOptionsList] = useState([]); + const [data, setData] = useState(bllbtable0Data); + const [delData, setDelData] = useState([]); + useEffect(() => { + if (!data.length) { + setData([ + { + sId: commonUtils.createSid(), + sParentId, + handleType: "add", + bMesNew: true + } + ]); + } + }, []); + useEffect( + async () => { + const { gdsconfigformslave = [] } = bllbtable0Config; + if (gdsconfigformslave.length) { + const bllbConfigTemp = gdsconfigformslave.filter(item => item.bVisible); + setBllbConfig(bllbConfigTemp); + const bldlOptions = await props.getSqlDropDownData( + "", + "bldl", + bllbConfigTemp.find(item => item.sName === "sType"), + {}, + "" + ); + setOptions(bldlOptions.dropDownData); + } + }, + [JSON.stringify(bllbtable0Config)] + ); + useEffect( + () => { + if (!data.length) return; + const MaxDecimal = [dReportQty, ...data.map(item => item.dQty)].reduce( + (pre, cur) => { + const str = (cur || 0).toString(); + const num = str.split(".")[1] || ""; + return Math.max(num.length, pre); + }, + 0 + ); + + const totalQty = data.reduce((pre, cur) => { + return pre + (Number(cur.dQty) || 0); + }, 0); + + let restQtyNew = (dReportQty - totalQty).toFixed(MaxDecimal); + + const dataTemp = [...data]; + if (totalQty >= dReportQty) { + const iIndex = data.findIndex(item => item.bLastChanged); + if (iIndex !== -1) { + const dataNew = data.filter((_, index) => index !== iIndex); + const totalQtyNew = dataNew.reduce((pre, cur) => { + return pre + (Number(cur.dQty) || 0); + }, 0); + + const MaxDecimalNew = [ + dReportQty, + ...dataNew.map(item => item.dQty) + ].reduce((pre, cur) => { + const str = (cur || 0).toString(); + const num = str.split(".")[1] || ""; + return Math.max(num.length, pre); + }, 0); + + dataTemp[iIndex].dQty = (dReportQty - totalQtyNew).toFixed( + MaxDecimalNew + ); + restQtyNew = 0; + } + } + dataTemp.forEach(item => { + delete item.bLastChanged; + }); + + setData(dataTemp); + setRestQty(restQtyNew); + }, + [refreshTime] + ); + + const onOk = () => { + props.onExecInstructSet({ + btnConfig: { + sInstruct: JSON.stringify([ + { + opr: "save", + doNotRefresh: true, + data: [ + { + tablename: "mftpitBadEntry", + srcDataset: "bblb" + } + ] + } + ]), + showName: "确认˝" + }, + nextProps: { + bblbData: data.map(item => ({ ...item, dQty: Number(item.dQty) })), + bblbDelData: delData, + bblbConfig: bllbtable0Config + }, + callback: () => { + setBllbVisible(false); + } + }); + }; + + return ( + setBllbVisible(false)} + footer={ + + + + + } + > +
+ + +
+ + OK合格 + 合格 + + + + 张 + + {data.map((rowData, index) => { + const { sId: lineId } = rowData; + const oBtnPlus = ( +
+ + ); +}; + +// 凹印挑规针位弹窗选择 +const PositionComponent = props => { + const { positionValue, positionModalVisible } = props; + if (!positionModalVisible) return ""; + + const [data, setData] = useState([]); + + useEffect(() => { + const arr = positionValue.replace(",", /,/g).split(","); + const tempData = []; + arr.forEach(item => { + const numbers = item.match(/\d+/g); // 提取所有数字 + const result = numbers?.map(Number); // 转换为数值 + if (result?.length === 3) { + tempData.push(result); + } + }); + + const dataLength = tempData.length; + if (dataLength < 10) { + for (let i = 0; i < 10 - dataLength; i++) { + tempData.push([undefined, undefined, undefined]); + } + } + setData(tempData); + }, []); + + const onCancel = () => { + props.onSaveState({ + positionValue: undefined, + positionModalVisible: false + }); + }; + + const onOk = () => { + const tableName = "wytgtable0"; + const { + [`${tableName}Data`]: tableData = [], + [`${tableName}SelectedRowKeys`]: selectedRowKeys = [] + } = props; + const iIndex = tableData.findIndex(item => item.sId === selectedRowKeys[0]); + const result = data + .filter( + item => + item[0] !== undefined && + item[1] !== undefined && + item[2] !== undefined && + item[0] !== "" && + item[1] !== "" && + item[2] !== "" + ) + .map(item => `前${item[0]}-${item[1]}侧${item[2]}`) + .toString(); + + tableData[iIndex].sPosition = result; + tableData[iIndex].handleType = "update"; + + props.onExecInstructSet({ + nextProps: { ...props, [`${tableName}Data`]: tableData }, + btnConfig: { + showName: "保存", + sInstruct: JSON.stringify([ + { + opr: "save", + data: [ + { + tablename: "plc_machinedate_tray", + srcDataset: tableName + } + ] + } + ]) + }, + callback: () => { + onCancel(); + } + }); + }; + + const options = new Array(10).fill("").map((_, index) => { + return { + label: index + 1, + value: index + 1 + }; + }); + + const getSelectComponent = (index, iIndex) => { + const value = data[index]?.[iIndex]; + + return ( +