Commit 71a442ddbb24ce8d8f5947406830dc4bc1c9540d

Authored by chenxt
1 parent 5333bf85

计算价格离开后计算

src/components/Common/CommonHooks/useCommonBase.js
@@ -1928,8 +1928,23 @@ const useCommonBase = props => { @@ -1928,8 +1928,23 @@ const useCommonBase = props => {
1928 const { masterData } = state 1928 const { masterData } = state
1929 const { app } = props 1929 const { app } = props
1930 const { token } = app || {} 1930 const { token } = app || {}
1931 - tableDataRow = await handleMaterialsChange(tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models);  
1932 - console.log(tableDataRow, 'tableDataRow'); 1931 + // tableDataRow = await handleMaterialsChange(tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models);
  1932 + /* 找到sFieldName对应的配置,判断是否是离开调用逻辑,若是离开调用, 则走离开调用逻辑,否则走原来的 */
  1933 + let bMoveSql = false;
  1934 + if (commonUtils.isNotEmptyObject(tableConfig)) {
  1935 + const iConfigIndex = tableConfig.gdsconfigformslave.findIndex(item => item.sName === sFieldName);
  1936 + if (iConfigIndex > -1) {
  1937 + const sDropDownType = tableConfig.gdsconfigformslave[iConfigIndex].sDropDownType;
  1938 + if (sDropDownType === 'movesql') {
  1939 + bMoveSql = true;
  1940 + }
  1941 + }
  1942 + }
  1943 +
  1944 + if (!bMoveSql) {
  1945 + tableDataRow = await handleMaterialsChange(tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models);
  1946 + }
  1947 +
1933 if (isWait) { 1948 if (isWait) {
1934 return tableDataRow; 1949 return tableDataRow;
1935 } else { 1950 } else {
@@ -1953,112 +1968,7 @@ const useCommonBase = props => { @@ -1953,112 +1968,7 @@ const useCommonBase = props => {
1953 ); 1968 );
1954 } 1969 }
1955 }; 1970 };
1956 - // const handleMaterialsChange = async (tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models) => {  
1957 - // const { sComputeId, sConversionComputeId, sReConversionComputeId } = tableDataRow;  
1958 - // const sFormulaIdType = tableDataRow.bInverse ? 'sReComputeId' : 'sComputeId'; /* 正算、反算类型 */  
1959 - // if (sFieldName === 'sMaterialsNo' || sFieldName === 'sMaterialsName' || sFieldName === 'dAuxiliaryQty' || sFieldName === 'dReelAuxiliaryQty' || sFieldName === 'dConversionQty' || sFieldName === 'sMaterialsStyle' || sFieldName === 'dProductQty') {  
1960 - // if (sFieldName === 'dReelAuxiliaryQty') {  
1961 - // if (tableDataRow.sMaterialsUnit === '吨' && tableDataRow.bReel && tableDataRow.dGramWeight > 0) {  
1962 - // tableDataRow = commonBusiness.getMaterialsQty(app, { ...tableDataRow, sMaterialsStyle: tableDataRow.sReelMaterialsStyle }, 'dReelAuxiliaryQty', 'dMaterialsQty');  
1963 - // tableDataRow.dAuxiliaryQty = tableDataRow.dMaterialsQty;  
1964 - // tableDataRow.sMaterialsStyle = tableDataRow.sMaterialsStyle !== undefined && tableDataRow.sMaterialsStyle.split('*').length > 1 ? tableDataRow.sMaterialsStyle.split('*')[0] : tableDataRow.sMaterialsStyle;  
1965 - // tableDataRow.sAuxiliaryUnit = tableDataRow.sMaterialsUnit;  
1966 - // } else if (tableDataRow.sMaterialsUnit.toUpper() === 'M2' && tableDataRow.bReel) {  
1967 - // tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, 'dReelAuxiliaryQty', 'dMaterialsQty');  
1968 - // tableDataRow.dAuxiliaryQty = tableDataRow.dReelAuxiliaryQty;  
1969 - // } else {  
1970 - // tableDataRow.dAuxiliaryQty = tableDataRow.dReelAuxiliaryQty;  
1971 - // }  
1972 - // }  
1973 - // if (commonUtils.isEmpty(sComputeId) && sFieldName !== 'dConversionQty') {  
1974 - // if (sFieldName === 'dProductQty') {  
1975 - // tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, 'dProductQty', 'dMaterialsQty');  
1976 - // } else if (app.currentPane.sModelsType && app.currentPane.sModelsType.includes('outside/')) {  
1977 - // tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, 'dAuxiliaryQty', 'dMaterialsQty');  
1978 - // } else {  
1979 - // tableDataRow.dMaterialsQty = await commonBusiness.getFormulaValue({  
1980 - // token, sModelsId, masterData, tableDataRow, sComputeId, sFormulaIdType,  
1981 - // });  
1982 - // }  
1983 - // } else if (!commonUtils.isEmpty(sComputeId)) {  
1984 - // tableDataRow.dMaterialsQty = await commonBusiness.getFormulaValue({  
1985 - // token, sModelsId, masterData, tableDataRow, sComputeId,  
1986 - // });  
1987 - // }  
1988 - // if (sFieldName !== 'dConversionQty' && !commonUtils.isEmpty(sConversionComputeId)) {  
1989 - // tableDataRow.dConversionQty = await commonBusiness.getFormulaValue({  
1990 - // token, sModelsId, masterData, tableDataRow, sComputeId: sConversionComputeId,  
1991 - // });  
1992 - // }  
1993 - // } else if (sFieldName === 'dMaterialsQty') {  
1994 - // const { sReComputeId } = tableDataRow;  
1995 - // if (commonUtils.isEmpty(sReComputeId) && tableDataRow.bInverse) {  
1996 - // if (app.currentPane.sModelsType && app.currentPane.sModelsType.includes('outside/')) {  
1997 - // tableDataRow = commonBusiness.getAuxiliaryQty(app, tableDataRow, sFieldName, 'dAuxiliaryQty');  
1998 - // } else {  
1999 - // tableDataRow.dAuxiliaryQty = await commonBusiness.getFormulaValue({  
2000 - // token, sModelsId, masterData, tableDataRow, sReComputeId, sFormulaIdType,  
2001 - // });  
2002 - // }  
2003 - // } else if (tableDataRow.bInverse) {  
2004 - // tableDataRow.dAuxiliaryQty = await commonBusiness.getFormulaValue({  
2005 - // token, sModelsId, masterData, tableDataRow, sComputeId: sReComputeId,  
2006 - // });  
2007 - // if (commonUtils.isNotEmptyArr(tableDataRow.dAuxiliaryQty) && tableDataRow.dAuxiliaryQty !== 0) {  
2008 - // tableDataRow.dProductQty = tableDataRow.dAuxiliaryQty;  
2009 - // }  
2010 - // }  
2011 - // if (!commonUtils.isEmpty(sReConversionComputeId)) {  
2012 - // tableDataRow.dConversionQty = await commonBusiness.getFormulaValue({  
2013 - // token, sModelsId, masterData, tableDataRow, sComputeId: sReConversionComputeId,  
2014 - // });  
2015 - // }  
2016 - // } else if (sFieldName === 'dAuxiliaryLossQty') {  
2017 - // const tableDataRowNew = { ...tableDataRow, dAuxiliaryQty: tableDataRow.dAuxiliaryLossQty };  
2018 - // if (commonUtils.isEmpty(sComputeId)) {  
2019 - // // tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, sFieldName, 'dLossQty');  
2020 - // tableDataRow.dLossQty = await commonBusiness.getFormulaValue({  
2021 - // token, sModelsId, masterData, tableDataRow: tableDataRowNew, sComputeId, sFormulaIdType,  
2022 - // });  
2023 - // } else {  
2024 - // tableDataRow.dLossQty = await commonBusiness.getFormulaValue({  
2025 - // token, sModelsId, masterData, tableDataRow: tableDataRowNew, sComputeId,  
2026 - // });  
2027 - // }  
2028 - // if (!commonUtils.isEmpty(tableDataRow.dSrcSurplusAuxiliaryQty)) {  
2029 - // tableDataRow.dAuxiliaryQty = tableDataRow.dSrcSurplusAuxiliaryQty - tableDataRow.dAuxiliaryLossQty;  
2030 - // tableDataRow.dMaterialsQty = commonUtils.convertFixNum(tableDataRow.dSrcSurplusQty - tableDataRow.dLossQty, 6);  
2031 - // }  
2032 - // } else if (sFieldName === 'dLossQty') {  
2033 - // const { sReComputeId } = tableDataRow;  
2034 - // const tableDataRowNew = { ...tableDataRow, dMaterialsQty: tableDataRow.dLossQty };  
2035 - // if (commonUtils.isEmpty(sReComputeId) && tableDataRow.bInverse) {  
2036 - // // tableDataRow = commonBusiness.getAuxiliaryQty(app, tableDataRow, sFieldName, 'dAuxiliaryLossQty');  
2037 - // tableDataRow.dAuxiliaryLossQty = await commonBusiness.getFormulaValue({  
2038 - // token, sModelsId, masterData, tableDataRow: tableDataRowNew, sReComputeId, sFormulaIdType,  
2039 - // });  
2040 - // } else {  
2041 - // tableDataRow.dAuxiliaryLossQty = await commonBusiness.getFormulaValue({  
2042 - // token, sModelsId, masterData, tableDataRow: tableDataRowNew, sComputeId: sReComputeId,  
2043 - // });  
2044 - // }  
2045 - // if (!commonUtils.isEmpty(tableDataRow.dSrcSurplusAuxiliaryQty)) {  
2046 - // tableDataRow.dAuxiliaryQty = tableDataRow.dSrcSurplusAuxiliaryQty - tableDataRow.dAuxiliaryLossQty;  
2047 - // tableDataRow.dMaterialsQty = tableDataRow.dSrcSurplusQty - tableDataRow.dLossQty;  
2048 - // }  
2049 - // } else if (sFieldName === 'sProcessId' || sFieldName === 'sProcessNo' || sFieldName === 'sProcessName') {  
2050 - // const sProcessId = changeValue.sProcessId;  
2051 - // const url = `${commonConfig.server_host}process/outsideprocess?sModelsId=${sModelsId}&sProcessId=${sProcessId}`;  
2052 - // const dataReturn = (await commonServices.getService(token, url)).data;  
2053 - // if (dataReturn.code === 1) {  
2054 - // if (commonUtils.isNotEmptyArr(dataReturn.dataset.rows)) {  
2055 - // tableDataRow.dMaterialsPrice = dataReturn.dataset.rows[0].dMaterialsPrice;  
2056 - // }  
2057 - // tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dMaterialsPrice', masterData, tableDataRow);  
2058 - // }  
2059 - // }  
2060 - // return tableDataRow;  
2061 - // } 1971 +
2062 const handleMaterialsChange = async (tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models) => { 1972 const handleMaterialsChange = async (tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models) => {
2063 const { sComputeId, sConversionComputeId, sReConversionComputeId } = tableDataRow; 1973 const { sComputeId, sConversionComputeId, sReConversionComputeId } = tableDataRow;
2064 // dAuxiliaryQty 1974 // dAuxiliaryQty
@@ -3758,6 +3668,7 @@ const useCommonBase = props => { @@ -3758,6 +3668,7 @@ const useCommonBase = props => {
3758 handleSqlDropDownNewRecord, 3668 handleSqlDropDownNewRecord,
3759 onChange: handleMasterChange, // 主表数据变化 3669 onChange: handleMasterChange, // 主表数据变化
3760 onDataChange: handleTableChange, // 表格数据变化 3670 onDataChange: handleTableChange, // 表格数据变化
  3671 + onMaterialsChange: handleMaterialsChange,
3761 onGetDataSet: handleGetDataSet, 3672 onGetDataSet: handleGetDataSet,
3762 onGetTreeDataSet: handleGetTreeDataSet, // 获取树型数据 3673 onGetTreeDataSet: handleGetTreeDataSet, // 获取树型数据
3763 onSaveState: handleSaveState, 3674 onSaveState: handleSaveState,
src/components/Common/CommonInstructSet.js
@@ -2395,7 +2395,7 @@ const utils = { @@ -2395,7 +2395,7 @@ const utils = {
2395 } 2395 }
2396 if (returnData.code === 1) { 2396 if (returnData.code === 1) {
2397 props.onSaveState({ 2397 props.onSaveState({
2398 - enabled: true, 2398 + enabled: false,
2399 currentId: masterData.sId, 2399 currentId: masterData.sId,
2400 loading: false, 2400 loading: false,
2401 isRefresh: true 2401 isRefresh: true
src/mes/common/commonModelComponent/index.js
@@ -338,12 +338,15 @@ const useCommonModelEvent = props => { @@ -338,12 +338,15 @@ const useCommonModelEvent = props => {
338 }, 338 },
339 [ 339 [
340 formData.length, 340 formData.length,
341 - ['production/productionReport', 'commonBill'].includes(sModelType) ? isRefresh : refreshCount, 341 + refreshCount,
342 noGetData, 342 noGetData,
343 JSON.stringify(sFilterConditions) 343 JSON.stringify(sFilterConditions)
344 ] 344 ]
345 ); 345 );
346 - 346 + useEffect(() => {
  347 + if (!isRefresh) return
  348 + handleRefresh()
  349 + }, [isRefresh])
347 350
348 // 初始化后执行一次指令集 351 // 初始化后执行一次指令集
349 useEffect( 352 useEffect(
src/mes/common/commonOperationBarComponent/MesToolbar.js
@@ -1019,7 +1019,7 @@ const handleSave = (props) => { @@ -1019,7 +1019,7 @@ const handleSave = (props) => {
1019 }, 1019 },
1020 inscallback: () => { 1020 inscallback: () => {
1021 props.onSaveState({ 1021 props.onSaveState({
1022 - currentId: props.masterData.sId,enabled:true 1022 + currentId: props.masterData.sId,enabled:false
1023 }); 1023 });
1024 } 1024 }
1025 }); 1025 });
src/mes/common/commonOperationBarComponent/index.js
@@ -737,12 +737,14 @@ const useCommonOperationBarComponentEvent = props => { @@ -737,12 +737,14 @@ const useCommonOperationBarComponentEvent = props => {
737 console.log("=====err", { tempData, str: sDefault, strNew, error }); 737 console.log("=====err", { tempData, str: sDefault, strNew, error });
738 } 738 }
739 } else if (props.bMesBill) { 739 } else if (props.bMesBill) {
  740 +
740 const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); 741 const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase();
  742 + console.log(btnName,props, 'btnName');
  743 +
741 if (props.enabled) { 744 if (props.enabled) {
742 if (["btnupd", 'btnevent', 'btnsubmit', 'btnsubmitcancel', 'btnexamine', 'btncancelexamine'].includes(btnName)) { 745 if (["btnupd", 'btnevent', 'btnsubmit', 'btnsubmitcancel', 'btnexamine', 'btncancelexamine'].includes(btnName)) {
743 defaultProps.disabled = true; 746 defaultProps.disabled = true;
744 } 747 }
745 - console.log(btnName, 'btnName');  
746 748
747 } else { 749 } else {
748 if (["btnsave", "btnscanface"].includes(btnName)) { 750 if (["btnsave", "btnscanface"].includes(btnName)) {