@gct-paas/excel 0.1.32 → 0.1.33-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseComponent-CC5rukQG.js → BaseComponent-BQ1yDI7t.js} +1 -1
- package/dist/{VueVideoPlayer-h_ZG9FHq.js → VueVideoPlayer-B_ZVi5G-.js} +2 -2
- package/dist/{align-editor-CnDiBeYX.js → align-editor-B_lvWYQG.js} +1 -1
- package/dist/{barcode-design-DKS1-ByA.js → barcode-design-Cfys0qZp.js} +2 -2
- package/dist/base/index.es.js +98 -98
- package/dist/{diagonal-design-DsSAdTPc.js → diagonal-design-COCeFGwR.js} +2 -2
- package/dist/{dynamic-table-action-C06Eolmw.js → dynamic-table-action-Cu1Le9hH.js} +108 -18
- package/dist/{dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-CeMxIrHD.js → dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-b00q9wdA.js} +1691 -338
- package/dist/{edit.utils-CXmmCnxE-DgR7eBfx.js → edit.utils-CXmmCnxE-BOncn5LV.js} +1 -1
- package/dist/excel.css +147 -45
- package/dist/{exceljs.min-tTYbMh8Q.js → exceljs.min-c52EOEt7.js} +2 -2
- package/dist/{font-editor-Dg4-mIar.js → font-editor-DQPdqXg5.js} +3 -3
- package/dist/{image-design-DipYIW7J.js → image-design-cooz4TPa.js} +2 -2
- package/dist/{index-DWHpkDH4.js → index-9oHgC7oG.js} +3 -3
- package/dist/{index-D7uEmsRJ.js → index-B8_k53zw.js} +2 -2
- package/dist/{index-BSDIqsy-.js → index-B8f6-KiD.js} +1 -1
- package/dist/{index-DyJk8rK7.js → index-BBcfyTk1.js} +2 -2
- package/dist/{index-BX7fyebb.js → index-BLK7v5CG.js} +1 -1
- package/dist/{index-ClPbkivx.js → index-BOR2505F.js} +2 -2
- package/dist/{index-BVyNEH4i.js → index-BYqRgQVr.js} +1 -1
- package/dist/{index-B_-itxOF.js → index-BZn98fN7.js} +2 -2
- package/dist/{index-Cl6vrDfE.js → index-Bb2S-dei.js} +2 -2
- package/dist/{index-DwCjfahr.js → index-BemQL5y4.js} +1 -1
- package/dist/{index-15gZRWSR.js → index-BfGmSyp1.js} +1 -1
- package/dist/{index-Bbm1OZll.js → index-Brh1l6iq.js} +2 -2
- package/dist/{index-D77cqI26.js → index-BuEjse-J.js} +1 -1
- package/dist/{index-DJS-Qycc.js → index-CNCGtCtF.js} +2 -2
- package/dist/{index-CxeNA6if.js → index-CO4nNHM3.js} +3 -3
- package/dist/{index-CRhFD2Ma.js → index-Cmn7U02v.js} +3 -3
- package/dist/{index-MOgjK9eo.js → index-Cvkw3W_d.js} +1946 -2979
- package/dist/{index-7uJnJBMV.js → index-CwWF4fNs.js} +2 -2
- package/dist/{index-Cca1mHnO.js → index-DSuZfLKu.js} +1 -1
- package/dist/{index-DH7pin31.js → index-DaEaDjdh.js} +2 -2
- package/dist/{index-8yIbmmaT.js → index-Dj0L8eKP.js} +2 -2
- package/dist/{index-B2uQ_Gpo.js → index-Dnau-LCe.js} +1 -1
- package/dist/{index-DkBu7mHZ.js → index-Dw_qNOpG.js} +2 -2
- package/dist/{index-BzWrm1H6.js → index-DyDtfr2s.js} +1 -1
- package/dist/{index-D6PLyjGU.js → index-DzbK_ZWg.js} +2 -2
- package/dist/{index-C2LjfZ8T.js → index-GAho8RX_.js} +2 -2
- package/dist/{index-DtBIvDQH.js → index-OI5mKlGl.js} +1 -1
- package/dist/{index-CoqaGOXy.js → index-Oi_LYhHE.js} +2 -2
- package/dist/{index-hdnCCYft.js → index-XnJJgOdm.js} +2 -2
- package/dist/{index-CLijkm1b.js → index-Xtis59gq.js} +3 -3
- package/dist/{index-CnD1HgLA.js → index-ZAtxWzkI.js} +3 -3
- package/dist/{index-BhReeJJg.js → index-cSg5gTIu.js} +2 -2
- package/dist/{index-CSgBgTvS.js → index-n5VrYAZv.js} +2 -2
- package/dist/{index-4oVjbEL5.js → index-ulKkTYuc.js} +2 -2
- package/dist/index.es.js +2 -2
- package/dist/{mb-render-BVp5fqUK.js → mb-render-DriWft67.js} +1 -1
- package/dist/{online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-0eC-BT2j.js → online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-CcJt835R.js} +1 -1
- package/dist/{pagination-design-BugQ6_X1.js → pagination-design-Bl-7ZdF0.js} +2 -2
- package/dist/paper-widget-design-CUHfm9rZ.js +4 -0
- package/dist/{qrcode-design-BvcrdqjC.js → qrcode-design-Bz74HviL.js} +1 -1
- package/dist/{revo-grid.entry-ByZf-Mkh.js → revo-grid.entry-DyC3Ie1V.js} +1 -1
- package/dist/{revogr-attribution_7.entry-Bkbb15P7.js → revogr-attribution_7.entry-BX3LvtVl.js} +3 -3
- package/dist/{revogr-clipboard_3.entry-BAsnJv1y.js → revogr-clipboard_3.entry-CIsl8Vf6.js} +2 -2
- package/dist/{revogr-data_4.entry-Cpmztqm8.js → revogr-data_4.entry-DZN_LFSr.js} +2 -2
- package/dist/{revogr-filter-panel.entry-CUJGzSbz.js → revogr-filter-panel.entry-B6YKEctL.js} +1 -1
- package/dist/{serialnumber-design-CtnZEPSs.js → serialnumber-design-Ad6LwvpG.js} +1 -1
- package/dist/shared/index.es.js +16 -16
- package/dist/{single-field-drop-BKf3R6dR.js → single-field-drop-BUs_erWr.js} +2 -2
- package/dist/{size-editor-DbOpQm-C.js → size-editor-Vti8btyq.js} +1 -1
- package/dist/src/nocode-base/src/hooks/material-consume/bom-validator.d.ts +10 -2
- package/dist/src/nocode-base/src/hooks/material-consume/material-consume-table-controller.d.ts +5 -0
- package/dist/src/nocode-base/src/types/common/base.d.ts +2 -1
- package/dist/src/nocode-web-render/src/render/sub-table/common/sub-table-render.d.ts +1 -1
- package/dist/src/nocode-web-render/src/render/sub-table/stocktake/stocktake-web-render.d.ts +1 -1
- package/dist/{text-design-D9Qm-frB.js → text-design-5_QVg_51.js} +2 -2
- package/dist/{throttle-Cpk1LoGk-CMDdqI7x.js → throttle-Cpk1LoGk-BEdxlFV2.js} +1 -1
- package/dist/{timediff-design-D9liVCTr.js → timediff-design-Bq8bixda.js} +1 -1
- package/dist/{trace-like-wrapper-DQqwOlxy.js → trace-like-wrapper-BADoff39.js} +2 -2
- package/dist/{value-editor.vue_vue_type_style_index_0_lang-B-NZBJiV.js → value-editor.vue_vue_type_style_index_0_lang-Ctur5316.js} +2 -2
- package/dist/web-render/index.es.js +3 -3
- package/dist/{widget-barcode-CRnaA-B2.js → widget-barcode-BZPMW3xm.js} +4 -4
- package/dist/{widget-diagonal-5QDZqvMH.js → widget-diagonal-CEK9zT4F.js} +3 -3
- package/dist/{widget-image-CkLJ-5pC.js → widget-image-BREa1eP3.js} +5 -5
- package/dist/{widget-line-DEsmouIk.js → widget-line-D1gy7UjT.js} +2 -2
- package/dist/{widget-pagination-Ce7zEUJk.js → widget-pagination-C6IuJtde.js} +5 -5
- package/dist/{widget-power-CwQz7Uwf.js → widget-power-CMbgf3lp.js} +3 -3
- package/dist/{widget-qrcode-CHkKCBRy.js → widget-qrcode-DYV1Thgb.js} +3 -3
- package/dist/{widget-rangelimit-Bki9XhUU.js → widget-rangelimit-DIFMYtBx.js} +3 -3
- package/dist/{widget-serialnumber-DI9hVJDB.js → widget-serialnumber-BhTM0Hxl.js} +1 -1
- package/dist/{widget-text-BM9hrxw_.js → widget-text-Drnj12hi.js} +5 -5
- package/dist/{widget-timediff-Ooda0sMm.js → widget-timediff-BKmpj3uq.js} +2 -2
- package/package.json +1 -1
- package/dist/paper-widget-design-C4mfMuuG.js +0 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { computed, watch, toRaw, onUnmounted, markRaw, ref, inject, unref, provide, nextTick, reactive, defineComponent, openBlock, createElementBlock, mergeProps, createElementVNode, normalizeClass, renderSlot, createCommentVNode, createVNode, toDisplayString, toRef, isVNode, h, onMounted, onBeforeMount, resolveComponent, createBlock, withCtx, Fragment, renderList, createTextVNode } from "vue";
|
|
2
|
-
import { C as ComponentTypeEnum,
|
|
2
|
+
import { C as ComponentTypeEnum, aQ as useWidgetStaticAttrs, Z as PlatformEnum, da as assembleRules, db as deleteFormRule, dc as setFormRule, c3 as requestDisplayValidation, dd as isReferenceOptionActive, de as validateAllFields, df as runValidation, dg as ensureFrontRowKey, dh as FRONT_ROW_KEY, cg as getRowId, b2 as getParseRuleInfo, bc as transformUtils, aZ as materialCheck, a_ as getLotLockedReason, a$ as validateReinspectionDate, bi as FormulaRuleFieldKeyEnum, aX as NCB_PROVIDE, F as FIELD_TYPE, di as buildError, z as api, l as SubTableType, b3 as getParseRuleValue, ca as uuid2, aI as DeviceLink, a4 as _export_sfc, cA as buildFormChangeDisplayRows, d6 as resolveRowFormChangeMark, d5 as resolveFormChangeRowUi, cT as isAnnLocationSelected, d7 as setSelectMobileTdId, cU as isFormChangeGhostRow, x as CellType, aS as setSelectAnnotationId, d0 as recordSubtableRowDelete, cC as deleteSubtableRow, d1 as relocateDeletedRowsToEnd, cS as insertSubtableRows, c$ as recordSubtableRowAdd, G as useModal, dj as q, dk as groupFixedTableRows, dl as QUICK_FILL_ALLOWED_FIELDS, dm as processQuickFillRows, dn as getIsGroupEmpty, bg as RenderModeEnum, cN as getSubTableQuickFillInfo } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-b00q9wdA.js";
|
|
3
3
|
import { isNil, cloneDeep, merge, pickBy, mergeWith, omit, last, pick } from "lodash-es";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
import { u as useNamespace } from "./use-namespace-BxkK4ofX.js";
|
|
6
6
|
import { Modal, message } from "ant-design-vue";
|
|
7
|
-
import { u as useFormModel } from "./mb-render-
|
|
7
|
+
import { u as useFormModel } from "./mb-render-DriWft67.js";
|
|
8
8
|
const InstanceStatusValues = {
|
|
9
9
|
/** 作废状态 */
|
|
10
10
|
ABANDON: "ABANDON",
|
|
@@ -365,13 +365,14 @@ class McRowValidateError extends Error {
|
|
|
365
365
|
row;
|
|
366
366
|
}
|
|
367
367
|
class BomEntryValidator {
|
|
368
|
-
constructor(bomEntry, enableSequenceLoading, getMaterialNoNum, historyData, mainMaterialNo, noBomMode) {
|
|
368
|
+
constructor(bomEntry, enableSequenceLoading, getMaterialNoNum, historyData, mainMaterialNo, noBomMode, isCustomRequiredQty = false) {
|
|
369
369
|
this.bomEntry = bomEntry;
|
|
370
370
|
this.enableSequenceLoading = enableSequenceLoading;
|
|
371
371
|
this.getMaterialNoNum = getMaterialNoNum;
|
|
372
372
|
this.historyData = historyData;
|
|
373
373
|
this.mainMaterialNo = mainMaterialNo;
|
|
374
374
|
this.noBomMode = noBomMode;
|
|
375
|
+
this.isCustomRequiredQty = isCustomRequiredQty;
|
|
375
376
|
this.productIds.push(this.bomEntry.product_id_);
|
|
376
377
|
this.productCodes[this.bomEntry.product_id_] = this.bomEntry.product_code_;
|
|
377
378
|
if (this.bomEntry.substitute_material_enabled_ && this.bomEntry.substitute_material_entries_) {
|
|
@@ -388,6 +389,7 @@ class BomEntryValidator {
|
|
|
388
389
|
historyData;
|
|
389
390
|
mainMaterialNo;
|
|
390
391
|
noBomMode;
|
|
392
|
+
isCustomRequiredQty;
|
|
391
393
|
/** 该明细使用到的产品的id集合 */
|
|
392
394
|
productIds = [];
|
|
393
395
|
/** 物料和code的映射 */
|
|
@@ -420,7 +422,7 @@ class BomEntryValidator {
|
|
|
420
422
|
* @return {*}
|
|
421
423
|
*/
|
|
422
424
|
filterGroupData(arr) {
|
|
423
|
-
return arr.filter((i) => this.
|
|
425
|
+
return arr.filter((i) => this.isRowInGroup(i) && i.product_id_);
|
|
424
426
|
}
|
|
425
427
|
/** 行是否属于本 BOM 组(优先 bom_entry_id_,避免跨组 product_id_ 误判) */
|
|
426
428
|
isRowInGroup(row) {
|
|
@@ -603,8 +605,18 @@ class BomEntryValidator {
|
|
|
603
605
|
if (!entry.qty_validation_enabled_ || entry.type_ === "view") {
|
|
604
606
|
return;
|
|
605
607
|
}
|
|
608
|
+
const groupData = this.filterGroupData(arr);
|
|
606
609
|
const loaded = this.calcQtyConsumed(arr);
|
|
607
|
-
|
|
610
|
+
let required = this.remainingNum;
|
|
611
|
+
if (this.isCustomRequiredQty) {
|
|
612
|
+
const currentQty = groupData[0]?.qty_required_;
|
|
613
|
+
if (typeof currentQty !== "number" || !Number.isFinite(currentQty) || currentQty <= 0) {
|
|
614
|
+
throw new Error(
|
|
615
|
+
groupNo != null && groupNo > 0 ? `序号${groupNo},需求数量必须大于 0` : "需求数量必须大于 0"
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
required = currentQty - this.hasConsumed;
|
|
619
|
+
}
|
|
608
620
|
const diff = loaded - required;
|
|
609
621
|
const rule = entry.qty_validation_rule_;
|
|
610
622
|
const fail = (msg) => {
|
|
@@ -626,9 +638,9 @@ class BomEntryValidator {
|
|
|
626
638
|
if (diff > 0) fail($t("sys.qtyValidationRule.lte"));
|
|
627
639
|
break;
|
|
628
640
|
case "bounds": {
|
|
629
|
-
const
|
|
641
|
+
const groupData2 = this.filterGroupData(arr);
|
|
630
642
|
const consumeSum = this.calcQtyForBounds(arr) + this.calcQtyForBounds(this.historyData);
|
|
631
|
-
const { min, max } = await this.calcCustomNumberLimit(
|
|
643
|
+
const { min, max } = await this.calcCustomNumberLimit(groupData2[0]);
|
|
632
644
|
if (min !== void 0 && consumeSum < min || max !== void 0 && consumeSum > max) {
|
|
633
645
|
fail($t("sys.qtyValidationRule.bounds", { min, max }));
|
|
634
646
|
}
|
|
@@ -638,13 +650,14 @@ class BomEntryValidator {
|
|
|
638
650
|
}
|
|
639
651
|
}
|
|
640
652
|
class BomEntriesValidator {
|
|
641
|
-
constructor(entries, enableSequenceLoading, getMaterialNoNum, historyData, mainMaterialNo, noBomMode) {
|
|
653
|
+
constructor(entries, enableSequenceLoading, getMaterialNoNum, historyData, mainMaterialNo, noBomMode, isCustomRequiredQty = false) {
|
|
642
654
|
this.entries = entries;
|
|
643
655
|
this.enableSequenceLoading = enableSequenceLoading;
|
|
644
656
|
this.getMaterialNoNum = getMaterialNoNum;
|
|
645
657
|
this.historyData = historyData;
|
|
646
658
|
this.mainMaterialNo = mainMaterialNo;
|
|
647
659
|
this.noBomMode = noBomMode;
|
|
660
|
+
this.isCustomRequiredQty = isCustomRequiredQty;
|
|
648
661
|
this.bomEntryValidators = entries.map(
|
|
649
662
|
(i) => new BomEntryValidator(
|
|
650
663
|
i,
|
|
@@ -652,7 +665,8 @@ class BomEntriesValidator {
|
|
|
652
665
|
getMaterialNoNum,
|
|
653
666
|
historyData,
|
|
654
667
|
mainMaterialNo,
|
|
655
|
-
noBomMode
|
|
668
|
+
noBomMode,
|
|
669
|
+
isCustomRequiredQty
|
|
656
670
|
)
|
|
657
671
|
);
|
|
658
672
|
}
|
|
@@ -662,6 +676,7 @@ class BomEntriesValidator {
|
|
|
662
676
|
historyData;
|
|
663
677
|
mainMaterialNo;
|
|
664
678
|
noBomMode;
|
|
679
|
+
isCustomRequiredQty;
|
|
665
680
|
bomEntryValidators;
|
|
666
681
|
/**
|
|
667
682
|
* 翻译物料的code
|
|
@@ -719,11 +734,14 @@ class BomEntriesValidator {
|
|
|
719
734
|
* 行 → BOM 明细在 bomEntryValidators 中的下标,找不到返回 -1
|
|
720
735
|
*/
|
|
721
736
|
resolveEntryIndex(row) {
|
|
737
|
+
if (row.bom_entry_id_) {
|
|
738
|
+
return this.bomEntryValidators.findIndex((v) => v.bomEntry.id_ === row.bom_entry_id_);
|
|
739
|
+
}
|
|
722
740
|
if (row.product_id_) {
|
|
723
741
|
const i = this.bomEntryValidators.findIndex((v) => v.productIds.includes(row.product_id_));
|
|
724
742
|
if (i >= 0) return i;
|
|
725
743
|
}
|
|
726
|
-
return
|
|
744
|
+
return -1;
|
|
727
745
|
}
|
|
728
746
|
/**
|
|
729
747
|
* 行所属组在序号列中的 groupOrderIndex(0-based;-1 未绑 BOM 组)
|
|
@@ -1119,6 +1137,7 @@ var ScanParamType = /* @__PURE__ */ ((ScanParamType2) => {
|
|
|
1119
1137
|
var RequiredQtyCalcRule = /* @__PURE__ */ ((RequiredQtyCalcRule2) => {
|
|
1120
1138
|
RequiredQtyCalcRule2["LotQty"] = "lotQty";
|
|
1121
1139
|
RequiredQtyCalcRule2["ProductQty"] = "productQty";
|
|
1140
|
+
RequiredQtyCalcRule2["Custom"] = "custom";
|
|
1122
1141
|
return RequiredQtyCalcRule2;
|
|
1123
1142
|
})(RequiredQtyCalcRule || {});
|
|
1124
1143
|
async function applyScanFillPlan(arr, scanRow, plan, options) {
|
|
@@ -1489,7 +1508,8 @@ class MaterialConsumeTableController {
|
|
|
1489
1508
|
() => this.materialNoNum,
|
|
1490
1509
|
this.tmplBomController.historyData,
|
|
1491
1510
|
this.tmplBomController.materialNo,
|
|
1492
|
-
this.mcPattern === MaterialConsumptionPatternEnum.RECORD && !this.tmplBom.personal_bom_enabled_
|
|
1511
|
+
this.mcPattern === MaterialConsumptionPatternEnum.RECORD && !this.tmplBom.personal_bom_enabled_,
|
|
1512
|
+
this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom
|
|
1493
1513
|
);
|
|
1494
1514
|
}
|
|
1495
1515
|
tmplBomController;
|
|
@@ -1528,6 +1548,9 @@ class MaterialConsumeTableController {
|
|
|
1528
1548
|
/** 批次数量或生产数量 */
|
|
1529
1549
|
get materialNoNum() {
|
|
1530
1550
|
const { required_qty_calc_rule_, product_qty_field_ } = this.tmplBom;
|
|
1551
|
+
if (required_qty_calc_rule_ === RequiredQtyCalcRule.Custom) {
|
|
1552
|
+
return void 0;
|
|
1553
|
+
}
|
|
1531
1554
|
if (required_qty_calc_rule_ === RequiredQtyCalcRule.ProductQty) {
|
|
1532
1555
|
return product_qty_field_ ? this.mainFormState.value[product_qty_field_] : 0;
|
|
1533
1556
|
}
|
|
@@ -1575,6 +1598,35 @@ class MaterialConsumeTableController {
|
|
|
1575
1598
|
const deletedArr = this.tableDataRef.value.filter((i) => i.deleted_);
|
|
1576
1599
|
this.tableDataRef.value = [...value, ...deletedArr];
|
|
1577
1600
|
}
|
|
1601
|
+
get isCustomRequiredQty() {
|
|
1602
|
+
return this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom;
|
|
1603
|
+
}
|
|
1604
|
+
getBomGroupForRow(row) {
|
|
1605
|
+
const validators = this.bomEntriesValidator.bomEntryValidators;
|
|
1606
|
+
if (row.bom_entry_id_) {
|
|
1607
|
+
return validators.find((util) => util.bomEntry.id_ === row.bom_entry_id_);
|
|
1608
|
+
}
|
|
1609
|
+
return row.product_id_ ? this.bomEntriesValidator.findUtilByProductId(row.product_id_) : void 0;
|
|
1610
|
+
}
|
|
1611
|
+
/** 自定义规则的需求数量在同一 BOM 组内保持一致。 */
|
|
1612
|
+
getCustomGroupRequiredQty(row) {
|
|
1613
|
+
const util = this.getBomGroupForRow(row);
|
|
1614
|
+
if (!util) return row.qty_required_;
|
|
1615
|
+
return this.actualTableData.find(
|
|
1616
|
+
(item) => util.isRowInGroup(item) && item.qty_required_ != null
|
|
1617
|
+
)?.qty_required_;
|
|
1618
|
+
}
|
|
1619
|
+
setCustomGroupRequiredQty(row, qty) {
|
|
1620
|
+
if (!this.isCustomRequiredQty) return;
|
|
1621
|
+
const util = this.getBomGroupForRow(row);
|
|
1622
|
+
if (!util) {
|
|
1623
|
+
row.qty_required_ = qty;
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
this.actualTableData.forEach((item) => {
|
|
1627
|
+
if (util.isRowInGroup(item)) item.qty_required_ = qty;
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1578
1630
|
/** 错误信息 */
|
|
1579
1631
|
error(message2) {
|
|
1580
1632
|
MaterialConsumeTableController.render.message({
|
|
@@ -1630,10 +1682,11 @@ class MaterialConsumeTableController {
|
|
|
1630
1682
|
*/
|
|
1631
1683
|
calcFormState() {
|
|
1632
1684
|
if (this.tmplBom.bom_init_enabled_) {
|
|
1685
|
+
const materialNoNum = this.materialNoNum;
|
|
1633
1686
|
return this.actualBomEntries.map((i) => {
|
|
1634
1687
|
return {
|
|
1635
1688
|
product_id_: i.product_id_,
|
|
1636
|
-
qty_required_: i.qty_required_ *
|
|
1689
|
+
...materialNoNum === void 0 ? {} : { qty_required_: i.qty_required_ * materialNoNum },
|
|
1637
1690
|
bom_entry_id_: i.id_
|
|
1638
1691
|
};
|
|
1639
1692
|
});
|
|
@@ -1673,7 +1726,7 @@ class MaterialConsumeTableController {
|
|
|
1673
1726
|
"sort_num_",
|
|
1674
1727
|
"qty_consumed_total_"
|
|
1675
1728
|
];
|
|
1676
|
-
const isRecordPattern = this.mcPattern === MaterialConsumptionPatternEnum.RECORD && !this.tmplBom.personal_bom_enabled_;
|
|
1729
|
+
const isRecordPattern = this.mcPattern === MaterialConsumptionPatternEnum.RECORD && (!this.tmplBom.personal_bom_enabled_ || this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom);
|
|
1677
1730
|
if (!isRecordPattern) {
|
|
1678
1731
|
disabledKeys.push("qty_required_");
|
|
1679
1732
|
}
|
|
@@ -1813,9 +1866,19 @@ class MaterialConsumeTableController {
|
|
|
1813
1866
|
this.setDefaultValue(row);
|
|
1814
1867
|
try {
|
|
1815
1868
|
const plan = await this.bomEntriesValidator.validateScanCanInsert(row, this.actualTableData);
|
|
1816
|
-
|
|
1869
|
+
const existingRequiredQty = this.isCustomRequiredQty && plan ? this.actualTableData.find(
|
|
1870
|
+
(item) => plan.target.isRowInGroup(item) && item.qty_required_ != null
|
|
1871
|
+
)?.qty_required_ : void 0;
|
|
1872
|
+
const nextTable = await applyScanFillPlan(this.actualTableData, row, plan, {
|
|
1817
1873
|
validateCurrentGroupForSwitch: (table, current) => this.bomEntriesValidator.validateCurrentGroupForSwitch(table, current)
|
|
1818
1874
|
});
|
|
1875
|
+
if (this.isCustomRequiredQty && plan) {
|
|
1876
|
+
const requiredQty = existingRequiredQty ?? row.qty_required_;
|
|
1877
|
+
nextTable.forEach((item) => {
|
|
1878
|
+
if (plan.target.isRowInGroup(item)) item.qty_required_ = requiredQty;
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
this.tableDataRef.value = nextTable;
|
|
1819
1882
|
this.updateDerivedQtyFields();
|
|
1820
1883
|
} catch (e) {
|
|
1821
1884
|
console.error(e);
|
|
@@ -1904,6 +1967,7 @@ class MaterialConsumeTableController {
|
|
|
1904
1967
|
* 按当前 materialNoNum 回写各行 qty_required_(校验侧 total 已通过 getter 实时读取)
|
|
1905
1968
|
*/
|
|
1906
1969
|
syncQtyRequiredFromBom() {
|
|
1970
|
+
if (this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom) return;
|
|
1907
1971
|
this.actualTableData.forEach((row) => {
|
|
1908
1972
|
if (!row.product_id_) return;
|
|
1909
1973
|
const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
|
|
@@ -2175,7 +2239,9 @@ class MaterialConsumeTableController {
|
|
|
2175
2239
|
if (row.product_id_) {
|
|
2176
2240
|
const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
|
|
2177
2241
|
if (util) {
|
|
2178
|
-
|
|
2242
|
+
if (this.tmplBom.required_qty_calc_rule_ !== RequiredQtyCalcRule.Custom) {
|
|
2243
|
+
row.qty_required_ = util.total;
|
|
2244
|
+
}
|
|
2179
2245
|
row.qty_consumed_ = util.hasConsumed;
|
|
2180
2246
|
row.bom_entry_id_ = util.bomEntry.id_;
|
|
2181
2247
|
}
|
|
@@ -2188,7 +2254,10 @@ class MaterialConsumeTableController {
|
|
|
2188
2254
|
async handleChange(opts) {
|
|
2189
2255
|
const { field, row, value, option } = opts;
|
|
2190
2256
|
console.log("handleChange", opts);
|
|
2191
|
-
if (field === "
|
|
2257
|
+
if (field === "qty_required_" && this.isCustomRequiredQty) {
|
|
2258
|
+
const qty = value == null || value === "" ? void 0 : Number(value);
|
|
2259
|
+
this.setCustomGroupRequiredQty(row, qty);
|
|
2260
|
+
} else if (field === "product_id_") {
|
|
2192
2261
|
if (row._scanFallback) {
|
|
2193
2262
|
try {
|
|
2194
2263
|
await validateReinspectionDate({
|
|
@@ -2202,6 +2271,8 @@ class MaterialConsumeTableController {
|
|
|
2202
2271
|
}
|
|
2203
2272
|
return;
|
|
2204
2273
|
}
|
|
2274
|
+
const oldGroupId = row.bom_entry_id_;
|
|
2275
|
+
const oldRequiredQty = this.isCustomRequiredQty && oldGroupId ? this.getCustomGroupRequiredQty(row) : void 0;
|
|
2205
2276
|
row.material_no_ = void 0;
|
|
2206
2277
|
row.material_no__id_ = void 0;
|
|
2207
2278
|
row.material_no__lb_ = void 0;
|
|
@@ -2210,6 +2281,10 @@ class MaterialConsumeTableController {
|
|
|
2210
2281
|
row.expiration_date_ = void 0;
|
|
2211
2282
|
this.setDefaultValue(row);
|
|
2212
2283
|
this.updateDerivedQtyFields();
|
|
2284
|
+
if (this.isCustomRequiredQty) {
|
|
2285
|
+
const qty = oldGroupId && row.bom_entry_id_ === oldGroupId ? oldRequiredQty : this.getCustomGroupRequiredQty(row);
|
|
2286
|
+
this.setCustomGroupRequiredQty(row, qty);
|
|
2287
|
+
}
|
|
2213
2288
|
} else if (field === "material_no_") {
|
|
2214
2289
|
if (option?.is_locked_) {
|
|
2215
2290
|
row.material_no_ = void 0;
|
|
@@ -2233,9 +2308,16 @@ class MaterialConsumeTableController {
|
|
|
2233
2308
|
this.error(e.message);
|
|
2234
2309
|
return;
|
|
2235
2310
|
}
|
|
2311
|
+
const oldGroupId = row.bom_entry_id_;
|
|
2312
|
+
const oldRequiredQty = this.isCustomRequiredQty && oldGroupId ? this.getCustomGroupRequiredQty(row) : void 0;
|
|
2236
2313
|
row.product_id_ = option.product_id_;
|
|
2237
2314
|
row.expiration_date_ = option.validate_;
|
|
2315
|
+
if (this.isCustomRequiredQty) row.qty_required_ = void 0;
|
|
2238
2316
|
this.setDefaultValue(row);
|
|
2317
|
+
if (this.isCustomRequiredQty) {
|
|
2318
|
+
const qty = oldGroupId && row.bom_entry_id_ === oldGroupId ? oldRequiredQty : this.getCustomGroupRequiredQty(row);
|
|
2319
|
+
this.setCustomGroupRequiredQty(row, qty);
|
|
2320
|
+
}
|
|
2239
2321
|
} else if (field === "qty_") {
|
|
2240
2322
|
this.updateDerivedQtyFields();
|
|
2241
2323
|
}
|
|
@@ -4673,6 +4755,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
4673
4755
|
Object.assign(rowData, defaultRow, preserved);
|
|
4674
4756
|
tableController.setDefaultValue(rowData);
|
|
4675
4757
|
rowData.bom_entry_id_ = void 0;
|
|
4758
|
+
if (tableController.isCustomRequiredQty) rowData.qty_required_ = void 0;
|
|
4676
4759
|
rowData.qty_consumed_total_ = void 0;
|
|
4677
4760
|
clearMcValidatorComments();
|
|
4678
4761
|
tableController.updateDerivedQtyFields();
|
|
@@ -4694,8 +4777,11 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
4694
4777
|
rowNum = 1,
|
|
4695
4778
|
quickFillDatas
|
|
4696
4779
|
}) => {
|
|
4780
|
+
const bomEntryId = rowData.bom_entry_id_ ?? (rowData.product_id_ ? tableController.bomEntriesValidator.findUtilByProductId(rowData.product_id_)?.bomEntry.id_ : void 0);
|
|
4781
|
+
const requiredQty = tableController.isCustomRequiredQty && bomEntryId ? tableController.getCustomGroupRequiredQty(rowData) : void 0;
|
|
4697
4782
|
insertRowsAt(resolveRealIndex(index) + 1, createDefaultRows(rowNum, quickFillDatas, (r) => {
|
|
4698
|
-
if (
|
|
4783
|
+
if (bomEntryId) r.bom_entry_id_ = bomEntryId;
|
|
4784
|
+
if (tableController.isCustomRequiredQty && bomEntryId) r.qty_required_ = requiredQty;
|
|
4699
4785
|
}));
|
|
4700
4786
|
};
|
|
4701
4787
|
const handleAddGroup = async ({
|
|
@@ -4732,7 +4818,11 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
4732
4818
|
});
|
|
4733
4819
|
}
|
|
4734
4820
|
if (groupLast < 0) groupLast = resolveRealIndex(index);
|
|
4735
|
-
insertRowsAt(groupLast + 1, createDefaultRows(1, quickFillDatas)
|
|
4821
|
+
insertRowsAt(groupLast + 1, createDefaultRows(1, quickFillDatas, (row) => {
|
|
4822
|
+
if (tableController.isCustomRequiredQty && quickFillDatas?.[0]?.qty_required_ == null) {
|
|
4823
|
+
row.qty_required_ = void 0;
|
|
4824
|
+
}
|
|
4825
|
+
}));
|
|
4736
4826
|
};
|
|
4737
4827
|
const handleAction = (action, rowData) => {
|
|
4738
4828
|
switch (action) {
|