From 4f64fb859eccc38b075164a4b07271bad7b02000 Mon Sep 17 00:00:00 2001 From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com> Date: Sun, 28 Sep 2025 14:58:44 +0800 Subject: [PATCH] 快速报价 --- src/components/Common/BoxDesignCompontent/index.js | 2 -- src/components/Common/BoxDesignCompontent/svg.js | 16 ++++++++++------ src/components/Common/BoxShowImgMaterial/indexNew.js | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------- src/components/QuickQuote/index.jsx | 31 +++++++++++++++++++++++-------- 4 files changed, 83 insertions(+), 97 deletions(-) diff --git a/src/components/Common/BoxDesignCompontent/index.js b/src/components/Common/BoxDesignCompontent/index.js index 719c420..4bca89c 100644 --- a/src/components/Common/BoxDesignCompontent/index.js +++ b/src/components/Common/BoxDesignCompontent/index.js @@ -24,7 +24,6 @@ const BoxDesignEvent = props => { setLoading(false); if (!tableData?.length) return const shape = tableData?.find(x => x.iTag === 70)?.showDropDown - if (!shape) return const JsonShape = JSON.parse(shape) const arr = Array.from(Object.values(JsonShape)); setOptions([ @@ -167,7 +166,6 @@ const BoxDesignCompontent = baseProps => { setTableDataList(newList); setTableDataLists(newList); const shape = tableData.find(x => x.iTag === 70)?.showDropDown - if (!shape) return const JsonShape = JSON.parse(shape) const shapeLists = Array.from(Object.values(JsonShape)) setShapeList(shapeLists) diff --git a/src/components/Common/BoxDesignCompontent/svg.js b/src/components/Common/BoxDesignCompontent/svg.js index 90ad58c..6650249 100644 --- a/src/components/Common/BoxDesignCompontent/svg.js +++ b/src/components/Common/BoxDesignCompontent/svg.js @@ -365,7 +365,6 @@ const SvgBox = props => { bottom = bottomOffect(boxList, orderLength, orderWidth, props); } if (Number(svgType) === 4) { - } else if (Number(svgType) === 8) { ySvg = topOffect(boxList, headLength, headWidth, props) * scale; } @@ -439,7 +438,6 @@ const SvgBox = props => { scale = 0.5; let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight, props) * scale; if (Number(svgType) === 4) { - } else if (Number(svgType) === 8) { ySvg = topOffect(boxList, headLength, headWidth, props) * scale; } @@ -602,6 +600,12 @@ const SvgBox = props => { svgContainerRef.current.style.transform = `scale(${scaleX >= 1 ? 1 : scaleX}, ${scaleY >= 1 ? 1 : scaleY})`; svgContainerRef.current.style.transformOrigin = "top left"; svgContainerRef.current.style.paddingTop = dSvgBoxWidth ? "0" : "25px"; + if (Number(svgType) !== 9) { + svgContainerRef.current.style.margin = `0 auto`; + } else { + svgContainerRef.current.style.margin = `0`; + + } svgContainerRef.current.style.backgroundColor = props.isMobile ? "#EDF4FF" : ""; // svgContainerRef.current.style.position = 'absolute'; // svgContainerRef.current.style.left = '50%'; @@ -5202,13 +5206,13 @@ const SvgBox = props => { } else if (Number(svgType) === 9) { svg.appendChild(drawCup(boxLength, boxWidth, boxHeight, g)); const result = calculateCupUnfoldDimensions(boxLength, boxWidth, boxHeight) - if (props.showNew !== 0) { + // if (props.showNew !== 0) { const w = result.width const h = result.height svg.setAttribute('viewBox', `${result.points.outerLeft.x} ${result.points.topCenter.y} ${w} ${h}`); svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); - } + // } } @@ -5385,7 +5389,7 @@ const SvgBox = props => { } top = sfhs?.value || 0; } - // if (svg === 4) top = Number(top) + Number(height); + if (svg === 4) top = Number(top) + Number(height); return isNaN(top) ? 0 : Number(top); }; const bottomOffect = (list, length, width, height, props) => { @@ -5484,7 +5488,7 @@ const SvgBox = props => { top = sfhs?.value || 0; } - // if (svg === 4) top = Number(top) + Number(height); + if (svg === 4) top = Number(top) + Number(height); return isNaN(top) ? 0 : top; }; // 将角度转换为弧度 diff --git a/src/components/Common/BoxShowImgMaterial/indexNew.js b/src/components/Common/BoxShowImgMaterial/indexNew.js index 9b55f54..45050f5 100644 --- a/src/components/Common/BoxShowImgMaterial/indexNew.js +++ b/src/components/Common/BoxShowImgMaterial/indexNew.js @@ -1,9 +1,8 @@ /* eslint-disable */ import React, { useEffect, useState, useRef } from "react"; -import { VerticalLeftOutlined, VerticalRightOutlined, ArrowRightOutlined } from "@ant-design/icons"; +import { VerticalLeftOutlined, VerticalRightOutlined } from "@ant-design/icons"; import styles from "./index.less"; -import { bottom } from "react-grid-layout/build/utils"; -import { transform } from "@antv/g2/lib/util/transform"; +import * as commonFunc from "@/components/Common/commonFunc"; const BoxShowImgMaterial = props => { const boxRef = useRef(null); const textRef = useRef(null); @@ -11,9 +10,8 @@ const BoxShowImgMaterial = props => { const nTextRefs = useRef(null); const nTextRef = useRef(null); const [boxKey, setBoxKey] = useState(new Date().getTime()); - const { width, height, size } = props; - const clientWidth = width || 300; - const clientHeight = height || 250; + const clientWidth = 300; + const clientHeight = 250; // 找出盒型信息 const { slaveData, selectedNode } = props.state; const { boxModel } = props; @@ -23,11 +21,10 @@ const BoxShowImgMaterial = props => { var { dMaxLength, dMaxWidth, dMachineLength, dMachineWidth, dWlcd, dWlkd, dSBLB, dXBLB, dZBLB, dYBLB, scale } = slaveDataDetail; } // 计算可以放置的盒子数量 - const isJuantong = selectedNode.sTypeKey === "juantong"; const horizontalBoxes = Math.floor(dWlcd / dMachineLength); const verticalBoxes = Math.floor(dWlkd / dMachineWidth); - const scaleX = (clientWidth - 100) / Number(dWlcd); - const scaleY = (clientHeight - 70) / Number(dWlkd); + const scaleX = (clientWidth - 70) / (dWlcd); + const scaleY = (clientHeight - 70) / (dWlkd); // 动态生成多个 materialBox const generateMaterialBoxes = () => { const boxes = []; @@ -49,8 +46,8 @@ const BoxShowImgMaterial = props => { position: "absolute", bottom: "-30px", left: "0px", - width: `${dMachineLength * scaleX}px`, - fontSize: `${size || 11}px`, + width: `${(dMachineLength * scaleX)}px`, + fontSize: "11px", textAlign: "center", height: "30px", lineHeight: "30px", @@ -70,7 +67,7 @@ const BoxShowImgMaterial = props => { position: "absolute", top: "15px", left: "5px", - width: `${dMachineLength * scaleX * 0.2}px`, + width: `${((dMachineLength * scaleX)) * 0.2}px`, backgroundColor: "#333", height: "1px", }} @@ -95,7 +92,7 @@ const BoxShowImgMaterial = props => { position: "absolute", top: "15px", right: "5px", - width: `${dMachineLength * scaleX * 0.2}px`, + width: `${((dMachineLength *scaleX)) * 0.2}px`, backgroundColor: "#333", height: "1px", }} @@ -107,9 +104,9 @@ const BoxShowImgMaterial = props => { position: "absolute", top: "0", right: "-30px", - height: `${dMachineWidth * scaleY}px`, - lineHeight: `${dMachineWidth * scaleY}px`, - fontSize: `${size || 11}px`, + height: `${(dMachineWidth * scaleY)}px`, + lineHeight: `${(dMachineWidth * scaleY)}px`, + fontSize: "11px", textAlign: "center", width: "30px", transform: `scale(${1 / scaleX}, ${1 / scaleY})`, @@ -129,7 +126,7 @@ const BoxShowImgMaterial = props => { position: "absolute", top: "5px", left: "15px", - height: `${dMachineWidth * scaleY * 0.3}px`, + height: `${((dMachineWidth * scaleY)) * 0.3}px`, backgroundColor: "#333", width: "1px", }} @@ -137,14 +134,10 @@ const BoxShowImgMaterial = props => { {dMachineWidth} - - { position: "absolute", bottom: "5px", left: "15px", - height: `${dMachineWidth * scaleY * 0.3}px`, + height: `${((dMachineWidth * scaleY)) * 0.3}px`, backgroundColor: "#333", width: "1px", }} /> - {/*
- {isJuantong ? "门幅方向" : ""} -
-
- -
*/} ); } @@ -199,30 +167,33 @@ const BoxShowImgMaterial = props => { ((horizontalBoxes * verticalBoxes * (Number(dMachineLength) * Number(dMachineWidth))) / (Number(dWlcd) * Number(dWlkd))) * 100 ).toFixed(2); - useEffect(() => { - setBoxKey(new Date().getTime()); - setTimeout(() => { - // if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) - if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) { - // 计算父元素的缩放因子 - // 对父元素应用缩放 - boxRef.current.style.transform = `scale(${scaleX}, ${scaleY})`; - boxRef.current.style.transformOrigin = "top left"; - // // 对子元素应用逆缩放 - textRef.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; - textRef.current.style.transformOrigin = "top left"; - textRefs.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; - textRefs.current.style.transformOrigin = "top left"; - } - }, 10); - }, [scaleX, scaleY]); + useEffect( + () => { + setBoxKey(new Date().getTime()); + setTimeout(() => { + // if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) + if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) { + // 计算父元素的缩放因子 + // 对父元素应用缩放 + boxRef.current.style.transform = `scale(${scaleX}, ${scaleY})`; + boxRef.current.style.transformOrigin = "top left"; + // // 对子元素应用逆缩放 + textRef.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; + textRef.current.style.transformOrigin = "top left"; + textRefs.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; + textRefs.current.style.transformOrigin = "top left"; + } + }, 0); + }, + [slaveDataDetail] + ); const isMax = slaveDataDetail?.dMaxWidth * slaveDataDetail?.dMaxLength > slaveDataDetail?.dMachineLength * slaveDataDetail?.dMachineWidth; - const isDPartsLength = slaveDataDetail?.dPartsLength < slaveDataDetail?.dMaxLength && slaveDataDetail?.dPartsWidth < slaveDataDetail?.dMaxWidth; - + const isDPartsLength = Number(slaveDataDetail?.dWlcd) <= slaveDataDetail?.dMaxLength && Number(slaveDataDetail?.dWlkd) <= slaveDataDetail?.dMaxWidth; + const MaterialUtilizationRate = commonFunc.showLocalMessage(props, "MaterialUtilizationRate", "材料利用率"); const isShow = - isDPartsLength && slaveDataDetail && slaveDataDetail.dMachineLength && slaveDataDetail.dMaxWidth && slaveDataDetail.dMaxLength && isMax; - - return ( + slaveDataDetail && slaveDataDetail.dMachineLength && slaveDataDetail.dMaxWidth && slaveDataDetail.dMaxLength && isMax; + console.log("🚀 ~ isDPartsLength:", isDPartsLength,isMax) + return ( <> {isShow ? (
{ style={{ position: "absolute", left: "0px", - width: `${(dWlcd * (clientWidth - 100)) / dWlcd}px`, - fontSize: `${size || 11}px`, + width: `${(dWlcd * (clientWidth - 50)) / (dWlcd + 60)}px`, + fontSize: "11px", textAlign: "center", height: "30px", - bottom: `-${80}px`, + bottom: `-${100}px`, lineHeight: "30px", }} > @@ -284,7 +255,7 @@ const BoxShowImgMaterial = props => { display: "inline-block", }} > - 材料利用率: + {MaterialUtilizationRate}: { style={{ position: "absolute", top: "0", - right: "-80px", - height: `${dWlkd * scaleY}px`, - lineHeight: `${dWlkd * scaleY}px`, - fontSize: `${size || 11}px`, + right: "15px", + height: `${(dWlkd * scaleY)}px`, + lineHeight: `${(dWlkd * scaleY)}px`, + fontSize: "11px", textAlign: "center", width: "30px", }} @@ -339,7 +310,7 @@ const BoxShowImgMaterial = props => { position: "absolute", top: "5px", left: "15px", - height: `${dWlkd * scaleY * 0.3}px`, + height: `${((dWlkd * scaleY)) * 0.3}px`, backgroundColor: "#333", width: "1px", }} @@ -347,8 +318,6 @@ const BoxShowImgMaterial = props => { {dWlkd} @@ -366,7 +335,7 @@ const BoxShowImgMaterial = props => { position: "absolute", bottom: "5px", left: "15px", - height: `${dWlkd * scaleY * 0.3}px`, + height: `${((dWlkd * scaleY)) * 0.3}px`, backgroundColor: "#333", width: "1px", }} diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index f6ac77f..073dc17 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -467,7 +467,7 @@ const QuickQuoteEvent = props => { slaveData[saveIndex] = { ...slaveData[saveIndex], sMachineStyle: materialStyleLength + "*" + materialStyleWidth, - dMachineQty: slaveData[saveIndex].dProductQty ? slaveData[saveIndex].dProductQty : masterData.dProductQty, + dMachineQty: masterData.sBillNo && slaveData[saveIndex].dMachineQty ? slaveData[saveIndex].dMachineQty : slaveData[saveIndex].dProductQty ? slaveData[saveIndex].dProductQty : masterData.dProductQty, }; if (sFieldName === "dWlcd" || sFieldName === "dWlkd") { const horizontalBoxes = Math.floor(slaveData[saveIndex]?.dWlkd / Number(slaveData[saveIndex]?.dMachineWidth)); @@ -475,12 +475,13 @@ const QuickQuoteEvent = props => { const newDMaterialsKQty = horizontalBoxes * verticalBoxes; slaveData[saveIndex] = { ...slaveData[saveIndex], - dMachineQty: Math.floor(slaveData[saveIndex].dMachineQty / slaveData[saveIndex].dSinglePQty), + dMachineQty: masterData.sBillNo && slaveData[saveIndex].dMachineQty ? slaveData[saveIndex].dMachineQty : Math.floor(slaveData[saveIndex].dMachineQty / slaveData[saveIndex].dSinglePQty), dMaterialsKQty: newDMaterialsKQty, newMaterialLength: sFieldName === "dWlcd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlcd, newMaterialWidth: sFieldName === "dWlkd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlkd, materialLength: sFieldName === "dWlcd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlcd, materialWidth: sFieldName === "dWlkd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlkd, + sMaterialsStyle: `${ sFieldName === "dWlcd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlcd || 0}*${sFieldName === "dWlkd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlkd|| 0}`, }; } @@ -996,6 +997,7 @@ const QuickQuoteEvent = props => { newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0]; for (let i = 0; i < partsNewInfo.length; i++) { const partInfo = partsNewInfo[i]; + console.log("🚀 ~ QuickQuoteEvent ~ partInfo:", partInfo) const iIndex = i; const partsDataRow = {}; for (const child of Object.keys(partInfo)) { @@ -1035,6 +1037,7 @@ const QuickQuoteEvent = props => { materialDataRow.sControlId = partsDataRow.sId; // materialDataRow.sSlaveId = ' '; materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial; + materialDataRow.sMaterialsStyle = partsDataRow.sMaterialsStyle; const models = "Materials"; materialDataRow = await props.onMaterialsChange(materialDataRow, sModelsId, masterData, [], "dAuxiliaryQty", app, token, models); materialDataRow = commonBusiness.getCalculateAllMoney(app, models, "dAuxiliaryQty", masterData, materialDataRow); @@ -1065,8 +1068,9 @@ const QuickQuoteEvent = props => { processPrintDataRow.sParentId = masterData.sId; processPrintDataRow.sControlId = partsDataRow.sId; // processPrintDataRow.sSlaveId = ' '; - processPrintDataRow.sColorSerialMemo = JSON.stringify([{ sId: partInfo.sColorId, sName: partInfo.sColor, dColor: partInfo.iColor }]); - + const iSpecialColor = partInfo.iSpecialColor !== undefined ? partInfo.iSpecialColor : partInfo.partInfoiSpecialColor; + processPrintDataRow.sColorSerialMemo = JSON.stringify([{ sId: partInfo.sColorId, sName: partInfo.sColor, dColor: partInfo.iColor, iSpecialColor }]); + processData.push(processPrintDataRow); // 配套工序 if (bProcessAssort) { @@ -2367,6 +2371,7 @@ const BoxComponent = props => { // 查找符合条件的索引 const { selectedNode } = props.state; const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel); + if (index !== undefined && index !== -1) { // 计算开数 // 获取原始对象并创建一个新的对象进行更新 @@ -2389,10 +2394,10 @@ const BoxComponent = props => { ).toFixed(2) ), // dWlcd: selectedNode.sTypeKey === 'juantong' ? Math.floor(dProductQty / dSinglePQty * ( length/ 1000)) : dWlcd, - dWlcd: dWlcd, - dWlkd: dWlkd, + dWlcd: sBillNo ? slaveData[index]?.dWlcd : dWlcd, + dWlkd: sBillNo ? slaveData[index]?.dWlkd : dWlkd, dAuxiliaryQty: Math.floor((dProductQty / dSinglePQty) * (length / 1000)), - dMachineQty: Math.floor(dProductQty / dSinglePQty), + dMachineQty: sBillNo && slaveData[index].dMachineQty ? slaveData[index].dMachineQty : Math.floor(dProductQty / dSinglePQty), dSinglePQty: dSinglePQty, dMaterialsKQty: dMaterialsKQty, scale: scale, @@ -3243,6 +3248,8 @@ const ManyComponent = props => { }, fixedHeight: 145, }; + const pricingInProgress = commonFunc.showLocalMessage(props, "sNuclearPricing", "核价中"); + const progress = commonFunc.showLocalMessage(props, "progress", "进度"); return (
@@ -3295,7 +3302,7 @@ const ManyComponent = props => { {BtnPriceDetails}