Commit c738f700b78cb82b20a846ec76b851e298bb11f5

Authored by 陈鑫涛
1 parent 94834f44

快速报价app 主表数据

src/components/QuickQuote/index.jsx
@@ -246,6 +246,7 @@ const QuickQuoteEvent = props => { @@ -246,6 +246,7 @@ const QuickQuoteEvent = props => {
246 handleType: slaveData[iIndex].handleType || "update", 246 handleType: slaveData[iIndex].handleType || "update",
247 }; 247 };
248 } 248 }
  249 +
249 } else { 250 } else {
250 if (iIndex === -1) { 251 if (iIndex === -1) {
251 slaveData.push({ 252 slaveData.push({
@@ -1423,6 +1424,7 @@ const BoxComponent = props => { @@ -1423,6 +1424,7 @@ const BoxComponent = props => {
1423 ); 1424 );
1424 }, 1425 },
1425 }; 1426 };
  1427 +
1426 // 获取sType为3的 1428 // 获取sType为3的
1427 const { productProcessInfo = [] } = masterData; 1429 const { productProcessInfo = [] } = masterData;
1428 const finishedViewProps = { 1430 const finishedViewProps = {
src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js
@@ -1770,7 +1770,6 @@ class QuotationPackTableTree extends Component { @@ -1770,7 +1770,6 @@ class QuotationPackTableTree extends Component {
1770 } 1770 }
1771 } 1771 }
1772 } 1772 }
1773 - console.log('222', skipFlag);  
1774 if(((skipFlag === 0) || masterData.bNoVerify) && !skipCalculation) { 1773 if(((skipFlag === 0) || masterData.bNoVerify) && !skipCalculation) {
1775 this.handleCalculation(true); 1774 this.handleCalculation(true);
1776 } else { 1775 } else {
@@ -2266,7 +2265,6 @@ class QuotationPackTableTree extends Component { @@ -2266,7 +2265,6 @@ class QuotationPackTableTree extends Component {
2266 if (commonUtils.isNotEmptyArr(materialsSelectedDelRowKeys)) { 2265 if (commonUtils.isNotEmptyArr(materialsSelectedDelRowKeys)) {
2267 materialsReturnData = this.props.onDataRowDel('materials', true, materialsSelectedDelRowKeys); 2266 materialsReturnData = this.props.onDataRowDel('materials', true, materialsSelectedDelRowKeys);
2268 } 2267 }
2269 - console.log('materialsReturnData', materialsReturnData);  
2270 this.props.onSaveState({ 2268 this.props.onSaveState({
2271 ...processReturnData, 2269 ...processReturnData,
2272 ...materialsReturnData, 2270 ...materialsReturnData,
@@ -2770,7 +2768,6 @@ class QuotationPackTableTree extends Component { @@ -2770,7 +2768,6 @@ class QuotationPackTableTree extends Component {
2770 if (commonUtils.isNotEmptyObject(dataReturn)) { 2768 if (commonUtils.isNotEmptyObject(dataReturn)) {
2771 if (dataReturn.code === 1) { 2769 if (dataReturn.code === 1) {
2772 const flowData = dataReturn.dataset.rows[0]; 2770 const flowData = dataReturn.dataset.rows[0];
2773 - console.log(flowData);  
2774 if (commonUtils.isNotEmptyObject(flowData)) { 2771 if (commonUtils.isNotEmptyObject(flowData)) {
2775 this.props.onSaveState({ 2772 this.props.onSaveState({
2776 flowData: flowData,workFlowVisible:true 2773 flowData: flowData,workFlowVisible:true
@@ -4121,7 +4118,6 @@ class QuotationPackTableTree extends Component { @@ -4121,7 +4118,6 @@ class QuotationPackTableTree extends Component {
4121 // const sSqlCondition = { sId: selectData[0].sSlaveId }; /* 后台根据rowData自己取 */ 4118 // const sSqlCondition = { sId: selectData[0].sSlaveId }; /* 后台根据rowData自己取 */
4122 const condition = { sConfigformId, sControlName, sRowData }; 4119 const condition = { sConfigformId, sControlName, sRowData };
4123 const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data; 4120 const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data;
4124 - console.log('dataReturn', dataReturn);  
4125 if (dataReturn.code === 1) { 4121 if (dataReturn.code === 1) {
4126 const copyTo = { config: masterConfig.gdsconfigformslave, name: selectConfig.sControlName }; 4122 const copyTo = { config: masterConfig.gdsconfigformslave, name: selectConfig.sControlName };
4127 const returnDataSet = dataReturn.dataset.rows[0]; 4123 const returnDataSet = dataReturn.dataset.rows[0];
@@ -4245,7 +4241,6 @@ class QuotationPackTableTree extends Component { @@ -4245,7 +4241,6 @@ class QuotationPackTableTree extends Component {
4245 returnData[sName] = returnDataSet[key]; 4241 returnData[sName] = returnDataSet[key];
4246 } 4242 }
4247 } 4243 }
4248 - console.log('returnData', returnData);  
4249 if (commonUtils.isNotEmptyArr(returnData.controlData)) { 4244 if (commonUtils.isNotEmptyArr(returnData.controlData)) {
4250 let dProductQty = 0; 4245 let dProductQty = 0;
4251 /* 主表配置bProductQtyAdd 则代表产品数量不叠加备货数 赠送数 */ 4246 /* 主表配置bProductQtyAdd 则代表产品数量不叠加备货数 赠送数 */
src/mobile/components/SelectInput.jsx
@@ -46,7 +46,7 @@ const SelectInput = props => { @@ -46,7 +46,7 @@ const SelectInput = props => {
46 }; 46 };
47 commonServices.postValueService(props.app.token, body, url).then(res => { 47 commonServices.postValueService(props.app.token, body, url).then(res => {
48 if (res.data.code === 1) { 48 if (res.data.code === 1) {
49 - const list = res.data.dataset.rows?.map(item => ({ 49 + const list = res.data.dataset.rows?.map((item,i) => ({
50 label: item.sCustomerName || item.sName || item.sProcessName || item.sColorName || item.sMaterialsName, 50 label: item.sCustomerName || item.sName || item.sProcessName || item.sColorName || item.sMaterialsName,
51 value: item.sId || item.sSlaveId, 51 value: item.sId || item.sSlaveId,
52 ...item, 52 ...item,
src/mobile/quotation/detailNew.jsx
@@ -97,29 +97,32 @@ const QuickQuoteEvent = props => { @@ -97,29 +97,32 @@ const QuickQuoteEvent = props => {
97 }, [bLinkFieledClick, props.enabled]); 97 }, [bLinkFieledClick, props.enabled]);
98 useEffect(() => { 98 useEffect(() => {
99 // 获取 masterConfig 99 // 获取 masterConfig
100 - const { sModelsId } = props;  
101 - const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}`;  
102 - commonServices  
103 - .getService(props.app.token, configUrl)  
104 - .then(({ data: configReturn }) => {  
105 - if (configReturn.code === 1) {  
106 - const formData = configReturn.dataset.rows[0]?.formData;  
107 - setMasterConfig(formData);  
108 - // setState(pre => ({ ...pre, masterConfig: formData, slaveConfig: formData[1] }));  
109 - }  
110 - })  
111 - .catch(error => {}); 100 +
112 const sActiveId = "172129113112117428019179600"; 101 const sActiveId = "172129113112117428019179600";
113 const configUrls = `${commonConfig.server_host}business/getModelBysId/${sActiveId}?sModelsId=${sActiveId}`; 102 const configUrls = `${commonConfig.server_host}business/getModelBysId/${sActiveId}?sModelsId=${sActiveId}`;
114 - commonServices.getService(props.app.token, configUrls).then(({ data: configReturn }) => { 103 + commonServices.getService(props.app.token, configUrls).then(async ({ data: configReturn }) => {
115 if (configReturn.code === 1) { 104 if (configReturn.code === 1) {
116 const formData = configReturn.dataset.rows[0].formData; 105 const formData = configReturn.dataset.rows[0].formData;
117 - // 需要查询到processConfig和materialsConfig  
118 - setState(pre => ({ ...pre, formData, masterConfig: formData[0], processConfig: {} })); 106 + setState(pre => ({ ...pre, formData, masterConfig: formData[0] }));
119 } 107 }
120 }); 108 });
121 }, []); 109 }, []);
122 - 110 + // 获取主表信息
  111 + useEffect(() => {
  112 + const configUrl = `${commonConfig.server_host}business/getModelBysId/${props.sModelsId}?sModelsId=${props.sModelsId}`;
  113 + commonServices
  114 + .getService(props.app.token, configUrl)
  115 + .then(({ data: masterReturn }) => {
  116 + if (masterReturn.code === 1) {
  117 + const materFormData = masterReturn.dataset.rows[0].formData;
  118 + const processConfig = materFormData.find(x => x.sTbName === "QuoQuotationprocess");
  119 + const materialsConfig = materFormData.find(x => x.sTbName === "QuoQuotationmaterials");
  120 + setMasterConfig(materFormData);
  121 + setState(pre => ({ ...pre, processConfig, materialsConfig }));
  122 + }
  123 + })
  124 + .catch(error => {});
  125 + }, [props.sModelsId]);
123 // 获取盒型定义配置 126 // 获取盒型定义配置
124 useEffect(() => { 127 useEffect(() => {
125 if (!formData.length) return; 128 if (!formData.length) return;
@@ -180,6 +183,7 @@ const QuickQuoteEvent = props => { @@ -180,6 +183,7 @@ const QuickQuoteEvent = props => {
180 } 183 }
181 setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState })); 184 setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState }));
182 } else if (name.includes("slave")) { 185 } else if (name.includes("slave")) {
  186 +
183 const boxModel = name.replace("slaveUp", "").replace("slaveDown", ""); 187 const boxModel = name.replace("slaveUp", "").replace("slaveDown", "");
184 if (sFieldName === "sName") { 188 if (sFieldName === "sName") {
185 if (!changeValue.sName) return; 189 if (!changeValue.sName) return;
@@ -224,7 +228,6 @@ const QuickQuoteEvent = props => { @@ -224,7 +228,6 @@ const QuickQuoteEvent = props => {
224 } else { 228 } else {
225 const sBackProcessData = slaveData[iIndex].sBackProcessData || []; 229 const sBackProcessData = slaveData[iIndex].sBackProcessData || [];
226 const iIndex1 = sBackProcessData.findIndex(item => item.value === dropDownData[0].value); 230 const iIndex1 = sBackProcessData.findIndex(item => item.value === dropDownData[0].value);
227 -  
228 if (iIndex1 === -1) { 231 if (iIndex1 === -1) {
229 dropDownDataSelected !== undefined && sBackProcessData.push(dropDownDataSelected); 232 dropDownDataSelected !== undefined && sBackProcessData.push(dropDownDataSelected);
230 } else { 233 } else {
@@ -295,6 +298,13 @@ const QuickQuoteEvent = props => { @@ -295,6 +298,13 @@ const QuickQuoteEvent = props => {
295 if (sFieldName === "sPrint") { 298 if (sFieldName === "sPrint") {
296 slaveData[saveIndex] = { 299 slaveData[saveIndex] = {
297 ...slaveData[saveIndex], 300 ...slaveData[saveIndex],
  301 + sProcessId: changeValue.sId,
  302 + sPrintProcessId: changeValue.sId,
  303 + };
  304 + }
  305 + if (sFieldName === "sPrint") {
  306 + slaveData[saveIndex] = {
  307 + ...slaveData[saveIndex],
298 dMachineWidth: slaveData[saveIndex].dWlkd, 308 dMachineWidth: slaveData[saveIndex].dWlkd,
299 dMachineLength: slaveData[saveIndex].dWlcd, 309 dMachineLength: slaveData[saveIndex].dWlcd,
300 }; 310 };
@@ -511,6 +521,8 @@ const QuickQuoteEvent = props => { @@ -511,6 +521,8 @@ const QuickQuoteEvent = props => {
511 }) 521 })
512 .filter(item => commonUtils.isNotEmptyObject(item) && item.materialsInfo && item.materialsInfo.length) 522 .filter(item => commonUtils.isNotEmptyObject(item) && item.materialsInfo && item.materialsInfo.length)
513 .map(item => { 523 .map(item => {
  524 + // slaveData里的sMaterialRate sMaterialsStyle
  525 +
514 return { 526 return {
515 ...Object.keys(item).reduce((pre, cur) => { 527 ...Object.keys(item).reduce((pre, cur) => {
516 if (typeof item[cur] !== "object") { 528 if (typeof item[cur] !== "object") {
@@ -541,8 +553,8 @@ const QuickQuoteEvent = props => { @@ -541,8 +553,8 @@ const QuickQuoteEvent = props => {
541 const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; 553 const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;
542 554
543 if (dataReturn.code === 1) { 555 if (dataReturn.code === 1) {
544 - const { app, sModelsId, materialsConfig } = props;  
545 - const { slaveConfig, masterData: masterData1, processConfig } = state; 556 + const { app, sModelsId } = props;
  557 + const { slaveConfig, masterData: masterData1, processConfig, materialsConfig } = state;
546 const { productClassify, partsNewInfo = [], productProcessInfo, partsInfo: partsOldInfo } = dataReturn.dataset.rows[0]; 558 const { productClassify, partsNewInfo = [], productProcessInfo, partsInfo: partsOldInfo } = dataReturn.dataset.rows[0];
547 559
548 const slaveData = []; 560 const slaveData = [];
@@ -673,7 +685,7 @@ const QuickQuoteEvent = props => { @@ -673,7 +685,7 @@ const QuickQuoteEvent = props => {
673 const materialInfo = partInfo.materialsInfo[i]; 685 const materialInfo = partInfo.materialsInfo[i];
674 const iOrder = i; 686 const iOrder = i;
675 let materialDataRow = {}; 687 let materialDataRow = {};
676 - for (const item of materialsConfig?.gdsconfigformslave) { 688 + for (const item of materialsConfig.gdsconfigformslave) {
677 materialDataRow[item.sName] = materialInfo[item.sName]; 689 materialDataRow[item.sName] = materialInfo[item.sName];
678 } 690 }
679 materialDataRow.handleType = "add"; 691 materialDataRow.handleType = "add";
@@ -861,9 +873,12 @@ const QuickQuoteEvent = props => { @@ -861,9 +873,12 @@ const QuickQuoteEvent = props => {
861 // quickQuoteModel: false, 873 // quickQuoteModel: false,
862 }; 874 };
863 delete newState.masterData.sQuoConfig; 875 delete newState.masterData.sQuoConfig;
  876 + const masterProps = {
  877 + ...props,
  878 + };
864 const result = await props.handleCalculation( 879 const result = await props.handleCalculation(
865 false, 880 false,
866 - { ...props, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData }, 881 + { ...masterProps, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData },
867 true 882 true
868 ); 883 );
869 884
@@ -1073,7 +1088,35 @@ const sortData = (tableData, processData) => { @@ -1073,7 +1088,35 @@ const sortData = (tableData, processData) => {
1073 }); 1088 });
1074 return processData; 1089 return processData;
1075 }; 1090 };
1076 -const QuotationAllprogressDetail = baseProps => { 1091 +// 计算数量
  1092 +const handleCalculation = async (bSave, nextProps, isWait) => {
  1093 + const dataUrl = `${commonConfig.server_host}business/addQuotationsheet?sModelsId=${nextProps.sModelsId}`;
  1094 + const {
  1095 + masterConfig,
  1096 + slaveConfig,
  1097 + slaveDelData,
  1098 + controlConfig,
  1099 + controlDelData,
  1100 + colorConfig,
  1101 + colorData,
  1102 + colorDelData,
  1103 + materialsConfig,
  1104 + materialsDelData,
  1105 + processConfig,
  1106 + processDelData,
  1107 + app,
  1108 + manyqtysConfig,
  1109 + manyqtysDelData,
  1110 + packConfig,
  1111 + packDelData,
  1112 + manyDataCache = [],
  1113 + dQuickQuoteProductQty,
  1114 + } = nextProps;
  1115 + let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps;
  1116 + const sMakePerson = masterData.sMakePerson;
  1117 + const data = [];
  1118 +};
  1119 +const getProps = baseProps => {
1077 const { location, quotationData, app, sModelsId } = baseProps; 1120 const { location, quotationData, app, sModelsId } = baseProps;
1078 const getSqlDropDownDatas = async (formId, name, showConfig, record, sKeyUpFilterName, pageNum) => { 1121 const getSqlDropDownDatas = async (formId, name, showConfig, record, sKeyUpFilterName, pageNum) => {
1079 const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId}?sModelsId=${sModelsId}`; 1122 const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId}?sModelsId=${sModelsId}`;
@@ -1110,10 +1153,17 @@ const QuotationAllprogressDetail = baseProps => { @@ -1110,10 +1153,17 @@ const QuotationAllprogressDetail = baseProps => {
1110 getSqlDropDownData: getSqlDropDownDatas, 1153 getSqlDropDownData: getSqlDropDownDatas,
1111 onMaterialsChange: handleMaterialsChange, 1154 onMaterialsChange: handleMaterialsChange,
1112 sortData, 1155 sortData,
  1156 + handleCalculation,
  1157 + };
  1158 + return {
  1159 + ...baseProps,
  1160 + ...propss,
1113 }; 1161 };
  1162 +};
  1163 +const QuotationAllprogressDetail = baseProps => {
  1164 + const props = QuickQuoteEvent(getProps(baseProps));
1114 1165
1115 - const props = QuickQuoteEvent(propss);  
1116 - const { selectedNode } = props; 1166 + const { selectedNode, location, quotationData, app, sModelsId } = props;
1117 const { showName, sUnit } = quotationData; 1167 const { showName, sUnit } = quotationData;
1118 const timeRef = useRef(0); 1168 const timeRef = useRef(0);
1119 1169
@@ -1593,7 +1643,7 @@ const BoxComponent = props => { @@ -1593,7 +1643,7 @@ const BoxComponent = props => {
1593 const newSwitchStates = downAbleConfigsNew 1643 const newSwitchStates = downAbleConfigsNew
1594 .filter(item => item.sPartsName === boxModel || !item.sPartsName) 1644 .filter(item => item.sPartsName === boxModel || !item.sPartsName)
1595 .reduce((acc, item, index) => { 1645 .reduce((acc, item, index) => {
1596 - acc[item.sName] = sBackProcessData[index][item.sName] !== ""; 1646 + acc[item.sName] = sBackProcessData ? sBackProcessData[index][item.sName] !== "" : false;
1597 return acc; 1647 return acc;
1598 }, {}); 1648 }, {});
1599 1649
@@ -1613,9 +1663,11 @@ const BoxComponent = props => { @@ -1613,9 +1663,11 @@ const BoxComponent = props => {
1613 // 过滤后的数据 1663 // 过滤后的数据
1614 const downViewConfigs = downAbleConfigsNew 1664 const downViewConfigs = downAbleConfigsNew
1615 .filter(item => item.sPartsName === boxModel || !item.sPartsName) 1665 .filter(item => item.sPartsName === boxModel || !item.sPartsName)
1616 - .map(item => ({ 1666 + .map((item, i) => ({
1617 ...item, 1667 ...item,
1618 isSelect: switchStates ? switchStates[item.sName] : false, 1668 isSelect: switchStates ? switchStates[item.sName] : false,
  1669 + sName: "sParams" + i,
  1670 + sProductClassifyId: item.sId,
1619 })); 1671 }));
1620 1672
1621 const downViewProps = { 1673 const downViewProps = {
@@ -1626,6 +1678,7 @@ const BoxComponent = props => { @@ -1626,6 +1678,7 @@ const BoxComponent = props => {
1626 viewRow: slaveRowData, 1678 viewRow: slaveRowData,
1627 tableName: `slaveDown${boxModel}`, 1679 tableName: `slaveDown${boxModel}`,
1628 }; 1680 };
  1681 +
1629 const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []); 1682 const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []);
1630 const radioValue = calcMethodData[0]?.sCode; 1683 const radioValue = calcMethodData[0]?.sCode;
1631 const [materialLength, setMaterialLength] = useState(0); 1684 const [materialLength, setMaterialLength] = useState(0);
@@ -1653,7 +1706,7 @@ const BoxComponent = props => { @@ -1653,7 +1706,7 @@ const BoxComponent = props => {
1653 dMachineWidth: width, // 上机宽 1706 dMachineWidth: width, // 上机宽
1654 sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸 1707 sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸
1655 sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸 1708 sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸
1656 - sMaterialRate: (((length * width) / (slaveData[index].dWlcd * slaveData[index].dWlkd)) * 100).toFixed(2), 1709 + sMaterialRate: (((length * width) / (dWlcd * dWlkd)) * 100).toFixed(2),
1657 newMaterialLength: length, 1710 newMaterialLength: length,
1658 newMaterialWidth: width, 1711 newMaterialWidth: width,
1659 sLayoutRate: Number( 1712 sLayoutRate: Number(
@@ -2069,11 +2122,11 @@ const MaterialsComponent = props => { @@ -2069,11 +2122,11 @@ const MaterialsComponent = props => {
2069 tableName: `slaveUp${boxModel}`, 2122 tableName: `slaveUp${boxModel}`,
2070 onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => { 2123 onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
2071 const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId); 2124 const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
2072 - const { sMaterialsName, sMaterialsNo, sMaterialsId, sAuxiliaryUnit, sMaterialsUnit, dGramWeight, sMaterialsType, dWlkd, dWlcd } = changeValue; 2125 + const { sMaterialsName, sMaterialsNo, sAuxiliaryUnit, sMaterialsUnit, dGramWeight, sMaterialsType, dWlkd, dWlcd } = changeValue;
2073 const masterials = { 2126 const masterials = {
2074 sMaterialsName, 2127 sMaterialsName,
2075 sMaterialsNo, 2128 sMaterialsNo,
2076 - sMaterialsId, 2129 + sMaterialsId: changeValue.sId,
2077 sAuxiliaryUnit, 2130 sAuxiliaryUnit,
2078 sMaterialsUnit, 2131 sMaterialsUnit,
2079 dGramWeight, 2132 dGramWeight,