Commit 6d54586fbb69e48f3973108a16d531f404703e78
1 parent
d8842ebf
优化websocket功能;
Showing
26 changed files
with
3220 additions
and
3757 deletions
src/components/Common/CommonBillDeliverEvent.js
| ... | ... | @@ -1418,46 +1418,17 @@ export default (ChildComponent) => { |
| 1418 | 1418 | }); |
| 1419 | 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 | 1434 | handleForm = (form) => { | ... | ... |
src/components/Common/CommonBillEvent.js
| ... | ... | @@ -2046,50 +2046,21 @@ export default (ChildComponent) => { |
| 2046 | 2046 | }); |
| 2047 | 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 | 2066 | handleForm = (form) => { | ... | ... |
src/components/Common/CommonCheckBillEvent.js
| ... | ... | @@ -1649,46 +1649,17 @@ export default (ChildComponent) => { |
| 1649 | 1649 | }); |
| 1650 | 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 | 1665 | handleForm = (form) => { | ... | ... |
src/components/Common/CommonClassifyEvent.js
| ... | ... | @@ -362,45 +362,16 @@ export default (ChildComponent) => { |
| 362 | 362 | return; |
| 363 | 363 | } |
| 364 | 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 | 377 | handleAdd = () => { | ... | ... |
src/components/Common/CommonElementEvent.js
| ... | ... | @@ -1990,53 +1990,23 @@ export default (ChildComponent) => { |
| 1990 | 1990 | // sId: [sId], |
| 1991 | 1991 | // }; |
| 1992 | 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 | 2010 | // const url = `${commonConfig.server_host}business/addSysLocking?sModelsId=${sModelsId}`; |
| 2041 | 2011 | // /* 接收返回值 */ |
| 2042 | 2012 | // const { data } = await commonServices.postValueService(token, value, url); | ... | ... |
src/components/Common/CommonGroupBillEvent.js
| ... | ... | @@ -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 | 821 | /* 消息列表双击打开时 调用获取websocket消息 */ |
| 822 | 822 | if (sModelsType === 'commonList/msg') { |
| 823 | 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 | 832 | if (this.props.app.currentPane.refresh !== undefined) { |
| 841 | 833 | this.props.app.currentPane.refresh(); |
| 842 | 834 | } |
| ... | ... | @@ -1420,75 +1412,58 @@ export default (ChildComponent) => { |
| 1420 | 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 | 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 | 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 | 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 | 1467 | } else { |
| 1493 | 1468 | message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 |
| 1494 | 1469 | } |
| ... | ... | @@ -1564,84 +1539,67 @@ export default (ChildComponent) => { |
| 1564 | 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 | 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 | 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 | 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 | 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 | 1603 | } else { |
| 1646 | 1604 | message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 |
| 1647 | 1605 | } | ... | ... |
src/components/Common/CommonListEvent.js
| ... | ... | @@ -787,22 +787,14 @@ export default (ChildComponent) => { |
| 787 | 787 | /* 消息列表双击打开时 调用获取websocket消息 */ |
| 788 | 788 | if (sModelsType === 'commonList/msg') { |
| 789 | 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 | 798 | if (this.props.app.currentPane.refresh !== undefined) { |
| 807 | 799 | this.props.app.currentPane.refresh(); |
| 808 | 800 | } |
| ... | ... | @@ -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 | 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 | 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 | 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 | 1864 | } else { |
| 1890 | 1865 | message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 |
| 1891 | 1866 | this.props.onSaveState({ |
| ... | ... | @@ -1964,84 +1939,67 @@ export default (ChildComponent) => { |
| 1964 | 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 | 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 | 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 | 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 | 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 | 2003 | } else { |
| 2046 | 2004 | message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 |
| 2047 | 2005 | } | ... | ... |
src/components/Common/CommonListTabEvent.js
| ... | ... | @@ -1195,22 +1195,14 @@ export default (ChildComponent) => { |
| 1195 | 1195 | /* 消息列表双击打开时 调用获取websocket消息 */ |
| 1196 | 1196 | if (sModelsType === 'commonList/msg') { |
| 1197 | 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 | 1206 | if (this.props.app.currentPane.refresh !== undefined) { |
| 1215 | 1207 | this.props.app.currentPane.refresh(); |
| 1216 | 1208 | } |
| ... | ... | @@ -1853,77 +1845,60 @@ export default (ChildComponent) => { |
| 1853 | 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 | 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 | 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 | 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 | 1902 | } else { |
| 1928 | 1903 | message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 |
| 1929 | 1904 | } |
| ... | ... | @@ -1999,84 +1974,67 @@ export default (ChildComponent) => { |
| 1999 | 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 | 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 | 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 | 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 | 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 | 2038 | } else { |
| 2081 | 2039 | message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 |
| 2082 | 2040 | } | ... | ... |
src/components/Common/CommonListTreeEvent.js
| ... | ... | @@ -434,22 +434,14 @@ export default (ChildComponent) => { |
| 434 | 434 | /* 消息列表双击打开时 调用获取websocket消息 */ |
| 435 | 435 | if (sModelsType === 'commonList/msg') { |
| 436 | 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 | 445 | if (this.props.app.currentPane.refresh !== undefined) { |
| 454 | 446 | this.props.app.currentPane.refresh(); |
| 455 | 447 | } |
| ... | ... | @@ -1243,76 +1235,59 @@ export default (ChildComponent) => { |
| 1243 | 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 | 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 | 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 | 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 | 1291 | } else { |
| 1317 | 1292 | message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 |
| 1318 | 1293 | } | ... | ... |
src/components/Common/CommonNewBillEvent.js
| ... | ... | @@ -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 | 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 | 1562 | const iIndex = queryConfigArr.findIndex(item => item[1].sTbName === sTbName); |
| 1575 | 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 | 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 | 1829 | }); |
| 1830 | 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 | 1851 | handleForm = (form) => { | ... | ... |
src/components/Manufacture/WorkOrder/WorkOrder.js
| ... | ... | @@ -462,292 +462,318 @@ class WorkOrder extends Component { |
| 462 | 462 | if (sAllPartsName !== undefined) { |
| 463 | 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 | 584 | } else { |
| 606 | 585 | message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); |
| 607 | 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 | 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 | 778 | if (bProcessAssort) { |
| 753 | 779 | returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { |
| ... | ... | @@ -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 | 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 | 674 | if (sAllPartsName !== undefined) { |
| 675 | 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 | 796 | } else { |
| 818 | 797 | message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); |
| 819 | 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 | 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 | 987 | if (bProcessAssort) { |
| 962 | 988 | returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { |
| ... | ... | @@ -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 | 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 | 1099 | if (sAllPartsName !== undefined) { |
| 1100 | 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 | 1221 | } else { |
| 1243 | 1222 | message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); |
| 1244 | 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 | 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 | 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 | 1403 | for (const item of processConfig.gdsconfigformslave) { |
| 1463 | - processProductDataRow[item.sName] = process[item.sName]; | |
| 1404 | + processAfterDataRow[item.sName] = process[item.sName]; | |
| 1464 | 1405 | } |
| 1465 | 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 | 1424 | if (bProcessAssort) { |
| 1482 | - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1425 | + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1483 | 1426 | const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); |
| 1484 | 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 | 1429 | if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { |
| 1487 | 1430 | let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 |
| 1488 | 1431 | processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 |
| 1489 | 1432 | processRow.handleType = 'add'; |
| 1490 | 1433 | processRow.sId = commonUtils.createSid(); |
| 1491 | 1434 | processRow.sParentId = masterData.sId; |
| 1435 | + processRow.sControlId = partsDataRow.sId; | |
| 1436 | + processRow.sPartsName = partsDataRow.sPartsName; | |
| 1492 | 1437 | processRow.sType = dropDownDataProcessName[iIndex].sType; |
| 1493 | 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 | 1018 | if (sAllPartsName !== undefined) { |
| 1019 | 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 | 1140 | } else { |
| 1162 | 1141 | message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); |
| 1163 | 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 | 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 | 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 | 1322 | for (const item of processConfig.gdsconfigformslave) { |
| 1382 | - processProductDataRow[item.sName] = process[item.sName]; | |
| 1323 | + processAfterDataRow[item.sName] = process[item.sName]; | |
| 1383 | 1324 | } |
| 1384 | 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 | 1343 | if (bProcessAssort) { |
| 1401 | - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1344 | + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1402 | 1345 | const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); |
| 1403 | 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 | 1348 | if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { |
| 1406 | 1349 | let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 |
| 1407 | 1350 | processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 |
| 1408 | 1351 | processRow.handleType = 'add'; |
| 1409 | 1352 | processRow.sId = commonUtils.createSid(); |
| 1410 | 1353 | processRow.sParentId = masterData.sId; |
| 1354 | + processRow.sControlId = partsDataRow.sId; | |
| 1355 | + processRow.sPartsName = partsDataRow.sPartsName; | |
| 1411 | 1356 | processRow.sType = dropDownDataProcessName[iIndex].sType; |
| 1412 | 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 | /* 勾选工序分类 */ | ... | ... |
src/components/QuoQuotation/Quotation/Quotation.js
| ... | ... | @@ -423,300 +423,328 @@ class Quotation extends Component { |
| 423 | 423 | if (sAllPartsName !== undefined) { |
| 424 | 424 | allPartsName = sAllPartsName.split(','); |
| 425 | 425 | } |
| 426 | - let timValue = 0; | |
| 427 | - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { | |
| 428 | - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 429 | - timValue = 3000; | |
| 430 | - } | |
| 431 | - setTimeout(async () => { | |
| 432 | - this.props.app.webSocket.onmessage = (msg) => { | |
| 433 | - const rtmsg = JSON.parse(msg.data); | |
| 434 | - if (rtmsg.action === 'quotationAllprogress') { | |
| 435 | - this.props.onSaveState({ | |
| 436 | - quotationAllprogress: rtmsg.msg, | |
| 437 | - }); | |
| 438 | - } else if (rtmsg.action === 'loginOut') { | |
| 439 | - if (location.pathname.indexOf('/indexOee') > -1) { | |
| 440 | - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } }); | |
| 441 | - } else if (location.pathname.indexOf('/indexMobile') > -1) { | |
| 442 | - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); | |
| 443 | - } else { | |
| 444 | - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); | |
| 445 | - } | |
| 446 | - } else if (this.props.app.webSocket.homeAction) { | |
| 447 | - this.props.app.webSocket.homeAction(msg); | |
| 448 | - } | |
| 449 | - }; | |
| 450 | - let cpProcessName = ''; | |
| 451 | - checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData; | |
| 452 | - // paramMap.modelName = masterData.modelName; | |
| 453 | - paramMap.bQuotation = true; | |
| 454 | - paramMap.sCustomerId = masterData.sCustomerId; | |
| 455 | - paramMap.sCustomerName = masterData.sCustomerName; | |
| 456 | - paramMap.sProductClassifyId = masterData.sProductClassifyId; | |
| 457 | - paramMap.sProductId = masterData.sProductId; | |
| 458 | - paramMap.sProductName = masterData.sProductName; | |
| 459 | - paramMap.sProductStyleId = masterData.sProductStyleId; | |
| 460 | - paramMap.sProductStyle = masterData.sProductStyle; | |
| 461 | - paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0; | |
| 462 | - paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0; | |
| 463 | - paramMap.dProductHeight = 0; | |
| 464 | - paramMap.dProductQty = masterData.dProductQty; | |
| 465 | - const partsInfo = []; | |
| 466 | - allPartsName.forEach((item) => { | |
| 467 | - const partInfo = {}; | |
| 468 | - partInfo.sPartsName = item; | |
| 469 | - partInfo.dPartsQty = masterData.dProductQty; | |
| 470 | - partInfo.dSumPQty = masterData[`dSumPQty${item}`]; | |
| 426 | + this.props.app.webSocket.onmessageTmp = (msg) => { | |
| 427 | + const rtmsg = JSON.parse(msg.data); | |
| 428 | + if (rtmsg.action === 'quotationAllprogress') { | |
| 429 | + this.props.onSaveState({ | |
| 430 | + quotationAllprogress: rtmsg.msg, | |
| 431 | + }); | |
| 432 | + } | |
| 433 | + }; | |
| 434 | + let cpProcessName = ''; | |
| 435 | + checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData; | |
| 436 | + // paramMap.modelName = masterData.modelName; | |
| 437 | + paramMap.bQuotation = true; | |
| 438 | + paramMap.sCustomerId = masterData.sCustomerId; | |
| 439 | + paramMap.sCustomerName = masterData.sCustomerName; | |
| 440 | + paramMap.sProductClassifyId = masterData.sProductClassifyId; | |
| 441 | + paramMap.sProductId = masterData.sProductId; | |
| 442 | + paramMap.sProductName = masterData.sProductName; | |
| 443 | + paramMap.sProductStyleId = masterData.sProductStyleId; | |
| 444 | + paramMap.sProductStyle = masterData.sProductStyle; | |
| 445 | + paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0; | |
| 446 | + paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0; | |
| 447 | + paramMap.dProductHeight = 0; | |
| 448 | + paramMap.dProductQty = masterData.dProductQty; | |
| 449 | + const partsInfo = []; | |
| 450 | + allPartsName.forEach((item) => { | |
| 451 | + const partInfo = {}; | |
| 452 | + partInfo.sPartsName = item; | |
| 453 | + partInfo.dPartsQty = masterData.dProductQty; | |
| 454 | + partInfo.dSumPQty = masterData[`dSumPQty${item}`]; | |
| 471 | 455 | |
| 472 | - const materialsInfo = []; | |
| 473 | - const material = {}; | |
| 474 | - material.sMaterialsId = masterData[`sMaterialsId${item}`]; | |
| 475 | - material.sMaterialsNo = masterData[`sMaterialsNo${item}`]; | |
| 476 | - material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`]; | |
| 477 | - materialsInfo.push(material); | |
| 478 | - partInfo.materialsInfo = materialsInfo; | |
| 479 | - partInfo.iPositiveColor = masterData[`iPositiveColor${item}`]; | |
| 480 | - partInfo.iPrintModePo = masterData[`iPrintModePo${item}`]; | |
| 481 | - if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') { | |
| 482 | - const processInfo = []; | |
| 483 | - checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => { | |
| 484 | - if (!commonUtils.isEmpty(masterData[card.sId + item])) { | |
| 485 | - if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') { | |
| 486 | - partInfo.sPrintProcessId = masterData[card.sId + item]; | |
| 487 | - } else { | |
| 488 | - const process = {}; | |
| 489 | - process.sProductClassifyId = card.sId; | |
| 490 | - process.sProcessId = masterData[card.sId + item]; | |
| 491 | - if (masterData[card.sId + card.sName + item] !== undefined) { | |
| 492 | - process.sProcessName = masterData[card.sId + card.sName + item]; | |
| 493 | - process.sType = masterData[card.sId + card.sType + item]; | |
| 494 | - processInfo.push(process); | |
| 495 | - } | |
| 456 | + const materialsInfo = []; | |
| 457 | + const material = {}; | |
| 458 | + material.sMaterialsId = masterData[`sMaterialsId${item}`]; | |
| 459 | + material.sMaterialsNo = masterData[`sMaterialsNo${item}`]; | |
| 460 | + material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`]; | |
| 461 | + materialsInfo.push(material); | |
| 462 | + partInfo.materialsInfo = materialsInfo; | |
| 463 | + partInfo.iPositiveColor = masterData[`iPositiveColor${item}`]; | |
| 464 | + partInfo.iPrintModePo = masterData[`iPrintModePo${item}`]; | |
| 465 | + if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') { | |
| 466 | + const processInfo = []; | |
| 467 | + checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => { | |
| 468 | + if (!commonUtils.isEmpty(masterData[card.sId + item])) { | |
| 469 | + if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') { | |
| 470 | + partInfo.sPrintProcessId = masterData[card.sId + item]; | |
| 471 | + } else { | |
| 472 | + const process = {}; | |
| 473 | + process.sProductClassifyId = card.sId; | |
| 474 | + process.sProcessId = masterData[card.sId + item]; | |
| 475 | + if (masterData[card.sId + card.sName + item] !== undefined) { | |
| 476 | + process.sProcessName = masterData[card.sId + card.sName + item]; | |
| 477 | + process.sType = masterData[card.sId + card.sType + item]; | |
| 478 | + processInfo.push(process); | |
| 496 | 479 | } |
| 497 | 480 | } |
| 498 | - }); | |
| 499 | - partInfo.processInfo = processInfo; | |
| 500 | - partsInfo.push(partInfo); | |
| 501 | - } | |
| 502 | - }); | |
| 503 | - const productProcess = []; | |
| 504 | - checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => { | |
| 505 | - if (!commonUtils.isEmpty(masterData[card.sId])) { | |
| 506 | - const process = {}; | |
| 507 | - process.sProductClassifyId = card.sId; | |
| 508 | - process.sProcessId = masterData[card.sId]; | |
| 509 | - process.sProcessName = masterData[card.sId + card.sName]; | |
| 510 | - if (masterData[card.sId + card.sName] !== undefined) { | |
| 511 | - cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`; | |
| 512 | - productProcess.push(process); | |
| 513 | 481 | } |
| 482 | + }); | |
| 483 | + partInfo.processInfo = processInfo; | |
| 484 | + partsInfo.push(partInfo); | |
| 485 | + } | |
| 486 | + }); | |
| 487 | + const productProcess = []; | |
| 488 | + checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => { | |
| 489 | + if (!commonUtils.isEmpty(masterData[card.sId])) { | |
| 490 | + const process = {}; | |
| 491 | + process.sProductClassifyId = card.sId; | |
| 492 | + process.sProcessId = masterData[card.sId]; | |
| 493 | + process.sProcessName = masterData[card.sId + card.sName]; | |
| 494 | + if (masterData[card.sId + card.sName] !== undefined) { | |
| 495 | + cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`; | |
| 496 | + productProcess.push(process); | |
| 514 | 497 | } |
| 515 | - }); | |
| 516 | - paramMap.cpProcessName = cpProcessName; | |
| 517 | - paramMap.productProcessInfo = productProcess; | |
| 518 | - paramMap.partsInfo = partsInfo; | |
| 519 | - let numErr = false; | |
| 520 | - let numName = ''; | |
| 521 | - let num = 0; | |
| 498 | + } | |
| 499 | + }); | |
| 500 | + paramMap.cpProcessName = cpProcessName; | |
| 501 | + paramMap.productProcessInfo = productProcess; | |
| 502 | + paramMap.partsInfo = partsInfo; | |
| 503 | + let numErr = false; | |
| 504 | + let numName = ''; | |
| 505 | + let num = 0; | |
| 522 | 506 | |
| 523 | - // eslint-disable-next-line array-callback-return | |
| 524 | - paramMap.partsInfo.map((item) => { | |
| 525 | - if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) { | |
| 526 | - num = item.dSumPQty; | |
| 527 | - numName = item.sPartsName; | |
| 528 | - } | |
| 529 | - if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) { | |
| 530 | - numErr = true; | |
| 531 | - numName = item.sPartsName; | |
| 532 | - } | |
| 533 | - }); | |
| 534 | - if (numErr) { | |
| 535 | - message.error(`${numName}P数必须是2的倍数!`); | |
| 536 | - return; | |
| 507 | + // eslint-disable-next-line array-callback-return | |
| 508 | + paramMap.partsInfo.map((item) => { | |
| 509 | + if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) { | |
| 510 | + num = item.dSumPQty; | |
| 511 | + numName = item.sPartsName; | |
| 537 | 512 | } |
| 538 | - if (num === 2) { | |
| 539 | - message.error(`${numName}P数必须大于4P!`); | |
| 540 | - return; | |
| 513 | + if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) { | |
| 514 | + numErr = true; | |
| 515 | + numName = item.sPartsName; | |
| 541 | 516 | } |
| 517 | + }); | |
| 518 | + if (numErr) { | |
| 519 | + message.error(`${numName}P数必须是2的倍数!`); | |
| 520 | + return; | |
| 521 | + } | |
| 522 | + if (num === 2) { | |
| 523 | + message.error(`${numName}P数必须大于4P!`); | |
| 524 | + return; | |
| 525 | + } | |
| 542 | 526 | |
| 543 | - if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) || | |
| 544 | - commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) { | |
| 545 | - // this.props.onSaveState({ fastOrderModalVisible: false }); | |
| 546 | - message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */ | |
| 547 | - return; | |
| 548 | - } | |
| 549 | - /* 验证产品规格是否 符合数字*数字格式 */ | |
| 550 | - const sProductStyle = paramMap.sProductStyle; | |
| 551 | - if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */ | |
| 552 | - const arr = sProductStyle.split('*'); | |
| 553 | - const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/; | |
| 554 | - if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) { | |
| 555 | - for (let i = 0; i < arr.length; i += 1) { | |
| 556 | - if (!numCheck.test(arr[i])) { /* 验证是否数字 */ | |
| 557 | - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 558 | - return; | |
| 559 | - } | |
| 527 | + if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) || | |
| 528 | + commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) { | |
| 529 | + // this.props.onSaveState({ fastOrderModalVisible: false }); | |
| 530 | + message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */ | |
| 531 | + return; | |
| 532 | + } | |
| 533 | + /* 验证产品规格是否 符合数字*数字格式 */ | |
| 534 | + const sProductStyle = paramMap.sProductStyle; | |
| 535 | + if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */ | |
| 536 | + const arr = sProductStyle.split('*'); | |
| 537 | + const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/; | |
| 538 | + if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) { | |
| 539 | + for (let i = 0; i < arr.length; i += 1) { | |
| 540 | + if (!numCheck.test(arr[i])) { /* 验证是否数字 */ | |
| 541 | + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 542 | + return; | |
| 560 | 543 | } |
| 561 | - } else { | |
| 562 | - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 563 | - return; | |
| 564 | 544 | } |
| 565 | - /* 验证*两边是否是数字 */ | |
| 566 | 545 | } else { |
| 567 | 546 | message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); |
| 568 | 547 | return; |
| 569 | 548 | } |
| 570 | - this.props.onSaveState({ | |
| 571 | - Loading: true, | |
| 572 | - }); | |
| 573 | - // onSendSocketMessage('quotationSplitPaste', 'noAction', masterData.sId, userinfo.sId, null, null); | |
| 549 | + /* 验证*两边是否是数字 */ | |
| 550 | + } else { | |
| 551 | + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 552 | + return; | |
| 553 | + } | |
| 554 | + this.props.onSaveState({ | |
| 555 | + Loading: true, | |
| 556 | + }); | |
| 557 | + // onSendSocketMessage('quotationSplitPaste', 'noAction', masterData.sId, userinfo.sId, null, null); | |
| 574 | 558 | |
| 575 | - const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`; | |
| 576 | - const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; | |
| 577 | - if (dataReturn.code === 1) { | |
| 578 | - const { | |
| 579 | - productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo, | |
| 580 | - } = dataReturn.dataset.rows[0]; | |
| 581 | - const slaveData = []; | |
| 582 | - const controlData = []; | |
| 583 | - const materialsData = []; | |
| 584 | - let processData = []; | |
| 585 | - const tableDataRow = {}; | |
| 586 | - for (const item of slaveConfig.gdsconfigformslave) { | |
| 587 | - tableDataRow[item.sName] = masterData[item.sName]; | |
| 559 | + const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`; | |
| 560 | + const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; | |
| 561 | + if (dataReturn.code === 1) { | |
| 562 | + const { | |
| 563 | + productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo, | |
| 564 | + } = dataReturn.dataset.rows[0]; | |
| 565 | + const slaveData = []; | |
| 566 | + const controlData = []; | |
| 567 | + const materialsData = []; | |
| 568 | + let processData = []; | |
| 569 | + const tableDataRow = {}; | |
| 570 | + for (const item of slaveConfig.gdsconfigformslave) { | |
| 571 | + tableDataRow[item.sName] = masterData[item.sName]; | |
| 572 | + } | |
| 573 | + tableDataRow.sId = commonUtils.createSid(); | |
| 574 | + tableDataRow.handleType = 'add'; | |
| 575 | + tableDataRow.iOrder = 1; | |
| 576 | + tableDataRow.sParentId = masterData.sId; | |
| 577 | + // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName'); | |
| 578 | + let productIdDropDown; | |
| 579 | + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName'); | |
| 580 | + if (slaveIndex > -1) { | |
| 581 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow); | |
| 582 | + productIdDropDown = sqlDropDownData.dropDownData; | |
| 583 | + } | |
| 584 | + const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId); | |
| 585 | + if (iProductIdIndex === -1) { | |
| 586 | + tableDataRow.sProductId = tableDataRow.sProductName; | |
| 587 | + tableDataRow.sProductInfo = JSON.stringify({ | |
| 588 | + sProductId: tableDataRow.sProductName, | |
| 589 | + sProductName: tableDataRow.sProductName, | |
| 590 | + sProductStyle: tableDataRow.sProductStyle, | |
| 591 | + sProductUnit: tableDataRow.sProductUnit, | |
| 592 | + sProductNo: tableDataRow.sProductNo, | |
| 593 | + sCustomerProductNo: tableDataRow.sCustomerProductNo, | |
| 594 | + sProductClassifyId: tableDataRow.sProductClassifyId, | |
| 595 | + sProductClassifyName: tableDataRow.sProductClassifyName, | |
| 596 | + }); | |
| 597 | + } else { | |
| 598 | + tableDataRow.sProductInfo = ''; | |
| 599 | + } | |
| 600 | + slaveData.push(tableDataRow); | |
| 601 | + const sInfoArr = []; | |
| 602 | + if (!commonUtils.isEmptyArr(partsOldInfo)) { | |
| 603 | + partsOldInfo.forEach((item) => { | |
| 604 | + if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) { | |
| 605 | + this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` }); | |
| 606 | + } | |
| 607 | + }); | |
| 608 | + } | |
| 609 | + if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */ | |
| 610 | + partsNewInfo.forEach((item) => { | |
| 611 | + const { sPartsName, sInfo } = item; | |
| 612 | + const sInfoObj = {}; | |
| 613 | + sInfoObj.sPartsName = sPartsName; | |
| 614 | + sInfoObj.sInfo = sInfo; | |
| 615 | + sInfoArr.push(sInfoObj); | |
| 616 | + }); | |
| 617 | + } | |
| 618 | + | |
| 619 | + const bProcessAssort = true; | |
| 620 | + let returnProcessAssort = []; | |
| 621 | + let processAssignAssort = ''; | |
| 622 | + let dropDownDataProcessName; | |
| 623 | + if (bProcessAssort) { | |
| 624 | + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`; | |
| 625 | + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data; | |
| 626 | + if (dataProcessAssort.code === 1) { | |
| 627 | + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort; | |
| 628 | + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); | |
| 629 | + if (iIndex > -1) { | |
| 630 | + if (commonUtils.isEmptyObject(dropDownDataProcessName)) { | |
| 631 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]); | |
| 632 | + dropDownDataProcessName = sqlDropDownData.dropDownData; | |
| 633 | + } | |
| 634 | + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; | |
| 635 | + } | |
| 588 | 636 | } |
| 589 | - tableDataRow.sId = commonUtils.createSid(); | |
| 590 | - tableDataRow.handleType = 'add'; | |
| 591 | - tableDataRow.iOrder = 1; | |
| 592 | - tableDataRow.sParentId = masterData.sId; | |
| 593 | - // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName'); | |
| 594 | - let productIdDropDown; | |
| 595 | - const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName'); | |
| 596 | - if (slaveIndex > -1) { | |
| 597 | - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow); | |
| 598 | - productIdDropDown = sqlDropDownData.dropDownData; | |
| 637 | + } | |
| 638 | + const newCopyTo = {}; | |
| 639 | + newCopyTo.master = masterData; | |
| 640 | + newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0]; | |
| 641 | + await partsNewInfo.forEach(async (partInfo, iIndex) => { | |
| 642 | + const partsDataRow = {}; | |
| 643 | + for (const child of Object.keys(partInfo)) { | |
| 644 | + partsDataRow[child] = partInfo[child]; | |
| 599 | 645 | } |
| 600 | - const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId); | |
| 601 | - if (iProductIdIndex === -1) { | |
| 602 | - tableDataRow.sProductId = tableDataRow.sProductName; | |
| 603 | - tableDataRow.sProductInfo = JSON.stringify({ | |
| 604 | - sProductId: tableDataRow.sProductName, | |
| 605 | - sProductName: tableDataRow.sProductName, | |
| 606 | - sProductStyle: tableDataRow.sProductStyle, | |
| 607 | - sProductUnit: tableDataRow.sProductUnit, | |
| 608 | - sProductNo: tableDataRow.sProductNo, | |
| 609 | - sCustomerProductNo: tableDataRow.sCustomerProductNo, | |
| 610 | - sProductClassifyId: tableDataRow.sProductClassifyId, | |
| 611 | - sProductClassifyName: tableDataRow.sProductClassifyName, | |
| 612 | - }); | |
| 613 | - } else { | |
| 614 | - tableDataRow.sProductInfo = ''; | |
| 646 | + partsDataRow.handleType = 'add'; | |
| 647 | + partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */ | |
| 648 | + partsDataRow.sId = commonUtils.createSid(); | |
| 649 | + partsDataRow.sParentId = masterData.sId; | |
| 650 | + partsDataRow.sSlaveId = tableDataRow.sId; | |
| 651 | + if (partsDataRow.iPrintMode !== 3) { | |
| 652 | + partsDataRow.iOppositeColor = partsDataRow.iPositiveColor; | |
| 615 | 653 | } |
| 616 | - slaveData.push(tableDataRow); | |
| 617 | - const sInfoArr = []; | |
| 618 | - if (!commonUtils.isEmptyArr(partsOldInfo)) { | |
| 619 | - partsOldInfo.forEach((item) => { | |
| 620 | - if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) { | |
| 621 | - this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` }); | |
| 622 | - } | |
| 623 | - }); | |
| 654 | + delete partsDataRow.dMaterialsKQty; | |
| 655 | + delete partsDataRow.dMaterialsLength; | |
| 656 | + delete partsDataRow.dMaterialsWidth; | |
| 657 | + if (productClassify.bSpecialRules) { | |
| 658 | + partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength; | |
| 659 | + partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth; | |
| 624 | 660 | } |
| 625 | - if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */ | |
| 626 | - partsNewInfo.forEach((item) => { | |
| 627 | - const { sPartsName, sInfo } = item; | |
| 628 | - const sInfoObj = {}; | |
| 629 | - sInfoObj.sPartsName = sPartsName; | |
| 630 | - sInfoObj.sInfo = sInfo; | |
| 631 | - sInfoArr.push(sInfoObj); | |
| 632 | - }); | |
| 661 | + controlData.push(partsDataRow); | |
| 662 | + // 材料信息 | |
| 663 | + await partInfo.materialsInfo.forEach(async (materialInfo, iOrder) => { | |
| 664 | + let materialDataRow = {}; | |
| 665 | + for (const item of materialsConfig.gdsconfigformslave) { | |
| 666 | + materialDataRow[item.sName] = materialInfo[item.sName]; | |
| 667 | + } | |
| 668 | + materialDataRow.handleType = 'add'; | |
| 669 | + materialDataRow.sType = '0'; | |
| 670 | + materialDataRow.iPartOrder = iIndex; | |
| 671 | + materialDataRow.iOrder = iOrder + 1; | |
| 672 | + materialDataRow.sPartsName = partsDataRow.sPartsName; | |
| 673 | + materialDataRow.sId = commonUtils.createSid(); | |
| 674 | + materialDataRow.sParentId = masterData.sId; | |
| 675 | + materialDataRow.sControlId = partsDataRow.sId; | |
| 676 | + materialDataRow.sSlaveId = tableDataRow.sId; | |
| 677 | + materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial; | |
| 678 | + const models = 'Materials'; | |
| 679 | + materialDataRow = await this.props.onMaterialsChange(materialDataRow, sModelsId, masterData, [], 'dAuxiliaryQty', app, token, models); | |
| 680 | + materialDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, materialDataRow); | |
| 681 | + materialsData.push(materialDataRow); | |
| 682 | + }); | |
| 683 | + // 工序信息 | |
| 684 | + let processPrintDataRow = {}; | |
| 685 | + processPrintDataRow.handleType = 'add'; | |
| 686 | + processPrintDataRow.sProcessId = partInfo.sProcessId; | |
| 687 | + const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId); | |
| 688 | + if (iProcessPrintIndex > -1) { | |
| 689 | + processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段 | |
| 633 | 690 | } |
| 634 | - | |
| 635 | - const bProcessAssort = true; | |
| 636 | - let returnProcessAssort = []; | |
| 637 | - let processAssignAssort = ''; | |
| 638 | - let dropDownDataProcessName; | |
| 691 | + processPrintDataRow.sType = partInfo.sType; | |
| 692 | + processPrintDataRow.iPartOrder = iIndex; | |
| 693 | + processPrintDataRow.iOrder = 1; | |
| 694 | + processPrintDataRow.sProcessName = partInfo.sProcessName; | |
| 695 | + processPrintDataRow.sPartsName = partsDataRow.sPartsName; | |
| 696 | + processPrintDataRow.dProcessInQty = partInfo.dProcessInQty; | |
| 697 | + processPrintDataRow.dLossQty = partInfo.dLossQty; | |
| 698 | + processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty; | |
| 699 | + processPrintDataRow.sId = commonUtils.createSid(); | |
| 700 | + processPrintDataRow.sParentId = masterData.sId; | |
| 701 | + processPrintDataRow.sControlId = partsDataRow.sId; | |
| 702 | + processPrintDataRow.sSlaveId = tableDataRow.sId; | |
| 703 | + processData.push(processPrintDataRow); | |
| 704 | + // 配套工序 | |
| 639 | 705 | if (bProcessAssort) { |
| 640 | - const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`; | |
| 641 | - const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data; | |
| 642 | - if (dataProcessAssort.code === 1) { | |
| 643 | - returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort; | |
| 644 | - const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); | |
| 645 | - if (iIndex > -1) { | |
| 646 | - if (commonUtils.isEmptyObject(dropDownDataProcessName)) { | |
| 647 | - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]); | |
| 648 | - dropDownDataProcessName = sqlDropDownData.dropDownData; | |
| 649 | - } | |
| 650 | - processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; | |
| 706 | + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 707 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 708 | + const iProcessIndex = -1; | |
| 709 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 710 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 711 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 712 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 713 | + processRow.handleType = 'add'; | |
| 714 | + processRow.sId = commonUtils.createSid(); | |
| 715 | + processRow.sParentId = masterData.sId; | |
| 716 | + processRow.sControlId = partsDataRow.sId; | |
| 717 | + processRow.sPartsName = partsDataRow.sPartsName; | |
| 718 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 719 | + processRow.sSlaveId = tableDataRow.sId; | |
| 720 | + processData.push(processRow); | |
| 651 | 721 | } |
| 652 | - } | |
| 722 | + })); | |
| 653 | 723 | } |
| 654 | - const newCopyTo = {}; | |
| 655 | - newCopyTo.master = masterData; | |
| 656 | - newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0]; | |
| 657 | - await partsNewInfo.forEach(async (partInfo, iIndex) => { | |
| 658 | - const partsDataRow = {}; | |
| 659 | - for (const child of Object.keys(partInfo)) { | |
| 660 | - partsDataRow[child] = partInfo[child]; | |
| 724 | + | |
| 725 | + partInfo.processInfo.forEach((process, iOrder) => { | |
| 726 | + let processAfterDataRow = {}; | |
| 727 | + for (const item of processConfig.gdsconfigformslave) { | |
| 728 | + processAfterDataRow[item.sName] = process[item.sName]; | |
| 661 | 729 | } |
| 662 | - partsDataRow.handleType = 'add'; | |
| 663 | - partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */ | |
| 664 | - partsDataRow.sId = commonUtils.createSid(); | |
| 665 | - partsDataRow.sParentId = masterData.sId; | |
| 666 | - partsDataRow.sSlaveId = tableDataRow.sId; | |
| 667 | - if (partsDataRow.iPrintMode !== 3) { | |
| 668 | - partsDataRow.iOppositeColor = partsDataRow.iPositiveColor; | |
| 730 | + for (const child of Object.keys(process)) { | |
| 731 | + processAfterDataRow[child] = process[child]; | |
| 669 | 732 | } |
| 670 | - delete partsDataRow.dMaterialsKQty; | |
| 671 | - delete partsDataRow.dMaterialsLength; | |
| 672 | - delete partsDataRow.dMaterialsWidth; | |
| 673 | - if (productClassify.bSpecialRules) { | |
| 674 | - partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength; | |
| 675 | - partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth; | |
| 733 | + processAfterDataRow.handleType = 'add'; | |
| 734 | + processAfterDataRow.sProcessId = process.sProcessId; | |
| 735 | + const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId); | |
| 736 | + if (iProcessAfterIndex > -1) { | |
| 737 | + processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段 | |
| 676 | 738 | } |
| 677 | - controlData.push(partsDataRow); | |
| 678 | - // 材料信息 | |
| 679 | - await partInfo.materialsInfo.forEach(async (materialInfo, iOrder) => { | |
| 680 | - let materialDataRow = {}; | |
| 681 | - for (const item of materialsConfig.gdsconfigformslave) { | |
| 682 | - materialDataRow[item.sName] = materialInfo[item.sName]; | |
| 683 | - } | |
| 684 | - materialDataRow.handleType = 'add'; | |
| 685 | - materialDataRow.sType = '0'; | |
| 686 | - materialDataRow.iPartOrder = iIndex; | |
| 687 | - materialDataRow.iOrder = iOrder + 1; | |
| 688 | - materialDataRow.sPartsName = partsDataRow.sPartsName; | |
| 689 | - materialDataRow.sId = commonUtils.createSid(); | |
| 690 | - materialDataRow.sParentId = masterData.sId; | |
| 691 | - materialDataRow.sControlId = partsDataRow.sId; | |
| 692 | - materialDataRow.sSlaveId = tableDataRow.sId; | |
| 693 | - materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial; | |
| 694 | - const models = 'Materials'; | |
| 695 | - materialDataRow = await this.props.onMaterialsChange(materialDataRow, sModelsId, masterData, [], 'dAuxiliaryQty', app, token, models); | |
| 696 | - materialDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, materialDataRow); | |
| 697 | - materialsData.push(materialDataRow); | |
| 698 | - }); | |
| 699 | - // 工序信息 | |
| 700 | - let processPrintDataRow = {}; | |
| 701 | - processPrintDataRow.handleType = 'add'; | |
| 702 | - processPrintDataRow.sProcessId = partInfo.sProcessId; | |
| 703 | - const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId); | |
| 704 | - if (iProcessPrintIndex > -1) { | |
| 705 | - processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段 | |
| 706 | - } | |
| 707 | - processPrintDataRow.sType = partInfo.sType; | |
| 708 | - processPrintDataRow.iPartOrder = iIndex; | |
| 709 | - processPrintDataRow.iOrder = 1; | |
| 710 | - processPrintDataRow.sProcessName = partInfo.sProcessName; | |
| 711 | - processPrintDataRow.sPartsName = partsDataRow.sPartsName; | |
| 712 | - processPrintDataRow.dProcessInQty = partInfo.dProcessInQty; | |
| 713 | - processPrintDataRow.dLossQty = partInfo.dLossQty; | |
| 714 | - processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty; | |
| 715 | - processPrintDataRow.sId = commonUtils.createSid(); | |
| 716 | - processPrintDataRow.sParentId = masterData.sId; | |
| 717 | - processPrintDataRow.sControlId = partsDataRow.sId; | |
| 718 | - processPrintDataRow.sSlaveId = tableDataRow.sId; | |
| 719 | - processData.push(processPrintDataRow); | |
| 739 | + processAfterDataRow.sType = process.sType; | |
| 740 | + processAfterDataRow.iPartOrder = iIndex; | |
| 741 | + processAfterDataRow.iOrder = iOrder + 1; | |
| 742 | + processAfterDataRow.sPartsName = partsDataRow.sPartsName; | |
| 743 | + processAfterDataRow.sId = commonUtils.createSid(); | |
| 744 | + processAfterDataRow.sParentId = masterData.sId; | |
| 745 | + processAfterDataRow.sControlId = partsDataRow.sId; | |
| 746 | + processAfterDataRow.sSlaveId = tableDataRow.sId; | |
| 747 | + processData.push(processAfterDataRow); | |
| 720 | 748 | // 配套工序 |
| 721 | 749 | if (bProcessAssort) { |
| 722 | 750 | returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { |
| ... | ... | @@ -737,118 +765,73 @@ class Quotation extends Component { |
| 737 | 765 | } |
| 738 | 766 | })); |
| 739 | 767 | } |
| 740 | - | |
| 741 | - partInfo.processInfo.forEach((process, iOrder) => { | |
| 742 | - let processAfterDataRow = {}; | |
| 743 | - for (const item of processConfig.gdsconfigformslave) { | |
| 744 | - processAfterDataRow[item.sName] = process[item.sName]; | |
| 745 | - } | |
| 746 | - for (const child of Object.keys(process)) { | |
| 747 | - processAfterDataRow[child] = process[child]; | |
| 748 | - } | |
| 749 | - processAfterDataRow.handleType = 'add'; | |
| 750 | - processAfterDataRow.sProcessId = process.sProcessId; | |
| 751 | - const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId); | |
| 752 | - if (iProcessAfterIndex > -1) { | |
| 753 | - processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段 | |
| 754 | - } | |
| 755 | - processAfterDataRow.sType = process.sType; | |
| 756 | - processAfterDataRow.iPartOrder = iIndex; | |
| 757 | - processAfterDataRow.iOrder = iOrder + 1; | |
| 758 | - processAfterDataRow.sPartsName = partsDataRow.sPartsName; | |
| 759 | - processAfterDataRow.sId = commonUtils.createSid(); | |
| 760 | - processAfterDataRow.sParentId = masterData.sId; | |
| 761 | - processAfterDataRow.sControlId = partsDataRow.sId; | |
| 762 | - processAfterDataRow.sSlaveId = tableDataRow.sId; | |
| 763 | - processData.push(processAfterDataRow); | |
| 764 | - // 配套工序 | |
| 765 | - if (bProcessAssort) { | |
| 766 | - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 767 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 768 | - const iProcessIndex = -1; | |
| 769 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 770 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 771 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 772 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 773 | - processRow.handleType = 'add'; | |
| 774 | - processRow.sId = commonUtils.createSid(); | |
| 775 | - processRow.sParentId = masterData.sId; | |
| 776 | - processRow.sControlId = partsDataRow.sId; | |
| 777 | - processRow.sPartsName = partsDataRow.sPartsName; | |
| 778 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 779 | - processRow.sSlaveId = tableDataRow.sId; | |
| 780 | - processData.push(processRow); | |
| 781 | - } | |
| 782 | - })); | |
| 783 | - } | |
| 784 | - }); | |
| 785 | 768 | }); |
| 786 | - productProcessInfo.forEach((process, iOrder) => { | |
| 787 | - let processProductDataRow = {}; | |
| 788 | - for (const item of processConfig.gdsconfigformslave) { | |
| 789 | - processProductDataRow[item.sName] = process[item.sName]; | |
| 790 | - } | |
| 791 | - for (const child of Object.keys(process)) { | |
| 792 | - processProductDataRow[child] = process[child]; | |
| 793 | - } | |
| 794 | - const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId); | |
| 795 | - if (iProductProcessIndex > -1) { | |
| 796 | - processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段 | |
| 797 | - } | |
| 798 | - processProductDataRow.handleType = 'add'; | |
| 799 | - processProductDataRow.sType = '3'; | |
| 800 | - processProductDataRow.sPartsName = ''; | |
| 801 | - processProductDataRow.iPartOrder = 999; | |
| 802 | - processProductDataRow.iOrder = iOrder + 1; | |
| 803 | - processProductDataRow.sId = commonUtils.createSid(); | |
| 804 | - processProductDataRow.sParentId = masterData.sId; | |
| 805 | - processProductDataRow.sSlaveId = tableDataRow.sId; | |
| 806 | - processData.push(processProductDataRow); | |
| 807 | - // 配套工序 | |
| 808 | - if (bProcessAssort) { | |
| 809 | - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 810 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 811 | - const iProcessIndex = -1; | |
| 812 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); | |
| 813 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 814 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 815 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 816 | - processRow.handleType = 'add'; | |
| 817 | - processRow.sId = commonUtils.createSid(); | |
| 818 | - processRow.sParentId = masterData.sId; | |
| 819 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 820 | - processRow.sSlaveId = tableDataRow.sId; | |
| 821 | - processData.push(processRow); | |
| 822 | - } | |
| 823 | - })); | |
| 824 | - } | |
| 825 | - }); | |
| 826 | - processData = this.sortData(controlData, processData); | |
| 827 | - const addState = { controlSelectedRowKeys: ['0000000'] }; | |
| 828 | - if (!commonUtils.isEmptyArr(slaveData)) { | |
| 829 | - addState.slaveSelectedRowKeys = [slaveData[0].sId]; | |
| 769 | + }); | |
| 770 | + productProcessInfo.forEach((process, iOrder) => { | |
| 771 | + let processProductDataRow = {}; | |
| 772 | + for (const item of processConfig.gdsconfigformslave) { | |
| 773 | + processProductDataRow[item.sName] = process[item.sName]; | |
| 830 | 774 | } |
| 831 | - this.props.onSaveState({ | |
| 832 | - materialsConfig, | |
| 833 | - slaveData, | |
| 834 | - controlData, | |
| 835 | - materialsData, | |
| 836 | - processData, | |
| 837 | - fastOrderModalVisible: false, | |
| 838 | - quotationAllprogress: 0, | |
| 839 | - materialsSelectedRowKeys: [], | |
| 840 | - ...addState, | |
| 841 | - sInfoArr, | |
| 842 | - bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr), | |
| 843 | - Loading: false, | |
| 844 | - }); | |
| 845 | - } else { | |
| 846 | - this.props.getServiceError(dataReturn); | |
| 847 | - this.props.onSaveState({ | |
| 848 | - Loading: false, | |
| 849 | - }); | |
| 775 | + for (const child of Object.keys(process)) { | |
| 776 | + processProductDataRow[child] = process[child]; | |
| 777 | + } | |
| 778 | + const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId); | |
| 779 | + if (iProductProcessIndex > -1) { | |
| 780 | + processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段 | |
| 781 | + } | |
| 782 | + processProductDataRow.handleType = 'add'; | |
| 783 | + processProductDataRow.sType = '3'; | |
| 784 | + processProductDataRow.sPartsName = ''; | |
| 785 | + processProductDataRow.iPartOrder = 999; | |
| 786 | + processProductDataRow.iOrder = iOrder + 1; | |
| 787 | + processProductDataRow.sId = commonUtils.createSid(); | |
| 788 | + processProductDataRow.sParentId = masterData.sId; | |
| 789 | + processProductDataRow.sSlaveId = tableDataRow.sId; | |
| 790 | + processData.push(processProductDataRow); | |
| 791 | + // 配套工序 | |
| 792 | + if (bProcessAssort) { | |
| 793 | + returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 794 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 795 | + const iProcessIndex = -1; | |
| 796 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); | |
| 797 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 798 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 799 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 800 | + processRow.handleType = 'add'; | |
| 801 | + processRow.sId = commonUtils.createSid(); | |
| 802 | + processRow.sParentId = masterData.sId; | |
| 803 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 804 | + processRow.sSlaveId = tableDataRow.sId; | |
| 805 | + processData.push(processRow); | |
| 806 | + } | |
| 807 | + })); | |
| 808 | + } | |
| 809 | + }); | |
| 810 | + processData = this.sortData(controlData, processData); | |
| 811 | + const addState = { controlSelectedRowKeys: ['0000000'] }; | |
| 812 | + if (!commonUtils.isEmptyArr(slaveData)) { | |
| 813 | + addState.slaveSelectedRowKeys = [slaveData[0].sId]; | |
| 850 | 814 | } |
| 851 | - }, timValue); | |
| 815 | + this.props.onSaveState({ | |
| 816 | + materialsConfig, | |
| 817 | + slaveData, | |
| 818 | + controlData, | |
| 819 | + materialsData, | |
| 820 | + processData, | |
| 821 | + fastOrderModalVisible: false, | |
| 822 | + quotationAllprogress: 0, | |
| 823 | + materialsSelectedRowKeys: [], | |
| 824 | + ...addState, | |
| 825 | + sInfoArr, | |
| 826 | + bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr), | |
| 827 | + Loading: false, | |
| 828 | + }); | |
| 829 | + } else { | |
| 830 | + this.props.getServiceError(dataReturn); | |
| 831 | + this.props.onSaveState({ | |
| 832 | + Loading: false, | |
| 833 | + }); | |
| 834 | + } | |
| 852 | 835 | }; |
| 853 | 836 | |
| 854 | 837 | /* 勾选工序分类 */ | ... | ... |
src/components/QuoQuotation/QuotationPack/QuotationPack.js
| ... | ... | @@ -652,397 +652,340 @@ class QuotationPack extends Component { |
| 652 | 652 | if (sAllPartsName !== undefined) { |
| 653 | 653 | allPartsName = sAllPartsName.split(','); |
| 654 | 654 | } |
| 655 | - let timValue = 0; | |
| 656 | - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { | |
| 657 | - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 658 | - timValue = 3000; | |
| 659 | - } | |
| 660 | - setTimeout(async () => { | |
| 661 | - this.props.app.webSocket.onmessage = (msg) => { | |
| 662 | - const rtmsg = JSON.parse(msg.data); | |
| 663 | - if (rtmsg.action === 'quotationAllprogress') { | |
| 664 | - this.props.onSaveState({ | |
| 665 | - quotationAllprogress: rtmsg.msg, | |
| 666 | - }); | |
| 667 | - } else if (rtmsg.action === 'loginOut') { | |
| 668 | - if (location.pathname.indexOf('/indexOee') > -1) { | |
| 669 | - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } }); | |
| 670 | - } else if (location.pathname.indexOf('/indexMobile') > -1) { | |
| 671 | - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); | |
| 672 | - } else { | |
| 673 | - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); | |
| 674 | - } | |
| 675 | - } else if (this.props.app.webSocket.homeAction) { | |
| 676 | - this.props.app.webSocket.homeAction(msg); | |
| 677 | - } | |
| 678 | - }; | |
| 679 | - let cpProcessName = ''; | |
| 680 | - checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData; | |
| 681 | - // paramMap.modelName = masterData.modelName; | |
| 682 | - paramMap.bQuotation = true; | |
| 683 | - paramMap.sCustomerId = masterData.sCustomerId; | |
| 684 | - paramMap.sCustomerName = masterData.sCustomerName; | |
| 685 | - paramMap.sProductClassifyId = masterData.sProductClassifyId; | |
| 686 | - paramMap.sProductId = masterData.sProductId; | |
| 687 | - paramMap.sProductName = masterData.sProductName; | |
| 688 | - paramMap.sProductStyleId = masterData.sProductStyleId; | |
| 689 | - paramMap.sProductStyle = masterData.sProductStyle; | |
| 690 | - paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0; | |
| 691 | - paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0; | |
| 692 | - paramMap.dProductHeight = 0; | |
| 693 | - paramMap.dProductQty = masterData.dProductQty; | |
| 694 | - const partsInfo = []; | |
| 695 | - allPartsName.forEach((item) => { | |
| 696 | - const partInfo = {}; | |
| 697 | - partInfo.sPartsName = item; | |
| 698 | - partInfo.dPartsQty = masterData.dProductQty; | |
| 699 | - partInfo.dSumPQty = masterData[`dSumPQty${item}`]; | |
| 700 | - | |
| 701 | - const materialsInfo = []; | |
| 702 | - const material = {}; | |
| 703 | - material.sMaterialsId = masterData[`sMaterialsId${item}`]; | |
| 704 | - material.sMaterialsNo = masterData[`sMaterialsNo${item}`]; | |
| 705 | - material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`]; | |
| 706 | - materialsInfo.push(material); | |
| 707 | - partInfo.materialsInfo = materialsInfo; | |
| 708 | - partInfo.iPositiveColor = masterData[`iPositiveColor${item}`]; | |
| 709 | - partInfo.iPrintModePo = masterData[`iPrintModePo${item}`]; | |
| 710 | - if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') { | |
| 711 | - const processInfo = []; | |
| 712 | - checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => { | |
| 713 | - if (!commonUtils.isEmpty(masterData[card.sId + item])) { | |
| 714 | - if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') { | |
| 715 | - partInfo.sPrintProcessId = masterData[card.sId + item]; | |
| 716 | - } else { | |
| 717 | - const process = {}; | |
| 718 | - process.sProductClassifyId = card.sId; | |
| 719 | - process.sProcessId = masterData[card.sId + item]; | |
| 720 | - if (masterData[card.sId + card.sName + item] !== undefined) { | |
| 721 | - process.sProcessName = masterData[card.sId + card.sName + item]; | |
| 722 | - process.sType = masterData[card.sId + card.sType + item]; | |
| 723 | - processInfo.push(process); | |
| 724 | - } | |
| 655 | + this.props.app.webSocket.onmessageTmp = (msg) => { | |
| 656 | + const rtmsg = JSON.parse(msg.data); | |
| 657 | + if (rtmsg.action === 'quotationAllprogress') { | |
| 658 | + this.props.onSaveState({ | |
| 659 | + quotationAllprogress: rtmsg.msg, | |
| 660 | + }); | |
| 661 | + } | |
| 662 | + }; | |
| 663 | + let cpProcessName = ''; | |
| 664 | + checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData; | |
| 665 | + // paramMap.modelName = masterData.modelName; | |
| 666 | + paramMap.bQuotation = true; | |
| 667 | + paramMap.sCustomerId = masterData.sCustomerId; | |
| 668 | + paramMap.sCustomerName = masterData.sCustomerName; | |
| 669 | + paramMap.sProductClassifyId = masterData.sProductClassifyId; | |
| 670 | + paramMap.sProductId = masterData.sProductId; | |
| 671 | + paramMap.sProductName = masterData.sProductName; | |
| 672 | + paramMap.sProductStyleId = masterData.sProductStyleId; | |
| 673 | + paramMap.sProductStyle = masterData.sProductStyle; | |
| 674 | + paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0; | |
| 675 | + paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0; | |
| 676 | + paramMap.dProductHeight = 0; | |
| 677 | + paramMap.dProductQty = masterData.dProductQty; | |
| 678 | + const partsInfo = []; | |
| 679 | + allPartsName.forEach((item) => { | |
| 680 | + const partInfo = {}; | |
| 681 | + partInfo.sPartsName = item; | |
| 682 | + partInfo.dPartsQty = masterData.dProductQty; | |
| 683 | + partInfo.dSumPQty = masterData[`dSumPQty${item}`]; | |
| 684 | + | |
| 685 | + const materialsInfo = []; | |
| 686 | + const material = {}; | |
| 687 | + material.sMaterialsId = masterData[`sMaterialsId${item}`]; | |
| 688 | + material.sMaterialsNo = masterData[`sMaterialsNo${item}`]; | |
| 689 | + material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`]; | |
| 690 | + materialsInfo.push(material); | |
| 691 | + partInfo.materialsInfo = materialsInfo; | |
| 692 | + partInfo.iPositiveColor = masterData[`iPositiveColor${item}`]; | |
| 693 | + partInfo.iPrintModePo = masterData[`iPrintModePo${item}`]; | |
| 694 | + if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') { | |
| 695 | + const processInfo = []; | |
| 696 | + checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => { | |
| 697 | + if (!commonUtils.isEmpty(masterData[card.sId + item])) { | |
| 698 | + if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') { | |
| 699 | + partInfo.sPrintProcessId = masterData[card.sId + item]; | |
| 700 | + } else { | |
| 701 | + const process = {}; | |
| 702 | + process.sProductClassifyId = card.sId; | |
| 703 | + process.sProcessId = masterData[card.sId + item]; | |
| 704 | + if (masterData[card.sId + card.sName + item] !== undefined) { | |
| 705 | + process.sProcessName = masterData[card.sId + card.sName + item]; | |
| 706 | + process.sType = masterData[card.sId + card.sType + item]; | |
| 707 | + processInfo.push(process); | |
| 725 | 708 | } |
| 726 | 709 | } |
| 727 | - }); | |
| 728 | - partInfo.processInfo = processInfo; | |
| 729 | - partsInfo.push(partInfo); | |
| 730 | - } | |
| 731 | - }); | |
| 732 | - const productProcess = []; | |
| 733 | - checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => { | |
| 734 | - if (!commonUtils.isEmpty(masterData[card.sId])) { | |
| 735 | - const process = {}; | |
| 736 | - process.sProductClassifyId = card.sId; | |
| 737 | - process.sProcessId = masterData[card.sId]; | |
| 738 | - process.sProcessName = masterData[card.sId + card.sName]; | |
| 739 | - if (masterData[card.sId + card.sName] !== undefined) { | |
| 740 | - cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`; | |
| 741 | - productProcess.push(process); | |
| 742 | 710 | } |
| 711 | + }); | |
| 712 | + partInfo.processInfo = processInfo; | |
| 713 | + partsInfo.push(partInfo); | |
| 714 | + } | |
| 715 | + }); | |
| 716 | + const productProcess = []; | |
| 717 | + checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => { | |
| 718 | + if (!commonUtils.isEmpty(masterData[card.sId])) { | |
| 719 | + const process = {}; | |
| 720 | + process.sProductClassifyId = card.sId; | |
| 721 | + process.sProcessId = masterData[card.sId]; | |
| 722 | + process.sProcessName = masterData[card.sId + card.sName]; | |
| 723 | + if (masterData[card.sId + card.sName] !== undefined) { | |
| 724 | + cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`; | |
| 725 | + productProcess.push(process); | |
| 743 | 726 | } |
| 744 | - }); | |
| 745 | - paramMap.cpProcessName = cpProcessName; | |
| 746 | - paramMap.productProcessInfo = productProcess; | |
| 747 | - paramMap.partsInfo = partsInfo; | |
| 748 | - let numErr = false; | |
| 749 | - let numName = ''; | |
| 750 | - let num = 0; | |
| 751 | - | |
| 752 | - // eslint-disable-next-line array-callback-return | |
| 753 | - paramMap.partsInfo.map((item) => { | |
| 754 | - if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) { | |
| 755 | - num = item.dSumPQty; | |
| 756 | - numName = item.sPartsName; | |
| 757 | - } | |
| 758 | - if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) { | |
| 759 | - numErr = true; | |
| 760 | - numName = item.sPartsName; | |
| 761 | - } | |
| 762 | - }); | |
| 763 | - if (numErr) { | |
| 764 | - message.error(`${numName}P数必须是2的倍数!`); | |
| 765 | - return; | |
| 766 | 727 | } |
| 767 | - if (num === 2) { | |
| 768 | - message.error(`${numName}P数必须大于4P!`); | |
| 769 | - return; | |
| 728 | + }); | |
| 729 | + paramMap.cpProcessName = cpProcessName; | |
| 730 | + paramMap.productProcessInfo = productProcess; | |
| 731 | + paramMap.partsInfo = partsInfo; | |
| 732 | + let numErr = false; | |
| 733 | + let numName = ''; | |
| 734 | + let num = 0; | |
| 735 | + | |
| 736 | + // eslint-disable-next-line array-callback-return | |
| 737 | + paramMap.partsInfo.map((item) => { | |
| 738 | + if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) { | |
| 739 | + num = item.dSumPQty; | |
| 740 | + numName = item.sPartsName; | |
| 770 | 741 | } |
| 771 | - | |
| 772 | - if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) || | |
| 773 | - commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) { | |
| 774 | - // this.props.onSaveState({ fastOrderModalVisible: false }); | |
| 775 | - message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */ | |
| 776 | - return; | |
| 742 | + if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) { | |
| 743 | + numErr = true; | |
| 744 | + numName = item.sPartsName; | |
| 777 | 745 | } |
| 778 | - /* 验证产品规格是否 符合数字*数字格式 */ | |
| 779 | - const sProductStyle = paramMap.sProductStyle; | |
| 780 | - if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */ | |
| 781 | - const arr = sProductStyle.split('*'); | |
| 782 | - const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/; | |
| 783 | - if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) { | |
| 784 | - for (let i = 0; i < arr.length; i += 1) { | |
| 785 | - if (!numCheck.test(arr[i])) { /* 验证是否数字 */ | |
| 786 | - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 787 | - return; | |
| 788 | - } | |
| 746 | + }); | |
| 747 | + if (numErr) { | |
| 748 | + message.error(`${numName}P数必须是2的倍数!`); | |
| 749 | + return; | |
| 750 | + } | |
| 751 | + if (num === 2) { | |
| 752 | + message.error(`${numName}P数必须大于4P!`); | |
| 753 | + return; | |
| 754 | + } | |
| 755 | + | |
| 756 | + if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) || | |
| 757 | + commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) { | |
| 758 | + // this.props.onSaveState({ fastOrderModalVisible: false }); | |
| 759 | + message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */ | |
| 760 | + return; | |
| 761 | + } | |
| 762 | + /* 验证产品规格是否 符合数字*数字格式 */ | |
| 763 | + const sProductStyle = paramMap.sProductStyle; | |
| 764 | + if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */ | |
| 765 | + const arr = sProductStyle.split('*'); | |
| 766 | + const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/; | |
| 767 | + if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) { | |
| 768 | + for (let i = 0; i < arr.length; i += 1) { | |
| 769 | + if (!numCheck.test(arr[i])) { /* 验证是否数字 */ | |
| 770 | + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 771 | + return; | |
| 789 | 772 | } |
| 790 | - } else { | |
| 791 | - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 792 | - return; | |
| 793 | 773 | } |
| 794 | - /* 验证*两边是否是数字 */ | |
| 795 | 774 | } else { |
| 796 | 775 | message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); |
| 797 | 776 | return; |
| 798 | 777 | } |
| 799 | - this.props.onSaveState({ | |
| 800 | - Loading: true, | |
| 801 | - }); | |
| 802 | - // onSendSocketMessage('quotationSplitPaste', 'noAction', masterData.sId, userinfo.sId, null, null); | |
| 778 | + /* 验证*两边是否是数字 */ | |
| 779 | + } else { | |
| 780 | + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 781 | + return; | |
| 782 | + } | |
| 783 | + this.props.onSaveState({ | |
| 784 | + Loading: true, | |
| 785 | + }); | |
| 786 | + // onSendSocketMessage('quotationSplitPaste', 'noAction', masterData.sId, userinfo.sId, null, null); | |
| 803 | 787 | |
| 804 | - const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`; | |
| 805 | - const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; | |
| 806 | - if (dataReturn.code === 1) { | |
| 807 | - const { | |
| 808 | - productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo, | |
| 809 | - } = dataReturn.dataset.rows[0]; | |
| 810 | - const slaveData = []; | |
| 811 | - const controlData = []; | |
| 812 | - const materialsData = []; | |
| 813 | - let processData = []; | |
| 814 | - const tableDataRow = {}; | |
| 815 | - for (const item of slaveConfig.gdsconfigformslave) { | |
| 816 | - tableDataRow[item.sName] = masterData[item.sName]; | |
| 817 | - } | |
| 818 | - tableDataRow.sId = commonUtils.createSid(); | |
| 819 | - tableDataRow.handleType = 'add'; | |
| 820 | - tableDataRow.iOrder = 1; | |
| 821 | - tableDataRow.sParentId = masterData.sId; | |
| 822 | - // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName'); | |
| 823 | - let productIdDropDown; | |
| 824 | - const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName'); | |
| 825 | - if (slaveIndex > -1) { | |
| 826 | - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow); | |
| 827 | - productIdDropDown = sqlDropDownData.dropDownData; | |
| 828 | - } | |
| 829 | - const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId); | |
| 830 | - if (iProductIdIndex === -1) { | |
| 831 | - tableDataRow.sProductId = tableDataRow.sProductName; | |
| 832 | - tableDataRow.sProductInfo = JSON.stringify({ | |
| 833 | - sProductId: tableDataRow.sProductName, | |
| 834 | - sProductName: tableDataRow.sProductName, | |
| 835 | - sProductStyle: tableDataRow.sProductStyle, | |
| 836 | - sProductUnit: tableDataRow.sProductUnit, | |
| 837 | - sProductNo: tableDataRow.sProductNo, | |
| 838 | - sCustomerProductNo: tableDataRow.sCustomerProductNo, | |
| 839 | - sProductClassifyId: tableDataRow.sProductClassifyId, | |
| 840 | - sProductClassifyName: tableDataRow.sProductClassifyName, | |
| 841 | - }); | |
| 842 | - } else { | |
| 843 | - tableDataRow.sProductInfo = ''; | |
| 844 | - } | |
| 845 | - slaveData.push(tableDataRow); | |
| 846 | - const sInfoArr = []; | |
| 847 | - if (!commonUtils.isEmptyArr(partsOldInfo)) { | |
| 848 | - partsOldInfo.forEach((item) => { | |
| 849 | - if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) { | |
| 850 | - this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` }); | |
| 851 | - } | |
| 852 | - }); | |
| 853 | - } | |
| 854 | - if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */ | |
| 855 | - partsNewInfo.forEach((item) => { | |
| 856 | - const { sPartsName, sInfo } = item; | |
| 857 | - const sInfoObj = {}; | |
| 858 | - sInfoObj.sPartsName = sPartsName; | |
| 859 | - sInfoObj.sInfo = sInfo; | |
| 860 | - sInfoArr.push(sInfoObj); | |
| 861 | - }); | |
| 862 | - } | |
| 788 | + const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`; | |
| 789 | + const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; | |
| 790 | + if (dataReturn.code === 1) { | |
| 791 | + const { | |
| 792 | + productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo, | |
| 793 | + } = dataReturn.dataset.rows[0]; | |
| 794 | + const slaveData = []; | |
| 795 | + const controlData = []; | |
| 796 | + const materialsData = []; | |
| 797 | + let processData = []; | |
| 798 | + const tableDataRow = {}; | |
| 799 | + for (const item of slaveConfig.gdsconfigformslave) { | |
| 800 | + tableDataRow[item.sName] = masterData[item.sName]; | |
| 801 | + } | |
| 802 | + tableDataRow.sId = commonUtils.createSid(); | |
| 803 | + tableDataRow.handleType = 'add'; | |
| 804 | + tableDataRow.iOrder = 1; | |
| 805 | + tableDataRow.sParentId = masterData.sId; | |
| 806 | + // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName'); | |
| 807 | + let productIdDropDown; | |
| 808 | + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName'); | |
| 809 | + if (slaveIndex > -1) { | |
| 810 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow); | |
| 811 | + productIdDropDown = sqlDropDownData.dropDownData; | |
| 812 | + } | |
| 813 | + const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId); | |
| 814 | + if (iProductIdIndex === -1) { | |
| 815 | + tableDataRow.sProductId = tableDataRow.sProductName; | |
| 816 | + tableDataRow.sProductInfo = JSON.stringify({ | |
| 817 | + sProductId: tableDataRow.sProductName, | |
| 818 | + sProductName: tableDataRow.sProductName, | |
| 819 | + sProductStyle: tableDataRow.sProductStyle, | |
| 820 | + sProductUnit: tableDataRow.sProductUnit, | |
| 821 | + sProductNo: tableDataRow.sProductNo, | |
| 822 | + sCustomerProductNo: tableDataRow.sCustomerProductNo, | |
| 823 | + sProductClassifyId: tableDataRow.sProductClassifyId, | |
| 824 | + sProductClassifyName: tableDataRow.sProductClassifyName, | |
| 825 | + }); | |
| 826 | + } else { | |
| 827 | + tableDataRow.sProductInfo = ''; | |
| 828 | + } | |
| 829 | + slaveData.push(tableDataRow); | |
| 830 | + const sInfoArr = []; | |
| 831 | + if (!commonUtils.isEmptyArr(partsOldInfo)) { | |
| 832 | + partsOldInfo.forEach((item) => { | |
| 833 | + if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) { | |
| 834 | + this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` }); | |
| 835 | + } | |
| 836 | + }); | |
| 837 | + } | |
| 838 | + if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */ | |
| 839 | + partsNewInfo.forEach((item) => { | |
| 840 | + const { sPartsName, sInfo } = item; | |
| 841 | + const sInfoObj = {}; | |
| 842 | + sInfoObj.sPartsName = sPartsName; | |
| 843 | + sInfoObj.sInfo = sInfo; | |
| 844 | + sInfoArr.push(sInfoObj); | |
| 845 | + }); | |
| 846 | + } | |
| 863 | 847 | |
| 864 | - const bProcessAssort = true; | |
| 865 | - let returnProcessAssort = []; | |
| 866 | - let processAssignAssort = ''; | |
| 867 | - let dropDownDataProcessName; | |
| 868 | - if (bProcessAssort) { | |
| 869 | - const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`; | |
| 870 | - const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data; | |
| 871 | - if (dataProcessAssort.code === 1) { | |
| 872 | - returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort; | |
| 873 | - const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); | |
| 874 | - if (iIndex > -1) { | |
| 875 | - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]); | |
| 876 | - dropDownDataProcessName = sqlDropDownData.dropDownData; | |
| 877 | - processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; | |
| 878 | - } | |
| 848 | + const bProcessAssort = true; | |
| 849 | + let returnProcessAssort = []; | |
| 850 | + let processAssignAssort = ''; | |
| 851 | + let dropDownDataProcessName; | |
| 852 | + if (bProcessAssort) { | |
| 853 | + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`; | |
| 854 | + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data; | |
| 855 | + if (dataProcessAssort.code === 1) { | |
| 856 | + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort; | |
| 857 | + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); | |
| 858 | + if (iIndex > -1) { | |
| 859 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]); | |
| 860 | + dropDownDataProcessName = sqlDropDownData.dropDownData; | |
| 861 | + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; | |
| 879 | 862 | } |
| 880 | 863 | } |
| 881 | - const newCopyTo = {}; | |
| 882 | - newCopyTo.master = masterData; | |
| 883 | - newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0]; | |
| 884 | - await partsNewInfo.forEach(async (partInfo, iIndex) => { | |
| 885 | - const partsDataRow = {}; | |
| 886 | - for (const child of Object.keys(partInfo)) { | |
| 887 | - partsDataRow[child] = partInfo[child]; | |
| 888 | - } | |
| 889 | - partsDataRow.handleType = 'add'; | |
| 890 | - partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */ | |
| 891 | - partsDataRow.sId = commonUtils.createSid(); | |
| 892 | - partsDataRow.sParentId = masterData.sId; | |
| 893 | - // partsDataRow.sSlaveId = ' '; | |
| 894 | - if (partsDataRow.iPrintMode !== 3) { | |
| 895 | - partsDataRow.iOppositeColor = partsDataRow.iPositiveColor; | |
| 896 | - } | |
| 897 | - delete partsDataRow.dMaterialsKQty; | |
| 898 | - delete partsDataRow.dMaterialsLength; | |
| 899 | - delete partsDataRow.dMaterialsWidth; | |
| 900 | - if (productClassify.bSpecialRules) { | |
| 901 | - partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength; | |
| 902 | - partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth; | |
| 864 | + } | |
| 865 | + const newCopyTo = {}; | |
| 866 | + newCopyTo.master = masterData; | |
| 867 | + newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0]; | |
| 868 | + await partsNewInfo.forEach(async (partInfo, iIndex) => { | |
| 869 | + const partsDataRow = {}; | |
| 870 | + for (const child of Object.keys(partInfo)) { | |
| 871 | + partsDataRow[child] = partInfo[child]; | |
| 872 | + } | |
| 873 | + partsDataRow.handleType = 'add'; | |
| 874 | + partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */ | |
| 875 | + partsDataRow.sId = commonUtils.createSid(); | |
| 876 | + partsDataRow.sParentId = masterData.sId; | |
| 877 | + // partsDataRow.sSlaveId = ' '; | |
| 878 | + if (partsDataRow.iPrintMode !== 3) { | |
| 879 | + partsDataRow.iOppositeColor = partsDataRow.iPositiveColor; | |
| 880 | + } | |
| 881 | + delete partsDataRow.dMaterialsKQty; | |
| 882 | + delete partsDataRow.dMaterialsLength; | |
| 883 | + delete partsDataRow.dMaterialsWidth; | |
| 884 | + if (productClassify.bSpecialRules) { | |
| 885 | + partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength; | |
| 886 | + partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth; | |
| 887 | + } | |
| 888 | + controlData.push(partsDataRow); | |
| 889 | + // 材料信息 | |
| 890 | + await partInfo.materialsInfo.forEach(async (materialInfo, iOrder) => { | |
| 891 | + let materialDataRow = {}; | |
| 892 | + for (const item of materialsConfig.gdsconfigformslave) { | |
| 893 | + materialDataRow[item.sName] = materialInfo[item.sName]; | |
| 903 | 894 | } |
| 904 | - controlData.push(partsDataRow); | |
| 905 | - // 材料信息 | |
| 906 | - await partInfo.materialsInfo.forEach(async (materialInfo, iOrder) => { | |
| 907 | - let materialDataRow = {}; | |
| 908 | - for (const item of materialsConfig.gdsconfigformslave) { | |
| 909 | - materialDataRow[item.sName] = materialInfo[item.sName]; | |
| 895 | + materialDataRow.handleType = 'add'; | |
| 896 | + materialDataRow.sType = '0'; | |
| 897 | + materialDataRow.iPartOrder = iIndex; | |
| 898 | + materialDataRow.iOrder = iOrder + 1; | |
| 899 | + materialDataRow.sPartsName = partsDataRow.sPartsName; | |
| 900 | + materialDataRow.sId = commonUtils.createSid(); | |
| 901 | + materialDataRow.sParentId = masterData.sId; | |
| 902 | + materialDataRow.sControlId = partsDataRow.sId; | |
| 903 | + // materialDataRow.sSlaveId = ' '; | |
| 904 | + materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial; | |
| 905 | + const models = 'Materials'; | |
| 906 | + materialDataRow = await this.props.onMaterialsChange(materialDataRow, sModelsId, masterData, [], 'dAuxiliaryQty', app, token, models); | |
| 907 | + materialDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, materialDataRow); | |
| 908 | + materialsData.push(materialDataRow); | |
| 909 | + }); | |
| 910 | + // 工序信息 | |
| 911 | + let processPrintDataRow = {}; | |
| 912 | + processPrintDataRow.handleType = 'add'; | |
| 913 | + processPrintDataRow.sProcessId = partInfo.sProcessId; | |
| 914 | + const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId); | |
| 915 | + if (iProcessPrintIndex > -1) { | |
| 916 | + processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段 | |
| 917 | + } | |
| 918 | + processPrintDataRow.sType = partInfo.sType; | |
| 919 | + processPrintDataRow.iPartOrder = iIndex; | |
| 920 | + processPrintDataRow.iOrder = 1; | |
| 921 | + processPrintDataRow.sProcessName = partInfo.sProcessName; | |
| 922 | + processPrintDataRow.sPartsName = partsDataRow.sPartsName; | |
| 923 | + processPrintDataRow.dProcessInQty = partInfo.dProcessInQty; | |
| 924 | + processPrintDataRow.dLossQty = partInfo.dLossQty; | |
| 925 | + processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty; | |
| 926 | + processPrintDataRow.sId = commonUtils.createSid(); | |
| 927 | + processPrintDataRow.sParentId = masterData.sId; | |
| 928 | + processPrintDataRow.sControlId = partsDataRow.sId; | |
| 929 | + // processPrintDataRow.sSlaveId = ' '; | |
| 930 | + processData.push(processPrintDataRow); | |
| 931 | + // 配套工序 | |
| 932 | + if (bProcessAssort) { | |
| 933 | + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 934 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 935 | + const iProcessIndex = -1; | |
| 936 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 937 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 938 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 939 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 940 | + processRow.handleType = 'add'; | |
| 941 | + processRow.sId = commonUtils.createSid(); | |
| 942 | + processRow.sParentId = masterData.sId; | |
| 943 | + processRow.sControlId = partsDataRow.sId; | |
| 944 | + processRow.sPartsName = partsDataRow.sPartsName; | |
| 945 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 946 | + // processRow.sSlaveId = ' '; | |
| 947 | + processData.push(processRow); | |
| 910 | 948 | } |
| 911 | - materialDataRow.handleType = 'add'; | |
| 912 | - materialDataRow.sType = '0'; | |
| 913 | - materialDataRow.iPartOrder = iIndex; | |
| 914 | - materialDataRow.iOrder = iOrder + 1; | |
| 915 | - materialDataRow.sPartsName = partsDataRow.sPartsName; | |
| 916 | - materialDataRow.sId = commonUtils.createSid(); | |
| 917 | - materialDataRow.sParentId = masterData.sId; | |
| 918 | - materialDataRow.sControlId = partsDataRow.sId; | |
| 919 | - // materialDataRow.sSlaveId = ' '; | |
| 920 | - materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial; | |
| 921 | - const models = 'Materials'; | |
| 922 | - materialDataRow = await this.props.onMaterialsChange(materialDataRow, sModelsId, masterData, [], 'dAuxiliaryQty', app, token, models); | |
| 923 | - materialDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, materialDataRow); | |
| 924 | - materialsData.push(materialDataRow); | |
| 925 | - }); | |
| 926 | - // 工序信息 | |
| 927 | - let processPrintDataRow = {}; | |
| 928 | - processPrintDataRow.handleType = 'add'; | |
| 929 | - processPrintDataRow.sProcessId = partInfo.sProcessId; | |
| 930 | - const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId); | |
| 931 | - if (iProcessPrintIndex > -1) { | |
| 932 | - processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段 | |
| 933 | - } | |
| 934 | - processPrintDataRow.sType = partInfo.sType; | |
| 935 | - processPrintDataRow.iPartOrder = iIndex; | |
| 936 | - processPrintDataRow.iOrder = 1; | |
| 937 | - processPrintDataRow.sProcessName = partInfo.sProcessName; | |
| 938 | - processPrintDataRow.sPartsName = partsDataRow.sPartsName; | |
| 939 | - processPrintDataRow.dProcessInQty = partInfo.dProcessInQty; | |
| 940 | - processPrintDataRow.dLossQty = partInfo.dLossQty; | |
| 941 | - processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty; | |
| 942 | - processPrintDataRow.sId = commonUtils.createSid(); | |
| 943 | - processPrintDataRow.sParentId = masterData.sId; | |
| 944 | - processPrintDataRow.sControlId = partsDataRow.sId; | |
| 945 | - // processPrintDataRow.sSlaveId = ' '; | |
| 946 | - processData.push(processPrintDataRow); | |
| 947 | - // 配套工序 | |
| 948 | - if (bProcessAssort) { | |
| 949 | - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 950 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 951 | - const iProcessIndex = -1; | |
| 952 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 953 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 954 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 955 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 956 | - processRow.handleType = 'add'; | |
| 957 | - processRow.sId = commonUtils.createSid(); | |
| 958 | - processRow.sParentId = masterData.sId; | |
| 959 | - processRow.sControlId = partsDataRow.sId; | |
| 960 | - processRow.sPartsName = partsDataRow.sPartsName; | |
| 961 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 962 | - // processRow.sSlaveId = ' '; | |
| 963 | - processData.push(processRow); | |
| 964 | - } | |
| 965 | - })); | |
| 966 | - } | |
| 949 | + })); | |
| 950 | + } | |
| 967 | 951 | |
| 968 | - partInfo.processInfo.forEach((process, iOrder) => { | |
| 969 | - let processAfterDataRow = {}; | |
| 970 | - for (const item of processConfig.gdsconfigformslave) { | |
| 971 | - processAfterDataRow[item.sName] = process[item.sName]; | |
| 972 | - } | |
| 973 | - for (const child of Object.keys(process)) { | |
| 974 | - processAfterDataRow[child] = process[child]; | |
| 975 | - } | |
| 976 | - processAfterDataRow.handleType = 'add'; | |
| 977 | - processAfterDataRow.sProcessId = process.sProcessId; | |
| 978 | - const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId); | |
| 979 | - if (iProcessAfterIndex > -1) { | |
| 980 | - processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段 | |
| 981 | - } | |
| 982 | - processAfterDataRow.sType = process.sType; | |
| 983 | - processAfterDataRow.iPartOrder = iIndex; | |
| 984 | - processAfterDataRow.iOrder = iOrder + 1; | |
| 985 | - processAfterDataRow.sPartsName = partsDataRow.sPartsName; | |
| 986 | - processAfterDataRow.sId = commonUtils.createSid(); | |
| 987 | - processAfterDataRow.sParentId = masterData.sId; | |
| 988 | - processAfterDataRow.sControlId = partsDataRow.sId; | |
| 989 | - // processAfterDataRow.sSlaveId = ' '; | |
| 990 | - processData.push(processAfterDataRow); | |
| 991 | - // 配套工序 | |
| 992 | - if (bProcessAssort) { | |
| 993 | - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 994 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 995 | - const iProcessIndex = -1; | |
| 996 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 997 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 998 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 999 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 1000 | - processRow.handleType = 'add'; | |
| 1001 | - processRow.sId = commonUtils.createSid(); | |
| 1002 | - processRow.sParentId = masterData.sId; | |
| 1003 | - processRow.sControlId = partsDataRow.sId; | |
| 1004 | - processRow.sPartsName = partsDataRow.sPartsName; | |
| 1005 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 1006 | - // processRow.sSlaveId = ' '; | |
| 1007 | - processData.push(processRow); | |
| 1008 | - } | |
| 1009 | - })); | |
| 1010 | - } | |
| 1011 | - }); | |
| 1012 | - }); | |
| 1013 | - productProcessInfo.forEach((process, iOrder) => { | |
| 1014 | - let processProductDataRow = {}; | |
| 952 | + partInfo.processInfo.forEach((process, iOrder) => { | |
| 953 | + let processAfterDataRow = {}; | |
| 1015 | 954 | for (const item of processConfig.gdsconfigformslave) { |
| 1016 | - processProductDataRow[item.sName] = process[item.sName]; | |
| 955 | + processAfterDataRow[item.sName] = process[item.sName]; | |
| 1017 | 956 | } |
| 1018 | 957 | for (const child of Object.keys(process)) { |
| 1019 | - processProductDataRow[child] = process[child]; | |
| 958 | + processAfterDataRow[child] = process[child]; | |
| 1020 | 959 | } |
| 1021 | - const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId); | |
| 1022 | - if (iProductProcessIndex > -1) { | |
| 1023 | - processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段 | |
| 960 | + processAfterDataRow.handleType = 'add'; | |
| 961 | + processAfterDataRow.sProcessId = process.sProcessId; | |
| 962 | + const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId); | |
| 963 | + if (iProcessAfterIndex > -1) { | |
| 964 | + processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段 | |
| 1024 | 965 | } |
| 1025 | - processProductDataRow.handleType = 'add'; | |
| 1026 | - processProductDataRow.sType = '3'; | |
| 1027 | - processProductDataRow.sPartsName = ''; | |
| 1028 | - processProductDataRow.iPartOrder = 999; | |
| 1029 | - processProductDataRow.iOrder = iOrder + 1; | |
| 1030 | - processProductDataRow.sId = commonUtils.createSid(); | |
| 1031 | - processProductDataRow.sParentId = masterData.sId; | |
| 1032 | - // processProductDataRow.sSlaveId = ' '; | |
| 1033 | - processData.push(processProductDataRow); | |
| 966 | + processAfterDataRow.sType = process.sType; | |
| 967 | + processAfterDataRow.iPartOrder = iIndex; | |
| 968 | + processAfterDataRow.iOrder = iOrder + 1; | |
| 969 | + processAfterDataRow.sPartsName = partsDataRow.sPartsName; | |
| 970 | + processAfterDataRow.sId = commonUtils.createSid(); | |
| 971 | + processAfterDataRow.sParentId = masterData.sId; | |
| 972 | + processAfterDataRow.sControlId = partsDataRow.sId; | |
| 973 | + // processAfterDataRow.sSlaveId = ' '; | |
| 974 | + processData.push(processAfterDataRow); | |
| 1034 | 975 | // 配套工序 |
| 1035 | 976 | if (bProcessAssort) { |
| 1036 | - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 977 | + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1037 | 978 | const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); |
| 1038 | 979 | const iProcessIndex = -1; |
| 1039 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); | |
| 980 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 1040 | 981 | if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { |
| 1041 | 982 | let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 |
| 1042 | 983 | processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 |
| 1043 | 984 | processRow.handleType = 'add'; |
| 1044 | 985 | processRow.sId = commonUtils.createSid(); |
| 1045 | 986 | processRow.sParentId = masterData.sId; |
| 987 | + processRow.sControlId = partsDataRow.sId; | |
| 988 | + processRow.sPartsName = partsDataRow.sPartsName; | |
| 1046 | 989 | processRow.sType = dropDownDataProcessName[iIndex].sType; |
| 1047 | 990 | // processRow.sSlaveId = ' '; |
| 1048 | 991 | processData.push(processRow); |
| ... | ... | @@ -1050,32 +993,72 @@ class QuotationPack extends Component { |
| 1050 | 993 | })); |
| 1051 | 994 | } |
| 1052 | 995 | }); |
| 1053 | - processData = this.sortData(controlData, processData); | |
| 1054 | - const addState = { controlSelectedRowKeys: ['0000000'] }; | |
| 1055 | - if (!commonUtils.isEmptyArr(slaveData)) { | |
| 1056 | - addState.slaveSelectedRowKeys = [slaveData[0].sId]; | |
| 996 | + }); | |
| 997 | + productProcessInfo.forEach((process, iOrder) => { | |
| 998 | + let processProductDataRow = {}; | |
| 999 | + for (const item of processConfig.gdsconfigformslave) { | |
| 1000 | + processProductDataRow[item.sName] = process[item.sName]; | |
| 1001 | + } | |
| 1002 | + for (const child of Object.keys(process)) { | |
| 1003 | + processProductDataRow[child] = process[child]; | |
| 1004 | + } | |
| 1005 | + const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId); | |
| 1006 | + if (iProductProcessIndex > -1) { | |
| 1007 | + processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段 | |
| 1008 | + } | |
| 1009 | + processProductDataRow.handleType = 'add'; | |
| 1010 | + processProductDataRow.sType = '3'; | |
| 1011 | + processProductDataRow.sPartsName = ''; | |
| 1012 | + processProductDataRow.iPartOrder = 999; | |
| 1013 | + processProductDataRow.iOrder = iOrder + 1; | |
| 1014 | + processProductDataRow.sId = commonUtils.createSid(); | |
| 1015 | + processProductDataRow.sParentId = masterData.sId; | |
| 1016 | + // processProductDataRow.sSlaveId = ' '; | |
| 1017 | + processData.push(processProductDataRow); | |
| 1018 | + // 配套工序 | |
| 1019 | + if (bProcessAssort) { | |
| 1020 | + returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1021 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 1022 | + const iProcessIndex = -1; | |
| 1023 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); | |
| 1024 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 1025 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 1026 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 1027 | + processRow.handleType = 'add'; | |
| 1028 | + processRow.sId = commonUtils.createSid(); | |
| 1029 | + processRow.sParentId = masterData.sId; | |
| 1030 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 1031 | + // processRow.sSlaveId = ' '; | |
| 1032 | + processData.push(processRow); | |
| 1033 | + } | |
| 1034 | + })); | |
| 1057 | 1035 | } |
| 1058 | - this.props.onSaveState({ | |
| 1059 | - materialsConfig, | |
| 1060 | - slaveData, | |
| 1061 | - controlData, | |
| 1062 | - materialsData, | |
| 1063 | - processData, | |
| 1064 | - fastOrderModalVisible: false, | |
| 1065 | - quotationAllprogress: 0, | |
| 1066 | - materialsSelectedRowKeys: [], | |
| 1067 | - ...addState, | |
| 1068 | - sInfoArr, | |
| 1069 | - bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr), | |
| 1070 | - Loading: false, | |
| 1071 | - }); | |
| 1072 | - } else { | |
| 1073 | - this.props.getServiceError(dataReturn); | |
| 1074 | - this.props.onSaveState({ | |
| 1075 | - Loading: false, | |
| 1076 | - }); | |
| 1036 | + }); | |
| 1037 | + processData = this.sortData(controlData, processData); | |
| 1038 | + const addState = { controlSelectedRowKeys: ['0000000'] }; | |
| 1039 | + if (!commonUtils.isEmptyArr(slaveData)) { | |
| 1040 | + addState.slaveSelectedRowKeys = [slaveData[0].sId]; | |
| 1077 | 1041 | } |
| 1078 | - }, timValue); | |
| 1042 | + this.props.onSaveState({ | |
| 1043 | + materialsConfig, | |
| 1044 | + slaveData, | |
| 1045 | + controlData, | |
| 1046 | + materialsData, | |
| 1047 | + processData, | |
| 1048 | + fastOrderModalVisible: false, | |
| 1049 | + quotationAllprogress: 0, | |
| 1050 | + materialsSelectedRowKeys: [], | |
| 1051 | + ...addState, | |
| 1052 | + sInfoArr, | |
| 1053 | + bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr), | |
| 1054 | + Loading: false, | |
| 1055 | + }); | |
| 1056 | + } else { | |
| 1057 | + this.props.getServiceError(dataReturn); | |
| 1058 | + this.props.onSaveState({ | |
| 1059 | + Loading: false, | |
| 1060 | + }); | |
| 1061 | + } | |
| 1079 | 1062 | }; |
| 1080 | 1063 | |
| 1081 | 1064 | /* 勾选工序分类 */ | ... | ... |
src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js
| ... | ... | @@ -1221,399 +1221,342 @@ class QuotationPackTableTree extends Component { |
| 1221 | 1221 | if (sAllPartsName !== undefined) { |
| 1222 | 1222 | allPartsName = sAllPartsName.split(','); |
| 1223 | 1223 | } |
| 1224 | - let timValue = 0; | |
| 1225 | - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { | |
| 1226 | - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 1227 | - timValue = 3000; | |
| 1228 | - } | |
| 1229 | - setTimeout(async () => { | |
| 1230 | - this.props.app.webSocket.onmessage = (msg) => { | |
| 1231 | - const rtmsg = JSON.parse(msg.data); | |
| 1232 | - if (rtmsg.action === 'quotationAllprogress') { | |
| 1233 | - this.props.onSaveState({ | |
| 1234 | - quotationAllprogress: rtmsg.msg, | |
| 1235 | - }); | |
| 1236 | - } else if (rtmsg.action === 'loginOut') { | |
| 1237 | - if (location.pathname.indexOf('/indexOee') > -1) { | |
| 1238 | - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } }); | |
| 1239 | - } else if (location.pathname.indexOf('/indexMobile') > -1) { | |
| 1240 | - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); | |
| 1241 | - } else { | |
| 1242 | - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); | |
| 1243 | - } | |
| 1244 | - } else if (this.props.app.webSocket.homeAction) { | |
| 1245 | - this.props.app.webSocket.homeAction(msg); | |
| 1246 | - } | |
| 1247 | - }; | |
| 1248 | - let cpProcessName = ''; | |
| 1249 | - checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData; | |
| 1250 | - // paramMap.modelName = masterData.modelName; | |
| 1251 | - paramMap.bQuotation = true; | |
| 1252 | - paramMap.sCustomerId = masterData.sCustomerId; | |
| 1253 | - paramMap.sCustomerName = masterData.sCustomerName; | |
| 1254 | - paramMap.sProductClassifyId = masterData.sProductClassifyId; | |
| 1255 | - paramMap.sProductId = masterData.sProductId; | |
| 1256 | - paramMap.sProductName = masterData.sProductName; | |
| 1257 | - paramMap.sProductStyleId = masterData.sProductStyleId; | |
| 1258 | - paramMap.sProductStyle = masterData.sProductStyle; | |
| 1259 | - paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0; | |
| 1260 | - paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0; | |
| 1261 | - paramMap.dProductHeight = 0; | |
| 1262 | - paramMap.dProductQty = masterData.dProductQty; | |
| 1263 | - const partsInfo = []; | |
| 1264 | - allPartsName.forEach((item) => { | |
| 1265 | - const partInfo = {}; | |
| 1266 | - partInfo.sPartsName = item; | |
| 1267 | - partInfo.dPartsQty = masterData.dProductQty; | |
| 1268 | - partInfo.dSumPQty = masterData[`dSumPQty${item}`]; | |
| 1269 | - partInfo.dPartsLength = masterData[`dPartsLength${item}`]; /* 部件长 */ | |
| 1270 | - partInfo.dPartsWidth = masterData[`dPartsWidth${item}`]; /* 部件宽 */ | |
| 1271 | - | |
| 1272 | - const materialsInfo = []; | |
| 1273 | - const material = {}; | |
| 1274 | - material.sMaterialsId = masterData[`sMaterialsId${item}`]; | |
| 1275 | - material.sMaterialsNo = masterData[`sMaterialsNo${item}`]; | |
| 1276 | - material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`]; | |
| 1277 | - materialsInfo.push(material); | |
| 1278 | - partInfo.materialsInfo = materialsInfo; | |
| 1279 | - partInfo.iPositiveColor = masterData[`iPositiveColor${item}`]; | |
| 1280 | - partInfo.iPrintModePo = masterData[`iPrintModePo${item}`]; | |
| 1281 | - if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') { | |
| 1282 | - const processInfo = []; | |
| 1283 | - checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => { | |
| 1284 | - if (!commonUtils.isEmpty(masterData[card.sId + item])) { | |
| 1285 | - if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') { | |
| 1286 | - partInfo.sPrintProcessId = masterData[card.sId + item]; | |
| 1287 | - } else { | |
| 1288 | - const process = {}; | |
| 1289 | - process.sProductClassifyId = card.sId; | |
| 1290 | - process.sProcessId = masterData[card.sId + item]; | |
| 1291 | - if (masterData[card.sId + card.sName + item] !== undefined) { | |
| 1292 | - process.sProcessName = masterData[card.sId + card.sName + item]; | |
| 1293 | - process.sType = masterData[card.sId + card.sType + item]; | |
| 1294 | - processInfo.push(process); | |
| 1295 | - } | |
| 1224 | + this.props.app.webSocket.onmessageTmp = (msg) => { | |
| 1225 | + const rtmsg = JSON.parse(msg.data); | |
| 1226 | + if (rtmsg.action === 'quotationAllprogress') { | |
| 1227 | + this.props.onSaveState({ | |
| 1228 | + quotationAllprogress: rtmsg.msg, | |
| 1229 | + }); | |
| 1230 | + } | |
| 1231 | + }; | |
| 1232 | + let cpProcessName = ''; | |
| 1233 | + checkProcessClassifyData = commonUtils.isEmptyArr(checkProcessClassifyData) ? [] : checkProcessClassifyData; | |
| 1234 | + // paramMap.modelName = masterData.modelName; | |
| 1235 | + paramMap.bQuotation = true; | |
| 1236 | + paramMap.sCustomerId = masterData.sCustomerId; | |
| 1237 | + paramMap.sCustomerName = masterData.sCustomerName; | |
| 1238 | + paramMap.sProductClassifyId = masterData.sProductClassifyId; | |
| 1239 | + paramMap.sProductId = masterData.sProductId; | |
| 1240 | + paramMap.sProductName = masterData.sProductName; | |
| 1241 | + paramMap.sProductStyleId = masterData.sProductStyleId; | |
| 1242 | + paramMap.sProductStyle = masterData.sProductStyle; | |
| 1243 | + paramMap.dProductWidth = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[1] : 0; | |
| 1244 | + paramMap.dProductLength = !commonUtils.isEmpty(masterData.sProductStyle) && masterData.sProductStyle.split('*').length > 0 ? masterData.sProductStyle.split('*')[0] : 0; | |
| 1245 | + paramMap.dProductHeight = 0; | |
| 1246 | + paramMap.dProductQty = masterData.dProductQty; | |
| 1247 | + const partsInfo = []; | |
| 1248 | + allPartsName.forEach((item) => { | |
| 1249 | + const partInfo = {}; | |
| 1250 | + partInfo.sPartsName = item; | |
| 1251 | + partInfo.dPartsQty = masterData.dProductQty; | |
| 1252 | + partInfo.dSumPQty = masterData[`dSumPQty${item}`]; | |
| 1253 | + partInfo.dPartsLength = masterData[`dPartsLength${item}`]; /* 部件长 */ | |
| 1254 | + partInfo.dPartsWidth = masterData[`dPartsWidth${item}`]; /* 部件宽 */ | |
| 1255 | + | |
| 1256 | + const materialsInfo = []; | |
| 1257 | + const material = {}; | |
| 1258 | + material.sMaterialsId = masterData[`sMaterialsId${item}`]; | |
| 1259 | + material.sMaterialsNo = masterData[`sMaterialsNo${item}`]; | |
| 1260 | + material.sMaterialsName = masterData[`sMaterialsName${item}`] !== undefined && masterData[`sMaterialsName${item}`].split('[-]').length > 1 ? masterData[`sMaterialsName${item}`].split('[-]')[1] : masterData[`sMaterialsName${item}`]; | |
| 1261 | + materialsInfo.push(material); | |
| 1262 | + partInfo.materialsInfo = materialsInfo; | |
| 1263 | + partInfo.iPositiveColor = masterData[`iPositiveColor${item}`]; | |
| 1264 | + partInfo.iPrintModePo = masterData[`iPrintModePo${item}`]; | |
| 1265 | + if (material.sMaterialsId !== undefined && material.sMaterialsId !== '') { | |
| 1266 | + const processInfo = []; | |
| 1267 | + checkProcessClassifyData.filter(card => card.sPartsName === item && card.sType !== '3').forEach((card) => { | |
| 1268 | + if (!commonUtils.isEmpty(masterData[card.sId + item])) { | |
| 1269 | + if (commonUtils.isEmpty(partInfo.sPrintProcessId) && card.sType === '1') { | |
| 1270 | + partInfo.sPrintProcessId = masterData[card.sId + item]; | |
| 1271 | + } else { | |
| 1272 | + const process = {}; | |
| 1273 | + process.sProductClassifyId = card.sId; | |
| 1274 | + process.sProcessId = masterData[card.sId + item]; | |
| 1275 | + if (masterData[card.sId + card.sName + item] !== undefined) { | |
| 1276 | + process.sProcessName = masterData[card.sId + card.sName + item]; | |
| 1277 | + process.sType = masterData[card.sId + card.sType + item]; | |
| 1278 | + processInfo.push(process); | |
| 1296 | 1279 | } |
| 1297 | 1280 | } |
| 1298 | - }); | |
| 1299 | - partInfo.processInfo = processInfo; | |
| 1300 | - partsInfo.push(partInfo); | |
| 1301 | - } | |
| 1302 | - }); | |
| 1303 | - const productProcess = []; | |
| 1304 | - checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => { | |
| 1305 | - if (!commonUtils.isEmpty(masterData[card.sId])) { | |
| 1306 | - const process = {}; | |
| 1307 | - process.sProductClassifyId = card.sId; | |
| 1308 | - process.sProcessId = masterData[card.sId]; | |
| 1309 | - process.sProcessName = masterData[card.sId + card.sName]; | |
| 1310 | - if (masterData[card.sId + card.sName] !== undefined) { | |
| 1311 | - cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`; | |
| 1312 | - productProcess.push(process); | |
| 1313 | 1281 | } |
| 1282 | + }); | |
| 1283 | + partInfo.processInfo = processInfo; | |
| 1284 | + partsInfo.push(partInfo); | |
| 1285 | + } | |
| 1286 | + }); | |
| 1287 | + const productProcess = []; | |
| 1288 | + checkProcessClassifyData.filter(card => card.sType === '3').forEach((card) => { | |
| 1289 | + if (!commonUtils.isEmpty(masterData[card.sId])) { | |
| 1290 | + const process = {}; | |
| 1291 | + process.sProductClassifyId = card.sId; | |
| 1292 | + process.sProcessId = masterData[card.sId]; | |
| 1293 | + process.sProcessName = masterData[card.sId + card.sName]; | |
| 1294 | + if (masterData[card.sId + card.sName] !== undefined) { | |
| 1295 | + cpProcessName = cpProcessName === '' ? masterData[card.sId + card.sName] : `${cpProcessName},${masterData[card.sId + card.sName]}`; | |
| 1296 | + productProcess.push(process); | |
| 1314 | 1297 | } |
| 1315 | - }); | |
| 1316 | - paramMap.cpProcessName = cpProcessName; | |
| 1317 | - paramMap.productProcessInfo = productProcess; | |
| 1318 | - paramMap.partsInfo = partsInfo; | |
| 1319 | - let numErr = false; | |
| 1320 | - let numName = ''; | |
| 1321 | - let num = 0; | |
| 1322 | - | |
| 1323 | - // eslint-disable-next-line array-callback-return | |
| 1324 | - paramMap.partsInfo.map((item) => { | |
| 1325 | - if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) { | |
| 1326 | - num = item.dSumPQty; | |
| 1327 | - numName = item.sPartsName; | |
| 1328 | - } | |
| 1329 | - if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) { | |
| 1330 | - numErr = true; | |
| 1331 | - numName = item.sPartsName; | |
| 1332 | - } | |
| 1333 | - }); | |
| 1334 | - if (numErr) { | |
| 1335 | - message.error(`${numName}P数必须是2的倍数!`); | |
| 1336 | - return; | |
| 1337 | 1298 | } |
| 1338 | - if (num === 2) { | |
| 1339 | - message.error(`${numName}P数必须大于4P!`); | |
| 1340 | - return; | |
| 1299 | + }); | |
| 1300 | + paramMap.cpProcessName = cpProcessName; | |
| 1301 | + paramMap.productProcessInfo = productProcess; | |
| 1302 | + paramMap.partsInfo = partsInfo; | |
| 1303 | + let numErr = false; | |
| 1304 | + let numName = ''; | |
| 1305 | + let num = 0; | |
| 1306 | + | |
| 1307 | + // eslint-disable-next-line array-callback-return | |
| 1308 | + paramMap.partsInfo.map((item) => { | |
| 1309 | + if (masterData.sProductClassifyId === '15736273370008507016374163380000' && item.dSumPQty < 4) { | |
| 1310 | + num = item.dSumPQty; | |
| 1311 | + numName = item.sPartsName; | |
| 1312 | + } | |
| 1313 | + if (item.dSumPQty % 2 !== 0 && item.dSumPQty !== undefined) { | |
| 1314 | + numErr = true; | |
| 1315 | + numName = item.sPartsName; | |
| 1341 | 1316 | } |
| 1317 | + }); | |
| 1318 | + if (numErr) { | |
| 1319 | + message.error(`${numName}P数必须是2的倍数!`); | |
| 1320 | + return; | |
| 1321 | + } | |
| 1322 | + if (num === 2) { | |
| 1323 | + message.error(`${numName}P数必须大于4P!`); | |
| 1324 | + return; | |
| 1325 | + } | |
| 1342 | 1326 | |
| 1343 | - if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) || | |
| 1344 | - commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) { | |
| 1345 | - // this.props.onSaveState({ fastOrderModalVisible: false }); | |
| 1346 | - message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */ | |
| 1347 | - return; | |
| 1348 | - } | |
| 1349 | - /* 验证产品规格是否 符合数字*数字格式 */ | |
| 1350 | - const sProductStyle = paramMap.sProductStyle; | |
| 1351 | - if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */ | |
| 1352 | - const arr = sProductStyle.split('*'); | |
| 1353 | - const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/; | |
| 1354 | - if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) { | |
| 1355 | - for (let i = 0; i < arr.length; i += 1) { | |
| 1356 | - if (!numCheck.test(arr[i])) { /* 验证是否数字 */ | |
| 1357 | - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 1358 | - return; | |
| 1359 | - } | |
| 1327 | + if (commonUtils.isEmpty(paramMap.sProductName) || commonUtils.isEmpty(paramMap.sProductStyle) || commonUtils.isEmpty(paramMap.dProductWidth) || | |
| 1328 | + commonUtils.isEmpty(paramMap.dProductLength) || commonUtils.isEmpty(paramMap.dProductQty)) { | |
| 1329 | + // this.props.onSaveState({ fastOrderModalVisible: false }); | |
| 1330 | + message.error(commonFunc.showMessage(app.commonConst, 'ProductError'));/* 产品信息不正确 */ | |
| 1331 | + return; | |
| 1332 | + } | |
| 1333 | + /* 验证产品规格是否 符合数字*数字格式 */ | |
| 1334 | + const sProductStyle = paramMap.sProductStyle; | |
| 1335 | + if (commonUtils.isNotEmptyObject(sProductStyle) && sProductStyle.indexOf('*') > -1) { /* 首先查看产品规格输入是否有*号 */ | |
| 1336 | + const arr = sProductStyle.split('*'); | |
| 1337 | + const numCheck = /^(-?\d+)(\.?)(\d{1,6})?$/; | |
| 1338 | + if (commonUtils.isNotEmptyArr(arr) && arr.length > 0) { | |
| 1339 | + for (let i = 0; i < arr.length; i += 1) { | |
| 1340 | + if (!numCheck.test(arr[i])) { /* 验证是否数字 */ | |
| 1341 | + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 1342 | + return; | |
| 1360 | 1343 | } |
| 1361 | - } else { | |
| 1362 | - message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 1363 | - return; | |
| 1364 | 1344 | } |
| 1365 | - /* 验证*两边是否是数字 */ | |
| 1366 | 1345 | } else { |
| 1367 | 1346 | message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); |
| 1368 | 1347 | return; |
| 1369 | 1348 | } |
| 1370 | - this.props.onSaveState({ | |
| 1371 | - Loading: true, | |
| 1372 | - }); | |
| 1373 | - // onSendSocketMessage('quotationSplitPaste', 'noAction', masterData.sId, userinfo.sId, null, null); | |
| 1349 | + /* 验证*两边是否是数字 */ | |
| 1350 | + } else { | |
| 1351 | + message.error(commonFunc.showMessage(app.commonConst, 'sProductStyleErr')); | |
| 1352 | + return; | |
| 1353 | + } | |
| 1354 | + this.props.onSaveState({ | |
| 1355 | + Loading: true, | |
| 1356 | + }); | |
| 1357 | + // onSendSocketMessage('quotationSplitPaste', 'noAction', masterData.sId, userinfo.sId, null, null); | |
| 1374 | 1358 | |
| 1375 | - const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`; | |
| 1376 | - const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; | |
| 1377 | - if (dataReturn.code === 1) { | |
| 1378 | - const { | |
| 1379 | - productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo, | |
| 1380 | - } = dataReturn.dataset.rows[0]; | |
| 1381 | - const slaveData = []; | |
| 1382 | - const controlData = []; | |
| 1383 | - const materialsData = []; | |
| 1384 | - let processData = []; | |
| 1385 | - const tableDataRow = {}; | |
| 1386 | - for (const item of slaveConfig.gdsconfigformslave) { | |
| 1387 | - tableDataRow[item.sName] = masterData[item.sName]; | |
| 1388 | - } | |
| 1389 | - tableDataRow.sId = commonUtils.createSid(); | |
| 1390 | - tableDataRow.handleType = 'add'; | |
| 1391 | - tableDataRow.iOrder = 1; | |
| 1392 | - tableDataRow.sParentId = masterData.sId; | |
| 1393 | - // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName'); | |
| 1394 | - let productIdDropDown; | |
| 1395 | - const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName'); | |
| 1396 | - if (slaveIndex > -1) { | |
| 1397 | - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow); | |
| 1398 | - productIdDropDown = sqlDropDownData.dropDownData; | |
| 1399 | - } | |
| 1400 | - const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId); | |
| 1401 | - if (iProductIdIndex === -1) { | |
| 1402 | - tableDataRow.sProductId = tableDataRow.sProductName; | |
| 1403 | - tableDataRow.sProductInfo = JSON.stringify({ | |
| 1404 | - sProductId: tableDataRow.sProductName, | |
| 1405 | - sProductName: tableDataRow.sProductName, | |
| 1406 | - sProductStyle: tableDataRow.sProductStyle, | |
| 1407 | - sProductUnit: tableDataRow.sProductUnit, | |
| 1408 | - sProductNo: tableDataRow.sProductNo, | |
| 1409 | - sCustomerProductNo: tableDataRow.sCustomerProductNo, | |
| 1410 | - sProductClassifyId: tableDataRow.sProductClassifyId, | |
| 1411 | - sProductClassifyName: tableDataRow.sProductClassifyName, | |
| 1412 | - }); | |
| 1413 | - } else { | |
| 1414 | - tableDataRow.sProductInfo = ''; | |
| 1415 | - } | |
| 1416 | - slaveData.push(tableDataRow); | |
| 1417 | - const sInfoArr = []; | |
| 1418 | - if (!commonUtils.isEmptyArr(partsOldInfo)) { | |
| 1419 | - partsOldInfo.forEach((item) => { | |
| 1420 | - if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) { | |
| 1421 | - this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` }); | |
| 1422 | - } | |
| 1423 | - }); | |
| 1424 | - } | |
| 1425 | - if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */ | |
| 1426 | - partsNewInfo.forEach((item) => { | |
| 1427 | - const { sPartsName, sInfo } = item; | |
| 1428 | - const sInfoObj = {}; | |
| 1429 | - sInfoObj.sPartsName = sPartsName; | |
| 1430 | - sInfoObj.sInfo = sInfo; | |
| 1431 | - sInfoArr.push(sInfoObj); | |
| 1432 | - }); | |
| 1433 | - } | |
| 1359 | + const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`; | |
| 1360 | + const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; | |
| 1361 | + if (dataReturn.code === 1) { | |
| 1362 | + const { | |
| 1363 | + productClassify, partsNewInfo, productProcessInfo, partsInfo: partsOldInfo, | |
| 1364 | + } = dataReturn.dataset.rows[0]; | |
| 1365 | + const slaveData = []; | |
| 1366 | + const controlData = []; | |
| 1367 | + const materialsData = []; | |
| 1368 | + let processData = []; | |
| 1369 | + const tableDataRow = {}; | |
| 1370 | + for (const item of slaveConfig.gdsconfigformslave) { | |
| 1371 | + tableDataRow[item.sName] = masterData[item.sName]; | |
| 1372 | + } | |
| 1373 | + tableDataRow.sId = commonUtils.createSid(); | |
| 1374 | + tableDataRow.handleType = 'add'; | |
| 1375 | + tableDataRow.iOrder = 1; | |
| 1376 | + tableDataRow.sParentId = masterData.sId; | |
| 1377 | + // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName'); | |
| 1378 | + let productIdDropDown; | |
| 1379 | + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName'); | |
| 1380 | + if (slaveIndex > -1) { | |
| 1381 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow); | |
| 1382 | + productIdDropDown = sqlDropDownData.dropDownData; | |
| 1383 | + } | |
| 1384 | + const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown) ? -1 : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId); | |
| 1385 | + if (iProductIdIndex === -1) { | |
| 1386 | + tableDataRow.sProductId = tableDataRow.sProductName; | |
| 1387 | + tableDataRow.sProductInfo = JSON.stringify({ | |
| 1388 | + sProductId: tableDataRow.sProductName, | |
| 1389 | + sProductName: tableDataRow.sProductName, | |
| 1390 | + sProductStyle: tableDataRow.sProductStyle, | |
| 1391 | + sProductUnit: tableDataRow.sProductUnit, | |
| 1392 | + sProductNo: tableDataRow.sProductNo, | |
| 1393 | + sCustomerProductNo: tableDataRow.sCustomerProductNo, | |
| 1394 | + sProductClassifyId: tableDataRow.sProductClassifyId, | |
| 1395 | + sProductClassifyName: tableDataRow.sProductClassifyName, | |
| 1396 | + }); | |
| 1397 | + } else { | |
| 1398 | + tableDataRow.sProductInfo = ''; | |
| 1399 | + } | |
| 1400 | + slaveData.push(tableDataRow); | |
| 1401 | + const sInfoArr = []; | |
| 1402 | + if (!commonUtils.isEmptyArr(partsOldInfo)) { | |
| 1403 | + partsOldInfo.forEach((item) => { | |
| 1404 | + if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) { | |
| 1405 | + this.props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` }); | |
| 1406 | + } | |
| 1407 | + }); | |
| 1408 | + } | |
| 1409 | + if (this.props.app.userinfo.sType === 'sysadmin') { /* 超级管理员,弹窗显示接口返回的sInfo */ | |
| 1410 | + partsNewInfo.forEach((item) => { | |
| 1411 | + const { sPartsName, sInfo } = item; | |
| 1412 | + const sInfoObj = {}; | |
| 1413 | + sInfoObj.sPartsName = sPartsName; | |
| 1414 | + sInfoObj.sInfo = sInfo; | |
| 1415 | + sInfoArr.push(sInfoObj); | |
| 1416 | + }); | |
| 1417 | + } | |
| 1434 | 1418 | |
| 1435 | - const bProcessAssort = true; | |
| 1436 | - let returnProcessAssort = []; | |
| 1437 | - let processAssignAssort = ''; | |
| 1438 | - let dropDownDataProcessName; | |
| 1419 | + const bProcessAssort = true; | |
| 1420 | + let returnProcessAssort = []; | |
| 1421 | + let processAssignAssort = ''; | |
| 1422 | + let dropDownDataProcessName; | |
| 1423 | + if (bProcessAssort) { | |
| 1424 | + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`; | |
| 1425 | + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data; | |
| 1426 | + if (dataProcessAssort.code === 1) { | |
| 1427 | + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort; | |
| 1428 | + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); | |
| 1429 | + if (iIndex > -1) { | |
| 1430 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]); | |
| 1431 | + dropDownDataProcessName = sqlDropDownData.dropDownData; | |
| 1432 | + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; | |
| 1433 | + } | |
| 1434 | + } | |
| 1435 | + } | |
| 1436 | + const newCopyTo = {}; | |
| 1437 | + newCopyTo.master = masterData; | |
| 1438 | + newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0]; | |
| 1439 | + await partsNewInfo.forEach(async (partInfo, iIndex) => { | |
| 1440 | + const partsDataRow = {}; | |
| 1441 | + for (const child of Object.keys(partInfo)) { | |
| 1442 | + partsDataRow[child] = partInfo[child]; | |
| 1443 | + } | |
| 1444 | + partsDataRow.handleType = 'add'; | |
| 1445 | + partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */ | |
| 1446 | + partsDataRow.sId = commonUtils.createSid(); | |
| 1447 | + partsDataRow.sParentId = masterData.sId; | |
| 1448 | + // partsDataRow.sSlaveId = ' '; | |
| 1449 | + if (partsDataRow.iPrintMode !== 3) { | |
| 1450 | + partsDataRow.iOppositeColor = partsDataRow.iPositiveColor; | |
| 1451 | + } | |
| 1452 | + delete partsDataRow.dMaterialsKQty; | |
| 1453 | + delete partsDataRow.dMaterialsLength; | |
| 1454 | + delete partsDataRow.dMaterialsWidth; | |
| 1455 | + if (productClassify.bSpecialRules) { | |
| 1456 | + partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength; | |
| 1457 | + partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth; | |
| 1458 | + } | |
| 1459 | + controlData.push(partsDataRow); | |
| 1460 | + // 材料信息 | |
| 1461 | + await partInfo.materialsInfo.forEach(async (materialInfo, iOrder) => { | |
| 1462 | + let materialDataRow = {}; | |
| 1463 | + for (const item of materialsConfig.gdsconfigformslave) { | |
| 1464 | + materialDataRow[item.sName] = materialInfo[item.sName]; | |
| 1465 | + } | |
| 1466 | + materialDataRow.handleType = 'add'; | |
| 1467 | + materialDataRow.sType = '0'; | |
| 1468 | + materialDataRow.iPartOrder = iIndex; | |
| 1469 | + materialDataRow.iOrder = iOrder + 1; | |
| 1470 | + materialDataRow.sPartsName = partsDataRow.sPartsName; | |
| 1471 | + materialDataRow.sId = commonUtils.createSid(); | |
| 1472 | + materialDataRow.sParentId = masterData.sId; | |
| 1473 | + materialDataRow.sControlId = partsDataRow.sId; | |
| 1474 | + // materialDataRow.sSlaveId = ' '; | |
| 1475 | + materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial; | |
| 1476 | + const models = 'Materials'; | |
| 1477 | + materialDataRow = await this.props.onMaterialsChange(materialDataRow, sModelsId, masterData, [], 'dAuxiliaryQty', app, token, models); | |
| 1478 | + materialDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, materialDataRow); | |
| 1479 | + materialsData.push(materialDataRow); | |
| 1480 | + }); | |
| 1481 | + // 工序信息 | |
| 1482 | + let processPrintDataRow = {}; | |
| 1483 | + processPrintDataRow.handleType = 'add'; | |
| 1484 | + processPrintDataRow.sProcessId = partInfo.sProcessId; | |
| 1485 | + const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId); | |
| 1486 | + if (iProcessPrintIndex > -1) { | |
| 1487 | + processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段 | |
| 1488 | + } | |
| 1489 | + processPrintDataRow.sType = partInfo.sType; | |
| 1490 | + processPrintDataRow.iPartOrder = iIndex; | |
| 1491 | + processPrintDataRow.iOrder = 1; | |
| 1492 | + processPrintDataRow.sProcessName = partInfo.sProcessName; | |
| 1493 | + processPrintDataRow.sPartsName = partsDataRow.sPartsName; | |
| 1494 | + processPrintDataRow.dProcessInQty = partInfo.dProcessInQty; | |
| 1495 | + processPrintDataRow.dLossQty = partInfo.dLossQty; | |
| 1496 | + processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty; | |
| 1497 | + processPrintDataRow.sId = commonUtils.createSid(); | |
| 1498 | + processPrintDataRow.sParentId = masterData.sId; | |
| 1499 | + processPrintDataRow.sControlId = partsDataRow.sId; | |
| 1500 | + // processPrintDataRow.sSlaveId = ' '; | |
| 1501 | + processData.push(processPrintDataRow); | |
| 1502 | + // 配套工序 | |
| 1439 | 1503 | if (bProcessAssort) { |
| 1440 | - const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`; | |
| 1441 | - const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data; | |
| 1442 | - if (dataProcessAssort.code === 1) { | |
| 1443 | - returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort; | |
| 1444 | - const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); | |
| 1445 | - if (iIndex > -1) { | |
| 1446 | - const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]); | |
| 1447 | - dropDownDataProcessName = sqlDropDownData.dropDownData; | |
| 1448 | - processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; | |
| 1504 | + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1505 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 1506 | + const iProcessIndex = -1; | |
| 1507 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 1508 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 1509 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 1510 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 1511 | + processRow.handleType = 'add'; | |
| 1512 | + processRow.sId = commonUtils.createSid(); | |
| 1513 | + processRow.sParentId = masterData.sId; | |
| 1514 | + processRow.sControlId = partsDataRow.sId; | |
| 1515 | + processRow.sPartsName = partsDataRow.sPartsName; | |
| 1516 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 1517 | + // processRow.sSlaveId = ' '; | |
| 1518 | + processData.push(processRow); | |
| 1449 | 1519 | } |
| 1450 | - } | |
| 1520 | + })); | |
| 1451 | 1521 | } |
| 1452 | - const newCopyTo = {}; | |
| 1453 | - newCopyTo.master = masterData; | |
| 1454 | - newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0]; | |
| 1455 | - await partsNewInfo.forEach(async (partInfo, iIndex) => { | |
| 1456 | - const partsDataRow = {}; | |
| 1457 | - for (const child of Object.keys(partInfo)) { | |
| 1458 | - partsDataRow[child] = partInfo[child]; | |
| 1459 | - } | |
| 1460 | - partsDataRow.handleType = 'add'; | |
| 1461 | - partsDataRow.iOrder = iIndex + 1;/* 快速下单编号从1开始 */ | |
| 1462 | - partsDataRow.sId = commonUtils.createSid(); | |
| 1463 | - partsDataRow.sParentId = masterData.sId; | |
| 1464 | - // partsDataRow.sSlaveId = ' '; | |
| 1465 | - if (partsDataRow.iPrintMode !== 3) { | |
| 1466 | - partsDataRow.iOppositeColor = partsDataRow.iPositiveColor; | |
| 1467 | - } | |
| 1468 | - delete partsDataRow.dMaterialsKQty; | |
| 1469 | - delete partsDataRow.dMaterialsLength; | |
| 1470 | - delete partsDataRow.dMaterialsWidth; | |
| 1471 | - if (productClassify.bSpecialRules) { | |
| 1472 | - partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength; | |
| 1473 | - partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth; | |
| 1474 | - } | |
| 1475 | - controlData.push(partsDataRow); | |
| 1476 | - // 材料信息 | |
| 1477 | - await partInfo.materialsInfo.forEach(async (materialInfo, iOrder) => { | |
| 1478 | - let materialDataRow = {}; | |
| 1479 | - for (const item of materialsConfig.gdsconfigformslave) { | |
| 1480 | - materialDataRow[item.sName] = materialInfo[item.sName]; | |
| 1481 | - } | |
| 1482 | - materialDataRow.handleType = 'add'; | |
| 1483 | - materialDataRow.sType = '0'; | |
| 1484 | - materialDataRow.iPartOrder = iIndex; | |
| 1485 | - materialDataRow.iOrder = iOrder + 1; | |
| 1486 | - materialDataRow.sPartsName = partsDataRow.sPartsName; | |
| 1487 | - materialDataRow.sId = commonUtils.createSid(); | |
| 1488 | - materialDataRow.sParentId = masterData.sId; | |
| 1489 | - materialDataRow.sControlId = partsDataRow.sId; | |
| 1490 | - // materialDataRow.sSlaveId = ' '; | |
| 1491 | - materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial; | |
| 1492 | - const models = 'Materials'; | |
| 1493 | - materialDataRow = await this.props.onMaterialsChange(materialDataRow, sModelsId, masterData, [], 'dAuxiliaryQty', app, token, models); | |
| 1494 | - materialDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, materialDataRow); | |
| 1495 | - materialsData.push(materialDataRow); | |
| 1496 | - }); | |
| 1497 | - // 工序信息 | |
| 1498 | - let processPrintDataRow = {}; | |
| 1499 | - processPrintDataRow.handleType = 'add'; | |
| 1500 | - processPrintDataRow.sProcessId = partInfo.sProcessId; | |
| 1501 | - const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId); | |
| 1502 | - if (iProcessPrintIndex > -1) { | |
| 1503 | - processPrintDataRow = { ...processPrintDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo) }; // 取赋值字段 | |
| 1504 | - } | |
| 1505 | - processPrintDataRow.sType = partInfo.sType; | |
| 1506 | - processPrintDataRow.iPartOrder = iIndex; | |
| 1507 | - processPrintDataRow.iOrder = 1; | |
| 1508 | - processPrintDataRow.sProcessName = partInfo.sProcessName; | |
| 1509 | - processPrintDataRow.sPartsName = partsDataRow.sPartsName; | |
| 1510 | - processPrintDataRow.dProcessInQty = partInfo.dProcessInQty; | |
| 1511 | - processPrintDataRow.dLossQty = partInfo.dLossQty; | |
| 1512 | - processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty; | |
| 1513 | - processPrintDataRow.sId = commonUtils.createSid(); | |
| 1514 | - processPrintDataRow.sParentId = masterData.sId; | |
| 1515 | - processPrintDataRow.sControlId = partsDataRow.sId; | |
| 1516 | - // processPrintDataRow.sSlaveId = ' '; | |
| 1517 | - processData.push(processPrintDataRow); | |
| 1518 | - // 配套工序 | |
| 1519 | - if (bProcessAssort) { | |
| 1520 | - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1521 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 1522 | - const iProcessIndex = -1; | |
| 1523 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 1524 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 1525 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 1526 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 1527 | - processRow.handleType = 'add'; | |
| 1528 | - processRow.sId = commonUtils.createSid(); | |
| 1529 | - processRow.sParentId = masterData.sId; | |
| 1530 | - processRow.sControlId = partsDataRow.sId; | |
| 1531 | - processRow.sPartsName = partsDataRow.sPartsName; | |
| 1532 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 1533 | - // processRow.sSlaveId = ' '; | |
| 1534 | - processData.push(processRow); | |
| 1535 | - } | |
| 1536 | - })); | |
| 1537 | - } | |
| 1538 | 1522 | |
| 1539 | - partInfo.processInfo.forEach((process, iOrder) => { | |
| 1540 | - let processAfterDataRow = {}; | |
| 1541 | - for (const item of processConfig.gdsconfigformslave) { | |
| 1542 | - processAfterDataRow[item.sName] = process[item.sName]; | |
| 1543 | - } | |
| 1544 | - for (const child of Object.keys(process)) { | |
| 1545 | - processAfterDataRow[child] = process[child]; | |
| 1546 | - } | |
| 1547 | - processAfterDataRow.handleType = 'add'; | |
| 1548 | - processAfterDataRow.sProcessId = process.sProcessId; | |
| 1549 | - const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId); | |
| 1550 | - if (iProcessAfterIndex > -1) { | |
| 1551 | - processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段 | |
| 1552 | - } | |
| 1553 | - processAfterDataRow.sType = process.sType; | |
| 1554 | - processAfterDataRow.iPartOrder = iIndex; | |
| 1555 | - processAfterDataRow.iOrder = iOrder + 1; | |
| 1556 | - processAfterDataRow.sPartsName = partsDataRow.sPartsName; | |
| 1557 | - processAfterDataRow.sId = commonUtils.createSid(); | |
| 1558 | - processAfterDataRow.sParentId = masterData.sId; | |
| 1559 | - processAfterDataRow.sControlId = partsDataRow.sId; | |
| 1560 | - // processAfterDataRow.sSlaveId = ' '; | |
| 1561 | - processData.push(processAfterDataRow); | |
| 1562 | - // 配套工序 | |
| 1563 | - if (bProcessAssort) { | |
| 1564 | - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1565 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 1566 | - const iProcessIndex = -1; | |
| 1567 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 1568 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 1569 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 1570 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 1571 | - processRow.handleType = 'add'; | |
| 1572 | - processRow.sId = commonUtils.createSid(); | |
| 1573 | - processRow.sParentId = masterData.sId; | |
| 1574 | - processRow.sControlId = partsDataRow.sId; | |
| 1575 | - processRow.sPartsName = partsDataRow.sPartsName; | |
| 1576 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 1577 | - // processRow.sSlaveId = ' '; | |
| 1578 | - processData.push(processRow); | |
| 1579 | - } | |
| 1580 | - })); | |
| 1581 | - } | |
| 1582 | - }); | |
| 1583 | - }); | |
| 1584 | - productProcessInfo.forEach((process, iOrder) => { | |
| 1585 | - let processProductDataRow = {}; | |
| 1523 | + partInfo.processInfo.forEach((process, iOrder) => { | |
| 1524 | + let processAfterDataRow = {}; | |
| 1586 | 1525 | for (const item of processConfig.gdsconfigformslave) { |
| 1587 | - processProductDataRow[item.sName] = process[item.sName]; | |
| 1526 | + processAfterDataRow[item.sName] = process[item.sName]; | |
| 1588 | 1527 | } |
| 1589 | 1528 | for (const child of Object.keys(process)) { |
| 1590 | - processProductDataRow[child] = process[child]; | |
| 1591 | - } | |
| 1592 | - const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId); | |
| 1593 | - if (iProductProcessIndex > -1) { | |
| 1594 | - processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段 | |
| 1595 | - } | |
| 1596 | - processProductDataRow.handleType = 'add'; | |
| 1597 | - processProductDataRow.sType = '3'; | |
| 1598 | - processProductDataRow.sPartsName = ''; | |
| 1599 | - processProductDataRow.iPartOrder = 999; | |
| 1600 | - processProductDataRow.iOrder = iOrder + 1; | |
| 1601 | - processProductDataRow.sId = commonUtils.createSid(); | |
| 1602 | - processProductDataRow.sParentId = masterData.sId; | |
| 1603 | - // processProductDataRow.sSlaveId = ' '; | |
| 1604 | - processData.push(processProductDataRow); | |
| 1529 | + processAfterDataRow[child] = process[child]; | |
| 1530 | + } | |
| 1531 | + processAfterDataRow.handleType = 'add'; | |
| 1532 | + processAfterDataRow.sProcessId = process.sProcessId; | |
| 1533 | + const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId); | |
| 1534 | + if (iProcessAfterIndex > -1) { | |
| 1535 | + processAfterDataRow = { ...processAfterDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo) }; // 取赋值字段 | |
| 1536 | + } | |
| 1537 | + processAfterDataRow.sType = process.sType; | |
| 1538 | + processAfterDataRow.iPartOrder = iIndex; | |
| 1539 | + processAfterDataRow.iOrder = iOrder + 1; | |
| 1540 | + processAfterDataRow.sPartsName = partsDataRow.sPartsName; | |
| 1541 | + processAfterDataRow.sId = commonUtils.createSid(); | |
| 1542 | + processAfterDataRow.sParentId = masterData.sId; | |
| 1543 | + processAfterDataRow.sControlId = partsDataRow.sId; | |
| 1544 | + // processAfterDataRow.sSlaveId = ' '; | |
| 1545 | + processData.push(processAfterDataRow); | |
| 1605 | 1546 | // 配套工序 |
| 1606 | 1547 | if (bProcessAssort) { |
| 1607 | - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1548 | + returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1608 | 1549 | const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); |
| 1609 | 1550 | const iProcessIndex = -1; |
| 1610 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); | |
| 1551 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId); | |
| 1611 | 1552 | if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { |
| 1612 | 1553 | let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 |
| 1613 | 1554 | processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 |
| 1614 | 1555 | processRow.handleType = 'add'; |
| 1615 | 1556 | processRow.sId = commonUtils.createSid(); |
| 1616 | 1557 | processRow.sParentId = masterData.sId; |
| 1558 | + processRow.sControlId = partsDataRow.sId; | |
| 1559 | + processRow.sPartsName = partsDataRow.sPartsName; | |
| 1617 | 1560 | processRow.sType = dropDownDataProcessName[iIndex].sType; |
| 1618 | 1561 | // processRow.sSlaveId = ' '; |
| 1619 | 1562 | processData.push(processRow); |
| ... | ... | @@ -1621,32 +1564,72 @@ class QuotationPackTableTree extends Component { |
| 1621 | 1564 | })); |
| 1622 | 1565 | } |
| 1623 | 1566 | }); |
| 1624 | - processData = this.sortData(controlData, processData); | |
| 1625 | - const addState = { controlSelectedRowKeys: ['0000000'] }; | |
| 1626 | - if (!commonUtils.isEmptyArr(slaveData)) { | |
| 1627 | - addState.slaveSelectedRowKeys = [slaveData[0].sId]; | |
| 1567 | + }); | |
| 1568 | + productProcessInfo.forEach((process, iOrder) => { | |
| 1569 | + let processProductDataRow = {}; | |
| 1570 | + for (const item of processConfig.gdsconfigformslave) { | |
| 1571 | + processProductDataRow[item.sName] = process[item.sName]; | |
| 1572 | + } | |
| 1573 | + for (const child of Object.keys(process)) { | |
| 1574 | + processProductDataRow[child] = process[child]; | |
| 1575 | + } | |
| 1576 | + const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId); | |
| 1577 | + if (iProductProcessIndex > -1) { | |
| 1578 | + processProductDataRow = { ...processProductDataRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo) }; // 取赋值字段 | |
| 1579 | + } | |
| 1580 | + processProductDataRow.handleType = 'add'; | |
| 1581 | + processProductDataRow.sType = '3'; | |
| 1582 | + processProductDataRow.sPartsName = ''; | |
| 1583 | + processProductDataRow.iPartOrder = 999; | |
| 1584 | + processProductDataRow.iOrder = iOrder + 1; | |
| 1585 | + processProductDataRow.sId = commonUtils.createSid(); | |
| 1586 | + processProductDataRow.sParentId = masterData.sId; | |
| 1587 | + // processProductDataRow.sSlaveId = ' '; | |
| 1588 | + processData.push(processProductDataRow); | |
| 1589 | + // 配套工序 | |
| 1590 | + if (bProcessAssort) { | |
| 1591 | + returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(((itemProcessAssort) => { | |
| 1592 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | |
| 1593 | + const iProcessIndex = -1; | |
| 1594 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); | |
| 1595 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | |
| 1596 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | |
| 1597 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | |
| 1598 | + processRow.handleType = 'add'; | |
| 1599 | + processRow.sId = commonUtils.createSid(); | |
| 1600 | + processRow.sParentId = masterData.sId; | |
| 1601 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | |
| 1602 | + // processRow.sSlaveId = ' '; | |
| 1603 | + processData.push(processRow); | |
| 1604 | + } | |
| 1605 | + })); | |
| 1628 | 1606 | } |
| 1629 | - this.props.onSaveState({ | |
| 1630 | - materialsConfig, | |
| 1631 | - slaveData, | |
| 1632 | - controlData, | |
| 1633 | - materialsData, | |
| 1634 | - processData, | |
| 1635 | - fastOrderModalVisible: false, | |
| 1636 | - quotationAllprogress: 0, | |
| 1637 | - materialsSelectedRowKeys: [], | |
| 1638 | - ...addState, | |
| 1639 | - sInfoArr, | |
| 1640 | - bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr), | |
| 1641 | - Loading: false, | |
| 1642 | - }); | |
| 1643 | - } else { | |
| 1644 | - this.props.getServiceError(dataReturn); | |
| 1645 | - this.props.onSaveState({ | |
| 1646 | - Loading: false, | |
| 1647 | - }); | |
| 1607 | + }); | |
| 1608 | + processData = this.sortData(controlData, processData); | |
| 1609 | + const addState = { controlSelectedRowKeys: ['0000000'] }; | |
| 1610 | + if (!commonUtils.isEmptyArr(slaveData)) { | |
| 1611 | + addState.slaveSelectedRowKeys = [slaveData[0].sId]; | |
| 1648 | 1612 | } |
| 1649 | - }, timValue); | |
| 1613 | + this.props.onSaveState({ | |
| 1614 | + materialsConfig, | |
| 1615 | + slaveData, | |
| 1616 | + controlData, | |
| 1617 | + materialsData, | |
| 1618 | + processData, | |
| 1619 | + fastOrderModalVisible: false, | |
| 1620 | + quotationAllprogress: 0, | |
| 1621 | + materialsSelectedRowKeys: [], | |
| 1622 | + ...addState, | |
| 1623 | + sInfoArr, | |
| 1624 | + bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr), | |
| 1625 | + Loading: false, | |
| 1626 | + }); | |
| 1627 | + } else { | |
| 1628 | + this.props.getServiceError(dataReturn); | |
| 1629 | + this.props.onSaveState({ | |
| 1630 | + Loading: false, | |
| 1631 | + }); | |
| 1632 | + } | |
| 1650 | 1633 | }; |
| 1651 | 1634 | |
| 1652 | 1635 | /* 勾选工序分类 */ | ... | ... |
src/mobile/common/CommobileBillEvent.js
| ... | ... | @@ -740,38 +740,21 @@ export default (ChildComponent) => { |
| 740 | 740 | /** 点击修改按钮操作 */ |
| 741 | 741 | handleEdit = () => { |
| 742 | 742 | const { |
| 743 | - slaveConfig, masterConfig, app, dispatch, currentId, | |
| 743 | + slaveConfig, masterConfig, app, currentId, | |
| 744 | 744 | } = this.props; |
| 745 | 745 | const { userinfo } = app; |
| 746 | 746 | |
| 747 | - let timValue = 0; | |
| 748 | - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { | |
| 749 | - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 750 | - timValue = 3000; | |
| 751 | - } | |
| 752 | - setTimeout(() => { | |
| 753 | - this.props.app.webSocket.onmessage = (msg) => { | |
| 754 | - const rtmsg = JSON.parse(msg.data); | |
| 755 | - if (rtmsg.action === 'showMsg') { | |
| 756 | - Toast.info(rtmsg.msg); | |
| 757 | - this.props.onSaveState({ loading: false }); | |
| 758 | - } else if (rtmsg.action === 'loginOut') { | |
| 759 | - if (location.pathname.indexOf('/indexOee') > -1) { | |
| 760 | - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } }); | |
| 761 | - } else if (location.pathname.indexOf('/indexMobile') > -1) { | |
| 762 | - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); | |
| 763 | - } else { | |
| 764 | - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); | |
| 765 | - } | |
| 766 | - } else if (rtmsg.action === 'update') { | |
| 767 | - this.handleGetData(masterConfig, slaveConfig); | |
| 768 | - this.props.onSaveState({ enabled: true, loading: false }); | |
| 769 | - } else if (this.props.app.webSocket.homeAction) { | |
| 770 | - this.props.app.webSocket.homeAction(msg); | |
| 771 | - } | |
| 772 | - }; | |
| 773 | - this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null); | |
| 774 | - }, timValue); | |
| 747 | + this.props.app.webSocket.onmessageTmp = (msg) => { | |
| 748 | + const rtmsg = JSON.parse(msg.data); | |
| 749 | + if (rtmsg.action === 'showMsg') { | |
| 750 | + Toast.info(rtmsg.msg); | |
| 751 | + this.props.onSaveState({ loading: false }); | |
| 752 | + } else if (rtmsg.action === 'update') { | |
| 753 | + this.handleGetData(masterConfig, slaveConfig); | |
| 754 | + this.props.onSaveState({ enabled: true, loading: false }); | |
| 755 | + } | |
| 756 | + }; | |
| 757 | + this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null); | |
| 775 | 758 | }; |
| 776 | 759 | |
| 777 | 760 | /** 获取主表、从表、审核表数据 */ | ... | ... |
src/mobile/common/CommobileClassifyEvent.js
| ... | ... | @@ -148,34 +148,15 @@ export default (ChildComponent) => { |
| 148 | 148 | } = this.props; |
| 149 | 149 | const { userinfo } = app; |
| 150 | 150 | this.handleGetData(slaveConfig, slaveFilterCondition, slavePagination.current, slaveOrderBy); |
| 151 | - let timValue = 0; | |
| 152 | - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { | |
| 153 | - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 154 | - timValue = 3000; | |
| 155 | - } | |
| 156 | - setTimeout(() => { | |
| 157 | - this.props.app.webSocket.onmessage = (msg) => { | |
| 158 | - const rtmsg = JSON.parse(msg.data); | |
| 159 | - if (rtmsg.action === 'showMsg') { | |
| 160 | - message.warning(rtmsg.msg); | |
| 161 | - this.props.onSaveState({ loading: false }); | |
| 162 | - } else if (rtmsg.action === 'loginOut') { | |
| 163 | - if (location.pathname.indexOf('/indexOee') > -1) { | |
| 164 | - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } }); | |
| 165 | - } else if (location.pathname.indexOf('/indexMobile') > -1) { | |
| 166 | - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); | |
| 167 | - } else { | |
| 168 | - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); | |
| 169 | - } | |
| 170 | - } else { | |
| 171 | - if (this.props.app.webSocket.homeAction) { | |
| 172 | - this.props.app.webSocket.homeAction(msg); | |
| 173 | - } | |
| 174 | - this.props.onSaveState({ enabled: true, loading: false }); | |
| 175 | - } | |
| 176 | - }; | |
| 177 | - this.props.handleSendSocketMessage('update', 'showMsg', sModelsId, userinfo.sId, null, null); // 分类型不能以Id来,涉及到多条修改 | |
| 178 | - }, timValue); | |
| 151 | + this.props.app.webSocket.onmessageTmp = (msg) => { | |
| 152 | + const rtmsg = JSON.parse(msg.data); | |
| 153 | + if (rtmsg.action === 'showMsg') { | |
| 154 | + message.warning(rtmsg.msg); | |
| 155 | + this.props.onSaveState({ loading: false }); | |
| 156 | + } | |
| 157 | + this.props.onSaveState({ enabled: true, loading: false }); | |
| 158 | + }; | |
| 159 | + this.props.handleSendSocketMessage('update', 'showMsg', sModelsId, userinfo.sId, null, null); // 分类型不能以Id来,涉及到多条修改 | |
| 179 | 160 | }; |
| 180 | 161 | /** 点击新增按钮操作 */ |
| 181 | 162 | handleAdd = () => { | ... | ... |
src/mobile/common/CommobileListEvent.js
| ... | ... | @@ -199,65 +199,48 @@ export default (ChildComponent) => { |
| 199 | 199 | return; |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | - let timValue = 0; | |
| 203 | - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { | |
| 204 | - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 205 | - timValue = 3000; | |
| 206 | - } | |
| 207 | - setTimeout(async () => { | |
| 208 | - this.props.app.webSocket.onmessage = (msg) => { | |
| 209 | - const rtmsg = JSON.parse(msg.data); | |
| 210 | - if (rtmsg.action === 'execute') { | |
| 211 | - if (rtmsg.msg === 'continue') { | |
| 212 | - if (commonUtils.isNotEmptyArr(copyToData)) { | |
| 213 | - dispatch({ | |
| 214 | - type: 'content/onRouterMobile', | |
| 215 | - payload: { | |
| 216 | - urlKey: sNameUrl, | |
| 217 | - sModelsId: sActiveId, | |
| 218 | - copyToData, | |
| 219 | - copyTo, | |
| 220 | - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slaveOrderBy), /* 刷新方法 */ | |
| 221 | - }, | |
| 222 | - }); | |
| 223 | - } else { | |
| 224 | - Toast.fail(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择相同 | |
| 225 | - } | |
| 226 | - } else { | |
| 227 | - Toast.fail(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation')); /* 在操作,请稍后再操作! */ | |
| 228 | - } | |
| 229 | - } else if (rtmsg.action === 'loginOut') { | |
| 230 | - if (location.pathname.indexOf('/indexOee') > -1) { | |
| 231 | - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } }); | |
| 232 | - } else if (location.pathname.indexOf('/indexMobile') > -1) { | |
| 233 | - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); | |
| 202 | + this.props.app.webSocket.onmessageTmp = (msg) => { | |
| 203 | + const rtmsg = JSON.parse(msg.data); | |
| 204 | + if (rtmsg.action === 'execute') { | |
| 205 | + if (rtmsg.msg === 'continue') { | |
| 206 | + if (commonUtils.isNotEmptyArr(copyToData)) { | |
| 207 | + dispatch({ | |
| 208 | + type: 'content/onRouterMobile', | |
| 209 | + payload: { | |
| 210 | + urlKey: sNameUrl, | |
| 211 | + sModelsId: sActiveId, | |
| 212 | + copyToData, | |
| 213 | + copyTo, | |
| 214 | + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slaveOrderBy), /* 刷新方法 */ | |
| 215 | + }, | |
| 216 | + }); | |
| 234 | 217 | } else { |
| 235 | - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); | |
| 218 | + Toast.fail(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择相同 | |
| 236 | 219 | } |
| 237 | - } else if (this.props.app.webSocket.homeAction) { | |
| 238 | - this.props.app.webSocket.homeAction(msg); | |
| 239 | - } | |
| 240 | - }; | |
| 241 | - const tbSuffix = ''; | |
| 242 | - const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}`; | |
| 243 | - const values = { sSlaveId: slaveSelectedRowKeys.toString() }; | |
| 244 | - const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data; | |
| 245 | - if (dataReturn.code === 1) { | |
| 246 | - if (dataReturn.dataset.rows.length > 0) { | |
| 247 | - alert('Warn', commonFunc.showMessage(app.commonConst, 'beUsedToNew'), [ | |
| 248 | - { | |
| 249 | - text: 'Ok', | |
| 250 | - onPress: () => { | |
| 251 | - sendSocketMessage('copy', 'execute', slaveSelectedRowKeys.toString(), app.userinfo.sId, null, null); | |
| 252 | - }, | |
| 253 | - }, | |
| 254 | - { text: 'Cancel' }, | |
| 255 | - ]); | |
| 256 | 220 | } else { |
| 257 | - sendSocketMessage('copy', 'execute', slaveSelectedRowKeys.toString(), app.userinfo.sId, null, null); | |
| 221 | + Toast.fail(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation')); /* 在操作,请稍后再操作! */ | |
| 258 | 222 | } |
| 259 | 223 | } |
| 260 | - }, timValue); | |
| 224 | + }; | |
| 225 | + const tbSuffix = ''; | |
| 226 | + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}`; | |
| 227 | + const values = { sSlaveId: slaveSelectedRowKeys.toString() }; | |
| 228 | + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data; | |
| 229 | + if (dataReturn.code === 1) { | |
| 230 | + if (dataReturn.dataset.rows.length > 0) { | |
| 231 | + alert('Warn', commonFunc.showMessage(app.commonConst, 'beUsedToNew'), [ | |
| 232 | + { | |
| 233 | + text: 'Ok', | |
| 234 | + onPress: () => { | |
| 235 | + sendSocketMessage('copy', 'execute', slaveSelectedRowKeys.toString(), app.userinfo.sId, null, null); | |
| 236 | + }, | |
| 237 | + }, | |
| 238 | + { text: 'Cancel' }, | |
| 239 | + ]); | |
| 240 | + } else { | |
| 241 | + sendSocketMessage('copy', 'execute', slaveSelectedRowKeys.toString(), app.userinfo.sId, null, null); | |
| 242 | + } | |
| 243 | + } | |
| 261 | 244 | } else { |
| 262 | 245 | Toast.fail(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 |
| 263 | 246 | } |
| ... | ... | @@ -289,22 +272,14 @@ export default (ChildComponent) => { |
| 289 | 272 | /* 消息列表双击打开时 调用获取websocket消息 */ |
| 290 | 273 | if (sModelsType === 'commonList/msg') { |
| 291 | 274 | const { webSocket, userinfo } = app; |
| 292 | - const timValue = 2000; | |
| 293 | - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { | |
| 294 | - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 295 | - } | |
| 296 | - setTimeout(() => { | |
| 297 | - webSocket.onmessage = async (msg) => { | |
| 298 | - const rtmsg = JSON.parse(msg.data); | |
| 299 | - if (rtmsg.action === 'showImg') { | |
| 300 | - const msgData = JSON.parse(msg.data); | |
| 301 | - dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } }); | |
| 302 | - } else if (this.props.app.webSocket.homeAction) { | |
| 303 | - this.props.app.webSocket.homeAction(msg); | |
| 304 | - } | |
| 305 | - }; | |
| 306 | - this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null); | |
| 307 | - }, timValue); | |
| 275 | + webSocket.onmessageTmp = async (msg) => { | |
| 276 | + const rtmsg = JSON.parse(msg.data); | |
| 277 | + if (rtmsg.action === 'showImg') { | |
| 278 | + const msgData = JSON.parse(msg.data); | |
| 279 | + dispatch({ type: 'app/saveMsgCount', payload: { msgCount: msgData.msg } }); | |
| 280 | + } | |
| 281 | + }; | |
| 282 | + this.props.handleSendSocketMessage('reflush', 'showImg', record.sId, userinfo.sId, '您有消息待审核', null); | |
| 308 | 283 | if (this.props.app.currentPane.refresh !== undefined) { |
| 309 | 284 | this.props.app.currentPane.refresh(); |
| 310 | 285 | } | ... | ... |
src/mobile/common/CommobileSubBillEvent.js
| ... | ... | @@ -917,41 +917,24 @@ export default (ChildComponent) => { |
| 917 | 917 | } = this.props; |
| 918 | 918 | const { userinfo } = app; |
| 919 | 919 | |
| 920 | - let timValue = 0; | |
| 921 | - if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { | |
| 922 | - this.props.dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 923 | - timValue = 3000; | |
| 924 | - } | |
| 925 | - setTimeout(() => { | |
| 926 | - this.props.app.webSocket.onmessage = (msg) => { | |
| 927 | - const rtmsg = JSON.parse(msg.data); | |
| 928 | - if (rtmsg.action === 'showMsg') { | |
| 929 | - Toast.info(rtmsg.msg); | |
| 930 | - this.props.onSaveState({ loading: false }); | |
| 931 | - } else if (rtmsg.action === 'loginOut') { | |
| 932 | - if (location.pathname.indexOf('/indexOee') > -1) { | |
| 933 | - dispatch({ type: 'app/throwErrorOee', payload: { code: -2, msg: rtmsg.msg } }); | |
| 934 | - } else if (location.pathname.indexOf('/indexMobile') > -1) { | |
| 935 | - dispatch({ type: 'app/throwErrorMobile', payload: { code: -2, msg: rtmsg.msg } }); | |
| 936 | - } else { | |
| 937 | - dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); | |
| 938 | - } | |
| 939 | - } else if (rtmsg.action === 'update') { | |
| 940 | - this.handleGetData(masterConfig, slaveConfig); | |
| 941 | - if(commonUtils.isNotEmptyObject(slave0Config) && this.isOutsourcedProcesses) { | |
| 942 | - this.handleGetMemoData(slave0Config); | |
| 943 | - } | |
| 944 | - if(commonUtils.isNotEmptyObject(slaveChildConfig) ) { | |
| 945 | - this.handleGetMemoData(slaveChildConfig); | |
| 946 | - } | |
| 947 | - // | |
| 948 | - this.props.onSaveState({ enabled: true, loading: false }); | |
| 949 | - } else if (this.props.app.webSocket.homeAction) { | |
| 950 | - this.props.app.webSocket.homeAction(msg); | |
| 920 | + this.props.app.webSocket.onmessageTmp = (msg) => { | |
| 921 | + const rtmsg = JSON.parse(msg.data); | |
| 922 | + if (rtmsg.action === 'showMsg') { | |
| 923 | + Toast.info(rtmsg.msg); | |
| 924 | + this.props.onSaveState({ loading: false }); | |
| 925 | + } else if (rtmsg.action === 'update') { | |
| 926 | + this.handleGetData(masterConfig, slaveConfig); | |
| 927 | + if(commonUtils.isNotEmptyObject(slave0Config) && this.isOutsourcedProcesses) { | |
| 928 | + this.handleGetMemoData(slave0Config); | |
| 929 | + } | |
| 930 | + if(commonUtils.isNotEmptyObject(slaveChildConfig) ) { | |
| 931 | + this.handleGetMemoData(slaveChildConfig); | |
| 951 | 932 | } |
| 952 | - }; | |
| 953 | - this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null); | |
| 954 | - }, timValue); | |
| 933 | + // | |
| 934 | + this.props.onSaveState({ enabled: true, loading: false }); | |
| 935 | + } | |
| 936 | + }; | |
| 937 | + this.props.handleSendSocketMessage('update', 'showMsg', currentId, userinfo.sId, null, null); | |
| 955 | 938 | }; |
| 956 | 939 | |
| 957 | 940 | /** 获取主表、从表、审核表数据 */ | ... | ... |
src/models/app.js
| ... | ... | @@ -578,9 +578,9 @@ export default { |
| 578 | 578 | // if (webSocket === null) { |
| 579 | 579 | // return null; |
| 580 | 580 | // } |
| 581 | - url = `${config.ws_host}websocket/${userinfo.sId}?reStart=true`; | |
| 581 | + url = `${config.ws_host}websocket/${userinfo.sId}?reStart=true&createTime=${new Date().getTime()}`; | |
| 582 | 582 | if (userinfo.sUserLoginType) { |
| 583 | - url = `${config.ws_host}websocket/${userinfo.sId}?reStart=true&sLoginType=${userinfo.sUserLoginType}`; | |
| 583 | + url = `${config.ws_host}websocket/${userinfo.sId}?reStart=true&createTime=${new Date().getTime()}&sLoginType=${userinfo.sUserLoginType}`; | |
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | const reset = (ws, config1) => { |
| ... | ... | @@ -589,15 +589,56 @@ export default { |
| 589 | 589 | start(ws, config1); |
| 590 | 590 | }; |
| 591 | 591 | const start = (ws, config1) => { |
| 592 | + if (!ws.originalSend) { | |
| 593 | + ws.originalSend = ws.send.bind(ws); | |
| 594 | + } | |
| 595 | + ws.send = (...args) => { | |
| 596 | + const value = utils.convertStrToObj(args[0], {}); | |
| 597 | + const { | |
| 598 | + key, | |
| 599 | + flag, | |
| 600 | + sendFrom, | |
| 601 | + sId, | |
| 602 | + } = value; | |
| 603 | + if ((key && flag && !['release', 'noAction'].includes(flag) && sendFrom && sId) || flag === 'connectTest') { | |
| 604 | + // 3s内没返回消息,则重新创建ws,重新发送 | |
| 605 | + clearTimeout(window.wsTimer); | |
| 606 | + window.wsTimer = setTimeout(() => { | |
| 607 | + console.log('================超时未收到WebSocket消息,重新创建ws并发送信息======================'); | |
| 608 | + window.wsHistoryArgs = args; | |
| 609 | + ws.onmessageTmp && (window.onmessageTmp = ws.onmessageTmp); | |
| 610 | + dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } }); | |
| 611 | + }, 3000); | |
| 612 | + } | |
| 613 | + ws.originalSend.apply(ws, args); | |
| 614 | + }; | |
| 615 | + | |
| 616 | + if (window.wsHistoryArgs) { | |
| 617 | + ws.send(...window.wsHistoryArgs); | |
| 618 | + window.wsHistoryArgs = undefined; | |
| 619 | + } | |
| 620 | + if (window.onmessageTmp) { | |
| 621 | + ws.onmessageTmp = window.onmessageTmp; | |
| 622 | + window.onmessageTmp = undefined; | |
| 623 | + } | |
| 592 | 624 | config1.timerServer = setTimeout(() => { |
| 593 | 625 | const message = { sendFrom: userinfo.sId, connectTest: "test" }; // param 存放其它参数 keyName 需要放入Redis的数据key,keyValue 需要放入Redis的数据key 的值 |
| 594 | 626 | ws.send(JSON.stringify(message)); |
| 595 | 627 | }, config1.timeoutServer); |
| 596 | 628 | }; |
| 629 | + const oldWebSocket = yield select(state => state.app.webSocket); | |
| 597 | 630 | const ws = new WebSocket(url); |
| 598 | 631 | ws.onopen = function (e) { |
| 599 | 632 | console.log("连接上 webscoket 服务端了", e); |
| 600 | 633 | start(ws, config); |
| 634 | + if (oldWebSocket && oldWebSocket !== ws) { | |
| 635 | + try { | |
| 636 | + oldWebSocket.close(); | |
| 637 | + console.log('================已关闭旧的WebSocket连接======================'); | |
| 638 | + } catch (error) { | |
| 639 | + console.log('================关闭旧WebSocket连接时出错======================', error); | |
| 640 | + } | |
| 641 | + } | |
| 601 | 642 | }; |
| 602 | 643 | // 全局通用的自定义onmessage的方法 |
| 603 | 644 | ws.homeAction = msg => { |
| ... | ... | @@ -663,7 +704,10 @@ export default { |
| 663 | 704 | } |
| 664 | 705 | }; |
| 665 | 706 | ws.onmessage = msg => { |
| 707 | + clearTimeout(window.wsTimer); | |
| 708 | + window.xlyWsTimerFun && window.xlyWsTimerFun(); | |
| 666 | 709 | reset(ws, config); |
| 710 | + ws.onmessageTmp?.(msg); | |
| 667 | 711 | ws.homeAction(msg); |
| 668 | 712 | }; |
| 669 | 713 | ws.onclose = e => { | ... | ... |
src/routes/indexPage.js
| 1 | -import { useEffect, useState } from 'react'; | |
| 1 | +import { useEffect, useRef, useState } from 'react'; | |
| 2 | 2 | import { connect } from 'umi'; |
| 3 | 3 | import { ConfigProvider, Layout } from 'antd-v4'; |
| 4 | 4 | import zhCN from 'antd-v4/lib/locale-provider/zh_CN'; |
| ... | ... | @@ -26,6 +26,35 @@ function IndexPage({ app }) { |
| 26 | 26 | }; |
| 27 | 27 | }, []); |
| 28 | 28 | |
| 29 | + const { webSocket, userinfo } = app; | |
| 30 | + const { sId } = userinfo; | |
| 31 | + const testMsg = JSON.stringify({ flag: "connectTest", sId: "test", sendFrom: sId }); | |
| 32 | + | |
| 33 | + const timer = useRef(null); | |
| 34 | + | |
| 35 | + const { url } = webSocket || {}; | |
| 36 | + const wsRef = useRef(webSocket); | |
| 37 | + const xlyWsTimerFun = () => { | |
| 38 | + clearInterval(timer.current); | |
| 39 | + // 重新启动定时器 | |
| 40 | + timer.current = setInterval(() => { | |
| 41 | + if (wsRef.current && wsRef.current.readyState === WebSocket.OPEN) { | |
| 42 | + wsRef.current.send(testMsg); | |
| 43 | + } | |
| 44 | + }, 20000); | |
| 45 | + } | |
| 46 | + useEffect(() => { | |
| 47 | + if (url) { | |
| 48 | + wsRef.current = webSocket; | |
| 49 | + xlyWsTimerFun(); | |
| 50 | + window.xlyWsTimerFun = xlyWsTimerFun; | |
| 51 | + } | |
| 52 | + return () => { | |
| 53 | + window.xlyWsTimerFun = null; | |
| 54 | + clearInterval(timer.current); | |
| 55 | + }; | |
| 56 | + }, [url]); | |
| 57 | + | |
| 29 | 58 | // 根据用户语言选择对应的语言包 |
| 30 | 59 | const getLocale = () => { |
| 31 | 60 | switch(currentLanguage) { | ... | ... |