diff --git a/src/mes/common/commonModelComponent/index.js b/src/mes/common/commonModelComponent/index.js
index 0748f19..0a76493 100644
--- a/src/mes/common/commonModelComponent/index.js
+++ b/src/mes/common/commonModelComponent/index.js
@@ -10,7 +10,9 @@ import {
Radio,
message,
Badge,
- Spin
+ Spin,
+ Row,
+ Col
} from "antd";
import * as commonUtils from "@/utils/utils";
import * as commonConfig from "@/utils/config";
@@ -28,6 +30,7 @@ import ChoosePalletComponent from "../choosePalletComponent";
import CommonViewDragable from "@/components/Common/CommonViewDragable";
import costomPageFun from "@/mes/costomPageFun";
import ReportInfo from "@/mes/productionExec/noticeModal/reportInfoButton";
+import BoxTypeDetail from "../../scheduledTasks/boxTypeDetail/boxTypeDetail";
import styles from "./index.less";
@@ -227,7 +230,7 @@ const useCommonModelEvent = props => {
try {
delete tabConfigFilter[0].configList[0].children[1].configList[2];
delete tabConfigFilter[0].configList[0].children[1].configList[1];
- } catch (error) {}
+ } catch (error) { }
} else if (
iTeamType === 1
// [
@@ -248,7 +251,7 @@ const useCommonModelEvent = props => {
delete tabConfigFilter[0].configList[0].children[1].configList[3];
delete tabConfigFilter[0].configList[0].children[1].configList[1];
delete tabConfigFilter[0].configList[1].children[2].configList[7];
- } catch (error) {}
+ } catch (error) { }
} else {
tableListFilter = tableList.filter(
item =>
@@ -260,7 +263,7 @@ const useCommonModelEvent = props => {
delete tabConfigFilter[0].configList[0].children[1].configList[3];
delete tabConfigFilter[0].configList[0].children[1].configList[2];
delete tabConfigFilter[0].configList[1].children[2].configList[7];
- } catch (error) {}
+ } catch (error) { }
}
return [tableListFilter, tabConfigFilter];
};
@@ -1473,12 +1476,12 @@ const TabTitleComponent = props => {
}
- if (sTabName.split("_")[0] === "空" || sTabName.split("_")[0] === "Empty" ) return "";
+ if (sTabName.split("_")[0] === "空" || sTabName.split("_")[0] === "Empty") return "";
const costomTitle =
props.costomTitle && sTabName === "下料信息" ? props.costomTitle : "";
- const sTip = sTabName !== sTipName ? sTabName + '-' + sTipName : sTabName;
+ const sTip = sTabName !== sTipName ? sTabName + '-' + sTipName : sTabName;
return (
@@ -1491,7 +1494,7 @@ const TabTitleComponent = props => {
// 表单组件
const CommonViewTableComponent = props => {
- const { sTabName, showType, sName, sEnglishTabName, } = props;
+ const { sTabName, showType, sName, sEnglishTabName, } = props;
if (showType !== "form") return "";
const {
@@ -1598,17 +1601,17 @@ const CommonViewTableComponent = props => {
};
- const [reportInfoVisible, setReportInfoVisible] = useState(false);
- const reportRef = useRef(null);
+ const [reportInfoVisible, setReportInfoVisible] = useState(false);
+ const reportRef = useRef(null);
- const handleReportInfo = (config = null) => {
- reportRef.current = config;
- setReportInfoVisible(!reportInfoVisible);
+ const handleReportInfo = (config = null) => {
+ reportRef.current = config;
+ setReportInfoVisible(!reportInfoVisible);
};
const sLanguage = props.app.userinfo?.sLanguage;
- const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName;
+ const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName;
const groupListNew = sTabLocalName?.split(",") || [];
const groupListChinese = sTabName?.split(",") || [];
@@ -1637,8 +1640,8 @@ const CommonViewTableComponent = props => {
handleReportInfo
};
- if(viewProps.tableS0Data && viewProps.tableS0Data.length!==0){
- viewProps.reportPeopleSelectedRowKeys = viewProps.tableS0Data[0].sMainAssistantTransId?.split(",")
+ if (viewProps.tableS0Data && viewProps.tableS0Data.length !== 0) {
+ viewProps.reportPeopleSelectedRowKeys = viewProps.tableS0Data[0].sMainAssistantTransId?.split(",")
}
@@ -1648,14 +1651,14 @@ const CommonViewTableComponent = props => {
return (
<>
-
+
@@ -1682,7 +1685,8 @@ const CommonTableComponent = props => {
showType,
sName,
sEnglishTabName,
- tableBtnsConfig: tableBtnsConfigOld = []
+ tableBtnsConfig: tableBtnsConfigOld = [],
+ app,
} = props;
if (showType !== "table") return "";
@@ -1863,7 +1867,7 @@ const CommonTableComponent = props => {
// },
onTableBtnClick,
tableProps: {
- onChange: () => {}
+ onChange: () => { }
// AutoTableHeight: 200
},
onViewClick: (tableName, sFieldName, record, index, config) => {
@@ -1897,14 +1901,46 @@ const CommonTableComponent = props => {
...props,
sName
};
- const sLanguage = props.app.userinfo?.sLanguage;
+ const sLanguage = props.app.userinfo?.sLanguage;
- const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName;
+ const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName;
+ const isPack = props.app.userinfo?.sBrandsId === '2222222222'; // 纸箱品牌
+ const bBoxShow = isPack && (sName === 'slave' || sName === 'control');
+ const { slaveData = [], enabled, controlData = [], slaveSelectedRowKeys = [], controlSelectedRowKeys = [] } = props;
+ /* 计算imageBox */
return (
<>
-
-
+
+ {
+ bBoxShow ? (
+
+
+
+
+
+
+
+
+
+
+ ) : ''
+ }
+ {
+ !bBoxShow ?
: ''
+ }
+
{
let bCenter = false;
// OQC标签弹窗添加清空按钮
- const onEmptyClick = () =>{
+ const onEmptyClick = () => {
setViewRow({
- ...viewRow,
- sAbnormalLine: '',
- sAbnormalType: '',
- sAbnormalMemo: '',
- sQcPerson: '',
- dSampQty: 0,
- bReturn: false
+ ...viewRow,
+ sAbnormalLine: '',
+ sAbnormalType: '',
+ sAbnormalMemo: '',
+ sQcPerson: '',
+ dSampQty: 0,
+ bReturn: false
})
}
const titleNew = title === '异常信息' ? 'Abnormal Info' : title;
@@ -2018,10 +2054,10 @@ const CommonRepairComponent = props => {
className="mesCommonModal"
footer={
- {/* // OQC标签弹窗添加清空按钮 */}
- {
- params.tableName=='slaveWyrj2'? : null
- }
+ {/* // OQC标签弹窗添加清空按钮 */}
+ {
+ params.tableName == 'slaveWyrj2' ? : null
+ }
@@ -2209,7 +2245,7 @@ const RunningStatusConditionComponent = props => {
: table0SelectedRowKeys,
bMutiSelect: true,
tableProps: {
- onChange: () => {}
+ onChange: () => { }
}
};
diff --git a/src/mes/scheduledTasks/boxTypeDetail/boxTypeDetail.js b/src/mes/scheduledTasks/boxTypeDetail/boxTypeDetail.js
new file mode 100644
index 0000000..0ea378a
--- /dev/null
+++ b/src/mes/scheduledTasks/boxTypeDetail/boxTypeDetail.js
@@ -0,0 +1,424 @@
+import React, { useEffect, useMemo, useState } from 'react';
+import { Row, Col, Divider, Tooltip, InputNumber, Carousel, Image, Modal } from 'antd';
+import * as commonUtils from "@/utils/utils";
+import * as commonConfig from "@/utils/config";
+import * as commonFunc from "@/components/Common/commonFunc";
+
+const evaluateFormula = (formula, variables) => {
+ if (!formula) return 0;
+ try {
+ const variableNames = formula.match(/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g) || [];
+ const params = variableNames.join(",") + ",Math";
+ const func = new Function(params, `return ${formula}`);
+ const args = variableNames.map(name => Number(variables[name]) || 0);
+ return func(...args, Math);
+ } catch (error) {
+ console.error("公式执行错误", error);
+ return Number(formula) || 0;
+ }
+};
+
+const removeExtension = (filename) => {
+ if (!filename) return '';
+ const lastDotIndex = filename.lastIndexOf('.');
+ return lastDotIndex === -1 ? filename : filename.substring(0, lastDotIndex);
+};
+
+const getImageUrl = (sName) => {
+ console.log('getImageUrl', sName);
+ return `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`;
+};
+
+const CuttingComponent = (props) => {
+ const { selectedRowIndex, slaveData, onSaveState } = props;
+ const PrintSize = commonFunc.showLocalMessage(props, "PrintSize", "印刷尺寸");
+ const insert = commonFunc.showLocalMessage(props, "insert", "插入");
+ const imposition = commonFunc.showLocalMessage(props, "imposition", "拼版");
+ const mouthpiece = commonFunc.showLocalMessage(props, "mouthpiece", "叼口");
+ const trailingEdge = commonFunc.showLocalMessage(props, "trailingEdge", "拖梢");
+ const SheetSize = commonFunc.showLocalMessage(props, "SheetSize", "印张尺寸");
+ const cutting = commonFunc.showLocalMessage(props, "cutting", "分切");
+ const edgeTrimming = commonFunc.showLocalMessage(props, "edgeTrimmings", "修边");
+ const MaterialSpecifications = commonFunc.showLocalMessage(props, "MaterialSpecifications", "材料规格");
+ const length = commonFunc.showLocalMessage(props, "length", "长");
+ const width = commonFunc.showLocalMessage(props, "width", "宽");
+
+ const lengthFormula = length + '( |-|)*| +(|+| )=|*|+|=';
+ const widthFormula = width + '( |-|)*| +(|+| )=|*|+|=';
+ const lengthFormulaList = lengthFormula.split('|');
+ const widthFormulaList = widthFormula.split('|');
+
+ const titleList = [
+ PrintSize, insert, imposition, mouthpiece, trailingEdge,
+ SheetSize, cutting, edgeTrimming, MaterialSpecifications,
+ ];
+
+ if (!slaveData || !slaveData[selectedRowIndex]) return null;
+ const slaveRowData = slaveData[selectedRowIndex];
+ const { boxLengthList = [], boxWidthList = [] } = slaveRowData;
+
+ return (
+
+
+ {titleList.map((item, i) => (
+
{item}
+ ))}
+
+
+
+ {boxLengthList.map((item, index) => (
+ {
+ const list = [...boxLengthList];
+ list[index].value = Number(val) || 0;
+ list[5].value = (list[0].value - list[1].value) * list[2].value + (list[3].value + list[4].value);
+ list[list.length - 1].value = list[5].value * list[6].value + list[7].value;
+ slaveData[selectedRowIndex] = {
+ ...slaveData[selectedRowIndex],
+ boxLengthList: list,
+ dBoxLengthSum: list[list.length - 1]?.value,
+ dBoxLengthSumPqty: list[2]?.value,
+ };
+ onSaveState({ slaveData });
+ }}
+ />
+ ))}
+
+
+
+
+ {lengthFormulaList.map((item, i) => (
+
{item}
+ ))}
+
+
+
+
+ {boxWidthList.map((item, index) => (
+ {
+ const list = [...boxWidthList];
+ list[index].value = Number(val) || 0;
+ list[5].value = (list[0].value - list[1].value) * list[2].value + (list[3].value + list[4].value);
+ list[list.length - 1].value = list[5].value * list[6].value + list[7].value;
+ slaveData[selectedRowIndex] = {
+ ...slaveData[selectedRowIndex],
+ boxWidthList: list,
+ dBoxWidthSum: list[list.length - 1]?.value,
+ dBoxWidthSumPqty: list[2]?.value,
+ };
+ onSaveState({ slaveData });
+ }}
+ />
+ ))}
+
+
+
+
+ {widthFormulaList.map((item, i) => (
+
{item}
+ ))}
+
+
+
+ );
+};
+
+export default function BoxTypeDetail(props) {
+ const {
+ slaveData,
+ controlData,
+ slaveSelectedRowKeys,
+ controlSelectedRowKeys,
+ onSaveState,
+ enabled = true,
+ sOrderCategoryId,
+ processShowLeft,
+ isPack,
+ parentProps,
+ } = props;
+ if(commonUtils.isEmptyArr(slaveData)) return null;
+
+ // 使用 useMemo 缓存,避免每次渲染创建新引用
+ const slaveSelectedRowKeysData = useMemo(() => {
+ return slaveData.find(item => slaveSelectedRowKeys?.includes(item.sId)) || slaveData[0];
+ }, [slaveData, slaveSelectedRowKeys]);
+
+ const slaveSelectedRowKeysId = slaveSelectedRowKeysData.sId;
+ const selectRowIndex = slaveData ? slaveData.findIndex(x => x.sId === slaveSelectedRowKeysId) : -1;
+
+ // 使用 useMemo 缓存,避免每次渲染创建新引用
+ const selectRow = useMemo(() => {
+ if (!slaveData || selectRowIndex < 0) return slaveData[0];
+ return slaveData[selectRowIndex];
+ }, [slaveData, selectRowIndex]);
+
+ const [boxMaxModalVisible, setBoxMaxModalVisible] = useState(false);
+ const [boxList, setBoxList] = useState([]);
+ const [offsetXList, setOffsetXList] = useState([]);
+ const [offsetYList, setOffsetYList] = useState([]);
+
+ // 使用 useMemo 缓存,避免每次渲染解析 JSON
+ const sBoxInfo = useMemo(() => {
+ if (!selectRow?.sBoxInfo || !commonUtils.isJSON(selectRow.sBoxInfo)) return [];
+ try {
+ return JSON.parse(selectRow.sBoxInfo);
+ } catch (e) {
+ return [];
+ }
+ }, [selectRow?.sBoxInfo]);
+
+ const selectRowData = useMemo(() => {
+ return { ...selectRow, ...sBoxInfo[0] };
+}, [selectRow, sBoxInfo]);
+
+
+ // 使用 useMemo 缓存,确保引用稳定
+ const upAbleConfigsExtra = useMemo(() => {
+ return commonUtils.isNotEmptyArr(sBoxInfo) ? sBoxInfo[0].upAbleConfigsExtra : '';
+ }, [sBoxInfo]);
+
+
+ const bSelectBox = selectRowData.bSelectBox;
+
+ useEffect(() => {
+ if (!upAbleConfigsExtra) return;
+ let slaveNewData = [];
+ try {
+ slaveNewData = JSON.parse(upAbleConfigsExtra.sColumnNameConfig || '[]');
+ } catch (e) {}
+
+ const { slaveRowData = {} } = slaveSelectedRowKeysData;
+ const L = Number(slaveSelectedRowKeysData.dProductLength) || 0;
+ const W = Number(slaveSelectedRowKeysData.dProductWidth) || 0;
+ const D = Number(slaveSelectedRowKeysData.dProductHeight) || 0;
+
+ const titleList1 = [
+ { name: "上方盒舌", value: "dSFHS" },
+ { name: "盒底组件", value: "dHDC" },
+ { name: "下方盒舌", value: "dXFHS" },
+ { name: "左(上)插位组件", value: "dZSCW" },
+ { name: "左贴边位", value: "dZTBW" },
+ { name: "左(下)插位组件", value: "dZXCW" },
+ { name: "右(上)插位组件", value: "dYSCW" },
+ { name: "右贴边位", value: "dYTBW" },
+ { name: "右(下)插位组件", value: "dYXCW" },
+ { name: "压线", value: "dYx" },
+ ];
+
+ const tables = [
+ { name: "盒型类别", value: slaveRowData.sBoxType, type: null },
+ { name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes },
+ { name: "盒长", value: L, type: null },
+ { name: "盒宽", value: W, type: null },
+ { name: "盒高", value: D, type: null },
+ ];
+
+ const variables = { L, W, H: W, D, ...slaveRowData };
+ const newBoxList = [];
+
+ slaveNewData.forEach(x => {
+ let key = 0;
+ if (x.sAssignFormula) {
+ key = evaluateFormula(x.sAssignFormula, variables);
+ slaveRowData[x.sName] = key;
+ } else {
+ if (x.sTypes && x.sTypes.includes('09')) {
+ if (x.sName === 'dZTBW' || x.sName === 'dYTBW') {
+ key = Number(x.iSLength || 0) + Number(x.iCLength || 0);
+ } else {
+ key = Number(x.iSWidth || 0) + Number(x.iCWidth || 0);
+ }
+ } else {
+ key = slaveRowData[x.sName];
+ }
+ }
+ newBoxList.push({
+ value: key,
+ sName: titleList1.find(i => i.value === x.sName)?.name || '',
+ sCode: x.sName,
+ type: x.sTypes,
+ showName: x.showName,
+ ...x,
+ });
+ });
+
+ tables.forEach(t => newBoxList.push(t));
+ setBoxList(newBoxList);
+ }, [upAbleConfigsExtra, slaveSelectedRowKeysData]);
+
+ useEffect(() => {
+ if (!upAbleConfigsExtra || !selectRowData) return;
+ let configData = [];
+ try {
+ configData = JSON.parse(upAbleConfigsExtra.sColumnNameConfig || '[]');
+ } catch (e) {}
+
+ const xList = selectRowData.controlSelectedRowBoxXList || [];
+ const yList = selectRowData.controlSelectedRowBoxYList || [];
+
+ const ox = xList.map(item => {
+ const d = configData.find(c => c.sName === item.id) || {};
+ return { x: d.dX || 0, y: d.dY || 0, id: item.id, value: item.value };
+ });
+
+ const oy = yList.map(item => {
+ const d = configData.find(c => c.sName === item.id) || {};
+ return { x: d.dX || 0, y: d.dY || 0, id: item.id, value: item.value };
+ });
+
+ if (ox.length) ox[9].value = ox.slice(0, 9).reduce((a, b) => a + b.value, 0);
+ if (oy.length) oy[9].value = oy.slice(0, 9).reduce((a, b) => a + b.value, 0);
+
+ setOffsetXList(ox);
+ setOffsetYList(oy);
+ }, [upAbleConfigsExtra, selectRowData]);
+
+ // 数据是查看用的,不需要更新状态,移除可能导致死循环的 useEffect
+
+ const imagesData = useMemo(() => {
+ if (!upAbleConfigsExtra) return [];
+ return [{ src: getImageUrl(removeExtension(upAbleConfigsExtra.sPackPath)), alt: "立体图" }];
+ }, [upAbleConfigsExtra?.sPackPath]);
+
+
+ const boxSizeImage = useMemo(() => {
+ if (!upAbleConfigsExtra) return '';
+ return getImageUrl(removeExtension(upAbleConfigsExtra.sPackDetailPathUpLoad));
+ }, [upAbleConfigsExtra?.sPackDetailPathUpLoad]);
+
+
+
+ const BoxDetails = commonFunc.showLocalMessage(parentProps, "BoxDetail", "盒型详情");
+ const noData = commonFunc.showLocalMessage(parentProps, 'noData', 'No Data');
+ const TransversePressure = commonFunc.showLocalMessage(parentProps, "TransversePressure", "横压");
+ const longitudinalPressure = commonFunc.showLocalMessage(parentProps, "longitudinalPressure", "纵压");
+ const { controlSelectedRowBoxXList = [], controlSelectedRowBoxYList = [] } = selectRowData;
+ const boxType = false;
+ return (
+ <>
+ setBoxMaxModalVisible(false)} footer={null} width={800}>
+
+
+
+
+ {isPack ? (
+
+
+ {boxSizeImage === '' ? (
+
+
{BoxDetails}
+
{noData}
+
+ ) : props.tableName === 'slave' && (
+
+
+
+

setBoxMaxModalVisible(true)} />
+ {offsetXList.map((item, i) => (
+
+ {item.value > 0 ? item.value : ''}
+
+ ))}
+ {offsetYList.map((item, i) => (
+
+ {item.value > 0 ? item.value : ''}
+
+ ))}
+
+
+
+
+ {imagesData.map((im, i) => (
+
+
+
+ ))}
+
+
+
+
+ {!boxType && boxList.length > 0 && (
+
+
+ {TransversePressure}:
+
+
+ {controlSelectedRowBoxYList?.map((cfg, i) => (
+ {
+ const list = controlSelectedRowBoxYList.map((it, idx) => idx === i ? { ...it, value: val } : it);
+ list[9].value = list.slice(0, 9).reduce((a, b) => a + b.value, 0);
+ const newSlave = [...slaveData];
+ newSlave[selectRowIndex] = {
+ ...newSlave[selectRowIndex],
+ controlSelectedRowBoxYList: list,
+ dMaterialsWidth: list[9].value,
+ };
+ onSaveState({ slaveData: newSlave });
+ }}
+ />
+ ))}
+
+
+ )}
+
+ {!boxType && boxList.length > 0 && (
+
+
+ {longitudinalPressure}:
+
+
+ {controlSelectedRowBoxXList?.map((cfg, i) => (
+ {
+ const list = controlSelectedRowBoxXList.map((it, idx) => idx === i ? { ...it, value: val } : it);
+ list[9].value = list.slice(0, 9).reduce((a, b) => a + b.value, 0);
+ const newSlave = [...slaveData];
+ newSlave[selectRowIndex] = {
+ ...newSlave[selectRowIndex],
+ controlSelectedRowBoxXList: list,
+ dMaterialsLength: list[9].value,
+ };
+ onSaveState({ slaveData: newSlave });
+ }}
+ />
+ ))}
+
+
+ )}
+
+ {sOrderCategoryId === '17581757610008020076844948336000' && boxList.length > 0 && (
+
+ )}
+
+ )}
+
+
+ ) : null}
+ >
+ );
+}
--
libgit2 0.22.2