Commit 40283de5a67360a7d8b8392bacc32497523fed25

Authored by chenxt
2 parents 63a64392 dde3587f

Merge branch '云南五彩' of http://git.xlyprint.cn/xlyErp/xlyUmi into 云南五彩

src/components/Common/Flows/CommonFlow.js
@@ -36,7 +36,7 @@ const OverviewFlow = (props) => { @@ -36,7 +36,7 @@ const OverviewFlow = (props) => {
36 if (commonutils.isNotEmptyArr(initialEdges)) { 36 if (commonutils.isNotEmptyArr(initialEdges)) {
37 initialEdges.forEach((item) => { 37 initialEdges.forEach((item) => {
38 if (commonutils.isNotEmptyStr(item.markerEnd)) { 38 if (commonutils.isNotEmptyStr(item.markerEnd)) {
39 - const markerObj = { 39 + const markerObj = {
40 type: MarkerType.ArrowClosed, 40 type: MarkerType.ArrowClosed,
41 } 41 }
42 item.markerEnd = markerObj 42 item.markerEnd = markerObj
@@ -123,11 +123,11 @@ const OverviewFlow = (props) => { @@ -123,11 +123,11 @@ const OverviewFlow = (props) => {
123 <Button onClick={onAdd} id='AddSole'>单一部件</Button> 123 <Button onClick={onAdd} id='AddSole'>单一部件</Button>
124 <Button onClick={onAdd} id='AddPortalBundle'>合版部件</Button> 124 <Button onClick={onAdd} id='AddPortalBundle'>合版部件</Button>
125 <Button onClick={onAdd} id='AddClaim'>组装部件</Button> 125 <Button onClick={onAdd} id='AddClaim'>组装部件</Button>
126 - <Button onClick={onMadl}>选择工序</Button>  
127 - <Button onClick={onMadl}>选择材料</Button>  
128 - <Button onClick={onDel}>删除</Button>  
129 - <Button onClick={onSave}>保存</Button>  
130 - <Button id='Generate' onClick={onMadl}>反向生成工单</Button> 126 + {/*<Button onClick={onMadl}>选择工序</Button>*/}
  127 + {/*<Button onClick={onMadl}>选择材料</Button>*/}
  128 + {/*<Button onClick={onDel}>删除</Button>*/}
  129 + {/*<Button onClick={onSave}>保存</Button>*/}
  130 + {/*<Button id='Generate' onClick={onMadl}>反向生成工单</Button>*/}
131 <Button id='Err' onClick={onMadl}>开单逻辑错误</Button> 131 <Button id='Err' onClick={onMadl}>开单逻辑错误</Button>
132 <Modal title="添加部件名称" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}><Input placeholder="Basic usage" onChange={e => handleChangeValue(e)} value={value} /></Modal> 132 <Modal title="添加部件名称" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}><Input placeholder="Basic usage" onChange={e => handleChangeValue(e)} value={value} /></Modal>
133 </div> 133 </div>
src/components/IndexCenter/IndexCenter.js
@@ -204,12 +204,16 @@ class IndexCenter extends Component { @@ -204,12 +204,16 @@ class IndexCenter extends Component {
204 // this.tableTree.scrollTop = 0; 204 // this.tableTree.scrollTop = 0;
205 // } 205 // }
206 const addState = {}; 206 const addState = {};
207 - Object.keys(model).forEach((child, index) => { 207 + Object.keys(model).sort((a, b) => {
  208 + const firstA = model[a][0]?.iJsOrder || 0;
  209 + const firstB = model[b][0]?.iJsOrder || 0;
  210 + return firstA - firstB;
  211 + }).forEach((child, index) => {
208 const name = child.split('_')[0]; 212 const name = child.split('_')[0];
209 // const num = child.split('_')[1]; 213 // const num = child.split('_')[1];
210 let num = 0; 214 let num = 0;
211 // const key = name; 215 // const key = name;
212 - const data = model[child]; 216 + const data = model[child].sort((a, b) => a.iJsOrder - b.iJsOrder);
213 data.forEach((item, index) => { 217 data.forEach((item, index) => {
214 let { dToDayNum } = item; 218 let { dToDayNum } = item;
215 dToDayNum = Number(dToDayNum); 219 dToDayNum = Number(dToDayNum);
src/components/Manufacture/WorkOrderPackTableTreeNew/index.js
@@ -19,6 +19,7 @@ import CommonViewDragable from &quot;@/components/Common/CommonViewDragable&quot;; @@ -19,6 +19,7 @@ import CommonViewDragable from &quot;@/components/Common/CommonViewDragable&quot;;
19 import AntdDraggableModal from "@/components/Common/AntdDraggableModal"; 19 import AntdDraggableModal from "@/components/Common/AntdDraggableModal";
20 import styles from "./index.less"; 20 import styles from "./index.less";
21 import CommonExamInfo from "../../Common/CommonExamInfo"; 21 import CommonExamInfo from "../../Common/CommonExamInfo";
  22 +import { Space } from "antd";
22 23
23 const { Panel } = Collapse; 24 const { Panel } = Collapse;
24 25
@@ -302,7 +303,7 @@ const WorkOrderPackTableTreeNewEvent = props =&gt; { @@ -302,7 +303,7 @@ const WorkOrderPackTableTreeNewEvent = props =&gt; {
302 sVerArray.push(sVerStr); 303 sVerArray.push(sVerStr);
303 } 304 }
304 }); 305 });
305 - console.log('copyTo', copyTo, sVerArray); 306 +
306 const sProductIds = sProductIdArray.toString(); 307 const sProductIds = sProductIdArray.toString();
307 const sProductTechnologyVer =sVerArray.toString(); 308 const sProductTechnologyVer =sVerArray.toString();
308 const sRowData = copyTo?.slaveData || []; 309 const sRowData = copyTo?.slaveData || [];
@@ -4457,6 +4458,146 @@ const OtherComponent = props =&gt; { @@ -4457,6 +4458,146 @@ const OtherComponent = props =&gt; {
4457 }; 4458 };
4458 4459
4459 const [activeKey, setActiveKey] = useState(["process", "material", "color", "vision", ...materialsChildInfoList]); 4460 const [activeKey, setActiveKey] = useState(["process", "material", "color", "vision", ...materialsChildInfoList]);
  4461 +
  4462 + // 删除材料方法
  4463 + const handleDelAllMaterials = (filterData, bPartDel) => {
  4464 + console.log("handleDelAllMaterials", filterData, bPartDel);
  4465 + console.log('sss', props);
  4466 + const { materials0SelectedRowKeys = [], materials0Data = [] } = props;
  4467 +
  4468 + // 如果是撤销操作 (bPartDel === 7)
  4469 + if (bPartDel === 7) {
  4470 + const undo = async () => {
  4471 + try {
  4472 + const { masterData, sModelsId, token, slaveData, controlData = [], controlSelectedRowKeys = [],
  4473 + slaveSelectedRowKeys = [],
  4474 + processData = [],
  4475 + materialsConfig
  4476 + } = props;
  4477 + const controlRow = commonUtils.isNotEmptyArr(controlSelectedRowKeys) ?
  4478 + controlData.find(item => controlSelectedRowKeys.includes(item.sId)) : controlData[0];
  4479 + const sCombineMemoObj = commonUtils.isNotEmptyObject(controlRow?.sCombinedMemo) && commonUtils.isJSON(controlRow.sCombinedMemo) ?
  4480 + JSON.parse(controlRow.sCombinedMemo) : [] ;
  4481 + console.log(sCombineMemoObj, controlRow, 's');
  4482 + let slaveObj = slaveData.find(item =>
  4483 + sCombineMemoObj?.some(obj => obj.sProductNo === item.sProductNo)
  4484 + );
  4485 + if(commonUtils.isNotEmptyObject(slaveObj)){
  4486 + if(commonUtils.isNotEmptyArr(slaveSelectedRowKeys)){
  4487 + slaveObj = slaveData.find(item => slaveSelectedRowKeys.includes(item.sId))
  4488 + } else{
  4489 + slaveObj = slaveData[0];
  4490 + }
  4491 + }
  4492 +
  4493 + const btnRoveObj = materialsConfig?.gdsconfigformslave.find(item => item.sControlName?.includes('BtnRevoke'));
  4494 + const materialsAssignField = btnRoveObj?.materialsAssignField;
  4495 + const dataUrl = `${commonConfig.server_host}salesorder/getMaterialsCardDataByCustomIdProductId/?sModelsId=${sModelsId}`;
  4496 + const sRowData = commonUtils.isNotEmptyObject(slaveObj) ? [slaveObj] : [];
  4497 + const condition = { sRowData };
  4498 + const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data;
  4499 + if (dataReturn.code === 1) {
  4500 + message.success("撤销成功!");
  4501 + const returnData = dataReturn.dataset.rows[0];
  4502 + const materialsReturnData = returnData?.materialsData || [];
  4503 + const newCopyTo = { control: controlRow }
  4504 + if (commonUtils.isNotEmptyArr(materialsReturnData)) {
  4505 + materialsReturnData.filter(item => item.sType !== '2').forEach((materialsItem) => {
  4506 + const newSid = commonUtils.createSid();
  4507 + let materialsRow = commonFunc.getDefaultData(materialsConfig, newCopyTo, { newSid }); // 取默认值
  4508 + if(materialsAssignField) {
  4509 + materialsRow = { ...materialsRow, ...commonFunc.getAssignFieldValue(materialsAssignField, materialsItem, newCopyTo) };
  4510 + }
  4511 + // materialsRow = {...materialsItem};
  4512 + materialsRow.handleType = 'add';
  4513 + materialsRow.sId = newSid;
  4514 + materialsRow.sParentId = masterData.sId;
  4515 + materialsRow.sControlId = controlRow.sId;
  4516 + materialsRow.sPartsName = controlRow.sPartsName;
  4517 + materialsRow.sSlaveId = slaveObj?.sId;
  4518 + materialsRow.sOriginalId = materialsItem.sId;
  4519 + materialsRow.sZmldlt = materialsItem.sZmldlt;
  4520 + materialsRow.sProcessId = materialsItem.sProcessId;
  4521 + materialsRow.sInkFatherMaterialsTbId = materialsItem.sInkFatherMaterialsTbId;
  4522 + // 材料对应工序的ID要变化
  4523 + if (commonUtils.isNotEmptyArr(processData)) {
  4524 + const iProcessIndex = processData.findIndex(prow => prow.sControlId === controlRow.sId
  4525 + && materialsRow.sProcessId === prow.sProcessId
  4526 + );
  4527 + if (iProcessIndex > -1) {
  4528 + materialsRow.sProcessTbId = processData[iProcessIndex].sId;
  4529 + }
  4530 + }
  4531 + materials0Data.push(materialsRow);
  4532 + });
  4533 + }
  4534 +
  4535 + // 这里可以根据返回的数据更新界面
  4536 + console.log("撤销返回数据:", materialsReturnData);
  4537 + console.log("汇总:", materials0Data);
  4538 + props.onSaveState({materials0Data})
  4539 + } else {
  4540 + message.error(dataReturn.msg || "撤销失败!");
  4541 + }
  4542 + } catch (error) {
  4543 + message.error(error + "撤销操作失败!");
  4544 + }
  4545 + };
  4546 +
  4547 + Modal.confirm({
  4548 + title: "确认要撤销操作吗?",
  4549 + onOk() {
  4550 + undo();
  4551 + },
  4552 + okText: '确定',
  4553 + cancelText: '取消'
  4554 + });
  4555 + return;
  4556 + }
  4557 +
  4558 + // 原有的删除逻辑
  4559 + const partFilterData = filterData.filter(item => item.bMark);
  4560 + console.log('ffff', partFilterData);
  4561 + if (bPartDel) {
  4562 + if (!partFilterData.length) {
  4563 + message.info("请先选择要删除的数据!");
  4564 + return;
  4565 + }
  4566 + }
  4567 +
  4568 + const delAll = () => {
  4569 + const sIds = filterData.map(item => item.sId);
  4570 + // 尝试调用删除方法 - 参数需要匹配 CommonBase 的 handleTableDel 方法签名
  4571 + if (props.onDataRowDel && typeof props.onDataRowDel === 'function') {
  4572 + console.log('删除全部材料sId集合', sIds);
  4573 + props.onDataRowDel("materials0", false, sIds, undefined);
  4574 + } else {
  4575 + console.error("onDataRowDel 方法不存在或不是函数");
  4576 + message.error("删除错误");
  4577 + }
  4578 + }
  4579 +
  4580 + const delPart = () => {
  4581 + const sIds = partFilterData.map(item => item.sId);
  4582 + // 尝试调用删除方法 - 参数需要匹配 CommonBase 的 handleTableDel 方法签名
  4583 + if (props.onDataRowDel && typeof props.onDataRowDel === 'function') {
  4584 + props.onDataRowDel("materials0", false, sIds, undefined);
  4585 + } else {
  4586 + console.error("onDataRowDel 方法不存在或不是函数");
  4587 + message.error("删除功能不可用");
  4588 + }
  4589 + }
  4590 +
  4591 + Modal.confirm({
  4592 + title: `确认要删除${bPartDel ? "选中" : "全部"}吗?`,
  4593 + onOk() {
  4594 + bPartDel ? delPart() : delAll();
  4595 + },
  4596 + okText: '确定',
  4597 + cancelText: '取消'
  4598 + });
  4599 + };
  4600 +
4460 const getHeaderIcon = tablename => ( 4601 const getHeaderIcon = tablename => (
4461 <RightOutlined 4602 <RightOutlined
4462 style={{ 4603 style={{
@@ -4478,7 +4619,7 @@ const OtherComponent = props =&gt; { @@ -4478,7 +4619,7 @@ const OtherComponent = props =&gt; {
4478 </Panel> 4619 </Panel>
4479 4620
4480 <Panel collapsible="header" header={getHeaderIcon("material")} showArrow={false} extra={panelExtra("material")} key="material"> 4621 <Panel collapsible="header" header={getHeaderIcon("material")} showArrow={false} extra={panelExtra("material")} key="material">
4481 - <MaterialsComponent {...props} materialsTabValue={materialsTabValue} /> 4622 + <MaterialsComponent {...props} materialsTabValue={materialsTabValue} onDelAllMaterials={handleDelAllMaterials} />
4482 { materialsTabValue === 22 && <ProductMaterialsComponent {...props} /> } 4623 { materialsTabValue === 22 && <ProductMaterialsComponent {...props} /> }
4483 </Panel> 4624 </Panel>
4484 {materialsChildInfoListFilter.map(tablename => { 4625 {materialsChildInfoListFilter.map(tablename => {
@@ -4750,37 +4891,50 @@ const MaterialsComponent = props =&gt; { @@ -4750,37 +4891,50 @@ const MaterialsComponent = props =&gt; {
4750 } 4891 }
4751 4892
4752 // 限制编辑-劲嘉定制 4893 // 限制编辑-劲嘉定制
4753 - if (index === 0 || index === 3) {  
4754 - materialsOtherPropsType.otherlimitDisabled = params => {  
4755 - const { record, sName } = params;  
4756 - let { enabledNew } = params;  
4757 - if (!["101251240115016082594412050"].includes(props.sModelsId)) return enabledNew;  
4758 - if (enabledNew && ["dAuxiThousheetQty"].includes(sName) && record.dPackageQty > 0) {  
4759 - enabledNew = false;  
4760 - }  
4761 - return enabledNew;  
4762 - };  
4763 - } 4894 + // if (index === 0 || index === 3) {
  4895 + // materialsOtherPropsType.otherlimitDisabled = params => {
  4896 + // const { record, sName } = params;
  4897 + // let { enabledNew } = params;
  4898 + // if (!["101251240115016082594412050"].includes(props.sModelsId)) return enabledNew;
  4899 + // if (enabledNew && ["dAuxiThousheetQty"].includes(sName) && record.dPackageQty > 0) {
  4900 + // enabledNew = false;
  4901 + // }
  4902 + // return enabledNew;
  4903 + // };
  4904 + // }
4764 4905
4765 return ( 4906 return (
4766 materialsTabValue === num && ( 4907 materialsTabValue === num && (
4767 <div className="dlhStyle"> 4908 <div className="dlhStyle">
4768 <div style={{ position: "relative", width: sWidth }}> 4909 <div style={{ position: "relative", width: sWidth }}>
4769 <StaticEditTable {...materialsOtherPropsType} /> 4910 <StaticEditTable {...materialsOtherPropsType} />
4770 - {/* {index === 0 && ( 4911 + {true && (
4771 <div className={styles.delAll}> 4912 <div className={styles.delAll}>
4772 - <Button  
4773 - type="primary"  
4774 - disabled={!props.enabled}  
4775 - // onClick={props.onDeleteAllMaterials.bind(  
4776 - // this,  
4777 - // materialsOtherPropsType.data  
4778 - // )}  
4779 - >  
4780 - 删除全部  
4781 - </Button> 4913 + <Space>
  4914 + <Button
  4915 + type="primary"
  4916 + disabled={!props.enabled || commonUtils.isEmptyArr(materialsOtherPropsType.data)}
  4917 + onClick={() => props.onDelAllMaterials?.(materialsOtherPropsType.data, false)}
  4918 + >
  4919 + 删除全部
  4920 + </Button>
  4921 + <Button
  4922 + type="primary"
  4923 + disabled={!props.enabled || commonUtils.isNotEmptyArr(materialsOtherPropsType.data)}
  4924 + onClick={() => props.onDelAllMaterials?.(materialsOtherPropsType.data, 7)}
  4925 + >
  4926 + 撤销
  4927 + </Button>
  4928 + <Button
  4929 + type="primary"
  4930 + disabled={!props.enabled || commonUtils.isEmptyArr(materialsOtherPropsType.data)}
  4931 + onClick={() => props.onDelAllMaterials?.(materialsOtherPropsType.data, true)}
  4932 + >
  4933 + 删除选中
  4934 + </Button>
  4935 + </Space>
4782 </div> 4936 </div>
4783 - )} */} 4937 + )}
4784 </div> 4938 </div>
4785 {materialsChildTableProps ? ( 4939 {materialsChildTableProps ? (
4786 <div style={{ width: sRightWidth, position: "relative" }}> 4940 <div style={{ width: sRightWidth, position: "relative" }}>