Commit 6d54586fbb69e48f3973108a16d531f404703e78

Authored by zhangzzzz
1 parent d8842ebf

优化websocket功能;

Too many changes to show.

To preserve performance only 17 of 26 files are displayed.

src/components/Common/CommonBillDeliverEvent.js
@@ -1418,46 +1418,17 @@ export default (ChildComponent) => { @@ -1418,46 +1418,17 @@ export default (ChildComponent) => {
1418 }); 1418 });
1419 return; 1419 return;
1420 } 1420 }
1421 - let timValue = 0;  
1422 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1423 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1424 - timValue = 3000;  
1425 - }  
1426 - const reset = (ws, config1) => {  
1427 - clearTimeout(config1.timerServer);  
1428 - clearTimeout(config1.serverTimer);  
1429 - start(ws, config1);  
1430 - };  
1431 - const start = (ws, config1) => {  
1432 - config1.timerServer = setTimeout(() => {  
1433 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: 'test' }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
1434 - ws.send(JSON.stringify(message));  
1435 - }, config1.timeoutServer); 1421 + this.props.app.webSocket.onmessageTmp = async (msg) => {
  1422 + const rtmsg = JSON.parse(msg.data);
  1423 + if (rtmsg.action === 'showMsg') {
  1424 + message.warning(rtmsg.msg);
  1425 + this.props.onSaveState({ loading: false });
  1426 + } else if (rtmsg.action === 'update') {
  1427 + await this.handleGetData(masterConfig, slaveConfig, checkConfig, 'update');
  1428 + this.props.onSaveState({ enabled: true, calculated: false, loading: false });
  1429 + }
1436 }; 1430 };
1437 - setTimeout(() => {  
1438 - this.props.app.webSocket.onmessage = async (msg) => {  
1439 - reset(this.props.app.webSocket, commonConfig);  
1440 - const rtmsg = JSON.parse(msg.data);  
1441 - if (rtmsg.action === 'showMsg') {  
1442 - message.warning(rtmsg.msg);  
1443 - this.props.onSaveState({ loading: false });  
1444 - } else if (rtmsg.action === 'loginOut') {  
1445 - if (location.pathname.indexOf('/indexOee') > -1) {  
1446 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1447 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1448 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1449 - } else {  
1450 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
1451 - }  
1452 - } else if (rtmsg.action === 'update') {  
1453 - await this.handleGetData(masterConfig, slaveConfig, checkConfig, 'update');  
1454 - this.props.onSaveState({ enabled: true, calculated: false, loading: false });  
1455 - } else if (this.props.app.webSocket.homeAction) {  
1456 - this.props.app.webSocket.homeAction(msg);  
1457 - }  
1458 - };  
1459 - this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);  
1460 - }, timValue); 1431 + this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);
1461 }; 1432 };
1462 /** 表单回带 */ 1433 /** 表单回带 */
1463 handleForm = (form) => { 1434 handleForm = (form) => {
src/components/Common/CommonBillEvent.js
@@ -2046,50 +2046,21 @@ export default (ChildComponent) => { @@ -2046,50 +2046,21 @@ export default (ChildComponent) => {
2046 }); 2046 });
2047 return; 2047 return;
2048 } 2048 }
2049 - let timValue = 0;  
2050 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
2051 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
2052 - timValue = 3000;  
2053 - }  
2054 - const reset = (ws, config1) => {  
2055 - clearTimeout(config1.timerServer);  
2056 - clearTimeout(config1.serverTimer);  
2057 - start(ws, config1);  
2058 - };  
2059 - const start = (ws, config1) => {  
2060 - config1.timerServer = setTimeout(() => {  
2061 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: 'test' }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
2062 - ws.send(JSON.stringify(message));  
2063 - }, config1.timeoutServer);  
2064 - };  
2065 - setTimeout(() => {  
2066 - this.props.app.webSocket.onmessage = async (msg) => {  
2067 - reset(this.props.app.webSocket, commonConfig);  
2068 - const rtmsg = JSON.parse(msg.data);  
2069 - if (rtmsg.action === 'showMsg') {  
2070 - message.warning(rtmsg.msg);  
2071 - this.props.onSaveState({ loading: false });  
2072 - } else if (rtmsg.action === 'loginOut') {  
2073 - if (location.pathname.indexOf('/indexOee') > -1) {  
2074 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
2075 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
2076 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
2077 - } else {  
2078 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
2079 - }  
2080 - } else if (rtmsg.action === 'update') {  
2081 - await this.handleGetData(masterConfig, slaveConfig, checkConfig,'update');  
2082 - if (cb && typeof cb === 'function') {  
2083 - this.props.onSaveState({ enabled: false, calculated: false }, () => { cb(); });  
2084 - } else {  
2085 - this.props.onSaveState({ enabled: true, calculated: false, loading: false });  
2086 - }  
2087 - } else if (this.props.app.webSocket.homeAction) {  
2088 - this.props.app.webSocket.homeAction(msg); 2049 + this.props.app.webSocket.onmessageTmp = async (msg) => {
  2050 + const rtmsg = JSON.parse(msg.data);
  2051 + if (rtmsg.action === 'showMsg') {
  2052 + message.warning(rtmsg.msg);
  2053 + this.props.onSaveState({ loading: false });
  2054 + } else if (rtmsg.action === 'update') {
  2055 + await this.handleGetData(masterConfig, slaveConfig, checkConfig,'update');
  2056 + if (cb && typeof cb === 'function') {
  2057 + this.props.onSaveState({ enabled: false, calculated: false }, () => { cb(); });
  2058 + } else {
  2059 + this.props.onSaveState({ enabled: true, calculated: false, loading: false });
2089 } 2060 }
2090 - };  
2091 - this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);  
2092 - }, timValue); 2061 + }
  2062 + };
  2063 + this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);
2093 }; 2064 };
2094 /** 表单回带 */ 2065 /** 表单回带 */
2095 handleForm = (form) => { 2066 handleForm = (form) => {
src/components/Common/CommonCheckBillEvent.js
@@ -1649,46 +1649,17 @@ export default (ChildComponent) => { @@ -1649,46 +1649,17 @@ export default (ChildComponent) => {
1649 }); 1649 });
1650 return; 1650 return;
1651 } 1651 }
1652 - let timValue = 0;  
1653 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1654 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1655 - timValue = 3000;  
1656 - }  
1657 - const reset = (ws, config1) => {  
1658 - clearTimeout(config1.timerServer);  
1659 - clearTimeout(config1.serverTimer);  
1660 - start(ws, config1);  
1661 - };  
1662 - const start = (ws, config1) => {  
1663 - config1.timerServer = setTimeout(() => {  
1664 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: 'test' }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
1665 - ws.send(JSON.stringify(message));  
1666 - }, config1.timeoutServer); 1652 + this.props.app.webSocket.onmessageTmp = async (msg) => {
  1653 + const rtmsg = JSON.parse(msg.data);
  1654 + if (rtmsg.action === 'showMsg') {
  1655 + message.warning(rtmsg.msg);
  1656 + this.props.onSaveState({ loading: false });
  1657 + } else if (rtmsg.action === 'update') {
  1658 + await this.handleGetData(masterConfig, slaveConfig, checkConfig, 'update');
  1659 + this.props.onSaveState({ enabled: true, calculated: false, loading: false });
  1660 + }
1667 }; 1661 };
1668 - setTimeout(() => {  
1669 - this.props.app.webSocket.onmessage = async (msg) => {  
1670 - reset(this.props.app.webSocket, commonConfig);  
1671 - const rtmsg = JSON.parse(msg.data);  
1672 - if (rtmsg.action === 'showMsg') {  
1673 - message.warning(rtmsg.msg);  
1674 - this.props.onSaveState({ loading: false });  
1675 - } else if (rtmsg.action === 'loginOut') {  
1676 - if (location.pathname.indexOf('/indexOee') > -1) {  
1677 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1678 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1679 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1680 - } else {  
1681 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
1682 - }  
1683 - } else if (rtmsg.action === 'update') {  
1684 - await this.handleGetData(masterConfig, slaveConfig, checkConfig, 'update');  
1685 - this.props.onSaveState({ enabled: true, calculated: false, loading: false });  
1686 - } else if (this.props.app.webSocket.homeAction) {  
1687 - this.props.app.webSocket.homeAction(msg);  
1688 - }  
1689 - };  
1690 - this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);  
1691 - }, timValue); 1662 + this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);
1692 }; 1663 };
1693 /** 表单回带 */ 1664 /** 表单回带 */
1694 handleForm = (form) => { 1665 handleForm = (form) => {
src/components/Common/CommonClassifyEvent.js
@@ -362,45 +362,16 @@ export default (ChildComponent) => { @@ -362,45 +362,16 @@ export default (ChildComponent) => {
362 return; 362 return;
363 } 363 }
364 this.handleGetData(slaveConfig, slaveFilterCondition, slavePagination.current, iPageSize, slaveOrderBy); 364 this.handleGetData(slaveConfig, slaveFilterCondition, slavePagination.current, iPageSize, slaveOrderBy);
365 - let timValue = 0;  
366 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
367 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
368 - timValue = 3000;  
369 - }  
370 - const reset = (ws, config1) => {  
371 - clearTimeout(config1.timerServer);  
372 - clearTimeout(config1.serverTimer);  
373 - start(ws, config1);  
374 - };  
375 - const start = (ws, config1) => {  
376 - config1.timerServer = setTimeout(() => {  
377 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: 'test' }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
378 - ws.send(JSON.stringify(message));  
379 - }, config1.timeoutServer); 365 + this.props.app.webSocket.onmessageTmp = (msg) => {
  366 + const rtmsg = JSON.parse(msg.data);
  367 + if (rtmsg.action === 'showMsg') {
  368 + message.warning(rtmsg.msg);
  369 + this.props.onSaveState({ loading: false });
  370 + } else if (rtmsg.action === 'update') {
  371 + this.props.onSaveState({ enabled: true, loading: false });
  372 + }
380 }; 373 };
381 - setTimeout(() => {  
382 - this.props.app.webSocket.onmessage = (msg) => {  
383 - reset(this.props.app.webSocket, commonConfig);  
384 - const rtmsg = JSON.parse(msg.data);  
385 - if (rtmsg.action === 'showMsg') {  
386 - message.warning(rtmsg.msg);  
387 - this.props.onSaveState({ loading: false });  
388 - } else if (rtmsg.action === 'loginOut') {  
389 - if (location.pathname.indexOf('/indexOee') > -1) {  
390 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
391 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
392 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
393 - } else {  
394 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
395 - }  
396 - } else if (rtmsg.action === 'update') {  
397 - this.props.onSaveState({ enabled: true, loading: false });  
398 - } else if (this.props.app.webSocket.homeAction) {  
399 - this.props.app.webSocket.homeAction(msg);  
400 - }  
401 - };  
402 - this.props.handleSendSocketMessage('update', 'showMsg', sModelsId, userinfo.sId, null, null); // 分类型不能以Id来,涉及到多条修改  
403 - }, timValue); 374 + this.props.handleSendSocketMessage('update', 'showMsg', sModelsId, userinfo.sId, null, null); // 分类型不能以Id来,涉及到多条修改
404 }; 375 };
405 /** 点击新增按钮操作 */ 376 /** 点击新增按钮操作 */
406 handleAdd = () => { 377 handleAdd = () => {
src/components/Common/CommonElementEvent.js
@@ -1990,53 +1990,23 @@ export default (ChildComponent) => { @@ -1990,53 +1990,23 @@ export default (ChildComponent) => {
1990 // sId: [sId], 1990 // sId: [sId],
1991 // }; 1991 // };
1992 // this.props.onSaveState({ pageLoading: true }); 1992 // this.props.onSaveState({ pageLoading: true });
1993 - const { masterData, bUserModel, dispatch } = this.props;  
1994 - let timValue = 0;  
1995 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1996 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1997 - timValue = 3000;  
1998 - }  
1999 - const reset = (ws, config1) => {  
2000 - clearTimeout(config1.timerServer);  
2001 - clearTimeout(config1.serverTimer);  
2002 - start(ws, config1);  
2003 - };  
2004 - const start = (ws, config1) => {  
2005 - config1.timerServer = setTimeout(() => {  
2006 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: 'test' }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
2007 - ws.send(JSON.stringify(message));  
2008 - }, config1.timeoutServer); 1993 + const { masterData, bUserModel } = this.props;
  1994 + this.props.app.webSocket.onmessageTmp = async (msg) => {
  1995 + const rtmsg = JSON.parse(msg.data);
  1996 + if (rtmsg.action === 'showMsg') {
  1997 + message.warning(rtmsg.msg);
  1998 + this.props.onSaveState({ loading: false });
  1999 + } else if (rtmsg.action === 'update') {
  2000 + await this.handleGetTableData('update');
  2001 + this.props.onSaveState({
  2002 + enabled: true,
  2003 + bUserModel,
  2004 + isEnabledPlcNo: (masterData?.iPlcNo === undefined || masterData?.iPlcNo === 0),
  2005 + loading: false,
  2006 + });
  2007 + }
2009 }; 2008 };
2010 - setTimeout(() => {  
2011 - this.props.app.webSocket.onmessage = async (msg) => {  
2012 - reset(this.props.app.webSocket, commonConfig);  
2013 - const rtmsg = JSON.parse(msg.data);  
2014 - if (rtmsg.action === 'showMsg') {  
2015 - message.warning(rtmsg.msg);  
2016 - this.props.onSaveState({ loading: false });  
2017 - } else if (rtmsg.action === 'loginOut') {  
2018 - if (location.pathname.indexOf('/indexOee') > -1) {  
2019 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
2020 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
2021 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
2022 - } else {  
2023 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
2024 - }  
2025 - } else if (rtmsg.action === 'update') {  
2026 - await this.handleGetTableData('update');  
2027 - this.props.onSaveState({  
2028 - enabled: true,  
2029 - bUserModel,  
2030 - isEnabledPlcNo: (masterData?.iPlcNo === undefined || masterData?.iPlcNo === 0),  
2031 - loading: false,  
2032 - });  
2033 - } else if (this.props.app.webSocket.homeAction) {  
2034 - this.props.app.webSocket.homeAction(msg);  
2035 - }  
2036 - // this.props.onSaveState({ pageLoading: false });  
2037 - };  
2038 - this.props.handleSendSocketMessage('update', 'showMsg', this.props.currentId, this.props.app.userinfo.sId, null, null);  
2039 - }, timValue); 2009 + this.props.handleSendSocketMessage('update', 'showMsg', this.props.currentId, this.props.app.userinfo.sId, null, null);
2040 // const url = `${commonConfig.server_host}business/addSysLocking?sModelsId=${sModelsId}`; 2010 // const url = `${commonConfig.server_host}business/addSysLocking?sModelsId=${sModelsId}`;
2041 // /* 接收返回值 */ 2011 // /* 接收返回值 */
2042 // const { data } = await commonServices.postValueService(token, value, url); 2012 // const { data } = await commonServices.postValueService(token, value, url);
src/components/Common/CommonGroupBillEvent.js
@@ -1112,53 +1112,24 @@ export default (ChildComponent) => { @@ -1112,53 +1112,24 @@ export default (ChildComponent) => {
1112 } 1112 }
1113 } 1113 }
1114 } 1114 }
1115 - let timValue = 0;  
1116 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1117 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1118 - timValue = 3000;  
1119 - }  
1120 - const reset = (ws, config1) => {  
1121 - clearTimeout(config1.timerServer);  
1122 - clearTimeout(config1.serverTimer);  
1123 - start(ws, config1);  
1124 - };  
1125 - const start = (ws, config1) => {  
1126 - config1.timerServer = setTimeout(() => {  
1127 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: 'test' }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
1128 - ws.send(JSON.stringify(message));  
1129 - }, config1.timeoutServer);  
1130 - };  
1131 - setTimeout(() => {  
1132 - this.props.app.webSocket.onmessage = async (msg) => {  
1133 - reset(this.props.app.webSocket, commonConfig);  
1134 - const rtmsg = JSON.parse(msg.data);  
1135 - if (rtmsg.action === 'showMsg') {  
1136 - message.warning(rtmsg.msg);  
1137 - this.props.onSaveState({ loading: false });  
1138 - } else if (rtmsg.action === 'loginOut') {  
1139 - if (location.pathname.indexOf('/indexOee') > -1) {  
1140 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1141 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1142 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1143 - } else {  
1144 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
1145 - }  
1146 - } else if (rtmsg.action === 'update') {  
1147 - await this.handleGetData(masterConfig, slaveConfig, slave0Config, slave1Config, slave2Config, slave3Config, slave4Config, 'update');  
1148 - this.props.onSaveState({ enabled: true, loading: false });  
1149 - const { slaveData } = this.props;  
1150 - if (commonUtils.isNotEmptyArr(slaveData)) {  
1151 - const selectRowKey = slaveData[0].sId;  
1152 - const selectRowKeyArr = [];  
1153 - selectRowKeyArr.push(selectRowKey);  
1154 - this.handleTableSelectRowChange('slave', selectRowKeyArr, slaveData);  
1155 - }  
1156 - } else if (this.props.app.webSocket.homeAction) {  
1157 - this.props.app.webSocket.homeAction(msg); 1115 + this.props.app.webSocket.onmessageTmp = async (msg) => {
  1116 + const rtmsg = JSON.parse(msg.data);
  1117 + if (rtmsg.action === 'showMsg') {
  1118 + message.warning(rtmsg.msg);
  1119 + this.props.onSaveState({ loading: false });
  1120 + } else if (rtmsg.action === 'update') {
  1121 + await this.handleGetData(masterConfig, slaveConfig, slave0Config, slave1Config, slave2Config, slave3Config, slave4Config, 'update');
  1122 + this.props.onSaveState({ enabled: true, loading: false });
  1123 + const { slaveData } = this.props;
  1124 + if (commonUtils.isNotEmptyArr(slaveData)) {
  1125 + const selectRowKey = slaveData[0].sId;
  1126 + const selectRowKeyArr = [];
  1127 + selectRowKeyArr.push(selectRowKey);
  1128 + this.handleTableSelectRowChange('slave', selectRowKeyArr, slaveData);
1158 } 1129 }
1159 - };  
1160 - this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);  
1161 - }, timValue); 1130 + }
  1131 + };
  1132 + this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);
1162 }; 1133 };
1163 1134
1164 /** 表单回带 */ 1135 /** 表单回带 */
src/components/Common/CommonListEditEvent.js
@@ -821,22 +821,14 @@ export default (ChildComponent) => { @@ -821,22 +821,14 @@ export default (ChildComponent) => {
821 /* 消息列表双击打开时 调用获取websocket消息 */ 821 /* 消息列表双击打开时 调用获取websocket消息 */
822 if (sModelsType === 'commonList/msg') { 822 if (sModelsType === 'commonList/msg') {
823 const { webSocket, userinfo } = app; 823 const { webSocket, userinfo } = app;
824 - const timValue = 2000;  
825 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
826 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
827 - }  
828 - setTimeout(() => {  
829 - webSocket.onmessage = async (msg) => {  
830 - const rtmsg = JSON.parse(msg.data);  
831 - if (rtmsg.action === 'showImg') {  
832 - const msgData = JSON.parse(msg.data);  
833 - dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } });  
834 - } else if (this.props.app.webSocket.homeAction) {  
835 - this.props.app.webSocket.homeAction(msg);  
836 - }  
837 - };  
838 - this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null);  
839 - }, timValue); 824 + webSocket.onmessageTmp = async (msg) => {
  825 + const rtmsg = JSON.parse(msg.data);
  826 + if (rtmsg.action === 'showImg') {
  827 + const msgData = JSON.parse(msg.data);
  828 + dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } });
  829 + }
  830 + };
  831 + this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null);
840 if (this.props.app.currentPane.refresh !== undefined) { 832 if (this.props.app.currentPane.refresh !== undefined) {
841 this.props.app.currentPane.refresh(); 833 this.props.app.currentPane.refresh();
842 } 834 }
@@ -1420,75 +1412,58 @@ export default (ChildComponent) => { @@ -1420,75 +1412,58 @@ export default (ChildComponent) => {
1420 sIdArray.push(item.sSlaveId); 1412 sIdArray.push(item.sSlaveId);
1421 } 1413 }
1422 }); 1414 });
1423 - let timValue = 0;  
1424 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1425 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1426 - timValue = 3000;  
1427 - }  
1428 - setTimeout(async () => {  
1429 - this.props.app.webSocket.onmessage = (msg) => {  
1430 - const rtmsg = JSON.parse(msg.data);  
1431 - if (rtmsg.action === 'execute') {  
1432 - if (rtmsg.msg === 'continue') {  
1433 - const { formRoute } = this.state;  
1434 - if (commonUtils.isNotEmptyArr(copyToData)) {  
1435 - const copyTo = {};  
1436 - copyTo.name = name;  
1437 - copyTo.config = copyToConfig;  
1438 - copyTo.masterData = copyToData[0];  
1439 - copyTo.slaveData = copyToData;  
1440 - copyTo.copyOtherData = addcopyOther;  
1441 - copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */  
1442 - dispatch({  
1443 - type: 'content/onRouter',  
1444 - payload: {  
1445 - url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */  
1446 - copyTo,  
1447 - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),  
1448 - sSrcModelsId: this.props.sModelsId,  
1449 - },  
1450 - });  
1451 - } else {  
1452 - message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据  
1453 - }  
1454 - } else {  
1455 - message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */  
1456 - }  
1457 - } else if (rtmsg.action === 'loginOut') {  
1458 - if (location.pathname.indexOf('/indexOee') > -1) {  
1459 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1460 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1461 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); 1415 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1416 + const rtmsg = JSON.parse(msg.data);
  1417 + if (rtmsg.action === 'execute') {
  1418 + if (rtmsg.msg === 'continue') {
  1419 + const { formRoute } = this.state;
  1420 + if (commonUtils.isNotEmptyArr(copyToData)) {
  1421 + const copyTo = {};
  1422 + copyTo.name = name;
  1423 + copyTo.config = copyToConfig;
  1424 + copyTo.masterData = copyToData[0];
  1425 + copyTo.slaveData = copyToData;
  1426 + copyTo.copyOtherData = addcopyOther;
  1427 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
  1428 + dispatch({
  1429 + type: 'content/onRouter',
  1430 + payload: {
  1431 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1432 + copyTo,
  1433 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  1434 + sSrcModelsId: this.props.sModelsId,
  1435 + },
  1436 + });
1462 } else { 1437 } else {
1463 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); 1438 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1464 } 1439 }
1465 - } else if (this.props.app.webSocket.homeAction) {  
1466 - this.props.app.webSocket.homeAction(msg);  
1467 - }  
1468 - };  
1469 - const sId = sIdArray.toString();  
1470 - const getData = this.handleGetData;  
1471 - const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`;  
1472 - const values = { sSlaveId: sId };  
1473 - const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;  
1474 - if (dataReturn.code === 1) {  
1475 - const sendSocketMessage = this.props.handleSendSocketMessage;  
1476 - if (dataReturn.dataset.rows.length > 0) {  
1477 - confirm({  
1478 - title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
1479 - onOk() {  
1480 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1481 - },  
1482 - onCancel() {  
1483 - },  
1484 - });  
1485 } else { 1440 } else {
1486 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 1441 + message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */
1487 } 1442 }
  1443 + }
  1444 + };
  1445 + const sId = sIdArray.toString();
  1446 + const getData = this.handleGetData;
  1447 + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`;
  1448 + const values = { sSlaveId: sId };
  1449 + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
  1450 + if (dataReturn.code === 1) {
  1451 + const sendSocketMessage = this.props.handleSendSocketMessage;
  1452 + if (dataReturn.dataset.rows.length > 0) {
  1453 + confirm({
  1454 + title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  1455 + onOk() {
  1456 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1457 + },
  1458 + onCancel() {
  1459 + },
  1460 + });
1488 } else { 1461 } else {
1489 - this.props.getServiceError(dataReturn); 1462 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
1490 } 1463 }
1491 - }, timValue); 1464 + } else {
  1465 + this.props.getServiceError(dataReturn);
  1466 + }
1492 } else { 1467 } else {
1493 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 1468 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1494 } 1469 }
@@ -1564,84 +1539,67 @@ export default (ChildComponent) => { @@ -1564,84 +1539,67 @@ export default (ChildComponent) => {
1564 sIdArray.push(item.sSlaveId); 1539 sIdArray.push(item.sSlaveId);
1565 } 1540 }
1566 }); 1541 });
1567 - let timValue = 0;  
1568 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1569 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1570 - timValue = 3000;  
1571 - }  
1572 - setTimeout(async () => {  
1573 - this.props.app.webSocket.onmessage = (msg) => {  
1574 - const rtmsg = JSON.parse(msg.data);  
1575 - if (rtmsg.action === 'execute') {  
1576 - if (rtmsg.msg === 'continue') {  
1577 - const { formRoute } = this.state;  
1578 - if (commonUtils.isNotEmptyArr(copyToData)) {  
1579 - const copyTo = {};  
1580 - copyTo.name = name;  
1581 - copyTo.config = copyToConfig;  
1582 - copyTo.masterData = copyToData[0];  
1583 - copyTo.slaveData = copyToData;  
1584 - copyTo.copyOtherData = addcopyOther;  
1585 - copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */  
1586 - dispatch({  
1587 - type: 'content/onRouter',  
1588 - payload: {  
1589 - url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */  
1590 - copyTo,  
1591 - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),  
1592 - sSrcModelsId: this.props.sModelsId,  
1593 - },  
1594 - });  
1595 - } else {  
1596 - message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据  
1597 - }  
1598 - } else {  
1599 - message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */  
1600 - }  
1601 - } else if (rtmsg.action === 'loginOut') {  
1602 - if (location.pathname.indexOf('/indexOee') > -1) {  
1603 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1604 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1605 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); 1542 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1543 + const rtmsg = JSON.parse(msg.data);
  1544 + if (rtmsg.action === 'execute') {
  1545 + if (rtmsg.msg === 'continue') {
  1546 + const { formRoute } = this.state;
  1547 + if (commonUtils.isNotEmptyArr(copyToData)) {
  1548 + const copyTo = {};
  1549 + copyTo.name = name;
  1550 + copyTo.config = copyToConfig;
  1551 + copyTo.masterData = copyToData[0];
  1552 + copyTo.slaveData = copyToData;
  1553 + copyTo.copyOtherData = addcopyOther;
  1554 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
  1555 + dispatch({
  1556 + type: 'content/onRouter',
  1557 + payload: {
  1558 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1559 + copyTo,
  1560 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  1561 + sSrcModelsId: this.props.sModelsId,
  1562 + },
  1563 + });
1606 } else { 1564 } else {
1607 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); 1565 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1608 } 1566 }
1609 - } else if (this.props.app.webSocket.homeAction) {  
1610 - this.props.app.webSocket.homeAction(msg);  
1611 - }  
1612 - };  
1613 - const sId = sIdArray.toString();  
1614 - const getData = this.handleGetData;  
1615 -  
1616 - const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName='/indexOee/commonOeeBill'`;  
1617 - const values = { sSlaveId: sId };  
1618 - const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;  
1619 - if (dataReturn.code === 1) {  
1620 - const sendSocketMessage = this.props.handleSendSocketMessage;  
1621 - if (dataReturn.dataset.rows.length > 0) {  
1622 - const { sId } = dataReturn.dataset.rows[0];  
1623 - if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */  
1624 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1625 - this.props.onSaveOeeState({ checkedId: sId });  
1626 - }  
1627 - // confirm({  
1628 - // title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
1629 - // onOk() {  
1630 - // sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1631 - // },  
1632 - // onCancel() {  
1633 - // },  
1634 - // });  
1635 } else { 1567 } else {
  1568 + message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */
  1569 + }
  1570 + }
  1571 + };
  1572 + const sId = sIdArray.toString();
  1573 + const getData = this.handleGetData;
  1574 +
  1575 + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName='/indexOee/commonOeeBill'`;
  1576 + const values = { sSlaveId: sId };
  1577 + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
  1578 + if (dataReturn.code === 1) {
  1579 + const sendSocketMessage = this.props.handleSendSocketMessage;
  1580 + if (dataReturn.dataset.rows.length > 0) {
  1581 + const { sId } = dataReturn.dataset.rows[0];
  1582 + if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */
1636 sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 1583 sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1584 + this.props.onSaveOeeState({ checkedId: sId });
1637 } 1585 }
  1586 + // confirm({
  1587 + // title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  1588 + // onOk() {
  1589 + // sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1590 + // },
  1591 + // onCancel() {
  1592 + // },
  1593 + // });
1638 } else { 1594 } else {
1639 - this.props.getServiceError(dataReturn);  
1640 - }  
1641 - if (callBack) {  
1642 - callBack(); 1595 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
1643 } 1596 }
1644 - }, timValue); 1597 + } else {
  1598 + this.props.getServiceError(dataReturn);
  1599 + }
  1600 + if (callBack) {
  1601 + callBack();
  1602 + }
1645 } else { 1603 } else {
1646 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 1604 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1647 } 1605 }
src/components/Common/CommonListEvent.js
@@ -787,22 +787,14 @@ export default (ChildComponent) => { @@ -787,22 +787,14 @@ export default (ChildComponent) => {
787 /* 消息列表双击打开时 调用获取websocket消息 */ 787 /* 消息列表双击打开时 调用获取websocket消息 */
788 if (sModelsType === 'commonList/msg') { 788 if (sModelsType === 'commonList/msg') {
789 const { webSocket, userinfo } = app; 789 const { webSocket, userinfo } = app;
790 - const timValue = 2000;  
791 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
792 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
793 - }  
794 - setTimeout(() => {  
795 - webSocket.onmessage = async (msg) => {  
796 - const rtmsg = JSON.parse(msg.data);  
797 - if (rtmsg.action === 'showImg') {  
798 - const msgData = JSON.parse(msg.data);  
799 - dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } });  
800 - } else if (this.props.app.webSocket.homeAction) {  
801 - this.props.app.webSocket.homeAction(msg);  
802 - }  
803 - };  
804 - this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null);  
805 - }, timValue); 790 + webSocket.onmessageTmp = async (msg) => {
  791 + const rtmsg = JSON.parse(msg.data);
  792 + if (rtmsg.action === 'showImg') {
  793 + const msgData = JSON.parse(msg.data);
  794 + dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } });
  795 + }
  796 + };
  797 + this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null);
806 if (this.props.app.currentPane.refresh !== undefined) { 798 if (this.props.app.currentPane.refresh !== undefined) {
807 this.props.app.currentPane.refresh(); 799 this.props.app.currentPane.refresh();
808 } 800 }
@@ -1809,83 +1801,66 @@ export default (ChildComponent) => { @@ -1809,83 +1801,66 @@ export default (ChildComponent) => {
1809 } 1801 }
1810 }); 1802 });
1811 } 1803 }
1812 - let timValue = 0;  
1813 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1814 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1815 - timValue = 3000;  
1816 - }  
1817 - setTimeout(async () => {  
1818 - this.props.app.webSocket.onmessage = (msg) => {  
1819 - const rtmsg = JSON.parse(msg.data);  
1820 - if (rtmsg.action === 'execute') {  
1821 - if (rtmsg.msg === 'continue') {  
1822 - const { formRoute } = this.state;  
1823 - if (commonUtils.isNotEmptyArr(copyToData)) {  
1824 - copyTo.name = name;  
1825 - copyTo.config = copyToConfig;  
1826 - if (name !== 'BtnCopyTo.workOrderToWorkOrder' && !name.includes('BtnCopyTo.tmpInfo') && !name.includes('btncopyto.tmpinfobysql')) {  
1827 - copyTo.masterData = copyToData[0];  
1828 - copyTo.slaveData = copyToData;  
1829 - copyTo.copyOtherData = addcopyOther;  
1830 - copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */  
1831 - }  
1832 - copyTo.copyToDataSid = sId?.split(',');  
1833 - dispatch({  
1834 - type: 'content/onRouter',  
1835 - payload: {  
1836 - url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */  
1837 - copyTo,  
1838 - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),  
1839 - sSrcModelsId: this.props.sModelsId,  
1840 - },  
1841 - });  
1842 - } else {  
1843 - message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 1804 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1805 + const rtmsg = JSON.parse(msg.data);
  1806 + if (rtmsg.action === 'execute') {
  1807 + if (rtmsg.msg === 'continue') {
  1808 + const { formRoute } = this.state;
  1809 + if (commonUtils.isNotEmptyArr(copyToData)) {
  1810 + copyTo.name = name;
  1811 + copyTo.config = copyToConfig;
  1812 + if (name !== 'BtnCopyTo.workOrderToWorkOrder' && !name.includes('BtnCopyTo.tmpInfo') && !name.includes('btncopyto.tmpinfobysql')) {
  1813 + copyTo.masterData = copyToData[0];
  1814 + copyTo.slaveData = copyToData;
  1815 + copyTo.copyOtherData = addcopyOther;
  1816 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
1844 } 1817 }
  1818 + copyTo.copyToDataSid = sId?.split(',');
  1819 + dispatch({
  1820 + type: 'content/onRouter',
  1821 + payload: {
  1822 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1823 + copyTo,
  1824 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  1825 + sSrcModelsId: this.props.sModelsId,
  1826 + },
  1827 + });
1845 } else { 1828 } else {
1846 - message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */  
1847 - }  
1848 - } else if (rtmsg.action === 'loginOut') {  
1849 - if (location.pathname.indexOf('/indexOee') > -1) {  
1850 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1851 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1852 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1853 - } else {  
1854 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); 1829 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1855 } 1830 }
1856 - } else if (this.props.app.webSocket.homeAction) {  
1857 - this.props.app.webSocket.homeAction(msg);  
1858 - }  
1859 - };  
1860 - let sId = sIdArray.toString();  
1861 - const getData = this.handleGetData;  
1862 - const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`;  
1863 - const values = { sSlaveId: sId };  
1864 - const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;  
1865 - if (dataReturn.code === 1) {  
1866 - const sendSocketMessage = this.props.handleSendSocketMessage;  
1867 - if (sIdArray?.length > 10) {  
1868 - sId = sIdArray?.[0];  
1869 - }  
1870 - if (dataReturn.dataset.rows.length > 0) {  
1871 - confirm({  
1872 - title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
1873 - onOk() {  
1874 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1875 - },  
1876 - onCancel() {  
1877 - },  
1878 - });  
1879 } else { 1831 } else {
1880 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 1832 + message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */
1881 } 1833 }
  1834 + }
  1835 + };
  1836 + let sId = sIdArray.toString();
  1837 + const getData = this.handleGetData;
  1838 + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`;
  1839 + const values = { sSlaveId: sId };
  1840 + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
  1841 + if (dataReturn.code === 1) {
  1842 + const sendSocketMessage = this.props.handleSendSocketMessage;
  1843 + if (sIdArray?.length > 10) {
  1844 + sId = sIdArray?.[0];
  1845 + }
  1846 + if (dataReturn.dataset.rows.length > 0) {
  1847 + confirm({
  1848 + title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  1849 + onOk() {
  1850 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1851 + },
  1852 + onCancel() {
  1853 + },
  1854 + });
1882 } else { 1855 } else {
1883 - this.props.getServiceError(dataReturn); 1856 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
1884 } 1857 }
1885 - this.props.onSaveState({  
1886 - loading: false,  
1887 - });  
1888 - }, timValue); 1858 + } else {
  1859 + this.props.getServiceError(dataReturn);
  1860 + }
  1861 + this.props.onSaveState({
  1862 + loading: false,
  1863 + });
1889 } else { 1864 } else {
1890 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 1865 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1891 this.props.onSaveState({ 1866 this.props.onSaveState({
@@ -1964,84 +1939,67 @@ export default (ChildComponent) => { @@ -1964,84 +1939,67 @@ export default (ChildComponent) => {
1964 sIdArray.push(item.sSlaveId); 1939 sIdArray.push(item.sSlaveId);
1965 } 1940 }
1966 }); 1941 });
1967 - let timValue = 0;  
1968 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1969 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1970 - timValue = 3000;  
1971 - }  
1972 - setTimeout(async () => {  
1973 - this.props.app.webSocket.onmessage = (msg) => {  
1974 - const rtmsg = JSON.parse(msg.data);  
1975 - if (rtmsg.action === 'execute') {  
1976 - if (rtmsg.msg === 'continue') {  
1977 - const { formRoute } = this.state;  
1978 - if (commonUtils.isNotEmptyArr(copyToData)) {  
1979 - const copyTo = {};  
1980 - copyTo.name = name;  
1981 - copyTo.config = copyToConfig;  
1982 - copyTo.masterData = copyToData[0];  
1983 - copyTo.slaveData = copyToData;  
1984 - copyTo.copyOtherData = addcopyOther;  
1985 - copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */  
1986 - dispatch({  
1987 - type: 'content/onRouter',  
1988 - payload: {  
1989 - url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */  
1990 - copyTo,  
1991 - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),  
1992 - sSrcModelsId: this.props.sModelsId,  
1993 - },  
1994 - });  
1995 - } else {  
1996 - message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据  
1997 - }  
1998 - } else {  
1999 - message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */  
2000 - }  
2001 - } else if (rtmsg.action === 'loginOut') {  
2002 - if (location.pathname.indexOf('/indexOee') > -1) {  
2003 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
2004 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
2005 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); 1942 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1943 + const rtmsg = JSON.parse(msg.data);
  1944 + if (rtmsg.action === 'execute') {
  1945 + if (rtmsg.msg === 'continue') {
  1946 + const { formRoute } = this.state;
  1947 + if (commonUtils.isNotEmptyArr(copyToData)) {
  1948 + const copyTo = {};
  1949 + copyTo.name = name;
  1950 + copyTo.config = copyToConfig;
  1951 + copyTo.masterData = copyToData[0];
  1952 + copyTo.slaveData = copyToData;
  1953 + copyTo.copyOtherData = addcopyOther;
  1954 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
  1955 + dispatch({
  1956 + type: 'content/onRouter',
  1957 + payload: {
  1958 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1959 + copyTo,
  1960 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  1961 + sSrcModelsId: this.props.sModelsId,
  1962 + },
  1963 + });
2006 } else { 1964 } else {
2007 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); 1965 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
2008 } 1966 }
2009 - } else if (this.props.app.webSocket.homeAction) {  
2010 - this.props.app.webSocket.homeAction(msg);  
2011 - }  
2012 - };  
2013 - const sId = sIdArray.toString();  
2014 - const getData = this.handleGetData;  
2015 -  
2016 - const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName='/indexOee/commonOeeBill'`;  
2017 - const values = { sSlaveId: sId };  
2018 - const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;  
2019 - if (dataReturn.code === 1) {  
2020 - const sendSocketMessage = this.props.handleSendSocketMessage;  
2021 - if (dataReturn.dataset.rows.length > 0) {  
2022 - const { sId } = dataReturn.dataset.rows[0];  
2023 - if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */  
2024 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
2025 - this.props.onSaveOeeState({ checkedId: sId });  
2026 - }  
2027 - // confirm({  
2028 - // title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
2029 - // onOk() {  
2030 - // sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
2031 - // },  
2032 - // onCancel() {  
2033 - // },  
2034 - // });  
2035 } else { 1967 } else {
  1968 + message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */
  1969 + }
  1970 + }
  1971 + };
  1972 + const sId = sIdArray.toString();
  1973 + const getData = this.handleGetData;
  1974 +
  1975 + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName='/indexOee/commonOeeBill'`;
  1976 + const values = { sSlaveId: sId };
  1977 + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
  1978 + if (dataReturn.code === 1) {
  1979 + const sendSocketMessage = this.props.handleSendSocketMessage;
  1980 + if (dataReturn.dataset.rows.length > 0) {
  1981 + const { sId } = dataReturn.dataset.rows[0];
  1982 + if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */
2036 sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 1983 sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1984 + this.props.onSaveOeeState({ checkedId: sId });
2037 } 1985 }
  1986 + // confirm({
  1987 + // title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  1988 + // onOk() {
  1989 + // sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1990 + // },
  1991 + // onCancel() {
  1992 + // },
  1993 + // });
2038 } else { 1994 } else {
2039 - this.props.getServiceError(dataReturn); 1995 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
2040 } 1996 }
2041 - if (callBack) {  
2042 - callBack();  
2043 - }  
2044 - }, timValue); 1997 + } else {
  1998 + this.props.getServiceError(dataReturn);
  1999 + }
  2000 + if (callBack) {
  2001 + callBack();
  2002 + }
2045 } else { 2003 } else {
2046 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 2004 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
2047 } 2005 }
src/components/Common/CommonListTabEvent.js
@@ -1195,22 +1195,14 @@ export default (ChildComponent) => { @@ -1195,22 +1195,14 @@ export default (ChildComponent) => {
1195 /* 消息列表双击打开时 调用获取websocket消息 */ 1195 /* 消息列表双击打开时 调用获取websocket消息 */
1196 if (sModelsType === 'commonList/msg') { 1196 if (sModelsType === 'commonList/msg') {
1197 const { webSocket, userinfo } = app; 1197 const { webSocket, userinfo } = app;
1198 - const timValue = 2000;  
1199 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1200 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1201 - }  
1202 - setTimeout(() => {  
1203 - webSocket.onmessage = async (msg) => {  
1204 - const rtmsg = JSON.parse(msg.data);  
1205 - if (rtmsg.action === 'showImg') {  
1206 - const msgData = JSON.parse(msg.data);  
1207 - dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } });  
1208 - } else if (this.props.app.webSocket.homeAction) {  
1209 - this.props.app.webSocket.homeAction(msg);  
1210 - }  
1211 - };  
1212 - this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null);  
1213 - }, timValue); 1198 + webSocket.onmessageTmp = async (msg) => {
  1199 + const rtmsg = JSON.parse(msg.data);
  1200 + if (rtmsg.action === 'showImg') {
  1201 + const msgData = JSON.parse(msg.data);
  1202 + dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } });
  1203 + }
  1204 + };
  1205 + this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null);
1214 if (this.props.app.currentPane.refresh !== undefined) { 1206 if (this.props.app.currentPane.refresh !== undefined) {
1215 this.props.app.currentPane.refresh(); 1207 this.props.app.currentPane.refresh();
1216 } 1208 }
@@ -1853,77 +1845,60 @@ export default (ChildComponent) => { @@ -1853,77 +1845,60 @@ export default (ChildComponent) => {
1853 sIdArray.push(item.sSlaveId); 1845 sIdArray.push(item.sSlaveId);
1854 } 1846 }
1855 }); 1847 });
1856 - let timValue = 0;  
1857 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1858 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1859 - timValue = 3000;  
1860 - }  
1861 - setTimeout(async () => {  
1862 - const tempData = JSON.parse(JSON.stringify(copyToData || []));  
1863 - this.props.app.webSocket.onmessage = (msg) => {  
1864 - const rtmsg = JSON.parse(msg.data);  
1865 - if (rtmsg.action === 'execute') {  
1866 - if (rtmsg.msg === 'continue') {  
1867 - const { formRoute } = this.state;  
1868 - if (commonUtils.isNotEmptyArr(tempData)) {  
1869 - copyTo.name = name;  
1870 - copyTo.config = copyToConfig;  
1871 - if(name !== 'ActOutsideProcessTemp') {  
1872 - copyTo.masterData = tempData[0];  
1873 - copyTo.slaveData = tempData;  
1874 - copyTo.copyOtherData = addcopyOther;  
1875 - }  
1876 - copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */  
1877 - dispatch({  
1878 - type: 'content/onRouter',  
1879 - payload: {  
1880 - url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */  
1881 - copyTo,  
1882 - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),  
1883 - sSrcModelsId: this.props.sModelsId,  
1884 - },  
1885 - });  
1886 - } else {  
1887 - message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 1848 + const tempData = JSON.parse(JSON.stringify(copyToData || []));
  1849 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1850 + const rtmsg = JSON.parse(msg.data);
  1851 + if (rtmsg.action === 'execute') {
  1852 + if (rtmsg.msg === 'continue') {
  1853 + const { formRoute } = this.state;
  1854 + if (commonUtils.isNotEmptyArr(tempData)) {
  1855 + copyTo.name = name;
  1856 + copyTo.config = copyToConfig;
  1857 + if(name !== 'ActOutsideProcessTemp') {
  1858 + copyTo.masterData = tempData[0];
  1859 + copyTo.slaveData = tempData;
  1860 + copyTo.copyOtherData = addcopyOther;
1888 } 1861 }
  1862 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
  1863 + dispatch({
  1864 + type: 'content/onRouter',
  1865 + payload: {
  1866 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1867 + copyTo,
  1868 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  1869 + sSrcModelsId: this.props.sModelsId,
  1870 + },
  1871 + });
1889 } else { 1872 } else {
1890 - message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */  
1891 - }  
1892 - } else if (rtmsg.action === 'loginOut') {  
1893 - if (location.pathname.indexOf('/indexOee') > -1) {  
1894 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1895 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1896 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1897 - } else {  
1898 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); 1873 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1899 } 1874 }
1900 - } else if (this.props.app.webSocket.homeAction) {  
1901 - this.props.app.webSocket.homeAction(msg);  
1902 - }  
1903 - };  
1904 - const sId = sIdArray.toString();  
1905 - const getData = this.handleGetData;  
1906 - const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`;  
1907 - const values = { sSlaveId: sId };  
1908 - const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;  
1909 - if (dataReturn.code === 1) {  
1910 - const sendSocketMessage = this.props.handleSendSocketMessage;  
1911 - if (dataReturn.dataset.rows.length > 0) {  
1912 - confirm({  
1913 - title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
1914 - onOk() {  
1915 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1916 - },  
1917 - onCancel() {  
1918 - },  
1919 - });  
1920 } else { 1875 } else {
1921 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 1876 + message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */
1922 } 1877 }
  1878 + }
  1879 + };
  1880 + const sId = sIdArray.toString();
  1881 + const getData = this.handleGetData;
  1882 + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`;
  1883 + const values = { sSlaveId: sId };
  1884 + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
  1885 + if (dataReturn.code === 1) {
  1886 + const sendSocketMessage = this.props.handleSendSocketMessage;
  1887 + if (dataReturn.dataset.rows.length > 0) {
  1888 + confirm({
  1889 + title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  1890 + onOk() {
  1891 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1892 + },
  1893 + onCancel() {
  1894 + },
  1895 + });
1923 } else { 1896 } else {
1924 - this.props.getServiceError(dataReturn); 1897 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
1925 } 1898 }
1926 - }, timValue); 1899 + } else {
  1900 + this.props.getServiceError(dataReturn);
  1901 + }
1927 } else { 1902 } else {
1928 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 1903 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1929 } 1904 }
@@ -1999,84 +1974,67 @@ export default (ChildComponent) => { @@ -1999,84 +1974,67 @@ export default (ChildComponent) => {
1999 sIdArray.push(item.sSlaveId); 1974 sIdArray.push(item.sSlaveId);
2000 } 1975 }
2001 }); 1976 });
2002 - let timValue = 0;  
2003 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
2004 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
2005 - timValue = 3000;  
2006 - }  
2007 - setTimeout(async () => {  
2008 - this.props.app.webSocket.onmessage = (msg) => {  
2009 - const rtmsg = JSON.parse(msg.data);  
2010 - if (rtmsg.action === 'execute') {  
2011 - if (rtmsg.msg === 'continue') {  
2012 - const { formRoute } = this.state;  
2013 - if (commonUtils.isNotEmptyArr(copyToData)) {  
2014 - const copyTo = {};  
2015 - copyTo.name = name;  
2016 - copyTo.config = copyToConfig;  
2017 - copyTo.masterData = copyToData[0];  
2018 - copyTo.slaveData = copyToData;  
2019 - copyTo.copyOtherData = addcopyOther;  
2020 - copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */  
2021 - dispatch({  
2022 - type: 'content/onRouter',  
2023 - payload: {  
2024 - url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */  
2025 - copyTo,  
2026 - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),  
2027 - sSrcModelsId: this.props.sModelsId,  
2028 - },  
2029 - });  
2030 - } else {  
2031 - message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据  
2032 - }  
2033 - } else {  
2034 - message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */  
2035 - }  
2036 - } else if (rtmsg.action === 'loginOut') {  
2037 - if (location.pathname.indexOf('/indexOee') > -1) {  
2038 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
2039 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
2040 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); 1977 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1978 + const rtmsg = JSON.parse(msg.data);
  1979 + if (rtmsg.action === 'execute') {
  1980 + if (rtmsg.msg === 'continue') {
  1981 + const { formRoute } = this.state;
  1982 + if (commonUtils.isNotEmptyArr(copyToData)) {
  1983 + const copyTo = {};
  1984 + copyTo.name = name;
  1985 + copyTo.config = copyToConfig;
  1986 + copyTo.masterData = copyToData[0];
  1987 + copyTo.slaveData = copyToData;
  1988 + copyTo.copyOtherData = addcopyOther;
  1989 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
  1990 + dispatch({
  1991 + type: 'content/onRouter',
  1992 + payload: {
  1993 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1994 + copyTo,
  1995 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  1996 + sSrcModelsId: this.props.sModelsId,
  1997 + },
  1998 + });
2041 } else { 1999 } else {
2042 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
2043 - }  
2044 - } else if (this.props.app.webSocket.homeAction) {  
2045 - this.props.app.webSocket.homeAction(msg);  
2046 - }  
2047 - };  
2048 - const sId = sIdArray.toString();  
2049 - const getData = this.handleGetData;  
2050 -  
2051 - const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName='/indexOee/commonOeeBill'`;  
2052 - const values = { sSlaveId: sId };  
2053 - const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;  
2054 - if (dataReturn.code === 1) {  
2055 - const sendSocketMessage = this.props.handleSendSocketMessage;  
2056 - if (dataReturn.dataset.rows.length > 0) {  
2057 - const { sId } = dataReturn.dataset.rows[0];  
2058 - if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */  
2059 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
2060 - this.props.onSaveOeeState({ checkedId: sId }); 2000 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
2061 } 2001 }
2062 - // confirm({  
2063 - // title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
2064 - // onOk() {  
2065 - // sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
2066 - // },  
2067 - // onCancel() {  
2068 - // },  
2069 - // });  
2070 } else { 2002 } else {
  2003 + message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */
  2004 + }
  2005 + }
  2006 + };
  2007 + const sId = sIdArray.toString();
  2008 + const getData = this.handleGetData;
  2009 +
  2010 + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName='/indexOee/commonOeeBill'`;
  2011 + const values = { sSlaveId: sId };
  2012 + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
  2013 + if (dataReturn.code === 1) {
  2014 + const sendSocketMessage = this.props.handleSendSocketMessage;
  2015 + if (dataReturn.dataset.rows.length > 0) {
  2016 + const { sId } = dataReturn.dataset.rows[0];
  2017 + if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */
2071 sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 2018 sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  2019 + this.props.onSaveOeeState({ checkedId: sId });
2072 } 2020 }
  2021 + // confirm({
  2022 + // title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  2023 + // onOk() {
  2024 + // sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  2025 + // },
  2026 + // onCancel() {
  2027 + // },
  2028 + // });
2073 } else { 2029 } else {
2074 - this.props.getServiceError(dataReturn);  
2075 - }  
2076 - if (callBack) {  
2077 - callBack(); 2030 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
2078 } 2031 }
2079 - }, timValue); 2032 + } else {
  2033 + this.props.getServiceError(dataReturn);
  2034 + }
  2035 + if (callBack) {
  2036 + callBack();
  2037 + }
2080 } else { 2038 } else {
2081 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 2039 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
2082 } 2040 }
src/components/Common/CommonListTreeEvent.js
@@ -434,22 +434,14 @@ export default (ChildComponent) => { @@ -434,22 +434,14 @@ export default (ChildComponent) => {
434 /* 消息列表双击打开时 调用获取websocket消息 */ 434 /* 消息列表双击打开时 调用获取websocket消息 */
435 if (sModelsType === 'commonList/msg') { 435 if (sModelsType === 'commonList/msg') {
436 const { webSocket, userinfo } = app; 436 const { webSocket, userinfo } = app;
437 - const timValue = 2000;  
438 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
439 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
440 - }  
441 - setTimeout(() => {  
442 - webSocket.onmessage = async (msg) => {  
443 - const rtmsg = JSON.parse(msg.data);  
444 - if (rtmsg.action === 'showImg') {  
445 - const msgData = JSON.parse(msg.data);  
446 - dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } });  
447 - } else if (this.props.app.webSocket.homeAction) {  
448 - this.props.app.webSocket.homeAction(msg);  
449 - }  
450 - };  
451 - this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null);  
452 - }, timValue); 437 + webSocket.onmessageTmp = async (msg) => {
  438 + const rtmsg = JSON.parse(msg.data);
  439 + if (rtmsg.action === 'showImg') {
  440 + const msgData = JSON.parse(msg.data);
  441 + dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } });
  442 + }
  443 + };
  444 + this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null);
453 if (this.props.app.currentPane.refresh !== undefined) { 445 if (this.props.app.currentPane.refresh !== undefined) {
454 this.props.app.currentPane.refresh(); 446 this.props.app.currentPane.refresh();
455 } 447 }
@@ -1243,76 +1235,59 @@ export default (ChildComponent) => { @@ -1243,76 +1235,59 @@ export default (ChildComponent) => {
1243 sIdArray.push(item.sId); 1235 sIdArray.push(item.sId);
1244 } 1236 }
1245 }); 1237 });
1246 - let timValue = 0;  
1247 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1248 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1249 - timValue = 3000;  
1250 - }  
1251 - setTimeout(async () => {  
1252 - this.props.app.webSocket.onmessage = (msg) => {  
1253 - const rtmsg = JSON.parse(msg.data);  
1254 - if (rtmsg.action === 'execute') {  
1255 - if (rtmsg.msg === 'continue') {  
1256 - const { formRoute } = this.state;  
1257 - if (commonUtils.isNotEmptyArr(copyToData)) {  
1258 - copyTo.name = name;  
1259 - copyTo.config = copyToConfig;  
1260 - if (!name.includes('BtnCopyTo.copyToOrder') && !name.includes('BtnCopyTo.tmpInfo')) {  
1261 - copyTo.masterData = copyToData[0];  
1262 - copyTo.slaveData = copyToData;  
1263 - copyTo.copyOtherData = addcopyOther;  
1264 - }  
1265 - copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */  
1266 - dispatch({  
1267 - type: 'content/onRouter',  
1268 - payload: {  
1269 - url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */  
1270 - copyTo,  
1271 - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),  
1272 - sSrcModelsId: this.props.sModelsId,  
1273 - },  
1274 - });  
1275 - } else {  
1276 - message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 1238 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1239 + const rtmsg = JSON.parse(msg.data);
  1240 + if (rtmsg.action === 'execute') {
  1241 + if (rtmsg.msg === 'continue') {
  1242 + const { formRoute } = this.state;
  1243 + if (commonUtils.isNotEmptyArr(copyToData)) {
  1244 + copyTo.name = name;
  1245 + copyTo.config = copyToConfig;
  1246 + if (!name.includes('BtnCopyTo.copyToOrder') && !name.includes('BtnCopyTo.tmpInfo')) {
  1247 + copyTo.masterData = copyToData[0];
  1248 + copyTo.slaveData = copyToData;
  1249 + copyTo.copyOtherData = addcopyOther;
1277 } 1250 }
  1251 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
  1252 + dispatch({
  1253 + type: 'content/onRouter',
  1254 + payload: {
  1255 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1256 + copyTo,
  1257 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  1258 + sSrcModelsId: this.props.sModelsId,
  1259 + },
  1260 + });
1278 } else { 1261 } else {
1279 - message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */  
1280 - }  
1281 - } else if (rtmsg.action === 'loginOut') {  
1282 - if (location.pathname.indexOf('/indexOee') > -1) {  
1283 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1284 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1285 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1286 - } else {  
1287 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); 1262 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1288 } 1263 }
1289 - } else if (this.props.app.webSocket.homeAction) {  
1290 - this.props.app.webSocket.homeAction(msg);  
1291 - }  
1292 - };  
1293 - const sId = sIdArray.toString();  
1294 - const getData = this.handleGetData;  
1295 - const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`;  
1296 - const values = { sSlaveId: sId };  
1297 - const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;  
1298 - if (dataReturn.code === 1) {  
1299 - const sendSocketMessage = this.props.handleSendSocketMessage;  
1300 - if (dataReturn.dataset.rows.length > 0) {  
1301 - confirm({  
1302 - title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
1303 - onOk() {  
1304 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1305 - },  
1306 - onCancel() {  
1307 - },  
1308 - });  
1309 } else { 1264 } else {
1310 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 1265 + message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */
1311 } 1266 }
  1267 + }
  1268 + };
  1269 + const sId = sIdArray.toString();
  1270 + const getData = this.handleGetData;
  1271 + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`;
  1272 + const values = { sSlaveId: sId };
  1273 + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
  1274 + if (dataReturn.code === 1) {
  1275 + const sendSocketMessage = this.props.handleSendSocketMessage;
  1276 + if (dataReturn.dataset.rows.length > 0) {
  1277 + confirm({
  1278 + title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  1279 + onOk() {
  1280 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1281 + },
  1282 + onCancel() {
  1283 + },
  1284 + });
1312 } else { 1285 } else {
1313 - this.props.getServiceError(dataReturn); 1286 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
1314 } 1287 }
1315 - }, timValue); 1288 + } else {
  1289 + this.props.getServiceError(dataReturn);
  1290 + }
1316 } else { 1291 } else {
1317 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 1292 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1318 } 1293 }
src/components/Common/CommonNewBillEvent.js
@@ -1436,46 +1436,17 @@ export default ChildComponent => { @@ -1436,46 +1436,17 @@ export default ChildComponent => {
1436 } 1436 }
1437 } 1437 }
1438 } 1438 }
1439 - let timValue = 0;  
1440 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1441 - this.props.dispatch({ type: "app/createWebSocket", payload: { reStart: true, dispatch } });  
1442 - timValue = 3000;  
1443 - }  
1444 - const reset = (ws, config1) => {  
1445 - clearTimeout(config1.timerServer);  
1446 - clearTimeout(config1.serverTimer);  
1447 - start(ws, config1);  
1448 - };  
1449 - const start = (ws, config1) => {  
1450 - config1.timerServer = setTimeout(() => {  
1451 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: "test" }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
1452 - ws.send(JSON.stringify(message));  
1453 - }, config1.timeoutServer); 1439 + this.props.app.webSocket.onmessageTmp = async msg => {
  1440 + const rtmsg = JSON.parse(msg.data);
  1441 + if (rtmsg.action === "showMsg") {
  1442 + message.warning(rtmsg.msg);
  1443 + this.props.onSaveState({ loading: false });
  1444 + } else if (rtmsg.action === "update") {
  1445 + await this.handleGetData(masterConfig, slaveConfig, slave0Config, slave1Config, slave2Config, slave3Config, slave4Config, "update");
  1446 + this.props.onSaveState({ enabled: true, loading: false });
  1447 + }
1454 }; 1448 };
1455 - setTimeout(() => {  
1456 - this.props.app.webSocket.onmessage = async msg => {  
1457 - reset(this.props.app.webSocket, commonConfig);  
1458 - const rtmsg = JSON.parse(msg.data);  
1459 - if (rtmsg.action === "showMsg") {  
1460 - message.warning(rtmsg.msg);  
1461 - this.props.onSaveState({ loading: false });  
1462 - } else if (rtmsg.action === "loginOut") {  
1463 - if (location.pathname.indexOf("/indexOee") > -1) {  
1464 - dispatch({ type: "app/throwErrorOee", payload: { code: -2, msg: rtmsg.msg } });  
1465 - } else if (location.pathname.indexOf("/indexMobile") > -1) {  
1466 - dispatch({ type: "app/throwErrorMobile", payload: { code: -2, msg: rtmsg.msg } });  
1467 - } else {  
1468 - dispatch({ type: "app/throwError", payload: { code: -2, msg: rtmsg.msg } });  
1469 - }  
1470 - } else if (rtmsg.action === "update") {  
1471 - await this.handleGetData(masterConfig, slaveConfig, slave0Config, slave1Config, slave2Config, slave3Config, slave4Config, "update");  
1472 - this.props.onSaveState({ enabled: true, loading: false });  
1473 - } else if (this.props.app.webSocket.homeAction) {  
1474 - this.props.app.webSocket.homeAction(msg);  
1475 - }  
1476 - };  
1477 - this.props.handleSendSocketMessage("update", "showMsg", currentId, userinfo.sId, null, null);  
1478 - }, timValue); 1449 + this.props.handleSendSocketMessage("update", "showMsg", currentId, userinfo.sId, null, null);
1479 }; 1450 };
1480 1451
1481 /** 表单回带 */ 1452 /** 表单回带 */
src/components/Common/CommonNewTabBillEvent.js
@@ -1517,98 +1517,69 @@ export default (ChildComponent) => { @@ -1517,98 +1517,69 @@ export default (ChildComponent) => {
1517 } 1517 }
1518 } 1518 }
1519 } 1519 }
1520 - let timValue = 0;  
1521 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1522 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1523 - timValue = 3000;  
1524 - }  
1525 - const reset = (ws, config1) => {  
1526 - clearTimeout(config1.timerServer);  
1527 - clearTimeout(config1.serverTimer);  
1528 - start(ws, config1);  
1529 - };  
1530 - const start = (ws, config1) => {  
1531 - config1.timerServer = setTimeout(() => {  
1532 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: 'test' }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
1533 - ws.send(JSON.stringify(message));  
1534 - }, config1.timeoutServer);  
1535 - };  
1536 - setTimeout(() => {  
1537 - this.props.app.webSocket.onmessage = async (msg) => {  
1538 - reset(this.props.app.webSocket, commonConfig);  
1539 - const rtmsg = JSON.parse(msg.data);  
1540 - if (rtmsg.action === 'showMsg') {  
1541 - message.warning(rtmsg.msg);  
1542 - this.props.onSaveState({ loading: false });  
1543 - } else if (rtmsg.action === 'loginOut') {  
1544 - if (location.pathname.indexOf('/indexOee') > -1) {  
1545 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1546 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1547 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1548 - } else {  
1549 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
1550 - }  
1551 - } else if (rtmsg.action === 'update') {  
1552 - if (formRoute === '/indexPage/commonCostomTabBill') {  
1553 - if(commonUtils.isNotEmptyArr(configArr)) {  
1554 - const queryConfigArr = configArr.filter(([_, config]) => config.sSqlStr !== 'noQuery');  
1555 - addState.queryConfigArr = queryConfigArr;  
1556 - addReturn = this.handleGetData1(queryConfigArr,undefined, { type: 'init'}, true);  
1557 - const materialsConfigArr = formData.filter(item => item.sTbName === 'salsalesordermaterials' &&  
1558 - (item.showName === "工序物料" || item.showName === "全部材料")) || [];  
1559 - /* 获取物料数据 */  
1560 - if(commonUtils.isNotEmptyArr(materialsConfigArr)) {  
1561 - this.handleGetTableData(this.props, 'materials');  
1562 - }  
1563 - const revisionArr = formData.filter(item => item.sTbName === 'salsalesorderrevision' && item.showName === "改版处") || [];  
1564 - /* 获取物料数据 */  
1565 - if(commonUtils.isNotEmptyArr(revisionArr)) {  
1566 - this.handleGetTableData(this.props, 'revision'); 1520 + this.props.app.webSocket.onmessageTmp = async (msg) => {
  1521 + const rtmsg = JSON.parse(msg.data);
  1522 + if (rtmsg.action === 'showMsg') {
  1523 + message.warning(rtmsg.msg);
  1524 + this.props.onSaveState({ loading: false });
  1525 + } else if (rtmsg.action === 'update') {
  1526 + if (formRoute === '/indexPage/commonCostomTabBill') {
  1527 + if(commonUtils.isNotEmptyArr(configArr)) {
  1528 + const queryConfigArr = configArr.filter(([_, config]) => config.sSqlStr !== 'noQuery');
  1529 + addState.queryConfigArr = queryConfigArr;
  1530 + addReturn = this.handleGetData1(queryConfigArr,undefined, { type: 'init'}, true);
  1531 + const materialsConfigArr = formData.filter(item => item.sTbName === 'salsalesordermaterials' &&
  1532 + (item.showName === "工序物料" || item.showName === "全部材料")) || [];
  1533 + /* 获取物料数据 */
  1534 + if(commonUtils.isNotEmptyArr(materialsConfigArr)) {
  1535 + this.handleGetTableData(this.props, 'materials');
  1536 + }
  1537 + const revisionArr = formData.filter(item => item.sTbName === 'salsalesorderrevision' && item.showName === "改版处") || [];
  1538 + /* 获取物料数据 */
  1539 + if(commonUtils.isNotEmptyArr(revisionArr)) {
  1540 + this.handleGetTableData(this.props, 'revision');
  1541 + }
  1542 + const dataRelationJson = {};
  1543 + const relateRelationJson = {};
  1544 + const noQueryConfigArr = configArr.filter(([_, config]) => config.sSqlStr === 'noQuery');
  1545 + noQueryConfigArr.forEach(item => {
  1546 + const [name, config] = item;
  1547 + const { sTbName } = config;
  1548 + const iIndex = queryConfigArr.findIndex(item => item[1].sTbName === sTbName);
  1549 + if (iIndex !== -1) {
  1550 + dataRelationJson[name] = queryConfigArr[iIndex][0];
1567 } 1551 }
1568 - const dataRelationJson = {};  
1569 - const relateRelationJson = {};  
1570 - const noQueryConfigArr = configArr.filter(([_, config]) => config.sSqlStr === 'noQuery');  
1571 - noQueryConfigArr.forEach(item => {  
1572 - const [name, config] = item;  
1573 - const { sTbName } = config; 1552 + });
  1553 + const childMaterialsInfoArr = formData.filter(item => item.sSqlStr === 'noQuery' && item.showName.includes("物料信息") )|| [];
  1554 + if(commonUtils.isNotEmptyArr(childMaterialsInfoArr)) {
  1555 + relateRelationJson['slave3Child0'] = 'materials';
  1556 + }
  1557 + /* 上批数据逻辑处理 */
  1558 + const childNoQueryConfigArr = formData.filter(item => item.sSqlStr === 'noQuery' && (item.showName.includes("对比") || item.showName.includes("上批"))) || [];
  1559 + if(commonUtils.isNotEmptyArr(childNoQueryConfigArr)) {
  1560 + childNoQueryConfigArr.forEach(itemChild => {
  1561 + const { sTbName } = itemChild;
1574 const iIndex = queryConfigArr.findIndex(item => item[1].sTbName === sTbName); 1562 const iIndex = queryConfigArr.findIndex(item => item[1].sTbName === sTbName);
1575 if (iIndex !== -1) { 1563 if (iIndex !== -1) {
  1564 + const arr = itemChild.sGrd.split('_');
  1565 + const num = arr.length > 0 && Number(arr[1]) -1;
  1566 + const name = arr[0]+'Child'+ num +'Child0';
1576 dataRelationJson[name] = queryConfigArr[iIndex][0]; 1567 dataRelationJson[name] = queryConfigArr[iIndex][0];
1577 } 1568 }
1578 }); 1569 });
1579 - const childMaterialsInfoArr = formData.filter(item => item.sSqlStr === 'noQuery' && item.showName.includes("物料信息") )|| [];  
1580 - if(commonUtils.isNotEmptyArr(childMaterialsInfoArr)) {  
1581 - relateRelationJson['slave3Child0'] = 'materials';  
1582 - }  
1583 - /* 上批数据逻辑处理 */  
1584 - const childNoQueryConfigArr = formData.filter(item => item.sSqlStr === 'noQuery' && (item.showName.includes("对比") || item.showName.includes("上批"))) || [];  
1585 - if(commonUtils.isNotEmptyArr(childNoQueryConfigArr)) {  
1586 - childNoQueryConfigArr.forEach(itemChild => {  
1587 - const { sTbName } = itemChild;  
1588 - const iIndex = queryConfigArr.findIndex(item => item[1].sTbName === sTbName);  
1589 - if (iIndex !== -1) {  
1590 - const arr = itemChild.sGrd.split('_');  
1591 - const num = arr.length > 0 && Number(arr[1]) -1;  
1592 - const name = arr[0]+'Child'+ num +'Child0';  
1593 - dataRelationJson[name] = queryConfigArr[iIndex][0];  
1594 - }  
1595 - });  
1596 - }  
1597 - addState.dataRelationJson = dataRelationJson;  
1598 - addState.relateRelationJson = relateRelationJson;  
1599 - addState.processCardUpdate = true;  
1600 - // addState.slave3Child0InfoData = [];  
1601 } 1570 }
1602 - }else {  
1603 - await this.handleGetData(masterConfig, slaveConfig, slave0Config, slave1Config, slave2Config, slave3Config, slave4Config, 'update'); 1571 + addState.dataRelationJson = dataRelationJson;
  1572 + addState.relateRelationJson = relateRelationJson;
  1573 + addState.processCardUpdate = true;
  1574 + // addState.slave3Child0InfoData = [];
1604 } 1575 }
1605 - this.props.onSaveState({ enabled: true, loading: false , ...addReturn, ...addState });  
1606 - } else if (this.props.app.webSocket.homeAction) {  
1607 - this.props.app.webSocket.homeAction(msg); 1576 + }else {
  1577 + await this.handleGetData(masterConfig, slaveConfig, slave0Config, slave1Config, slave2Config, slave3Config, slave4Config, 'update');
1608 } 1578 }
1609 - };  
1610 - this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);  
1611 - }, timValue); 1579 + this.props.onSaveState({ enabled: true, loading: false , ...addReturn, ...addState });
  1580 + }
  1581 + };
  1582 + this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);
1612 }; 1583 };
1613 1584
1614 /** 表单回带 */ 1585 /** 表单回带 */
src/components/Common/CommonSubBillEvent.js
@@ -1829,52 +1829,23 @@ export default (ChildComponent) => { @@ -1829,52 +1829,23 @@ export default (ChildComponent) => {
1829 }); 1829 });
1830 return; 1830 return;
1831 } 1831 }
1832 - let timValue = 0;  
1833 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1834 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1835 - timValue = 3000;  
1836 - }  
1837 - const reset = (ws, config1) => {  
1838 - clearTimeout(config1.timerServer);  
1839 - clearTimeout(config1.serverTimer);  
1840 - start(ws, config1);  
1841 - };  
1842 - const start = (ws, config1) => {  
1843 - config1.timerServer = setTimeout(() => {  
1844 - const message = { sendFrom: this.props.app.userinfo.sId, connectTest: 'test' }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值  
1845 - ws.send(JSON.stringify(message));  
1846 - }, config1.timeoutServer);  
1847 - };  
1848 - setTimeout(() => {  
1849 - this.props.app.webSocket.onmessage = async (msg) => {  
1850 - reset(this.props.app.webSocket, commonConfig);  
1851 - const rtmsg = JSON.parse(msg.data);  
1852 - if (rtmsg.action === 'showMsg') {  
1853 - message.warning(rtmsg.msg);  
1854 - this.props.onSaveState({ loading: false });  
1855 - } else if (rtmsg.action === 'loginOut') {  
1856 - if (location.pathname.indexOf('/indexOee') > -1) {  
1857 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1858 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1859 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1860 - } else {  
1861 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
1862 - }  
1863 - } else if (rtmsg.action === 'update') {  
1864 - await this.handleGetData(masterConfig, slaveConfig, checkConfig, 'update');  
1865 - if(commonUtils.isNotEmptyObject(slaveChildConfig)) {  
1866 - await this.handleGetOneMemoData('slaveChild', slaveChildConfig);  
1867 - }  
1868 - if(commonUtils.isNotEmptyObject(slave0Config)) {  
1869 - await this.handleGetOneMemoData('slave0', slave0Config);  
1870 - }  
1871 - this.props.onSaveState({ enabled: true, calculated: false, loading: false });  
1872 - } else if (this.props.app.webSocket.homeAction) {  
1873 - this.props.app.webSocket.homeAction(msg); 1832 + this.props.app.webSocket.onmessageTmp = async (msg) => {
  1833 + const rtmsg = JSON.parse(msg.data);
  1834 + if (rtmsg.action === 'showMsg') {
  1835 + message.warning(rtmsg.msg);
  1836 + this.props.onSaveState({ loading: false });
  1837 + } else if (rtmsg.action === 'update') {
  1838 + await this.handleGetData(masterConfig, slaveConfig, checkConfig, 'update');
  1839 + if(commonUtils.isNotEmptyObject(slaveChildConfig)) {
  1840 + await this.handleGetOneMemoData('slaveChild', slaveChildConfig);
1874 } 1841 }
1875 - };  
1876 - this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);  
1877 - }, timValue); 1842 + if(commonUtils.isNotEmptyObject(slave0Config)) {
  1843 + await this.handleGetOneMemoData('slave0', slave0Config);
  1844 + }
  1845 + this.props.onSaveState({ enabled: true, calculated: false, loading: false });
  1846 + }
  1847 + };
  1848 + this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null);
1878 }; 1849 };
1879 /** 表单回带 */ 1850 /** 表单回带 */
1880 handleForm = (form) => { 1851 handleForm = (form) => {
src/components/Manufacture/WorkOrder/WorkOrder.js
@@ -462,292 +462,318 @@ class WorkOrder extends Component { @@ -462,292 +462,318 @@ class WorkOrder extends Component {
462 if (sAllPartsName !== undefined) { 462 if (sAllPartsName !== undefined) {
463 allPartsName = sAllPartsName.split(','); 463 allPartsName = sAllPartsName.split(',');
464 } 464 }
465 - let timValue = 0;  
466 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
467 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
468 - timValue = 3000;  
469 - }  
470 - setTimeout(async () => {  
471 - this.props.app.webSocket.onmessage = (msg) => {  
472 - const rtmsg = JSON.parse(msg.data);  
473 - if (rtmsg.action === 'workOrderAllprogress') {  
474 - this.props.onSaveState({  
475 - workOrderAllprogress: rtmsg.msg,  
476 - });  
477 - } else if (rtmsg.action === 'loginOut') {  
478 - if (location.pathname.indexOf('/indexOee') > -1) {  
479 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
480 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
481 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
482 - } else {  
483 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
484 - }  
485 - } else if (this.props.app.webSocket.homeAction) {  
486 - this.props.app.webSocket.homeAction(msg);  
487 - }  
488 - };  
489 - let cpProcessName = '';  
490 - checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData;  
491 - // paramMap.modelName = masterData.modelName;  
492 - paramMap.sCustomerId = masterData.sCustomerId;  
493 - paramMap.sCustomerName = masterData.sCustomerName;  
494 - paramMap.sProductClassifyId = masterData.sProductClassifyId;  
495 - paramMap.sProductId = masterData.sProductId;  
496 - paramMap.sProductName = masterData.sProductName;  
497 - paramMap.sProductStyleId = masterData.sProductStyleId;  
498 - paramMap.sProductStyle = masterData.sProductStyle;  
499 - paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0;  
500 - paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0;  
501 - paramMap.dProductHeight = 0;  
502 - paramMap.dProductQty = masterData.dProductQty;  
503 - const partsInfo = [];  
504 - allPartsName.forEach((item) => {  
505 - const partInfo = {};  
506 - partInfo.sPartsName = item;  
507 - partInfo.dPartsQty = masterData.dProductQty;  
508 - partInfo.dSumPQty = masterData[`dSumPQty${item}`];  
509 - const materialsInfo = [];  
510 - const material = {};  
511 - material.sMaterialsId = masterData[`sMaterialsId${item}`];  
512 - material.sMaterialsNo = masterData[`sMaterialsNo${item}`];  
513 - material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`];  
514 - materialsInfo.push(material);  
515 - partInfo.materialsInfo = materialsInfo;  
516 - partInfo.iPositiveColor = masterData[`iPositiveColor${item}`];  
517 - partInfo.iPrintModePo = masterData[`iPrintModePo${item}`];  
518 - if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') {  
519 - const processInfo = [];  
520 - checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => {  
521 - if (!commonUtils.isEmpty(masterData[card.sId + item])) {  
522 - if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') {  
523 - partInfo.sPrintProcessId = masterData[card.sId + item];  
524 - } else {  
525 - const process = {};  
526 - process.sProductClassifyId = card.sId;  
527 - process.sProcessId = masterData[card.sId + item]; 465 + this.props.app.webSocket.onmessageTmp = (msg) => {
  466 + const rtmsg = JSON.parse(msg.data);
  467 + if (rtmsg.action === 'workOrderAllprogress') {
  468 + this.props.onSaveState({
  469 + workOrderAllprogress: rtmsg.msg,
  470 + });
  471 + }
  472 + };
  473 + let cpProcessName = '';
  474 + checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData;
  475 + // paramMap.modelName = masterData.modelName;
  476 + paramMap.sCustomerId = masterData.sCustomerId;
  477 + paramMap.sCustomerName = masterData.sCustomerName;
  478 + paramMap.sProductClassifyId = masterData.sProductClassifyId;
  479 + paramMap.sProductId = masterData.sProductId;
  480 + paramMap.sProductName = masterData.sProductName;
  481 + paramMap.sProductStyleId = masterData.sProductStyleId;
  482 + paramMap.sProductStyle = masterData.sProductStyle;
  483 + paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0;
  484 + paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0;
  485 + paramMap.dProductHeight = 0;
  486 + paramMap.dProductQty = masterData.dProductQty;
  487 + const partsInfo = [];
  488 + allPartsName.forEach((item) => {
  489 + const partInfo = {};
  490 + partInfo.sPartsName = item;
  491 + partInfo.dPartsQty = masterData.dProductQty;
  492 + partInfo.dSumPQty = masterData[`dSumPQty${item}`];
  493 + const materialsInfo = [];
  494 + const material = {};
  495 + material.sMaterialsId = masterData[`sMaterialsId${item}`];
  496 + material.sMaterialsNo = masterData[`sMaterialsNo${item}`];
  497 + material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`];
  498 + materialsInfo.push(material);
  499 + partInfo.materialsInfo = materialsInfo;
  500 + partInfo.iPositiveColor = masterData[`iPositiveColor${item}`];
  501 + partInfo.iPrintModePo = masterData[`iPrintModePo${item}`];
  502 + if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') {
  503 + const processInfo = [];
  504 + checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => {
  505 + if (!commonUtils.isEmpty(masterData[card.sId + item])) {
  506 + if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') {
  507 + partInfo.sPrintProcessId = masterData[card.sId + item];
  508 + } else {
  509 + const process = {};
  510 + process.sProductClassifyId = card.sId;
  511 + process.sProcessId = masterData[card.sId + item];
528 512
529 - if (masterData[card.sId + card.sName + item] !== undefined) {  
530 - process.sProcessName = masterData[card.sId + card.sName + item];  
531 - process.sType = masterData[card.sId + card.sType + item];  
532 - processInfo.push(process);  
533 - } 513 + if (masterData[card.sId + card.sName + item] !== undefined) {
  514 + process.sProcessName = masterData[card.sId + card.sName + item];
  515 + process.sType = masterData[card.sId + card.sType + item];
  516 + processInfo.push(process);
534 } 517 }
535 } 518 }
536 - });  
537 - partInfo.processInfo = processInfo;  
538 - partsInfo.push(partInfo);  
539 - }  
540 - });  
541 - const productProcess = [];  
542 - checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => {  
543 - if (!commonUtils.isEmpty(masterData[card.sId])) {  
544 - const process = {};  
545 - process.sProductClassifyId = card.sId;  
546 - process.sProcessId = masterData[card.sId];  
547 - process.sProcessName = masterData[card.sId + card.sName];  
548 - if (masterData[card.sId + card.sName] !== undefined) {  
549 - cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`;  
550 - productProcess.push(process);  
551 } 519 }
  520 + });
  521 + partInfo.processInfo = processInfo;
  522 + partsInfo.push(partInfo);
  523 + }
  524 + });
  525 + const productProcess = [];
  526 + checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => {
  527 + if (!commonUtils.isEmpty(masterData[card.sId])) {
  528 + const process = {};
  529 + process.sProductClassifyId = card.sId;
  530 + process.sProcessId = masterData[card.sId];
  531 + process.sProcessName = masterData[card.sId + card.sName];
  532 + if (masterData[card.sId + card.sName] !== undefined) {
  533 + cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`;
  534 + productProcess.push(process);
552 } 535 }
553 - });  
554 - paramMap.cpProcessName = cpProcessName;  
555 - paramMap.productProcessInfo = productProcess;  
556 - paramMap.partsInfo = partsInfo;  
557 - let numErr = false;  
558 - let numName = '';  
559 - let num = 0; 536 + }
  537 + });
  538 + paramMap.cpProcessName = cpProcessName;
  539 + paramMap.productProcessInfo = productProcess;
  540 + paramMap.partsInfo = partsInfo;
  541 + let numErr = false;
  542 + let numName = '';
  543 + let num = 0;
560 544
561 - // eslint-disable-next-line array-callback-return  
562 - paramMap.partsInfo.map((item) => {  
563 - if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) {  
564 - num = item.dSumPQty;  
565 - numName = item.sPartsName;  
566 - }  
567 - if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) {  
568 - numErr = true;  
569 - numName = item.sPartsName;  
570 - }  
571 - });  
572 - if (numErr) {  
573 - message.error(`${numName}P数必须是2的倍数!`);  
574 - return; 545 + // eslint-disable-next-line array-callback-return
  546 + paramMap.partsInfo.map((item) => {
  547 + if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) {
  548 + num = item.dSumPQty;
  549 + numName = item.sPartsName;
575 } 550 }
576 - if (num === 2) {  
577 - message.error(`${numName}P数必须大于4P!`);  
578 - return; 551 + if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) {
  552 + numErr = true;
  553 + numName = item.sPartsName;
579 } 554 }
  555 + });
  556 + if (numErr) {
  557 + message.error(`${numName}P数必须是2的倍数!`);
  558 + return;
  559 + }
  560 + if (num === 2) {
  561 + message.error(`${numName}P数必须大于4P!`);
  562 + return;
  563 + }
580 564
581 565
582 - if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) ||  
583 - commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) {  
584 - // this.props.onSaveState({ fastOrderModalVisible: false });  
585 - message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */  
586 - return;  
587 - }  
588 - /* 验证产品规格是否 符合数字*数字格式 */  
589 - const sProductStyle = paramMap.sProductStyle;  
590 - if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */  
591 - const arr = sProductStyle.split('*');  
592 - const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/;  
593 - if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) {  
594 - for (let i = 0; i < arr.length; i += 1) {  
595 - if (!numCheck.test(arr[i])) { /* 验证是否数字 */  
596 - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));  
597 - return;  
598 - } 566 + if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) ||
  567 + commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) {
  568 + // this.props.onSaveState({ fastOrderModalVisible: false });
  569 + message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */
  570 + return;
  571 + }
  572 + /* 验证产品规格是否 符合数字*数字格式 */
  573 + const sProductStyle = paramMap.sProductStyle;
  574 + if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */
  575 + const arr = sProductStyle.split('*');
  576 + const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/;
  577 + if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) {
  578 + for (let i = 0; i < arr.length; i += 1) {
  579 + if (!numCheck.test(arr[i])) { /* 验证是否数字 */
  580 + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
  581 + return;
599 } 582 }
600 - } else {  
601 - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));  
602 - return;  
603 } 583 }
604 - /* 验证*两边是否是数字 */  
605 } else { 584 } else {
606 message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); 585 message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
607 return; 586 return;
608 } 587 }
609 - if (flag === false) {  
610 - return; 588 + /* 验证*两边是否是数字 */
  589 + } else {
  590 + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
  591 + return;
  592 + }
  593 + if (flag === false) {
  594 + return;
  595 + }
  596 + this.props.onSaveState({
  597 + Loading: true,
  598 + });
  599 + const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;
  600 + const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;
  601 + if (dataReturn.code === 1) {
  602 + const {
  603 + productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo,
  604 + } = dataReturn.dataset.rows[0];
  605 + const slaveData = [];
  606 + const controlData = [];
  607 + const materialsData = [];
  608 + let processData = [];
  609 + const tableDataRow = {};
  610 + for (const item of slaveConfig.gdsconfigformslave) {
  611 + tableDataRow[item.sName] = masterData[item.sName];
611 } 612 }
612 - this.props.onSaveState({  
613 - Loading: true,  
614 - });  
615 - const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;  
616 - const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;  
617 - if (dataReturn.code === 1) {  
618 - const {  
619 - productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo,  
620 - } = dataReturn.dataset.rows[0];  
621 - const slaveData = [];  
622 - const controlData = [];  
623 - const materialsData = [];  
624 - let processData = [];  
625 - const tableDataRow = {};  
626 - for (const item of slaveConfig.gdsconfigformslave) {  
627 - tableDataRow[item.sName] = masterData[item.sName]; 613 + tableDataRow.sId = commonUtils.createSid();
  614 + tableDataRow.handleType = 'add';
  615 + tableDataRow.iOrder = 1;
  616 + tableDataRow.sParentId = masterData.sId;
  617 + // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');
  618 + let productIdDropDown;
  619 + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName');
  620 + if (slaveIndex > -1) {
  621 + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);
  622 + productIdDropDown = sqlDropDownData.dropDownData;
  623 + }
  624 + const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);
  625 + if (iProductIdIndex === -1) {
  626 + tableDataRow.sProductId = tableDataRow.sProductName;
  627 + tableDataRow.sProductInfo = JSON.stringify({
  628 + sProductId: tableDataRow.sProductName,
  629 + sProductName: tableDataRow.sProductName,
  630 + sProductStyle: tableDataRow.sProductStyle,
  631 + sProductUnit: tableDataRow.sProductUnit,
  632 + sProductNo: tableDataRow.sProductNo,
  633 + sCustomerProductNo: tableDataRow.sCustomerProductNo,
  634 + sProductClassifyId: tableDataRow.sProductClassifyId,
  635 + sProductClassifyName: tableDataRow.sProductClassifyName,
  636 + });
  637 + } else {
  638 + tableDataRow.sProductInfo = '';
  639 + }
  640 + slaveData.push(tableDataRow);
  641 + const sInfoArr = [];
  642 + if (!commonUtils.isEmptyArr(partsOldInfo)) {
  643 + partsOldInfo.forEach((item) => {
  644 + if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {
  645 + this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });
  646 + }
  647 + });
  648 + }
  649 + if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */
  650 + partsNewInfo.forEach((item) => {
  651 + const { sPartsName, sInfo } = item;
  652 + const sInfoObj = {};
  653 + sInfoObj.sPartsName = sPartsName;
  654 + sInfoObj.sInfo = sInfo;
  655 + sInfoArr.push(sInfoObj);
  656 + });
  657 + }
  658 + const bProcessAssort = true;
  659 + let returnProcessAssort = [];
  660 + let processAssignAssort = '';
  661 + let dropDownDataProcessName;
  662 + if (bProcessAssort) {
  663 + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;
  664 + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;
  665 + if (dataProcessAssort.code === 1) {
  666 + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;
  667 + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName');
  668 + if (iIndex > -1) {
  669 + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]);
  670 + dropDownDataProcessName = sqlDropDownData.dropDownData;
  671 + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField;
  672 + }
628 } 673 }
629 - tableDataRow.sId = commonUtils.createSid();  
630 - tableDataRow.handleType = 'add';  
631 - tableDataRow.iOrder = 1;  
632 - tableDataRow.sParentId = masterData.sId;  
633 - // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');  
634 - let productIdDropDown;  
635 - const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName');  
636 - if (slaveIndex > -1) {  
637 - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);  
638 - productIdDropDown = sqlDropDownData.dropDownData; 674 + }
  675 + const newCopyTo = {};
  676 + newCopyTo.master = masterData;
  677 + newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];
  678 + partsNewInfo.forEach((partInfo, iIndex) => {
  679 + const partsDataRow = {};
  680 + for (const child of Object.keys(partInfo)) {
  681 + partsDataRow[child] = partInfo[child];
639 } 682 }
640 - const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);  
641 - if (iProductIdIndex === -1) {  
642 - tableDataRow.sProductId = tableDataRow.sProductName;  
643 - tableDataRow.sProductInfo = JSON.stringify({  
644 - sProductId: tableDataRow.sProductName,  
645 - sProductName: tableDataRow.sProductName,  
646 - sProductStyle: tableDataRow.sProductStyle,  
647 - sProductUnit: tableDataRow.sProductUnit,  
648 - sProductNo: tableDataRow.sProductNo,  
649 - sCustomerProductNo: tableDataRow.sCustomerProductNo,  
650 - sProductClassifyId: tableDataRow.sProductClassifyId,  
651 - sProductClassifyName: tableDataRow.sProductClassifyName,  
652 - });  
653 - } else {  
654 - tableDataRow.sProductInfo = ''; 683 + partsDataRow.handleType = 'add';
  684 + partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */
  685 + partsDataRow.sId = commonUtils.createSid();
  686 + partsDataRow.sParentId = masterData.sId;
  687 + if (partsDataRow.iPrintMode !== 3) {
  688 + partsDataRow.iOppositeColor = partsDataRow.iPositiveColor;
655 } 689 }
656 - slaveData.push(tableDataRow);  
657 - const sInfoArr = [];  
658 - if (!commonUtils.isEmptyArr(partsOldInfo)) {  
659 - partsOldInfo.forEach((item) => {  
660 - if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {  
661 - this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });  
662 - }  
663 - }); 690 + delete partsDataRow.dMaterialsKQty;
  691 + delete partsDataRow.dMaterialsLength;
  692 + delete partsDataRow.dMaterialsWidth;
  693 + if (productClassify.bSpecialRules) {
  694 + partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;
  695 + partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;
664 } 696 }
665 - if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */  
666 - partsNewInfo.forEach((item) => {  
667 - const { sPartsName, sInfo } = item;  
668 - const sInfoObj = {};  
669 - sInfoObj.sPartsName = sPartsName;  
670 - sInfoObj.sInfo = sInfo;  
671 - sInfoArr.push(sInfoObj);  
672 - }); 697 + controlData.push(partsDataRow);
  698 + // 材料信息
  699 + partInfo.materialsInfo.forEach((materialInfo, iOrder) => {
  700 + const materialDataRow = {};
  701 + for (const item of materialsConfig.gdsconfigformslave) {
  702 + materialDataRow[item.sName] = materialInfo[item.sName];
  703 + }
  704 + materialDataRow.handleType = 'add';
  705 + materialDataRow.sType = '0';
  706 + materialDataRow.iPartOrder = iIndex;
  707 + materialDataRow.iOrder = iOrder + 1;
  708 + materialDataRow.sPartsName = partsDataRow.sPartsName;
  709 + materialDataRow.sId = commonUtils.createSid();
  710 + materialDataRow.sParentId = masterData.sId;
  711 + materialDataRow.sControlId = partsDataRow.sId;
  712 + materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;
  713 + materialsData.push(materialDataRow);
  714 + });
  715 + // 工序信息
  716 + let processPrintDataRow = {};
  717 + processPrintDataRow.handleType = 'add';
  718 + processPrintDataRow.sProcessId = partInfo.sProcessId;
  719 + const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);
  720 + if (iProcessPrintIndex > -1) {
  721 + processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段
673 } 722 }
674 - const bProcessAssort = true;  
675 - let returnProcessAssort = [];  
676 - let processAssignAssort = '';  
677 - let dropDownDataProcessName; 723 + processPrintDataRow.sType = partInfo.sType;
  724 + processPrintDataRow.iPartOrder = iIndex;
  725 + processPrintDataRow.iOrder = 1;
  726 + processPrintDataRow.sProcessName = partInfo.sProcessName;
  727 + processPrintDataRow.sPartsName = partsDataRow.sPartsName;
  728 + processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;
  729 + processPrintDataRow.dLossQty = partInfo.dLossQty;
  730 + processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;
  731 + processPrintDataRow.sId = commonUtils.createSid();
  732 + processPrintDataRow.sParentId = masterData.sId;
  733 + processPrintDataRow.sControlId = partsDataRow.sId;
  734 + processData.push(processPrintDataRow);
  735 + // 配套工序
678 if (bProcessAssort) { 736 if (bProcessAssort) {
679 - const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;  
680 - const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;  
681 - if (dataProcessAssort.code === 1) {  
682 - returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;  
683 - const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName');  
684 - if (iIndex > -1) {  
685 - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]);  
686 - dropDownDataProcessName = sqlDropDownData.dropDownData;  
687 - processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; 737 + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {
  738 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  739 + const iProcessIndex = -1;
  740 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);
  741 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  742 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  743 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  744 + processRow.handleType = 'add';
  745 + processRow.sId = commonUtils.createSid();
  746 + processRow.sParentId = masterData.sId;
  747 + processRow.sControlId = partsDataRow.sId;
  748 + processRow.sPartsName = partsDataRow.sPartsName;
  749 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  750 + processData.push(processRow);
688 } 751 }
689 - } 752 + }));
690 } 753 }
691 - const newCopyTo = {};  
692 - newCopyTo.master = masterData;  
693 - newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];  
694 - partsNewInfo.forEach((partInfo, iIndex) => {  
695 - const partsDataRow = {};  
696 - for (const child of Object.keys(partInfo)) {  
697 - partsDataRow[child] = partInfo[child];  
698 - }  
699 - partsDataRow.handleType = 'add';  
700 - partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */  
701 - partsDataRow.sId = commonUtils.createSid();  
702 - partsDataRow.sParentId = masterData.sId;  
703 - if (partsDataRow.iPrintMode !== 3) {  
704 - partsDataRow.iOppositeColor = partsDataRow.iPositiveColor; 754 +
  755 + partInfo.processInfo.forEach((process, iOrder) => {
  756 + let processAfterDataRow = {};
  757 + for (const item of processConfig.gdsconfigformslave) {
  758 + processAfterDataRow[item.sName] = process[item.sName];
705 } 759 }
706 - delete partsDataRow.dMaterialsKQty;  
707 - delete partsDataRow.dMaterialsLength;  
708 - delete partsDataRow.dMaterialsWidth;  
709 - if (productClassify.bSpecialRules) {  
710 - partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;  
711 - partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth; 760 + for (const child of Object.keys(process)) {
  761 + processAfterDataRow[child] = process[child];
712 } 762 }
713 - controlData.push(partsDataRow);  
714 - // 材料信息  
715 - partInfo.materialsInfo.forEach((materialInfo, iOrder) => {  
716 - const materialDataRow = {};  
717 - for (const item of materialsConfig.gdsconfigformslave) {  
718 - materialDataRow[item.sName] = materialInfo[item.sName];  
719 - }  
720 - materialDataRow.handleType = 'add';  
721 - materialDataRow.sType = '0';  
722 - materialDataRow.iPartOrder = iIndex;  
723 - materialDataRow.iOrder = iOrder + 1;  
724 - materialDataRow.sPartsName = partsDataRow.sPartsName;  
725 - materialDataRow.sId = commonUtils.createSid();  
726 - materialDataRow.sParentId = masterData.sId;  
727 - materialDataRow.sControlId = partsDataRow.sId;  
728 - materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;  
729 - materialsData.push(materialDataRow);  
730 - });  
731 - // 工序信息  
732 - let processPrintDataRow = {};  
733 - processPrintDataRow.handleType = 'add';  
734 - processPrintDataRow.sProcessId = partInfo.sProcessId;  
735 - const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);  
736 - if (iProcessPrintIndex > -1) {  
737 - processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段 763 + processAfterDataRow.handleType = 'add';
  764 + processAfterDataRow.sProcessId = process.sProcessId;
  765 + const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);
  766 + if (iProcessAfterIndex > -1) {
  767 + processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段
738 } 768 }
739 - processPrintDataRow.sType = partInfo.sType;  
740 - processPrintDataRow.iPartOrder = iIndex;  
741 - processPrintDataRow.iOrder = 1;  
742 - processPrintDataRow.sProcessName = partInfo.sProcessName;  
743 - processPrintDataRow.sPartsName = partsDataRow.sPartsName;  
744 - processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;  
745 - processPrintDataRow.dLossQty = partInfo.dLossQty;  
746 - processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;  
747 - processPrintDataRow.sId = commonUtils.createSid();  
748 - processPrintDataRow.sParentId = masterData.sId;  
749 - processPrintDataRow.sControlId = partsDataRow.sId;  
750 - processData.push(processPrintDataRow); 769 + processAfterDataRow.sType = process.sType;
  770 + processAfterDataRow.iPartOrder = iIndex;
  771 + processAfterDataRow.iOrder = iOrder + 1;
  772 + processAfterDataRow.sPartsName = partsDataRow.sPartsName;
  773 + processAfterDataRow.sId = commonUtils.createSid();
  774 + processAfterDataRow.sParentId = masterData.sId;
  775 + processAfterDataRow.sControlId = partsDataRow.sId;
  776 + processData.push(processAfterDataRow);
751 // 配套工序 777 // 配套工序
752 if (bProcessAssort) { 778 if (bProcessAssort) {
753 returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { 779 returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {
@@ -767,115 +793,72 @@ class WorkOrder extends Component { @@ -767,115 +793,72 @@ class WorkOrder extends Component {
767 } 793 }
768 })); 794 }));
769 } 795 }
770 -  
771 - partInfo.processInfo.forEach((process, iOrder) => {  
772 - let processAfterDataRow = {};  
773 - for (const item of processConfig.gdsconfigformslave) {  
774 - processAfterDataRow[item.sName] = process[item.sName];  
775 - }  
776 - for (const child of Object.keys(process)) {  
777 - processAfterDataRow[child] = process[child];  
778 - }  
779 - processAfterDataRow.handleType = 'add';  
780 - processAfterDataRow.sProcessId = process.sProcessId;  
781 - const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);  
782 - if (iProcessAfterIndex > -1) {  
783 - processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段  
784 - }  
785 - processAfterDataRow.sType = process.sType;  
786 - processAfterDataRow.iPartOrder = iIndex;  
787 - processAfterDataRow.iOrder = iOrder + 1;  
788 - processAfterDataRow.sPartsName = partsDataRow.sPartsName;  
789 - processAfterDataRow.sId = commonUtils.createSid();  
790 - processAfterDataRow.sParentId = masterData.sId;  
791 - processAfterDataRow.sControlId = partsDataRow.sId;  
792 - processData.push(processAfterDataRow);  
793 - // 配套工序  
794 - if (bProcessAssort) {  
795 - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {  
796 - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);  
797 - const iProcessIndex = -1;  
798 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);  
799 - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {  
800 - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值  
801 - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段  
802 - processRow.handleType = 'add';  
803 - processRow.sId = commonUtils.createSid();  
804 - processRow.sParentId = masterData.sId;  
805 - processRow.sControlId = partsDataRow.sId;  
806 - processRow.sPartsName = partsDataRow.sPartsName;  
807 - processRow.sType = dropDownDataProcessName[iIndex].sType;  
808 - processData.push(processRow);  
809 - }  
810 - }));  
811 - }  
812 - });  
813 }); 796 });
814 - productProcessInfo.forEach((process, iOrder) => {  
815 - let processProductDataRow = {};  
816 - for (const item of processConfig.gdsconfigformslave) {  
817 - processProductDataRow[item.sName] = process[item.sName];  
818 - }  
819 - for (const child of Object.keys(process)) {  
820 - processProductDataRow[child] = process[child];  
821 - }  
822 - const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);  
823 - if (iProductProcessIndex > -1) {  
824 - processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段  
825 - }  
826 - processProductDataRow.handleType = 'add';  
827 - processProductDataRow.sType = '3';  
828 - processProductDataRow.sPartsName = '';  
829 - processProductDataRow.iPartOrder = 999;  
830 - processProductDataRow.iOrder = iOrder + 1;  
831 - processProductDataRow.sId = commonUtils.createSid();  
832 - processProductDataRow.sParentId = masterData.sId;  
833 - processData.push(processProductDataRow);  
834 - // 配套工序  
835 - if (bProcessAssort) {  
836 - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => {  
837 - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);  
838 - const iProcessIndex = -1;  
839 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId);  
840 - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {  
841 - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值  
842 - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段  
843 - processRow.handleType = 'add';  
844 - processRow.sId = commonUtils.createSid();  
845 - processRow.sParentId = masterData.sId;  
846 - processRow.sType = dropDownDataProcessName[iIndex].sType;  
847 - processData.push(processRow);  
848 - }  
849 - }));  
850 - }  
851 - });  
852 - processData = this.sortData(controlData, processData);  
853 - const addState = {};  
854 - if (!commonUtils.isEmptyArr(controlData) && controlData.length === 1) {  
855 - addState.controlSelectedRowKeys = [controlData[0].sId];  
856 - } else {  
857 - addState.controlSelectedRowKeys = []; 797 + });
  798 + productProcessInfo.forEach((process, iOrder) => {
  799 + let processProductDataRow = {};
  800 + for (const item of processConfig.gdsconfigformslave) {
  801 + processProductDataRow[item.sName] = process[item.sName];
858 } 802 }
859 - this.props.onSaveState({  
860 - slaveData,  
861 - controlData,  
862 - materialsData,  
863 - processData,  
864 - fastOrderModalVisible: false,  
865 - workOrderAllprogress: 0,  
866 - ...addState,  
867 - materialsSelectedRowKeys: [],  
868 - sInfoArr,  
869 - bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),  
870 - Loading: false,  
871 - }); 803 + for (const child of Object.keys(process)) {
  804 + processProductDataRow[child] = process[child];
  805 + }
  806 + const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);
  807 + if (iProductProcessIndex > -1) {
  808 + processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段
  809 + }
  810 + processProductDataRow.handleType = 'add';
  811 + processProductDataRow.sType = '3';
  812 + processProductDataRow.sPartsName = '';
  813 + processProductDataRow.iPartOrder = 999;
  814 + processProductDataRow.iOrder = iOrder + 1;
  815 + processProductDataRow.sId = commonUtils.createSid();
  816 + processProductDataRow.sParentId = masterData.sId;
  817 + processData.push(processProductDataRow);
  818 + // 配套工序
  819 + if (bProcessAssort) {
  820 + returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => {
  821 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  822 + const iProcessIndex = -1;
  823 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId);
  824 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  825 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  826 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  827 + processRow.handleType = 'add';
  828 + processRow.sId = commonUtils.createSid();
  829 + processRow.sParentId = masterData.sId;
  830 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  831 + processData.push(processRow);
  832 + }
  833 + }));
  834 + }
  835 + });
  836 + processData = this.sortData(controlData, processData);
  837 + const addState = {};
  838 + if (!commonUtils.isEmptyArr(controlData) && controlData.length === 1) {
  839 + addState.controlSelectedRowKeys = [controlData[0].sId];
872 } else { 840 } else {
873 - this.props.getServiceError(dataReturn);  
874 - this.props.onSaveState({  
875 - Loading: false,  
876 - }); 841 + addState.controlSelectedRowKeys = [];
877 } 842 }
878 - }, timValue); 843 + this.props.onSaveState({
  844 + slaveData,
  845 + controlData,
  846 + materialsData,
  847 + processData,
  848 + fastOrderModalVisible: false,
  849 + workOrderAllprogress: 0,
  850 + ...addState,
  851 + materialsSelectedRowKeys: [],
  852 + sInfoArr,
  853 + bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),
  854 + Loading: false,
  855 + });
  856 + } else {
  857 + this.props.getServiceError(dataReturn);
  858 + this.props.onSaveState({
  859 + Loading: false,
  860 + });
  861 + }
879 }; 862 };
880 863
881 /* 勾选工序分类 */ 864 /* 勾选工序分类 */
src/components/Manufacture/WorkOrderPack/WorkOrderPack.js
@@ -674,289 +674,315 @@ class WorkOrderPack extends Component { @@ -674,289 +674,315 @@ class WorkOrderPack extends Component {
674 if (sAllPartsName !== undefined) { 674 if (sAllPartsName !== undefined) {
675 allPartsName = sAllPartsName.split(','); 675 allPartsName = sAllPartsName.split(',');
676 } 676 }
677 - let timValue = 0;  
678 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
679 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
680 - timValue = 3000;  
681 - }  
682 - setTimeout(async () => {  
683 - this.props.app.webSocket.onmessage = (msg) => {  
684 - const rtmsg = JSON.parse(msg.data);  
685 - if (rtmsg.action === 'workOrderAllprogress') {  
686 - this.props.onSaveState({  
687 - workOrderAllprogress: rtmsg.msg,  
688 - });  
689 - } else if (rtmsg.action === 'loginOut') {  
690 - if (location.pathname.indexOf('/indexOee') > -1) {  
691 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
692 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
693 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
694 - } else {  
695 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
696 - }  
697 - } else if (this.props.app.webSocket.homeAction) {  
698 - this.props.app.webSocket.homeAction(msg);  
699 - }  
700 - };  
701 - let cpProcessName = '';  
702 - checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData;  
703 - // paramMap.modelName = masterData.modelName;  
704 - paramMap.sCustomerId = masterData.sCustomerId;  
705 - paramMap.sCustomerName = masterData.sCustomerName;  
706 - paramMap.sProductClassifyId = masterData.sProductClassifyId;  
707 - paramMap.sProductId = masterData.sProductId;  
708 - paramMap.sProductName = masterData.sProductName;  
709 - paramMap.sProductStyleId = masterData.sProductStyleId;  
710 - paramMap.sProductStyle = masterData.sProductStyle;  
711 - paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0;  
712 - paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0;  
713 - paramMap.dProductHeight = 0;  
714 - paramMap.dProductQty = masterData.dProductQty;  
715 - const partsInfo = [];  
716 - allPartsName.forEach((item) => {  
717 - const partInfo = {};  
718 - partInfo.sPartsName = item;  
719 - partInfo.dPartsQty = masterData.dProductQty;  
720 - partInfo.dSumPQty = masterData[`dSumPQty${item}`];  
721 - const materialsInfo = [];  
722 - const material = {};  
723 - material.sMaterialsId = masterData[`sMaterialsId${item}`];  
724 - material.sMaterialsNo = masterData[`sMaterialsNo${item}`];  
725 - material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`];  
726 - materialsInfo.push(material);  
727 - partInfo.materialsInfo = materialsInfo;  
728 - partInfo.iPositiveColor = masterData[`iPositiveColor${item}`];  
729 - partInfo.iPrintModePo = masterData[`iPrintModePo${item}`];  
730 - if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') {  
731 - const processInfo = [];  
732 - checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => {  
733 - if (!commonUtils.isEmpty(masterData[card.sId + item])) {  
734 - if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') {  
735 - partInfo.sPrintProcessId = masterData[card.sId + item];  
736 - } else {  
737 - const process = {};  
738 - process.sProductClassifyId = card.sId;  
739 - process.sProcessId = masterData[card.sId + item];  
740 -  
741 - if (masterData[card.sId + card.sName + item] !== undefined) {  
742 - process.sProcessName = masterData[card.sId + card.sName + item];  
743 - process.sType = masterData[card.sId + card.sType + item];  
744 - processInfo.push(process);  
745 - } 677 + this.props.app.webSocket.onmessageTmp = (msg) => {
  678 + const rtmsg = JSON.parse(msg.data);
  679 + if (rtmsg.action === 'workOrderAllprogress') {
  680 + this.props.onSaveState({
  681 + workOrderAllprogress: rtmsg.msg,
  682 + });
  683 + }
  684 + };
  685 + let cpProcessName = '';
  686 + checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData;
  687 + // paramMap.modelName = masterData.modelName;
  688 + paramMap.sCustomerId = masterData.sCustomerId;
  689 + paramMap.sCustomerName = masterData.sCustomerName;
  690 + paramMap.sProductClassifyId = masterData.sProductClassifyId;
  691 + paramMap.sProductId = masterData.sProductId;
  692 + paramMap.sProductName = masterData.sProductName;
  693 + paramMap.sProductStyleId = masterData.sProductStyleId;
  694 + paramMap.sProductStyle = masterData.sProductStyle;
  695 + paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0;
  696 + paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0;
  697 + paramMap.dProductHeight = 0;
  698 + paramMap.dProductQty = masterData.dProductQty;
  699 + const partsInfo = [];
  700 + allPartsName.forEach((item) => {
  701 + const partInfo = {};
  702 + partInfo.sPartsName = item;
  703 + partInfo.dPartsQty = masterData.dProductQty;
  704 + partInfo.dSumPQty = masterData[`dSumPQty${item}`];
  705 + const materialsInfo = [];
  706 + const material = {};
  707 + material.sMaterialsId = masterData[`sMaterialsId${item}`];
  708 + material.sMaterialsNo = masterData[`sMaterialsNo${item}`];
  709 + material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`];
  710 + materialsInfo.push(material);
  711 + partInfo.materialsInfo = materialsInfo;
  712 + partInfo.iPositiveColor = masterData[`iPositiveColor${item}`];
  713 + partInfo.iPrintModePo = masterData[`iPrintModePo${item}`];
  714 + if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') {
  715 + const processInfo = [];
  716 + checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => {
  717 + if (!commonUtils.isEmpty(masterData[card.sId + item])) {
  718 + if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') {
  719 + partInfo.sPrintProcessId = masterData[card.sId + item];
  720 + } else {
  721 + const process = {};
  722 + process.sProductClassifyId = card.sId;
  723 + process.sProcessId = masterData[card.sId + item];
  724 +
  725 + if (masterData[card.sId + card.sName + item] !== undefined) {
  726 + process.sProcessName = masterData[card.sId + card.sName + item];
  727 + process.sType = masterData[card.sId + card.sType + item];
  728 + processInfo.push(process);
746 } 729 }
747 } 730 }
748 - });  
749 - partInfo.processInfo = processInfo;  
750 - partsInfo.push(partInfo);  
751 - }  
752 - });  
753 - const productProcess = [];  
754 - checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => {  
755 - if (!commonUtils.isEmpty(masterData[card.sId])) {  
756 - const process = {};  
757 - process.sProductClassifyId = card.sId;  
758 - process.sProcessId = masterData[card.sId];  
759 - process.sProcessName = masterData[card.sId + card.sName];  
760 - if (masterData[card.sId + card.sName] !== undefined) {  
761 - cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`;  
762 - productProcess.push(process);  
763 } 731 }
  732 + });
  733 + partInfo.processInfo = processInfo;
  734 + partsInfo.push(partInfo);
  735 + }
  736 + });
  737 + const productProcess = [];
  738 + checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => {
  739 + if (!commonUtils.isEmpty(masterData[card.sId])) {
  740 + const process = {};
  741 + process.sProductClassifyId = card.sId;
  742 + process.sProcessId = masterData[card.sId];
  743 + process.sProcessName = masterData[card.sId + card.sName];
  744 + if (masterData[card.sId + card.sName] !== undefined) {
  745 + cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`;
  746 + productProcess.push(process);
764 } 747 }
765 - });  
766 - paramMap.cpProcessName = cpProcessName;  
767 - paramMap.productProcessInfo = productProcess;  
768 - paramMap.partsInfo = partsInfo;  
769 - let numErr = false;  
770 - let numName = '';  
771 - let num = 0;  
772 -  
773 - // eslint-disable-next-line array-callback-return  
774 - paramMap.partsInfo.map((item) => {  
775 - if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) {  
776 - num = item.dSumPQty;  
777 - numName = item.sPartsName;  
778 - }  
779 - if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) {  
780 - numErr = true;  
781 - numName = item.sPartsName;  
782 - }  
783 - });  
784 - if (numErr) {  
785 - message.error(`${numName}P数必须是2的倍数!`);  
786 - return;  
787 } 748 }
788 - if (num === 2) {  
789 - message.error(`${numName}P数必须大于4P!`);  
790 - return; 749 + });
  750 + paramMap.cpProcessName = cpProcessName;
  751 + paramMap.productProcessInfo = productProcess;
  752 + paramMap.partsInfo = partsInfo;
  753 + let numErr = false;
  754 + let numName = '';
  755 + let num = 0;
  756 +
  757 + // eslint-disable-next-line array-callback-return
  758 + paramMap.partsInfo.map((item) => {
  759 + if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) {
  760 + num = item.dSumPQty;
  761 + numName = item.sPartsName;
  762 + }
  763 + if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) {
  764 + numErr = true;
  765 + numName = item.sPartsName;
791 } 766 }
  767 + });
  768 + if (numErr) {
  769 + message.error(`${numName}P数必须是2的倍数!`);
  770 + return;
  771 + }
  772 + if (num === 2) {
  773 + message.error(`${numName}P数必须大于4P!`);
  774 + return;
  775 + }
792 776
793 777
794 - if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) ||  
795 - commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) {  
796 - // this.props.onSaveState({ fastOrderModalVisible: false });  
797 - message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */  
798 - return;  
799 - }  
800 - /* 验证产品规格是否 符合数字*数字格式 */  
801 - const sProductStyle = paramMap.sProductStyle;  
802 - if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */  
803 - const arr = sProductStyle.split('*');  
804 - const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/;  
805 - if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) {  
806 - for (let i = 0; i < arr.length; i += 1) {  
807 - if (!numCheck.test(arr[i])) { /* 验证是否数字 */  
808 - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));  
809 - return;  
810 - } 778 + if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) ||
  779 + commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) {
  780 + // this.props.onSaveState({ fastOrderModalVisible: false });
  781 + message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */
  782 + return;
  783 + }
  784 + /* 验证产品规格是否 符合数字*数字格式 */
  785 + const sProductStyle = paramMap.sProductStyle;
  786 + if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */
  787 + const arr = sProductStyle.split('*');
  788 + const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/;
  789 + if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) {
  790 + for (let i = 0; i < arr.length; i += 1) {
  791 + if (!numCheck.test(arr[i])) { /* 验证是否数字 */
  792 + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
  793 + return;
811 } 794 }
812 - } else {  
813 - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));  
814 - return;  
815 } 795 }
816 - /* 验证*两边是否是数字 */  
817 } else { 796 } else {
818 message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); 797 message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
819 return; 798 return;
820 } 799 }
821 - this.props.onSaveState({  
822 - Loading: true,  
823 - });  
824 - const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;  
825 - const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;  
826 - if (dataReturn.code === 1) {  
827 - const {  
828 - productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo,  
829 - } = dataReturn.dataset.rows[0];  
830 - const slaveData = [];  
831 - const controlData = [];  
832 - const materialsData = [];  
833 - let processData = [];  
834 - const tableDataRow = {};  
835 - for (const item of slaveConfig.gdsconfigformslave) {  
836 - tableDataRow[item.sName] = masterData[item.sName];  
837 - }  
838 - tableDataRow.sId = commonUtils.createSid();  
839 - tableDataRow.handleType = 'add';  
840 - tableDataRow.iOrder = 1;  
841 - tableDataRow.sParentId = masterData.sId;  
842 - // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');  
843 - let productIdDropDown;  
844 - const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName');  
845 - if (slaveIndex > -1) {  
846 - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);  
847 - productIdDropDown = sqlDropDownData.dropDownData;  
848 - }  
849 - const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);  
850 - if (iProductIdIndex === -1) {  
851 - tableDataRow.sProductId = tableDataRow.sProductName;  
852 - tableDataRow.sProductInfo = JSON.stringify({  
853 - sProductId: tableDataRow.sProductName,  
854 - sProductName: tableDataRow.sProductName,  
855 - sProductStyle: tableDataRow.sProductStyle,  
856 - sProductUnit: tableDataRow.sProductUnit,  
857 - sProductNo: tableDataRow.sProductNo,  
858 - sCustomerProductNo: tableDataRow.sCustomerProductNo,  
859 - sProductClassifyId: tableDataRow.sProductClassifyId,  
860 - sProductClassifyName: tableDataRow.sProductClassifyName,  
861 - });  
862 - } else {  
863 - tableDataRow.sProductInfo = '';  
864 - }  
865 - slaveData.push(tableDataRow);  
866 - const sInfoArr = [];  
867 - if (!commonUtils.isEmptyArr(partsOldInfo)) {  
868 - partsOldInfo.forEach((item) => {  
869 - if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {  
870 - this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });  
871 - }  
872 - });  
873 - }  
874 - if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */  
875 - partsNewInfo.forEach((item) => {  
876 - const { sPartsName, sInfo } = item;  
877 - const sInfoObj = {};  
878 - sInfoObj.sPartsName = sPartsName;  
879 - sInfoObj.sInfo = sInfo;  
880 - sInfoArr.push(sInfoObj);  
881 - }); 800 + /* 验证*两边是否是数字 */
  801 + } else {
  802 + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
  803 + return;
  804 + }
  805 + this.props.onSaveState({
  806 + Loading: true,
  807 + });
  808 + const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;
  809 + const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;
  810 + if (dataReturn.code === 1) {
  811 + const {
  812 + productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo,
  813 + } = dataReturn.dataset.rows[0];
  814 + const slaveData = [];
  815 + const controlData = [];
  816 + const materialsData = [];
  817 + let processData = [];
  818 + const tableDataRow = {};
  819 + for (const item of slaveConfig.gdsconfigformslave) {
  820 + tableDataRow[item.sName] = masterData[item.sName];
  821 + }
  822 + tableDataRow.sId = commonUtils.createSid();
  823 + tableDataRow.handleType = 'add';
  824 + tableDataRow.iOrder = 1;
  825 + tableDataRow.sParentId = masterData.sId;
  826 + // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');
  827 + let productIdDropDown;
  828 + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName');
  829 + if (slaveIndex > -1) {
  830 + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);
  831 + productIdDropDown = sqlDropDownData.dropDownData;
  832 + }
  833 + const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);
  834 + if (iProductIdIndex === -1) {
  835 + tableDataRow.sProductId = tableDataRow.sProductName;
  836 + tableDataRow.sProductInfo = JSON.stringify({
  837 + sProductId: tableDataRow.sProductName,
  838 + sProductName: tableDataRow.sProductName,
  839 + sProductStyle: tableDataRow.sProductStyle,
  840 + sProductUnit: tableDataRow.sProductUnit,
  841 + sProductNo: tableDataRow.sProductNo,
  842 + sCustomerProductNo: tableDataRow.sCustomerProductNo,
  843 + sProductClassifyId: tableDataRow.sProductClassifyId,
  844 + sProductClassifyName: tableDataRow.sProductClassifyName,
  845 + });
  846 + } else {
  847 + tableDataRow.sProductInfo = '';
  848 + }
  849 + slaveData.push(tableDataRow);
  850 + const sInfoArr = [];
  851 + if (!commonUtils.isEmptyArr(partsOldInfo)) {
  852 + partsOldInfo.forEach((item) => {
  853 + if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {
  854 + this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });
  855 + }
  856 + });
  857 + }
  858 + if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */
  859 + partsNewInfo.forEach((item) => {
  860 + const { sPartsName, sInfo } = item;
  861 + const sInfoObj = {};
  862 + sInfoObj.sPartsName = sPartsName;
  863 + sInfoObj.sInfo = sInfo;
  864 + sInfoArr.push(sInfoObj);
  865 + });
  866 + }
  867 + const bProcessAssort = true;
  868 + let returnProcessAssort = [];
  869 + let processAssignAssort = '';
  870 + let dropDownDataProcessName;
  871 + if (bProcessAssort) {
  872 + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;
  873 + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;
  874 + if (dataProcessAssort.code === 1) {
  875 + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;
  876 + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName');
  877 + if (iIndex > -1) {
  878 + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]);
  879 + dropDownDataProcessName = sqlDropDownData.dropDownData;
  880 + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField;
  881 + }
882 } 882 }
883 - const bProcessAssort = true;  
884 - let returnProcessAssort = [];  
885 - let processAssignAssort = '';  
886 - let dropDownDataProcessName; 883 + }
  884 + const newCopyTo = {};
  885 + newCopyTo.master = masterData;
  886 + newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];
  887 + partsNewInfo.forEach((partInfo, iIndex) => {
  888 + const partsDataRow = {};
  889 + for (const child of Object.keys(partInfo)) {
  890 + partsDataRow[child] = partInfo[child];
  891 + }
  892 + partsDataRow.handleType = 'add';
  893 + partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */
  894 + partsDataRow.sId = commonUtils.createSid();
  895 + partsDataRow.sParentId = masterData.sId;
  896 + if (partsDataRow.iPrintMode !== 3) {
  897 + partsDataRow.iOppositeColor = partsDataRow.iPositiveColor;
  898 + }
  899 + delete partsDataRow.dMaterialsKQty;
  900 + delete partsDataRow.dMaterialsLength;
  901 + delete partsDataRow.dMaterialsWidth;
  902 + if (productClassify.bSpecialRules) {
  903 + partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;
  904 + partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;
  905 + }
  906 + controlData.push(partsDataRow);
  907 + // 材料信息
  908 + partInfo.materialsInfo.forEach((materialInfo, iOrder) => {
  909 + const materialDataRow = {};
  910 + for (const item of materialsConfig.gdsconfigformslave) {
  911 + materialDataRow[item.sName] = materialInfo[item.sName];
  912 + }
  913 + materialDataRow.handleType = 'add';
  914 + materialDataRow.sType = '0';
  915 + materialDataRow.iPartOrder = iIndex;
  916 + materialDataRow.iOrder = iOrder + 1;
  917 + materialDataRow.sPartsName = partsDataRow.sPartsName;
  918 + materialDataRow.sId = commonUtils.createSid();
  919 + materialDataRow.sParentId = masterData.sId;
  920 + materialDataRow.sControlId = partsDataRow.sId;
  921 + materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;
  922 + materialsData.push(materialDataRow);
  923 + });
  924 + // 工序信息
  925 + let processPrintDataRow = {};
  926 + processPrintDataRow.handleType = 'add';
  927 + processPrintDataRow.sProcessId = partInfo.sProcessId;
  928 + const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);
  929 + if (iProcessPrintIndex > -1) {
  930 + processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段
  931 + }
  932 + processPrintDataRow.sType = partInfo.sType;
  933 + processPrintDataRow.iPartOrder = iIndex;
  934 + processPrintDataRow.iOrder = 1;
  935 + processPrintDataRow.sProcessName = partInfo.sProcessName;
  936 + processPrintDataRow.sPartsName = partsDataRow.sPartsName;
  937 + processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;
  938 + processPrintDataRow.dLossQty = partInfo.dLossQty;
  939 + processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;
  940 + processPrintDataRow.sId = commonUtils.createSid();
  941 + processPrintDataRow.sParentId = masterData.sId;
  942 + processPrintDataRow.sControlId = partsDataRow.sId;
  943 + processData.push(processPrintDataRow);
  944 + // 配套工序
887 if (bProcessAssort) { 945 if (bProcessAssort) {
888 - const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;  
889 - const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;  
890 - if (dataProcessAssort.code === 1) {  
891 - returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;  
892 - const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName');  
893 - if (iIndex > -1) {  
894 - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]);  
895 - dropDownDataProcessName = sqlDropDownData.dropDownData;  
896 - processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; 946 + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {
  947 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  948 + const iProcessIndex = -1;
  949 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);
  950 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  951 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  952 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  953 + processRow.handleType = 'add';
  954 + processRow.sId = commonUtils.createSid();
  955 + processRow.sParentId = masterData.sId;
  956 + processRow.sControlId = partsDataRow.sId;
  957 + processRow.sPartsName = partsDataRow.sPartsName;
  958 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  959 + processData.push(processRow);
897 } 960 }
898 - } 961 + }));
899 } 962 }
900 - const newCopyTo = {};  
901 - newCopyTo.master = masterData;  
902 - newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];  
903 - partsNewInfo.forEach((partInfo, iIndex) => {  
904 - const partsDataRow = {};  
905 - for (const child of Object.keys(partInfo)) {  
906 - partsDataRow[child] = partInfo[child];  
907 - }  
908 - partsDataRow.handleType = 'add';  
909 - partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */  
910 - partsDataRow.sId = commonUtils.createSid();  
911 - partsDataRow.sParentId = masterData.sId;  
912 - if (partsDataRow.iPrintMode !== 3) {  
913 - partsDataRow.iOppositeColor = partsDataRow.iPositiveColor; 963 +
  964 + partInfo.processInfo.forEach((process, iOrder) => {
  965 + let processAfterDataRow = {};
  966 + for (const item of processConfig.gdsconfigformslave) {
  967 + processAfterDataRow[item.sName] = process[item.sName];
914 } 968 }
915 - delete partsDataRow.dMaterialsKQty;  
916 - delete partsDataRow.dMaterialsLength;  
917 - delete partsDataRow.dMaterialsWidth;  
918 - if (productClassify.bSpecialRules) {  
919 - partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;  
920 - partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth; 969 + for (const child of Object.keys(process)) {
  970 + processAfterDataRow[child] = process[child];
921 } 971 }
922 - controlData.push(partsDataRow);  
923 - // 材料信息  
924 - partInfo.materialsInfo.forEach((materialInfo, iOrder) => {  
925 - const materialDataRow = {};  
926 - for (const item of materialsConfig.gdsconfigformslave) {  
927 - materialDataRow[item.sName] = materialInfo[item.sName];  
928 - }  
929 - materialDataRow.handleType = 'add';  
930 - materialDataRow.sType = '0';  
931 - materialDataRow.iPartOrder = iIndex;  
932 - materialDataRow.iOrder = iOrder + 1;  
933 - materialDataRow.sPartsName = partsDataRow.sPartsName;  
934 - materialDataRow.sId = commonUtils.createSid();  
935 - materialDataRow.sParentId = masterData.sId;  
936 - materialDataRow.sControlId = partsDataRow.sId;  
937 - materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;  
938 - materialsData.push(materialDataRow);  
939 - });  
940 - // 工序信息  
941 - let processPrintDataRow = {};  
942 - processPrintDataRow.handleType = 'add';  
943 - processPrintDataRow.sProcessId = partInfo.sProcessId;  
944 - const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);  
945 - if (iProcessPrintIndex > -1) {  
946 - processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段 972 + processAfterDataRow.handleType = 'add';
  973 + processAfterDataRow.sProcessId = process.sProcessId;
  974 + const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);
  975 + if (iProcessAfterIndex > -1) {
  976 + processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段
947 } 977 }
948 - processPrintDataRow.sType = partInfo.sType;  
949 - processPrintDataRow.iPartOrder = iIndex;  
950 - processPrintDataRow.iOrder = 1;  
951 - processPrintDataRow.sProcessName = partInfo.sProcessName;  
952 - processPrintDataRow.sPartsName = partsDataRow.sPartsName;  
953 - processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;  
954 - processPrintDataRow.dLossQty = partInfo.dLossQty;  
955 - processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;  
956 - processPrintDataRow.sId = commonUtils.createSid();  
957 - processPrintDataRow.sParentId = masterData.sId;  
958 - processPrintDataRow.sControlId = partsDataRow.sId;  
959 - processData.push(processPrintDataRow); 978 + processAfterDataRow.sType = process.sType;
  979 + processAfterDataRow.iPartOrder = iIndex;
  980 + processAfterDataRow.iOrder = iOrder + 1;
  981 + processAfterDataRow.sPartsName = partsDataRow.sPartsName;
  982 + processAfterDataRow.sId = commonUtils.createSid();
  983 + processAfterDataRow.sParentId = masterData.sId;
  984 + processAfterDataRow.sControlId = partsDataRow.sId;
  985 + processData.push(processAfterDataRow);
960 // 配套工序 986 // 配套工序
961 if (bProcessAssort) { 987 if (bProcessAssort) {
962 returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { 988 returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {
@@ -976,116 +1002,73 @@ class WorkOrderPack extends Component { @@ -976,116 +1002,73 @@ class WorkOrderPack extends Component {
976 } 1002 }
977 })); 1003 }));
978 } 1004 }
979 -  
980 - partInfo.processInfo.forEach((process, iOrder) => {  
981 - let processAfterDataRow = {};  
982 - for (const item of processConfig.gdsconfigformslave) {  
983 - processAfterDataRow[item.sName] = process[item.sName];  
984 - }  
985 - for (const child of Object.keys(process)) {  
986 - processAfterDataRow[child] = process[child];  
987 - }  
988 - processAfterDataRow.handleType = 'add';  
989 - processAfterDataRow.sProcessId = process.sProcessId;  
990 - const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);  
991 - if (iProcessAfterIndex > -1) {  
992 - processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段  
993 - }  
994 - processAfterDataRow.sType = process.sType;  
995 - processAfterDataRow.iPartOrder = iIndex;  
996 - processAfterDataRow.iOrder = iOrder + 1;  
997 - processAfterDataRow.sPartsName = partsDataRow.sPartsName;  
998 - processAfterDataRow.sId = commonUtils.createSid();  
999 - processAfterDataRow.sParentId = masterData.sId;  
1000 - processAfterDataRow.sControlId = partsDataRow.sId;  
1001 - processData.push(processAfterDataRow);  
1002 - // 配套工序  
1003 - if (bProcessAssort) {  
1004 - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {  
1005 - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);  
1006 - const iProcessIndex = -1;  
1007 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);  
1008 - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {  
1009 - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值  
1010 - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段  
1011 - processRow.handleType = 'add';  
1012 - processRow.sId = commonUtils.createSid();  
1013 - processRow.sParentId = masterData.sId;  
1014 - processRow.sControlId = partsDataRow.sId;  
1015 - processRow.sPartsName = partsDataRow.sPartsName;  
1016 - processRow.sType = dropDownDataProcessName[iIndex].sType;  
1017 - processData.push(processRow);  
1018 - }  
1019 - }));  
1020 - }  
1021 - });  
1022 }); 1005 });
1023 - productProcessInfo.forEach((process, iOrder) => {  
1024 - let processProductDataRow = {};  
1025 - for (const item of processConfig.gdsconfigformslave) {  
1026 - processProductDataRow[item.sName] = process[item.sName];  
1027 - }  
1028 - for (const child of Object.keys(process)) {  
1029 - processProductDataRow[child] = process[child];  
1030 - }  
1031 - const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);  
1032 - if (iProductProcessIndex > -1) {  
1033 - processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段  
1034 - }  
1035 - processProductDataRow.handleType = 'add';  
1036 - processProductDataRow.sType = '3';  
1037 - processProductDataRow.sPartsName = '';  
1038 - processProductDataRow.iPartOrder = 999;  
1039 - processProductDataRow.iOrder = iOrder + 1;  
1040 - processProductDataRow.sId = commonUtils.createSid();  
1041 - processProductDataRow.sParentId = masterData.sId;  
1042 - processData.push(processProductDataRow);  
1043 - // 配套工序  
1044 - if (bProcessAssort) {  
1045 - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => {  
1046 - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);  
1047 - const iProcessIndex = -1;  
1048 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId);  
1049 - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {  
1050 - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值  
1051 - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段  
1052 - processRow.handleType = 'add';  
1053 - processRow.sId = commonUtils.createSid();  
1054 - processRow.sParentId = masterData.sId;  
1055 - processRow.sType = dropDownDataProcessName[iIndex].sType;  
1056 - processData.push(processRow);  
1057 - }  
1058 - }));  
1059 - }  
1060 - });  
1061 - processData = this.sortData(controlData, processData);  
1062 - const addState = {};  
1063 - if (!commonUtils.isEmptyArr(controlData) && controlData.length === 1) {  
1064 - addState.controlSelectedRowKeys = [controlData[0].sId];  
1065 - } else {  
1066 - addState.controlSelectedRowKeys = []; 1006 + });
  1007 + productProcessInfo.forEach((process, iOrder) => {
  1008 + let processProductDataRow = {};
  1009 + for (const item of processConfig.gdsconfigformslave) {
  1010 + processProductDataRow[item.sName] = process[item.sName];
  1011 + }
  1012 + for (const child of Object.keys(process)) {
  1013 + processProductDataRow[child] = process[child];
  1014 + }
  1015 + const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);
  1016 + if (iProductProcessIndex > -1) {
  1017 + processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段
  1018 + }
  1019 + processProductDataRow.handleType = 'add';
  1020 + processProductDataRow.sType = '3';
  1021 + processProductDataRow.sPartsName = '';
  1022 + processProductDataRow.iPartOrder = 999;
  1023 + processProductDataRow.iOrder = iOrder + 1;
  1024 + processProductDataRow.sId = commonUtils.createSid();
  1025 + processProductDataRow.sParentId = masterData.sId;
  1026 + processData.push(processProductDataRow);
  1027 + // 配套工序
  1028 + if (bProcessAssort) {
  1029 + returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => {
  1030 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  1031 + const iProcessIndex = -1;
  1032 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId);
  1033 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  1034 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  1035 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  1036 + processRow.handleType = 'add';
  1037 + processRow.sId = commonUtils.createSid();
  1038 + processRow.sParentId = masterData.sId;
  1039 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  1040 + processData.push(processRow);
  1041 + }
  1042 + }));
1067 } 1043 }
1068 - this.props.onSaveState({  
1069 - materialsConfig,  
1070 - slaveData,  
1071 - controlData,  
1072 - materialsData,  
1073 - processData,  
1074 - fastOrderModalVisible: false,  
1075 - workOrderAllprogress: 0,  
1076 - ...addState,  
1077 - materialsSelectedRowKeys: [],  
1078 - sInfoArr,  
1079 - bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),  
1080 - Loading: false,  
1081 - }); 1044 + });
  1045 + processData = this.sortData(controlData, processData);
  1046 + const addState = {};
  1047 + if (!commonUtils.isEmptyArr(controlData) && controlData.length === 1) {
  1048 + addState.controlSelectedRowKeys = [controlData[0].sId];
1082 } else { 1049 } else {
1083 - this.props.getServiceError(dataReturn);  
1084 - this.props.onSaveState({  
1085 - Loading: false,  
1086 - }); 1050 + addState.controlSelectedRowKeys = [];
1087 } 1051 }
1088 - }, timValue); 1052 + this.props.onSaveState({
  1053 + materialsConfig,
  1054 + slaveData,
  1055 + controlData,
  1056 + materialsData,
  1057 + processData,
  1058 + fastOrderModalVisible: false,
  1059 + workOrderAllprogress: 0,
  1060 + ...addState,
  1061 + materialsSelectedRowKeys: [],
  1062 + sInfoArr,
  1063 + bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),
  1064 + Loading: false,
  1065 + });
  1066 + } else {
  1067 + this.props.getServiceError(dataReturn);
  1068 + this.props.onSaveState({
  1069 + Loading: false,
  1070 + });
  1071 + }
1089 }; 1072 };
1090 1073
1091 /* 勾选工序分类 */ 1074 /* 勾选工序分类 */
src/components/Manufacture/WorkOrderPack/WorkOrderPackTableTree.js
@@ -1099,431 +1099,414 @@ class WorkOrderPack extends Component { @@ -1099,431 +1099,414 @@ class WorkOrderPack extends Component {
1099 if (sAllPartsName !== undefined) { 1099 if (sAllPartsName !== undefined) {
1100 allPartsName = sAllPartsName.split(','); 1100 allPartsName = sAllPartsName.split(',');
1101 } 1101 }
1102 - let timValue = 0;  
1103 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1104 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1105 - timValue = 3000;  
1106 - }  
1107 - setTimeout(async () => {  
1108 - this.props.app.webSocket.onmessage = (msg) => {  
1109 - const rtmsg = JSON.parse(msg.data);  
1110 - if (rtmsg.action === 'workOrderAllprogress') {  
1111 - this.props.onSaveState({  
1112 - workOrderAllprogress: rtmsg.msg,  
1113 - });  
1114 - } else if (rtmsg.action === 'loginOut') {  
1115 - if (location.pathname.indexOf('/indexOee') > -1) {  
1116 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1117 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1118 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1119 - } else {  
1120 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
1121 - }  
1122 - } else if (this.props.app.webSocket.homeAction) {  
1123 - this.props.app.webSocket.homeAction(msg);  
1124 - }  
1125 - };  
1126 - let cpProcessName = '';  
1127 - checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData;  
1128 - // paramMap.modelName = masterData.modelName;  
1129 - paramMap.sCustomerId = masterData.sCustomerId;  
1130 - paramMap.sCustomerName = masterData.sCustomerName;  
1131 - paramMap.sProductClassifyId = masterData.sProductClassifyId;  
1132 - paramMap.sProductId = masterData.sProductId;  
1133 - paramMap.sProductName = masterData.sProductName;  
1134 - paramMap.sProductStyleId = masterData.sProductStyleId;  
1135 - paramMap.sProductStyle = masterData.sProductStyle;  
1136 - paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0;  
1137 - paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0;  
1138 - paramMap.dProductHeight = 0;  
1139 - paramMap.dProductQty = masterData.dProductQty;  
1140 - const partsInfo = [];  
1141 - allPartsName.forEach((item) => {  
1142 - const partInfo = {};  
1143 - partInfo.sPartsName = item;  
1144 - partInfo.dPartsQty = masterData.dProductQty;  
1145 - partInfo.dSumPQty = masterData[`dSumPQty${item}`];  
1146 - const materialsInfo = [];  
1147 - const material = {};  
1148 - material.sMaterialsId = masterData[`sMaterialsId${item}`];  
1149 - material.sMaterialsNo = masterData[`sMaterialsNo${item}`];  
1150 - material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`];  
1151 - materialsInfo.push(material);  
1152 - partInfo.materialsInfo = materialsInfo;  
1153 - partInfo.iPositiveColor = masterData[`iPositiveColor${item}`];  
1154 - partInfo.iPrintModePo = masterData[`iPrintModePo${item}`];  
1155 - if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') {  
1156 - const processInfo = [];  
1157 - checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => {  
1158 - if (!commonUtils.isEmpty(masterData[card.sId + item])) {  
1159 - if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') {  
1160 - partInfo.sPrintProcessId = masterData[card.sId + item];  
1161 - } else {  
1162 - const process = {};  
1163 - process.sProductClassifyId = card.sId;  
1164 - process.sProcessId = masterData[card.sId + item];  
1165 -  
1166 - if (masterData[card.sId + card.sName + item] !== undefined) {  
1167 - process.sProcessName = masterData[card.sId + card.sName + item];  
1168 - process.sType = masterData[card.sId + card.sType + item];  
1169 - processInfo.push(process);  
1170 - } 1102 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1103 + const rtmsg = JSON.parse(msg.data);
  1104 + if (rtmsg.action === 'workOrderAllprogress') {
  1105 + this.props.onSaveState({
  1106 + workOrderAllprogress: rtmsg.msg,
  1107 + });
  1108 + }
  1109 + };
  1110 + let cpProcessName = '';
  1111 + checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData;
  1112 + // paramMap.modelName = masterData.modelName;
  1113 + paramMap.sCustomerId = masterData.sCustomerId;
  1114 + paramMap.sCustomerName = masterData.sCustomerName;
  1115 + paramMap.sProductClassifyId = masterData.sProductClassifyId;
  1116 + paramMap.sProductId = masterData.sProductId;
  1117 + paramMap.sProductName = masterData.sProductName;
  1118 + paramMap.sProductStyleId = masterData.sProductStyleId;
  1119 + paramMap.sProductStyle = masterData.sProductStyle;
  1120 + paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0;
  1121 + paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0;
  1122 + paramMap.dProductHeight = 0;
  1123 + paramMap.dProductQty = masterData.dProductQty;
  1124 + const partsInfo = [];
  1125 + allPartsName.forEach((item) => {
  1126 + const partInfo = {};
  1127 + partInfo.sPartsName = item;
  1128 + partInfo.dPartsQty = masterData.dProductQty;
  1129 + partInfo.dSumPQty = masterData[`dSumPQty${item}`];
  1130 + const materialsInfo = [];
  1131 + const material = {};
  1132 + material.sMaterialsId = masterData[`sMaterialsId${item}`];
  1133 + material.sMaterialsNo = masterData[`sMaterialsNo${item}`];
  1134 + material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`];
  1135 + materialsInfo.push(material);
  1136 + partInfo.materialsInfo = materialsInfo;
  1137 + partInfo.iPositiveColor = masterData[`iPositiveColor${item}`];
  1138 + partInfo.iPrintModePo = masterData[`iPrintModePo${item}`];
  1139 + if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') {
  1140 + const processInfo = [];
  1141 + checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => {
  1142 + if (!commonUtils.isEmpty(masterData[card.sId + item])) {
  1143 + if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') {
  1144 + partInfo.sPrintProcessId = masterData[card.sId + item];
  1145 + } else {
  1146 + const process = {};
  1147 + process.sProductClassifyId = card.sId;
  1148 + process.sProcessId = masterData[card.sId + item];
  1149 +
  1150 + if (masterData[card.sId + card.sName + item] !== undefined) {
  1151 + process.sProcessName = masterData[card.sId + card.sName + item];
  1152 + process.sType = masterData[card.sId + card.sType + item];
  1153 + processInfo.push(process);
1171 } 1154 }
1172 } 1155 }
1173 - });  
1174 - partInfo.processInfo = processInfo;  
1175 - partsInfo.push(partInfo);  
1176 - }  
1177 - });  
1178 - const productProcess = [];  
1179 - checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => {  
1180 - if (!commonUtils.isEmpty(masterData[card.sId])) {  
1181 - const process = {};  
1182 - process.sProductClassifyId = card.sId;  
1183 - process.sProcessId = masterData[card.sId];  
1184 - process.sProcessName = masterData[card.sId + card.sName];  
1185 - if (masterData[card.sId + card.sName] !== undefined) {  
1186 - cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`;  
1187 - productProcess.push(process);  
1188 } 1156 }
  1157 + });
  1158 + partInfo.processInfo = processInfo;
  1159 + partsInfo.push(partInfo);
  1160 + }
  1161 + });
  1162 + const productProcess = [];
  1163 + checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => {
  1164 + if (!commonUtils.isEmpty(masterData[card.sId])) {
  1165 + const process = {};
  1166 + process.sProductClassifyId = card.sId;
  1167 + process.sProcessId = masterData[card.sId];
  1168 + process.sProcessName = masterData[card.sId + card.sName];
  1169 + if (masterData[card.sId + card.sName] !== undefined) {
  1170 + cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`;
  1171 + productProcess.push(process);
1189 } 1172 }
1190 - });  
1191 - paramMap.cpProcessName = cpProcessName;  
1192 - paramMap.productProcessInfo = productProcess;  
1193 - paramMap.partsInfo = partsInfo;  
1194 - let numErr = false;  
1195 - let numName = '';  
1196 - let num = 0;  
1197 -  
1198 - // eslint-disable-next-line array-callback-return  
1199 - paramMap.partsInfo.map((item) => {  
1200 - if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) {  
1201 - num = item.dSumPQty;  
1202 - numName = item.sPartsName;  
1203 - }  
1204 - if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) {  
1205 - numErr = true;  
1206 - numName = item.sPartsName;  
1207 - }  
1208 - });  
1209 - if (numErr) {  
1210 - message.error(`${numName}P数必须是2的倍数!`);  
1211 - return;  
1212 } 1173 }
1213 - if (num === 2) {  
1214 - message.error(`${numName}P数必须大于4P!`);  
1215 - return; 1174 + });
  1175 + paramMap.cpProcessName = cpProcessName;
  1176 + paramMap.productProcessInfo = productProcess;
  1177 + paramMap.partsInfo = partsInfo;
  1178 + let numErr = false;
  1179 + let numName = '';
  1180 + let num = 0;
  1181 +
  1182 + // eslint-disable-next-line array-callback-return
  1183 + paramMap.partsInfo.map((item) => {
  1184 + if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) {
  1185 + num = item.dSumPQty;
  1186 + numName = item.sPartsName;
  1187 + }
  1188 + if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) {
  1189 + numErr = true;
  1190 + numName = item.sPartsName;
1216 } 1191 }
  1192 + });
  1193 + if (numErr) {
  1194 + message.error(`${numName}P数必须是2的倍数!`);
  1195 + return;
  1196 + }
  1197 + if (num === 2) {
  1198 + message.error(`${numName}P数必须大于4P!`);
  1199 + return;
  1200 + }
1217 1201
1218 1202
1219 - if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) ||  
1220 - commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) {  
1221 - // this.props.onSaveState({ fastOrderModalVisible: false });  
1222 - message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */  
1223 - return;  
1224 - }  
1225 - /* 验证产品规格是否 符合数字*数字格式 */  
1226 - const sProductStyle = paramMap.sProductStyle;  
1227 - if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */  
1228 - const arr = sProductStyle.split('*');  
1229 - const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/;  
1230 - if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) {  
1231 - for (let i = 0; i < arr.length; i += 1) {  
1232 - if (!numCheck.test(arr[i])) { /* 验证是否数字 */  
1233 - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));  
1234 - return;  
1235 - } 1203 + if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) ||
  1204 + commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) {
  1205 + // this.props.onSaveState({ fastOrderModalVisible: false });
  1206 + message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */
  1207 + return;
  1208 + }
  1209 + /* 验证产品规格是否 符合数字*数字格式 */
  1210 + const sProductStyle = paramMap.sProductStyle;
  1211 + if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */
  1212 + const arr = sProductStyle.split('*');
  1213 + const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/;
  1214 + if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) {
  1215 + for (let i = 0; i < arr.length; i += 1) {
  1216 + if (!numCheck.test(arr[i])) { /* 验证是否数字 */
  1217 + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
  1218 + return;
1236 } 1219 }
1237 - } else {  
1238 - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));  
1239 - return;  
1240 } 1220 }
1241 - /* 验证*两边是否是数字 */  
1242 } else { 1221 } else {
1243 message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); 1222 message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
1244 return; 1223 return;
1245 } 1224 }
1246 - this.props.onSaveState({  
1247 - Loading: true,  
1248 - }); 1225 + /* 验证*两边是否是数字 */
  1226 + } else {
  1227 + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
  1228 + return;
  1229 + }
  1230 + this.props.onSaveState({
  1231 + Loading: true,
  1232 + });
1249 1233
1250 - let dataReturn = paramMap; 1234 + let dataReturn = paramMap;
  1235 + if (!flag) {
  1236 + const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;
  1237 + dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;
  1238 + }
  1239 + if (dataReturn.code === 1 || flag) {
  1240 + const {
  1241 + productClassify, productProcessInfo, partsInfo: partsOldInfo,
  1242 + } = flag ? dataReturn : dataReturn.dataset.rows[0];
  1243 + let partsNewInfo = [];
1251 if (!flag) { 1244 if (!flag) {
1252 - const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;  
1253 - dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; 1245 + partsNewInfo = dataReturn.dataset.rows[0].partsNewInfo;
  1246 + } else {
  1247 + partsNewInfo = partsOldInfo;
1254 } 1248 }
1255 - if (dataReturn.code === 1 || flag) {  
1256 - const {  
1257 - productClassify, productProcessInfo, partsInfo: partsOldInfo,  
1258 - } = flag ? dataReturn : dataReturn.dataset.rows[0];  
1259 - let partsNewInfo = [];  
1260 - if (!flag) {  
1261 - partsNewInfo = dataReturn.dataset.rows[0].partsNewInfo;  
1262 - } else {  
1263 - partsNewInfo = partsOldInfo;  
1264 - }  
1265 - const slaveData = [];  
1266 - const controlData = [];  
1267 - const materialsData = [];  
1268 - let processData = [];  
1269 - const tableDataRow = {};  
1270 - for (const item of slaveConfig.gdsconfigformslave) {  
1271 - tableDataRow[item.sName] = masterData[item.sName];  
1272 - }  
1273 - tableDataRow.sId = commonUtils.createSid();  
1274 - tableDataRow.handleType = 'add';  
1275 - tableDataRow.iOrder = 1;  
1276 - tableDataRow.sParentId = masterData.sId;  
1277 - // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');  
1278 - let productIdDropDown;  
1279 - const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName');  
1280 - if (slaveIndex > -1) {  
1281 - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);  
1282 - productIdDropDown = sqlDropDownData.dropDownData;  
1283 - }  
1284 - const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);  
1285 - if (iProductIdIndex === -1) {  
1286 - tableDataRow.sProductId = tableDataRow.sProductName;  
1287 - tableDataRow.sProductInfo = JSON.stringify({  
1288 - sProductId: tableDataRow.sProductName,  
1289 - sProductName: tableDataRow.sProductName,  
1290 - sProductStyle: tableDataRow.sProductStyle,  
1291 - sProductUnit: tableDataRow.sProductUnit,  
1292 - sProductNo: tableDataRow.sProductNo,  
1293 - sCustomerProductNo: tableDataRow.sCustomerProductNo,  
1294 - sProductClassifyId: tableDataRow.sProductClassifyId,  
1295 - sProductClassifyName: tableDataRow.sProductClassifyName,  
1296 - });  
1297 - } else {  
1298 - tableDataRow.sProductInfo = '';  
1299 - }  
1300 - slaveData.push(tableDataRow);  
1301 - const sInfoArr = [];  
1302 - if (!commonUtils.isEmptyArr(partsOldInfo)) {  
1303 - partsOldInfo.forEach((item) => {  
1304 - if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {  
1305 - this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });  
1306 - }  
1307 - });  
1308 - }  
1309 - if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */  
1310 - partsNewInfo.forEach((item) => {  
1311 - const { sPartsName, sInfo } = item;  
1312 - const sInfoObj = {};  
1313 - sInfoObj.sPartsName = sPartsName;  
1314 - sInfoObj.sInfo = sInfo;  
1315 - sInfoArr.push(sInfoObj);  
1316 - });  
1317 - }  
1318 - const bProcessAssort = false;  
1319 - let returnProcessAssort = [];  
1320 - let processAssignAssort = '';  
1321 - let dropDownDataProcessName; 1249 + const slaveData = [];
  1250 + const controlData = [];
  1251 + const materialsData = [];
  1252 + let processData = [];
  1253 + const tableDataRow = {};
  1254 + for (const item of slaveConfig.gdsconfigformslave) {
  1255 + tableDataRow[item.sName] = masterData[item.sName];
  1256 + }
  1257 + tableDataRow.sId = commonUtils.createSid();
  1258 + tableDataRow.handleType = 'add';
  1259 + tableDataRow.iOrder = 1;
  1260 + tableDataRow.sParentId = masterData.sId;
  1261 + // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');
  1262 + let productIdDropDown;
  1263 + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName');
  1264 + if (slaveIndex > -1) {
  1265 + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);
  1266 + productIdDropDown = sqlDropDownData.dropDownData;
  1267 + }
  1268 + const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);
  1269 + if (iProductIdIndex === -1) {
  1270 + tableDataRow.sProductId = tableDataRow.sProductName;
  1271 + tableDataRow.sProductInfo = JSON.stringify({
  1272 + sProductId: tableDataRow.sProductName,
  1273 + sProductName: tableDataRow.sProductName,
  1274 + sProductStyle: tableDataRow.sProductStyle,
  1275 + sProductUnit: tableDataRow.sProductUnit,
  1276 + sProductNo: tableDataRow.sProductNo,
  1277 + sCustomerProductNo: tableDataRow.sCustomerProductNo,
  1278 + sProductClassifyId: tableDataRow.sProductClassifyId,
  1279 + sProductClassifyName: tableDataRow.sProductClassifyName,
  1280 + });
  1281 + } else {
  1282 + tableDataRow.sProductInfo = '';
  1283 + }
  1284 + slaveData.push(tableDataRow);
  1285 + const sInfoArr = [];
  1286 + if (!commonUtils.isEmptyArr(partsOldInfo)) {
  1287 + partsOldInfo.forEach((item) => {
  1288 + if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {
  1289 + this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });
  1290 + }
  1291 + });
  1292 + }
  1293 + if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */
  1294 + partsNewInfo.forEach((item) => {
  1295 + const { sPartsName, sInfo } = item;
  1296 + const sInfoObj = {};
  1297 + sInfoObj.sPartsName = sPartsName;
  1298 + sInfoObj.sInfo = sInfo;
  1299 + sInfoArr.push(sInfoObj);
  1300 + });
  1301 + }
  1302 + const bProcessAssort = false;
  1303 + let returnProcessAssort = [];
  1304 + let processAssignAssort = '';
  1305 + let dropDownDataProcessName;
  1306 + if (bProcessAssort) {
  1307 + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;
  1308 + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;
  1309 + if (dataProcessAssort.code === 1) {
  1310 + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;
  1311 + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName');
  1312 + if (iIndex > -1) {
  1313 + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]);
  1314 + dropDownDataProcessName = sqlDropDownData.dropDownData;
  1315 + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField;
  1316 + }
  1317 + }
  1318 + }
  1319 + const newCopyTo = {};
  1320 + newCopyTo.master = masterData;
  1321 + newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];
  1322 + partsNewInfo.forEach((partInfo, iIndex) => {
  1323 + const partsDataRow = {};
  1324 + for (const child of Object.keys(partInfo)) {
  1325 + partsDataRow[child] = partInfo[child];
  1326 + }
  1327 + partsDataRow.handleType = 'add';
  1328 + partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */
  1329 + partsDataRow.sId = commonUtils.createSid();
  1330 + partsDataRow.sParentId = masterData.sId;
  1331 + if (partsDataRow.iPrintMode !== 3) {
  1332 + partsDataRow.iOppositeColor = partsDataRow.iPositiveColor;
  1333 + }
  1334 + delete partsDataRow.dMaterialsKQty;
  1335 + delete partsDataRow.dMaterialsLength;
  1336 + delete partsDataRow.dMaterialsWidth;
  1337 + if (productClassify && productClassify.bSpecialRules) {
  1338 + partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;
  1339 + partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;
  1340 + }
  1341 + controlData.push(partsDataRow);
  1342 + // 材料信息
  1343 + partInfo.materialsInfo.forEach((materialInfo, iOrder) => {
  1344 + const materialDataRow = {};
  1345 + for (const item of materialsConfig.gdsconfigformslave) {
  1346 + materialDataRow[item.sName] = materialInfo[item.sName];
  1347 + }
  1348 + materialDataRow.handleType = 'add';
  1349 + materialDataRow.sType = '0';
  1350 + materialDataRow.iPartOrder = iIndex;
  1351 + materialDataRow.iOrder = iOrder + 1;
  1352 + materialDataRow.sPartsName = partsDataRow.sPartsName;
  1353 + materialDataRow.sId = commonUtils.createSid();
  1354 + materialDataRow.sParentId = masterData.sId;
  1355 + materialDataRow.sControlId = partsDataRow.sId;
  1356 + materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;
  1357 + materialsData.push(materialDataRow);
  1358 + });
  1359 + // 工序信息
  1360 + let processPrintDataRow = {};
  1361 + processPrintDataRow.handleType = 'add';
  1362 + processPrintDataRow.sProcessId = partInfo.sProcessId || partInfo.sPrintProcessId;
  1363 + const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);
  1364 + if (iProcessPrintIndex > -1) {
  1365 + processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段
  1366 + }
  1367 + processPrintDataRow.sType = partInfo.sType;
  1368 + processPrintDataRow.iPartOrder = iIndex;
  1369 + processPrintDataRow.iOrder = 1;
  1370 + if (partInfo.sProcessName) {
  1371 + processPrintDataRow.sProcessName = partInfo.sProcessName;
  1372 + }
  1373 + processPrintDataRow.sPartsName = partsDataRow.sPartsName;
  1374 + processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;
  1375 + processPrintDataRow.dLossQty = partInfo.dLossQty;
  1376 + processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;
  1377 + processPrintDataRow.sId = commonUtils.createSid();
  1378 + processPrintDataRow.sParentId = masterData.sId;
  1379 + processPrintDataRow.sControlId = partsDataRow.sId;
  1380 + processData.push(processPrintDataRow);
  1381 + // 配套工序
1322 if (bProcessAssort) { 1382 if (bProcessAssort) {
1323 - const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;  
1324 - const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;  
1325 - if (dataProcessAssort.code === 1) {  
1326 - returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;  
1327 - const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName');  
1328 - if (iIndex > -1) {  
1329 - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]);  
1330 - dropDownDataProcessName = sqlDropDownData.dropDownData;  
1331 - processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; 1383 + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {
  1384 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  1385 + const iProcessIndex = -1;
  1386 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);
  1387 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  1388 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  1389 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  1390 + processRow.handleType = 'add';
  1391 + processRow.sId = commonUtils.createSid();
  1392 + processRow.sParentId = masterData.sId;
  1393 + processRow.sControlId = partsDataRow.sId;
  1394 + processRow.sPartsName = partsDataRow.sPartsName;
  1395 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  1396 + processData.push(processRow);
1332 } 1397 }
1333 - } 1398 + }));
1334 } 1399 }
1335 - const newCopyTo = {};  
1336 - newCopyTo.master = masterData;  
1337 - newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];  
1338 - partsNewInfo.forEach((partInfo, iIndex) => {  
1339 - const partsDataRow = {};  
1340 - for (const child of Object.keys(partInfo)) {  
1341 - partsDataRow[child] = partInfo[child];  
1342 - }  
1343 - partsDataRow.handleType = 'add';  
1344 - partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */  
1345 - partsDataRow.sId = commonUtils.createSid();  
1346 - partsDataRow.sParentId = masterData.sId;  
1347 - if (partsDataRow.iPrintMode !== 3) {  
1348 - partsDataRow.iOppositeColor = partsDataRow.iPositiveColor;  
1349 - }  
1350 - delete partsDataRow.dMaterialsKQty;  
1351 - delete partsDataRow.dMaterialsLength;  
1352 - delete partsDataRow.dMaterialsWidth;  
1353 - if (productClassify && productClassify.bSpecialRules) {  
1354 - partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;  
1355 - partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;  
1356 - }  
1357 - controlData.push(partsDataRow);  
1358 - // 材料信息  
1359 - partInfo.materialsInfo.forEach((materialInfo, iOrder) => {  
1360 - const materialDataRow = {};  
1361 - for (const item of materialsConfig.gdsconfigformslave) {  
1362 - materialDataRow[item.sName] = materialInfo[item.sName];  
1363 - }  
1364 - materialDataRow.handleType = 'add';  
1365 - materialDataRow.sType = '0';  
1366 - materialDataRow.iPartOrder = iIndex;  
1367 - materialDataRow.iOrder = iOrder + 1;  
1368 - materialDataRow.sPartsName = partsDataRow.sPartsName;  
1369 - materialDataRow.sId = commonUtils.createSid();  
1370 - materialDataRow.sParentId = masterData.sId;  
1371 - materialDataRow.sControlId = partsDataRow.sId;  
1372 - materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;  
1373 - materialsData.push(materialDataRow);  
1374 - });  
1375 - // 工序信息  
1376 - let processPrintDataRow = {};  
1377 - processPrintDataRow.handleType = 'add';  
1378 - processPrintDataRow.sProcessId = partInfo.sProcessId || partInfo.sPrintProcessId;  
1379 - const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);  
1380 - if (iProcessPrintIndex > -1) {  
1381 - processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段  
1382 - }  
1383 - processPrintDataRow.sType = partInfo.sType;  
1384 - processPrintDataRow.iPartOrder = iIndex;  
1385 - processPrintDataRow.iOrder = 1;  
1386 - if (partInfo.sProcessName) {  
1387 - processPrintDataRow.sProcessName = partInfo.sProcessName;  
1388 - }  
1389 - processPrintDataRow.sPartsName = partsDataRow.sPartsName;  
1390 - processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;  
1391 - processPrintDataRow.dLossQty = partInfo.dLossQty;  
1392 - processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;  
1393 - processPrintDataRow.sId = commonUtils.createSid();  
1394 - processPrintDataRow.sParentId = masterData.sId;  
1395 - processPrintDataRow.sControlId = partsDataRow.sId;  
1396 - processData.push(processPrintDataRow);  
1397 - // 配套工序  
1398 - if (bProcessAssort) {  
1399 - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {  
1400 - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);  
1401 - const iProcessIndex = -1;  
1402 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);  
1403 - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {  
1404 - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值  
1405 - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段  
1406 - processRow.handleType = 'add';  
1407 - processRow.sId = commonUtils.createSid();  
1408 - processRow.sParentId = masterData.sId;  
1409 - processRow.sControlId = partsDataRow.sId;  
1410 - processRow.sPartsName = partsDataRow.sPartsName;  
1411 - processRow.sType = dropDownDataProcessName[iIndex].sType;  
1412 - processData.push(processRow);  
1413 - }  
1414 - }));  
1415 - }  
1416 1400
1417 - partInfo.processInfo.forEach((process, iOrder) => {  
1418 - let processAfterDataRow = {};  
1419 - for (const item of processConfig.gdsconfigformslave) {  
1420 - processAfterDataRow[item.sName] = process[item.sName];  
1421 - }  
1422 - for (const child of Object.keys(process)) {  
1423 - processAfterDataRow[child] = process[child];  
1424 - }  
1425 - processAfterDataRow.handleType = 'add';  
1426 - processAfterDataRow.sProcessId = process.sProcessId;  
1427 - const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);  
1428 - if (iProcessAfterIndex > -1) {  
1429 - processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段  
1430 - }  
1431 - processAfterDataRow.sType = process.sType;  
1432 - processAfterDataRow.iPartOrder = iIndex;  
1433 - processAfterDataRow.iOrder = iOrder + 1;  
1434 - processAfterDataRow.sPartsName = partsDataRow.sPartsName;  
1435 - processAfterDataRow.sId = commonUtils.createSid();  
1436 - processAfterDataRow.sParentId = masterData.sId;  
1437 - processAfterDataRow.sControlId = partsDataRow.sId;  
1438 - processData.push(processAfterDataRow);  
1439 - // 配套工序  
1440 - if (bProcessAssort) {  
1441 - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {  
1442 - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);  
1443 - const iProcessIndex = -1;  
1444 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);  
1445 - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {  
1446 - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值  
1447 - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段  
1448 - processRow.handleType = 'add';  
1449 - processRow.sId = commonUtils.createSid();  
1450 - processRow.sParentId = masterData.sId;  
1451 - processRow.sControlId = partsDataRow.sId;  
1452 - processRow.sPartsName = partsDataRow.sPartsName;  
1453 - processRow.sType = dropDownDataProcessName[iIndex].sType;  
1454 - processData.push(processRow);  
1455 - }  
1456 - }));  
1457 - }  
1458 - });  
1459 - });  
1460 - productProcessInfo.forEach((process, iOrder) => {  
1461 - let processProductDataRow = {}; 1401 + partInfo.processInfo.forEach((process, iOrder) => {
  1402 + let processAfterDataRow = {};
1462 for (const item of processConfig.gdsconfigformslave) { 1403 for (const item of processConfig.gdsconfigformslave) {
1463 - processProductDataRow[item.sName] = process[item.sName]; 1404 + processAfterDataRow[item.sName] = process[item.sName];
1464 } 1405 }
1465 for (const child of Object.keys(process)) { 1406 for (const child of Object.keys(process)) {
1466 - processProductDataRow[child] = process[child];  
1467 - }  
1468 - const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);  
1469 - if (iProductProcessIndex > -1) {  
1470 - processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段  
1471 - }  
1472 - processProductDataRow.handleType = 'add';  
1473 - processProductDataRow.sType = '3';  
1474 - processProductDataRow.sPartsName = '';  
1475 - processProductDataRow.iPartOrder = 999;  
1476 - processProductDataRow.iOrder = iOrder + 1;  
1477 - processProductDataRow.sId = commonUtils.createSid();  
1478 - processProductDataRow.sParentId = masterData.sId;  
1479 - processData.push(processProductDataRow); 1407 + processAfterDataRow[child] = process[child];
  1408 + }
  1409 + processAfterDataRow.handleType = 'add';
  1410 + processAfterDataRow.sProcessId = process.sProcessId;
  1411 + const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);
  1412 + if (iProcessAfterIndex > -1) {
  1413 + processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段
  1414 + }
  1415 + processAfterDataRow.sType = process.sType;
  1416 + processAfterDataRow.iPartOrder = iIndex;
  1417 + processAfterDataRow.iOrder = iOrder + 1;
  1418 + processAfterDataRow.sPartsName = partsDataRow.sPartsName;
  1419 + processAfterDataRow.sId = commonUtils.createSid();
  1420 + processAfterDataRow.sParentId = masterData.sId;
  1421 + processAfterDataRow.sControlId = partsDataRow.sId;
  1422 + processData.push(processAfterDataRow);
1480 // 配套工序 1423 // 配套工序
1481 if (bProcessAssort) { 1424 if (bProcessAssort) {
1482 - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { 1425 + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {
1483 const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); 1426 const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
1484 const iProcessIndex = -1; 1427 const iProcessIndex = -1;
1485 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); 1428 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);
1486 if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { 1429 if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
1487 let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 1430 let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
1488 processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 1431 processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
1489 processRow.handleType = 'add'; 1432 processRow.handleType = 'add';
1490 processRow.sId = commonUtils.createSid(); 1433 processRow.sId = commonUtils.createSid();
1491 processRow.sParentId = masterData.sId; 1434 processRow.sParentId = masterData.sId;
  1435 + processRow.sControlId = partsDataRow.sId;
  1436 + processRow.sPartsName = partsDataRow.sPartsName;
1492 processRow.sType = dropDownDataProcessName[iIndex].sType; 1437 processRow.sType = dropDownDataProcessName[iIndex].sType;
1493 processData.push(processRow); 1438 processData.push(processRow);
1494 } 1439 }
1495 })); 1440 }));
1496 } 1441 }
1497 }); 1442 });
1498 - processData = this.sortData(controlData, processData);  
1499 - const addState = {};  
1500 - if (!commonUtils.isEmptyArr(controlData) && controlData.length === 1) {  
1501 - addState.controlSelectedRowKeys = [controlData[0].sId];  
1502 - } else {  
1503 - addState.controlSelectedRowKeys = []; 1443 + });
  1444 + productProcessInfo.forEach((process, iOrder) => {
  1445 + let processProductDataRow = {};
  1446 + for (const item of processConfig.gdsconfigformslave) {
  1447 + processProductDataRow[item.sName] = process[item.sName];
  1448 + }
  1449 + for (const child of Object.keys(process)) {
  1450 + processProductDataRow[child] = process[child];
  1451 + }
  1452 + const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);
  1453 + if (iProductProcessIndex > -1) {
  1454 + processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段
  1455 + }
  1456 + processProductDataRow.handleType = 'add';
  1457 + processProductDataRow.sType = '3';
  1458 + processProductDataRow.sPartsName = '';
  1459 + processProductDataRow.iPartOrder = 999;
  1460 + processProductDataRow.iOrder = iOrder + 1;
  1461 + processProductDataRow.sId = commonUtils.createSid();
  1462 + processProductDataRow.sParentId = masterData.sId;
  1463 + processData.push(processProductDataRow);
  1464 + // 配套工序
  1465 + if (bProcessAssort) {
  1466 + returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => {
  1467 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  1468 + const iProcessIndex = -1;
  1469 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId);
  1470 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  1471 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  1472 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  1473 + processRow.handleType = 'add';
  1474 + processRow.sId = commonUtils.createSid();
  1475 + processRow.sParentId = masterData.sId;
  1476 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  1477 + processData.push(processRow);
  1478 + }
  1479 + }));
1504 } 1480 }
1505 - this.props.onSaveState({  
1506 - materialsConfig,  
1507 - slaveData,  
1508 - controlData,  
1509 - materialsData,  
1510 - processData,  
1511 - fastOrderModalVisible: false,  
1512 - workOrderAllprogress: 0,  
1513 - ...addState,  
1514 - materialsSelectedRowKeys: [],  
1515 - sInfoArr,  
1516 - bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),  
1517 - Loading: false,  
1518 - });  
1519 - }  
1520 - if (dataReturn.code !== 1 && !flag) {  
1521 - this.props.getServiceError(dataReturn);  
1522 - this.props.onSaveState({  
1523 - Loading: false,  
1524 - }); 1481 + });
  1482 + processData = this.sortData(controlData, processData);
  1483 + const addState = {};
  1484 + if (!commonUtils.isEmptyArr(controlData) && controlData.length === 1) {
  1485 + addState.controlSelectedRowKeys = [controlData[0].sId];
  1486 + } else {
  1487 + addState.controlSelectedRowKeys = [];
1525 } 1488 }
1526 - }, timValue); 1489 + this.props.onSaveState({
  1490 + materialsConfig,
  1491 + slaveData,
  1492 + controlData,
  1493 + materialsData,
  1494 + processData,
  1495 + fastOrderModalVisible: false,
  1496 + workOrderAllprogress: 0,
  1497 + ...addState,
  1498 + materialsSelectedRowKeys: [],
  1499 + sInfoArr,
  1500 + bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),
  1501 + Loading: false,
  1502 + });
  1503 + }
  1504 + if (dataReturn.code !== 1 && !flag) {
  1505 + this.props.getServiceError(dataReturn);
  1506 + this.props.onSaveState({
  1507 + Loading: false,
  1508 + });
  1509 + }
1527 }; 1510 };
1528 1511
1529 /* 勾选工序分类 */ 1512 /* 勾选工序分类 */
src/components/Manufacture/WorkOrderPack/WorkOrderResearchTableTree.js
@@ -1018,431 +1018,414 @@ class WorkOrderPack extends Component { @@ -1018,431 +1018,414 @@ class WorkOrderPack extends Component {
1018 if (sAllPartsName !== undefined) { 1018 if (sAllPartsName !== undefined) {
1019 allPartsName = sAllPartsName.split(','); 1019 allPartsName = sAllPartsName.split(',');
1020 } 1020 }
1021 - let timValue = 0;  
1022 - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) {  
1023 - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });  
1024 - timValue = 3000;  
1025 - }  
1026 - setTimeout(async () => {  
1027 - this.props.app.webSocket.onmessage = (msg) => {  
1028 - const rtmsg = JSON.parse(msg.data);  
1029 - if (rtmsg.action === 'workOrderAllprogress') {  
1030 - this.props.onSaveState({  
1031 - workOrderAllprogress: rtmsg.msg,  
1032 - });  
1033 - } else if (rtmsg.action === 'loginOut') {  
1034 - if (location.pathname.indexOf('/indexOee') > -1) {  
1035 - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } });  
1036 - } else if (location.pathname.indexOf('/indexMobile') > -1) {  
1037 - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } });  
1038 - } else {  
1039 - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } });  
1040 - }  
1041 - } else if (this.props.app.webSocket.homeAction) {  
1042 - this.props.app.webSocket.homeAction(msg);  
1043 - }  
1044 - };  
1045 - let cpProcessName = '';  
1046 - checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData;  
1047 - // paramMap.modelName = masterData.modelName;  
1048 - paramMap.sCustomerId = masterData.sCustomerId;  
1049 - paramMap.sCustomerName = masterData.sCustomerName;  
1050 - paramMap.sProductClassifyId = masterData.sProductClassifyId;  
1051 - paramMap.sProductId = masterData.sProductId;  
1052 - paramMap.sProductName = masterData.sProductName;  
1053 - paramMap.sProductStyleId = masterData.sProductStyleId;  
1054 - paramMap.sProductStyle = masterData.sProductStyle;  
1055 - paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0;  
1056 - paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0;  
1057 - paramMap.dProductHeight = 0;  
1058 - paramMap.dProductQty = masterData.dProductQty;  
1059 - const partsInfo = [];  
1060 - allPartsName.forEach((item) => {  
1061 - const partInfo = {};  
1062 - partInfo.sPartsName = item;  
1063 - partInfo.dPartsQty = masterData.dProductQty;  
1064 - partInfo.dSumPQty = masterData[`dSumPQty${item}`];  
1065 - const materialsInfo = [];  
1066 - const material = {};  
1067 - material.sMaterialsId = masterData[`sMaterialsId${item}`];  
1068 - material.sMaterialsNo = masterData[`sMaterialsNo${item}`];  
1069 - material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`];  
1070 - materialsInfo.push(material);  
1071 - partInfo.materialsInfo = materialsInfo;  
1072 - partInfo.iPositiveColor = masterData[`iPositiveColor${item}`];  
1073 - partInfo.iPrintModePo = masterData[`iPrintModePo${item}`];  
1074 - if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') {  
1075 - const processInfo = [];  
1076 - checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => {  
1077 - if (!commonUtils.isEmpty(masterData[card.sId + item])) {  
1078 - if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') {  
1079 - partInfo.sPrintProcessId = masterData[card.sId + item];  
1080 - } else {  
1081 - const process = {};  
1082 - process.sProductClassifyId = card.sId;  
1083 - process.sProcessId = masterData[card.sId + item];  
1084 -  
1085 - if (masterData[card.sId + card.sName + item] !== undefined) {  
1086 - process.sProcessName = masterData[card.sId + card.sName + item];  
1087 - process.sType = masterData[card.sId + card.sType + item];  
1088 - processInfo.push(process);  
1089 - } 1021 + this.props.app.webSocket.onmessageTmp = (msg) => {
  1022 + const rtmsg = JSON.parse(msg.data);
  1023 + if (rtmsg.action === 'workOrderAllprogress') {
  1024 + this.props.onSaveState({
  1025 + workOrderAllprogress: rtmsg.msg,
  1026 + });
  1027 + }
  1028 + };
  1029 + let cpProcessName = '';
  1030 + checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData;
  1031 + // paramMap.modelName = masterData.modelName;
  1032 + paramMap.sCustomerId = masterData.sCustomerId;
  1033 + paramMap.sCustomerName = masterData.sCustomerName;
  1034 + paramMap.sProductClassifyId = masterData.sProductClassifyId;
  1035 + paramMap.sProductId = masterData.sProductId;
  1036 + paramMap.sProductName = masterData.sProductName;
  1037 + paramMap.sProductStyleId = masterData.sProductStyleId;
  1038 + paramMap.sProductStyle = masterData.sProductStyle;
  1039 + paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0;
  1040 + paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0;
  1041 + paramMap.dProductHeight = 0;
  1042 + paramMap.dProductQty = masterData.dProductQty;
  1043 + const partsInfo = [];
  1044 + allPartsName.forEach((item) => {
  1045 + const partInfo = {};
  1046 + partInfo.sPartsName = item;
  1047 + partInfo.dPartsQty = masterData.dProductQty;
  1048 + partInfo.dSumPQty = masterData[`dSumPQty${item}`];
  1049 + const materialsInfo = [];
  1050 + const material = {};
  1051 + material.sMaterialsId = masterData[`sMaterialsId${item}`];
  1052 + material.sMaterialsNo = masterData[`sMaterialsNo${item}`];
  1053 + material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`];
  1054 + materialsInfo.push(material);
  1055 + partInfo.materialsInfo = materialsInfo;
  1056 + partInfo.iPositiveColor = masterData[`iPositiveColor${item}`];
  1057 + partInfo.iPrintModePo = masterData[`iPrintModePo${item}`];
  1058 + if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') {
  1059 + const processInfo = [];
  1060 + checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => {
  1061 + if (!commonUtils.isEmpty(masterData[card.sId + item])) {
  1062 + if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') {
  1063 + partInfo.sPrintProcessId = masterData[card.sId + item];
  1064 + } else {
  1065 + const process = {};
  1066 + process.sProductClassifyId = card.sId;
  1067 + process.sProcessId = masterData[card.sId + item];
  1068 +
  1069 + if (masterData[card.sId + card.sName + item] !== undefined) {
  1070 + process.sProcessName = masterData[card.sId + card.sName + item];
  1071 + process.sType = masterData[card.sId + card.sType + item];
  1072 + processInfo.push(process);
1090 } 1073 }
1091 } 1074 }
1092 - });  
1093 - partInfo.processInfo = processInfo;  
1094 - partsInfo.push(partInfo);  
1095 - }  
1096 - });  
1097 - const productProcess = [];  
1098 - checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => {  
1099 - if (!commonUtils.isEmpty(masterData[card.sId])) {  
1100 - const process = {};  
1101 - process.sProductClassifyId = card.sId;  
1102 - process.sProcessId = masterData[card.sId];  
1103 - process.sProcessName = masterData[card.sId + card.sName];  
1104 - if (masterData[card.sId + card.sName] !== undefined) {  
1105 - cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`;  
1106 - productProcess.push(process);  
1107 } 1075 }
  1076 + });
  1077 + partInfo.processInfo = processInfo;
  1078 + partsInfo.push(partInfo);
  1079 + }
  1080 + });
  1081 + const productProcess = [];
  1082 + checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => {
  1083 + if (!commonUtils.isEmpty(masterData[card.sId])) {
  1084 + const process = {};
  1085 + process.sProductClassifyId = card.sId;
  1086 + process.sProcessId = masterData[card.sId];
  1087 + process.sProcessName = masterData[card.sId + card.sName];
  1088 + if (masterData[card.sId + card.sName] !== undefined) {
  1089 + cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`;
  1090 + productProcess.push(process);
1108 } 1091 }
1109 - });  
1110 - paramMap.cpProcessName = cpProcessName;  
1111 - paramMap.productProcessInfo = productProcess;  
1112 - paramMap.partsInfo = partsInfo;  
1113 - let numErr = false;  
1114 - let numName = '';  
1115 - let num = 0;  
1116 -  
1117 - // eslint-disable-next-line array-callback-return  
1118 - paramMap.partsInfo.map((item) => {  
1119 - if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) {  
1120 - num = item.dSumPQty;  
1121 - numName = item.sPartsName;  
1122 - }  
1123 - if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) {  
1124 - numErr = true;  
1125 - numName = item.sPartsName;  
1126 - }  
1127 - });  
1128 - if (numErr) {  
1129 - message.error(`${numName}P数必须是2的倍数!`);  
1130 - return;  
1131 } 1092 }
1132 - if (num === 2) {  
1133 - message.error(`${numName}P数必须大于4P!`);  
1134 - return; 1093 + });
  1094 + paramMap.cpProcessName = cpProcessName;
  1095 + paramMap.productProcessInfo = productProcess;
  1096 + paramMap.partsInfo = partsInfo;
  1097 + let numErr = false;
  1098 + let numName = '';
  1099 + let num = 0;
  1100 +
  1101 + // eslint-disable-next-line array-callback-return
  1102 + paramMap.partsInfo.map((item) => {
  1103 + if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) {
  1104 + num = item.dSumPQty;
  1105 + numName = item.sPartsName;
  1106 + }
  1107 + if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) {
  1108 + numErr = true;
  1109 + numName = item.sPartsName;
1135 } 1110 }
  1111 + });
  1112 + if (numErr) {
  1113 + message.error(`${numName}P数必须是2的倍数!`);
  1114 + return;
  1115 + }
  1116 + if (num === 2) {
  1117 + message.error(`${numName}P数必须大于4P!`);
  1118 + return;
  1119 + }
1136 1120
1137 1121
1138 - if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) ||  
1139 - commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) {  
1140 - // this.props.onSaveState({ fastOrderModalVisible: false });  
1141 - message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */  
1142 - return;  
1143 - }  
1144 - /* 验证产品规格是否 符合数字*数字格式 */  
1145 - const sProductStyle = paramMap.sProductStyle;  
1146 - if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */  
1147 - const arr = sProductStyle.split('*');  
1148 - const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/;  
1149 - if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) {  
1150 - for (let i = 0; i < arr.length; i += 1) {  
1151 - if (!numCheck.test(arr[i])) { /* 验证是否数字 */  
1152 - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));  
1153 - return;  
1154 - } 1122 + if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) ||
  1123 + commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) {
  1124 + // this.props.onSaveState({ fastOrderModalVisible: false });
  1125 + message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */
  1126 + return;
  1127 + }
  1128 + /* 验证产品规格是否 符合数字*数字格式 */
  1129 + const sProductStyle = paramMap.sProductStyle;
  1130 + if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */
  1131 + const arr = sProductStyle.split('*');
  1132 + const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/;
  1133 + if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) {
  1134 + for (let i = 0; i < arr.length; i += 1) {
  1135 + if (!numCheck.test(arr[i])) { /* 验证是否数字 */
  1136 + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
  1137 + return;
1155 } 1138 }
1156 - } else {  
1157 - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));  
1158 - return;  
1159 } 1139 }
1160 - /* 验证*两边是否是数字 */  
1161 } else { 1140 } else {
1162 message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); 1141 message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
1163 return; 1142 return;
1164 } 1143 }
1165 - this.props.onSaveState({  
1166 - Loading: true,  
1167 - }); 1144 + /* 验证*两边是否是数字 */
  1145 + } else {
  1146 + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr'));
  1147 + return;
  1148 + }
  1149 + this.props.onSaveState({
  1150 + Loading: true,
  1151 + });
1168 1152
1169 - let dataReturn = paramMap; 1153 + let dataReturn = paramMap;
  1154 + if (!flag) {
  1155 + const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;
  1156 + dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;
  1157 + }
  1158 + if (dataReturn.code === 1 || flag) {
  1159 + const {
  1160 + productClassify, productProcessInfo, partsInfo: partsOldInfo,
  1161 + } = flag ? dataReturn : dataReturn.dataset.rows[0];
  1162 + let partsNewInfo = [];
1170 if (!flag) { 1163 if (!flag) {
1171 - const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;  
1172 - dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; 1164 + partsNewInfo = dataReturn.dataset.rows[0].partsNewInfo;
  1165 + } else {
  1166 + partsNewInfo = partsOldInfo;
1173 } 1167 }
1174 - if (dataReturn.code === 1 || flag) {  
1175 - const {  
1176 - productClassify, productProcessInfo, partsInfo: partsOldInfo,  
1177 - } = flag ? dataReturn : dataReturn.dataset.rows[0];  
1178 - let partsNewInfo = [];  
1179 - if (!flag) {  
1180 - partsNewInfo = dataReturn.dataset.rows[0].partsNewInfo;  
1181 - } else {  
1182 - partsNewInfo = partsOldInfo;  
1183 - }  
1184 - const slaveData = [];  
1185 - const controlData = [];  
1186 - const materialsData = [];  
1187 - let processData = [];  
1188 - const tableDataRow = {};  
1189 - for (const item of slaveConfig.gdsconfigformslave) {  
1190 - tableDataRow[item.sName] = masterData[item.sName];  
1191 - }  
1192 - tableDataRow.sId = commonUtils.createSid();  
1193 - tableDataRow.handleType = 'add';  
1194 - tableDataRow.iOrder = 1;  
1195 - tableDataRow.sParentId = masterData.sId;  
1196 - // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');  
1197 - let productIdDropDown;  
1198 - const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName');  
1199 - if (slaveIndex > -1) {  
1200 - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);  
1201 - productIdDropDown = sqlDropDownData.dropDownData;  
1202 - }  
1203 - const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);  
1204 - if (iProductIdIndex === -1) {  
1205 - tableDataRow.sProductId = tableDataRow.sProductName;  
1206 - tableDataRow.sProductInfo = JSON.stringify({  
1207 - sProductId: tableDataRow.sProductName,  
1208 - sProductName: tableDataRow.sProductName,  
1209 - sProductStyle: tableDataRow.sProductStyle,  
1210 - sProductUnit: tableDataRow.sProductUnit,  
1211 - sProductNo: tableDataRow.sProductNo,  
1212 - sCustomerProductNo: tableDataRow.sCustomerProductNo,  
1213 - sProductClassifyId: tableDataRow.sProductClassifyId,  
1214 - sProductClassifyName: tableDataRow.sProductClassifyName,  
1215 - });  
1216 - } else {  
1217 - tableDataRow.sProductInfo = '';  
1218 - }  
1219 - slaveData.push(tableDataRow);  
1220 - const sInfoArr = [];  
1221 - if (!commonUtils.isEmptyArr(partsOldInfo)) {  
1222 - partsOldInfo.forEach((item) => {  
1223 - if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {  
1224 - this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });  
1225 - }  
1226 - });  
1227 - }  
1228 - if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */  
1229 - partsNewInfo.forEach((item) => {  
1230 - const { sPartsName, sInfo } = item;  
1231 - const sInfoObj = {};  
1232 - sInfoObj.sPartsName = sPartsName;  
1233 - sInfoObj.sInfo = sInfo;  
1234 - sInfoArr.push(sInfoObj);  
1235 - });  
1236 - }  
1237 - const bProcessAssort = true;  
1238 - let returnProcessAssort = [];  
1239 - let processAssignAssort = '';  
1240 - let dropDownDataProcessName; 1168 + const slaveData = [];
  1169 + const controlData = [];
  1170 + const materialsData = [];
  1171 + let processData = [];
  1172 + const tableDataRow = {};
  1173 + for (const item of slaveConfig.gdsconfigformslave) {
  1174 + tableDataRow[item.sName] = masterData[item.sName];
  1175 + }
  1176 + tableDataRow.sId = commonUtils.createSid();
  1177 + tableDataRow.handleType = 'add';
  1178 + tableDataRow.iOrder = 1;
  1179 + tableDataRow.sParentId = masterData.sId;
  1180 + // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');
  1181 + let productIdDropDown;
  1182 + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName');
  1183 + if (slaveIndex > -1) {
  1184 + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);
  1185 + productIdDropDown = sqlDropDownData.dropDownData;
  1186 + }
  1187 + const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);
  1188 + if (iProductIdIndex === -1) {
  1189 + tableDataRow.sProductId = tableDataRow.sProductName;
  1190 + tableDataRow.sProductInfo = JSON.stringify({
  1191 + sProductId: tableDataRow.sProductName,
  1192 + sProductName: tableDataRow.sProductName,
  1193 + sProductStyle: tableDataRow.sProductStyle,
  1194 + sProductUnit: tableDataRow.sProductUnit,
  1195 + sProductNo: tableDataRow.sProductNo,
  1196 + sCustomerProductNo: tableDataRow.sCustomerProductNo,
  1197 + sProductClassifyId: tableDataRow.sProductClassifyId,
  1198 + sProductClassifyName: tableDataRow.sProductClassifyName,
  1199 + });
  1200 + } else {
  1201 + tableDataRow.sProductInfo = '';
  1202 + }
  1203 + slaveData.push(tableDataRow);
  1204 + const sInfoArr = [];
  1205 + if (!commonUtils.isEmptyArr(partsOldInfo)) {
  1206 + partsOldInfo.forEach((item) => {
  1207 + if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {
  1208 + this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });
  1209 + }
  1210 + });
  1211 + }
  1212 + if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */
  1213 + partsNewInfo.forEach((item) => {
  1214 + const { sPartsName, sInfo } = item;
  1215 + const sInfoObj = {};
  1216 + sInfoObj.sPartsName = sPartsName;
  1217 + sInfoObj.sInfo = sInfo;
  1218 + sInfoArr.push(sInfoObj);
  1219 + });
  1220 + }
  1221 + const bProcessAssort = true;
  1222 + let returnProcessAssort = [];
  1223 + let processAssignAssort = '';
  1224 + let dropDownDataProcessName;
  1225 + if (bProcessAssort) {
  1226 + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;
  1227 + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;
  1228 + if (dataProcessAssort.code === 1) {
  1229 + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;
  1230 + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName');
  1231 + if (iIndex > -1) {
  1232 + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]);
  1233 + dropDownDataProcessName = sqlDropDownData.dropDownData;
  1234 + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField;
  1235 + }
  1236 + }
  1237 + }
  1238 + const newCopyTo = {};
  1239 + newCopyTo.master = masterData;
  1240 + newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];
  1241 + partsNewInfo.forEach((partInfo, iIndex) => {
  1242 + const partsDataRow = {};
  1243 + for (const child of Object.keys(partInfo)) {
  1244 + partsDataRow[child] = partInfo[child];
  1245 + }
  1246 + partsDataRow.handleType = 'add';
  1247 + partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */
  1248 + partsDataRow.sId = commonUtils.createSid();
  1249 + partsDataRow.sParentId = masterData.sId;
  1250 + if (partsDataRow.iPrintMode !== 3) {
  1251 + partsDataRow.iOppositeColor = partsDataRow.iPositiveColor;
  1252 + }
  1253 + delete partsDataRow.dMaterialsKQty;
  1254 + delete partsDataRow.dMaterialsLength;
  1255 + delete partsDataRow.dMaterialsWidth;
  1256 + if (productClassify && productClassify.bSpecialRules) {
  1257 + partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;
  1258 + partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;
  1259 + }
  1260 + controlData.push(partsDataRow);
  1261 + // 材料信息
  1262 + partInfo.materialsInfo.forEach((materialInfo, iOrder) => {
  1263 + const materialDataRow = {};
  1264 + for (const item of materialsConfig.gdsconfigformslave) {
  1265 + materialDataRow[item.sName] = materialInfo[item.sName];
  1266 + }
  1267 + materialDataRow.handleType = 'add';
  1268 + materialDataRow.sType = '0';
  1269 + materialDataRow.iPartOrder = iIndex;
  1270 + materialDataRow.iOrder = iOrder + 1;
  1271 + materialDataRow.sPartsName = partsDataRow.sPartsName;
  1272 + materialDataRow.sId = commonUtils.createSid();
  1273 + materialDataRow.sParentId = masterData.sId;
  1274 + materialDataRow.sControlId = partsDataRow.sId;
  1275 + materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;
  1276 + materialsData.push(materialDataRow);
  1277 + });
  1278 + // 工序信息
  1279 + let processPrintDataRow = {};
  1280 + processPrintDataRow.handleType = 'add';
  1281 + processPrintDataRow.sProcessId = partInfo.sProcessId || partInfo.sPrintProcessId;
  1282 + const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);
  1283 + if (iProcessPrintIndex > -1) {
  1284 + processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段
  1285 + }
  1286 + processPrintDataRow.sType = partInfo.sType;
  1287 + processPrintDataRow.iPartOrder = iIndex;
  1288 + processPrintDataRow.iOrder = 1;
  1289 + if (partInfo.sProcessName) {
  1290 + processPrintDataRow.sProcessName = partInfo.sProcessName;
  1291 + }
  1292 + processPrintDataRow.sPartsName = partsDataRow.sPartsName;
  1293 + processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;
  1294 + processPrintDataRow.dLossQty = partInfo.dLossQty;
  1295 + processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;
  1296 + processPrintDataRow.sId = commonUtils.createSid();
  1297 + processPrintDataRow.sParentId = masterData.sId;
  1298 + processPrintDataRow.sControlId = partsDataRow.sId;
  1299 + processData.push(processPrintDataRow);
  1300 + // 配套工序
1241 if (bProcessAssort) { 1301 if (bProcessAssort) {
1242 - const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;  
1243 - const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;  
1244 - if (dataProcessAssort.code === 1) {  
1245 - returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;  
1246 - const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName');  
1247 - if (iIndex > -1) {  
1248 - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]);  
1249 - dropDownDataProcessName = sqlDropDownData.dropDownData;  
1250 - processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; 1302 + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {
  1303 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  1304 + const iProcessIndex = -1;
  1305 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);
  1306 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  1307 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  1308 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  1309 + processRow.handleType = 'add';
  1310 + processRow.sId = commonUtils.createSid();
  1311 + processRow.sParentId = masterData.sId;
  1312 + processRow.sControlId = partsDataRow.sId;
  1313 + processRow.sPartsName = partsDataRow.sPartsName;
  1314 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  1315 + processData.push(processRow);
1251 } 1316 }
1252 - } 1317 + }));
1253 } 1318 }
1254 - const newCopyTo = {};  
1255 - newCopyTo.master = masterData;  
1256 - newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];  
1257 - partsNewInfo.forEach((partInfo, iIndex) => {  
1258 - const partsDataRow = {};  
1259 - for (const child of Object.keys(partInfo)) {  
1260 - partsDataRow[child] = partInfo[child];  
1261 - }  
1262 - partsDataRow.handleType = 'add';  
1263 - partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */  
1264 - partsDataRow.sId = commonUtils.createSid();  
1265 - partsDataRow.sParentId = masterData.sId;  
1266 - if (partsDataRow.iPrintMode !== 3) {  
1267 - partsDataRow.iOppositeColor = partsDataRow.iPositiveColor;  
1268 - }  
1269 - delete partsDataRow.dMaterialsKQty;  
1270 - delete partsDataRow.dMaterialsLength;  
1271 - delete partsDataRow.dMaterialsWidth;  
1272 - if (productClassify && productClassify.bSpecialRules) {  
1273 - partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;  
1274 - partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;  
1275 - }  
1276 - controlData.push(partsDataRow);  
1277 - // 材料信息  
1278 - partInfo.materialsInfo.forEach((materialInfo, iOrder) => {  
1279 - const materialDataRow = {};  
1280 - for (const item of materialsConfig.gdsconfigformslave) {  
1281 - materialDataRow[item.sName] = materialInfo[item.sName];  
1282 - }  
1283 - materialDataRow.handleType = 'add';  
1284 - materialDataRow.sType = '0';  
1285 - materialDataRow.iPartOrder = iIndex;  
1286 - materialDataRow.iOrder = iOrder + 1;  
1287 - materialDataRow.sPartsName = partsDataRow.sPartsName;  
1288 - materialDataRow.sId = commonUtils.createSid();  
1289 - materialDataRow.sParentId = masterData.sId;  
1290 - materialDataRow.sControlId = partsDataRow.sId;  
1291 - materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;  
1292 - materialsData.push(materialDataRow);  
1293 - });  
1294 - // 工序信息  
1295 - let processPrintDataRow = {};  
1296 - processPrintDataRow.handleType = 'add';  
1297 - processPrintDataRow.sProcessId = partInfo.sProcessId || partInfo.sPrintProcessId;  
1298 - const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);  
1299 - if (iProcessPrintIndex > -1) {  
1300 - processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段  
1301 - }  
1302 - processPrintDataRow.sType = partInfo.sType;  
1303 - processPrintDataRow.iPartOrder = iIndex;  
1304 - processPrintDataRow.iOrder = 1;  
1305 - if (partInfo.sProcessName) {  
1306 - processPrintDataRow.sProcessName = partInfo.sProcessName;  
1307 - }  
1308 - processPrintDataRow.sPartsName = partsDataRow.sPartsName;  
1309 - processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;  
1310 - processPrintDataRow.dLossQty = partInfo.dLossQty;  
1311 - processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;  
1312 - processPrintDataRow.sId = commonUtils.createSid();  
1313 - processPrintDataRow.sParentId = masterData.sId;  
1314 - processPrintDataRow.sControlId = partsDataRow.sId;  
1315 - processData.push(processPrintDataRow);  
1316 - // 配套工序  
1317 - if (bProcessAssort) {  
1318 - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {  
1319 - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);  
1320 - const iProcessIndex = -1;  
1321 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);  
1322 - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {  
1323 - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值  
1324 - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段  
1325 - processRow.handleType = 'add';  
1326 - processRow.sId = commonUtils.createSid();  
1327 - processRow.sParentId = masterData.sId;  
1328 - processRow.sControlId = partsDataRow.sId;  
1329 - processRow.sPartsName = partsDataRow.sPartsName;  
1330 - processRow.sType = dropDownDataProcessName[iIndex].sType;  
1331 - processData.push(processRow);  
1332 - }  
1333 - }));  
1334 - }  
1335 1319
1336 - partInfo.processInfo.forEach((process, iOrder) => {  
1337 - let processAfterDataRow = {};  
1338 - for (const item of processConfig.gdsconfigformslave) {  
1339 - processAfterDataRow[item.sName] = process[item.sName];  
1340 - }  
1341 - for (const child of Object.keys(process)) {  
1342 - processAfterDataRow[child] = process[child];  
1343 - }  
1344 - processAfterDataRow.handleType = 'add';  
1345 - processAfterDataRow.sProcessId = process.sProcessId;  
1346 - const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);  
1347 - if (iProcessAfterIndex > -1) {  
1348 - processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段  
1349 - }  
1350 - processAfterDataRow.sType = process.sType;  
1351 - processAfterDataRow.iPartOrder = iIndex;  
1352 - processAfterDataRow.iOrder = iOrder + 1;  
1353 - processAfterDataRow.sPartsName = partsDataRow.sPartsName;  
1354 - processAfterDataRow.sId = commonUtils.createSid();  
1355 - processAfterDataRow.sParentId = masterData.sId;  
1356 - processAfterDataRow.sControlId = partsDataRow.sId;  
1357 - processData.push(processAfterDataRow);  
1358 - // 配套工序  
1359 - if (bProcessAssort) {  
1360 - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {  
1361 - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);  
1362 - const iProcessIndex = -1;  
1363 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);  
1364 - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {  
1365 - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值  
1366 - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段  
1367 - processRow.handleType = 'add';  
1368 - processRow.sId = commonUtils.createSid();  
1369 - processRow.sParentId = masterData.sId;  
1370 - processRow.sControlId = partsDataRow.sId;  
1371 - processRow.sPartsName = partsDataRow.sPartsName;  
1372 - processRow.sType = dropDownDataProcessName[iIndex].sType;  
1373 - processData.push(processRow);  
1374 - }  
1375 - }));  
1376 - }  
1377 - });  
1378 - });  
1379 - productProcessInfo.forEach((process, iOrder) => {  
1380 - let processProductDataRow = {}; 1320 + partInfo.processInfo.forEach((process, iOrder) => {
  1321 + let processAfterDataRow = {};
1381 for (const item of processConfig.gdsconfigformslave) { 1322 for (const item of processConfig.gdsconfigformslave) {
1382 - processProductDataRow[item.sName] = process[item.sName]; 1323 + processAfterDataRow[item.sName] = process[item.sName];
1383 } 1324 }
1384 for (const child of Object.keys(process)) { 1325 for (const child of Object.keys(process)) {
1385 - processProductDataRow[child] = process[child];  
1386 - }  
1387 - const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);  
1388 - if (iProductProcessIndex > -1) {  
1389 - processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段  
1390 - }  
1391 - processProductDataRow.handleType = 'add';  
1392 - processProductDataRow.sType = '3';  
1393 - processProductDataRow.sPartsName = '';  
1394 - processProductDataRow.iPartOrder = 999;  
1395 - processProductDataRow.iOrder = iOrder + 1;  
1396 - processProductDataRow.sId = commonUtils.createSid();  
1397 - processProductDataRow.sParentId = masterData.sId;  
1398 - processData.push(processProductDataRow); 1326 + processAfterDataRow[child] = process[child];
  1327 + }
  1328 + processAfterDataRow.handleType = 'add';
  1329 + processAfterDataRow.sProcessId = process.sProcessId;
  1330 + const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);
  1331 + if (iProcessAfterIndex > -1) {
  1332 + processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段
  1333 + }
  1334 + processAfterDataRow.sType = process.sType;
  1335 + processAfterDataRow.iPartOrder = iIndex;
  1336 + processAfterDataRow.iOrder = iOrder + 1;
  1337 + processAfterDataRow.sPartsName = partsDataRow.sPartsName;
  1338 + processAfterDataRow.sId = commonUtils.createSid();
  1339 + processAfterDataRow.sParentId = masterData.sId;
  1340 + processAfterDataRow.sControlId = partsDataRow.sId;
  1341 + processData.push(processAfterDataRow);
1399 // 配套工序 1342 // 配套工序
1400 if (bProcessAssort) { 1343 if (bProcessAssort) {
1401 - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { 1344 + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => {
1402 const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); 1345 const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
1403 const iProcessIndex = -1; 1346 const iProcessIndex = -1;
1404 - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); 1347 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId);
1405 if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { 1348 if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
1406 let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 1349 let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
1407 processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 1350 processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
1408 processRow.handleType = 'add'; 1351 processRow.handleType = 'add';
1409 processRow.sId = commonUtils.createSid(); 1352 processRow.sId = commonUtils.createSid();
1410 processRow.sParentId = masterData.sId; 1353 processRow.sParentId = masterData.sId;
  1354 + processRow.sControlId = partsDataRow.sId;
  1355 + processRow.sPartsName = partsDataRow.sPartsName;
1411 processRow.sType = dropDownDataProcessName[iIndex].sType; 1356 processRow.sType = dropDownDataProcessName[iIndex].sType;
1412 processData.push(processRow); 1357 processData.push(processRow);
1413 } 1358 }
1414 })); 1359 }));
1415 } 1360 }
1416 }); 1361 });
1417 - processData = this.sortData(controlData, processData);  
1418 - const addState = {};  
1419 - if (!commonUtils.isEmptyArr(controlData) && controlData.length === 1) {  
1420 - addState.controlSelectedRowKeys = [controlData[0].sId];  
1421 - } else {  
1422 - addState.controlSelectedRowKeys = []; 1362 + });
  1363 + productProcessInfo.forEach((process, iOrder) => {
  1364 + let processProductDataRow = {};
  1365 + for (const item of processConfig.gdsconfigformslave) {
  1366 + processProductDataRow[item.sName] = process[item.sName];
  1367 + }
  1368 + for (const child of Object.keys(process)) {
  1369 + processProductDataRow[child] = process[child];
  1370 + }
  1371 + const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);
  1372 + if (iProductProcessIndex > -1) {
  1373 + processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段
  1374 + }
  1375 + processProductDataRow.handleType = 'add';
  1376 + processProductDataRow.sType = '3';
  1377 + processProductDataRow.sPartsName = '';
  1378 + processProductDataRow.iPartOrder = 999;
  1379 + processProductDataRow.iOrder = iOrder + 1;
  1380 + processProductDataRow.sId = commonUtils.createSid();
  1381 + processProductDataRow.sParentId = masterData.sId;
  1382 + processData.push(processProductDataRow);
  1383 + // 配套工序
  1384 + if (bProcessAssort) {
  1385 + returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => {
  1386 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  1387 + const iProcessIndex = -1;
  1388 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId);
  1389 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  1390 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  1391 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  1392 + processRow.handleType = 'add';
  1393 + processRow.sId = commonUtils.createSid();
  1394 + processRow.sParentId = masterData.sId;
  1395 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  1396 + processData.push(processRow);
  1397 + }
  1398 + }));
1423 } 1399 }
1424 - this.props.onSaveState({  
1425 - materialsConfig,  
1426 - slaveData,  
1427 - controlData,  
1428 - materialsData,  
1429 - processData,  
1430 - fastOrderModalVisible: false,  
1431 - workOrderAllprogress: 0,  
1432 - ...addState,  
1433 - materialsSelectedRowKeys: [],  
1434 - sInfoArr,  
1435 - bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),  
1436 - Loading: false,  
1437 - });  
1438 - }  
1439 - if (dataReturn.code !== 1 && !flag) {  
1440 - this.props.getServiceError(dataReturn);  
1441 - this.props.onSaveState({  
1442 - Loading: false,  
1443 - }); 1400 + });
  1401 + processData = this.sortData(controlData, processData);
  1402 + const addState = {};
  1403 + if (!commonUtils.isEmptyArr(controlData) && controlData.length === 1) {
  1404 + addState.controlSelectedRowKeys = [controlData[0].sId];
  1405 + } else {
  1406 + addState.controlSelectedRowKeys = [];
1444 } 1407 }
1445 - }, timValue); 1408 + this.props.onSaveState({
  1409 + materialsConfig,
  1410 + slaveData,
  1411 + controlData,
  1412 + materialsData,
  1413 + processData,
  1414 + fastOrderModalVisible: false,
  1415 + workOrderAllprogress: 0,
  1416 + ...addState,
  1417 + materialsSelectedRowKeys: [],
  1418 + sInfoArr,
  1419 + bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),
  1420 + Loading: false,
  1421 + });
  1422 + }
  1423 + if (dataReturn.code !== 1 && !flag) {
  1424 + this.props.getServiceError(dataReturn);
  1425 + this.props.onSaveState({
  1426 + Loading: false,
  1427 + });
  1428 + }
1446 }; 1429 };
1447 1430
1448 /* 勾选工序分类 */ 1431 /* 勾选工序分类 */