@gct-paas/word 0.1.52-beta.9 → 0.1.53

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/index.es.js CHANGED
@@ -355,116 +355,85 @@ function setupGlobDirectives(app) {
355
355
  }
356
356
  const apiConfig$2 = [
357
357
  {
358
- name: "medPro",
359
- entityName: "medPro",
358
+ name: "ai",
359
+ entityName: "ai",
360
360
  apis: [
361
361
  {
362
362
  mode: "post",
363
- method: "postModelMetaDataAssociation",
364
- path: "modelMeta/dataAssociation",
363
+ method: "postFormConvertBatchAddFormTmpl",
364
+ path: "form-convert/batch-add-form-tmpl",
365
365
  hasData: true
366
366
  },
367
- {
368
- mode: "get",
369
- method: "getModelMetaGetSysConfig",
370
- path: "modelMeta/getSysConfig",
371
- hasQuery: true
372
- },
373
- {
374
- mode: "get",
375
- method: "getModelMetaHasDataAssociation",
376
- path: "modelMeta/hasDataAssociation",
377
- hasQuery: true
378
- },
379
- {
380
- mode: "get",
381
- method: "getModelMetaModelDataAssociation",
382
- path: "modelMeta/modelDataAssociation",
383
- hasQuery: true
384
- },
385
367
  {
386
368
  mode: "post",
387
- method: "postApproveProcessApprove",
388
- path: "approve/process/approve",
369
+ method: "postFormConvertBatchFailReasons",
370
+ path: "form-convert/batch/fail-reasons",
389
371
  hasData: true
390
372
  },
391
373
  {
392
374
  mode: "post",
393
- method: "postApproveProcessInterfereReassign",
394
- path: "approve/process/interfere/reassign",
375
+ method: "postFormConvertBatchList",
376
+ path: "form-convert/batch/list",
395
377
  hasData: true
396
378
  },
397
379
  {
398
380
  mode: "post",
399
- method: "postApproveProcessInterfereReturn",
400
- path: "approve/process/interfere/return",
381
+ method: "postFormConvertBatchUpload",
382
+ path: "form-convert/batch/upload",
401
383
  hasData: true
402
384
  },
403
385
  {
404
- mode: "post",
405
- method: "postApproveProcessJump",
406
- path: "approve/process/jump",
407
- hasData: true
386
+ mode: "get",
387
+ method: "getFormConvertBatchId",
388
+ path: "form-convert/batch/{id}",
389
+ hasPathParams: true
408
390
  },
409
391
  {
410
- mode: "post",
411
- method: "postApproveProcessReassign",
412
- path: "approve/process/reassign",
413
- hasData: true
392
+ mode: "delete",
393
+ method: "deleteFormConvertBatchId",
394
+ path: "form-convert/batch/{id}",
395
+ hasPathParams: true
414
396
  },
415
397
  {
416
398
  mode: "post",
417
- method: "postApproveProcessReturn",
418
- path: "approve/process/return",
399
+ method: "postFormConvertFailReasons",
400
+ path: "form-convert/fail-reasons",
419
401
  hasData: true
420
402
  },
421
- {
422
- mode: "get",
423
- method: "getEdhrAttachmentGetEdhrAttachment",
424
- path: "edhrAttachment/getEdhrAttachment",
425
- hasQuery: true
426
- },
427
- {
428
- mode: "post",
429
- method: "postFileUnzip",
430
- path: "file/unzip",
431
- hasQuery: true
432
- },
433
403
  {
434
404
  mode: "post",
435
- method: "postFormChangeProcessApprove",
436
- path: "form/change/process/approve",
405
+ method: "postFormConvertList",
406
+ path: "form-convert/list",
437
407
  hasData: true
438
408
  },
439
409
  {
440
410
  mode: "post",
441
- method: "postFormChangeProcessInterfereReassign",
442
- path: "form/change/process/interfere/reassign",
443
- hasData: true
411
+ method: "postFormConvertRefresh",
412
+ path: "form-convert/refresh"
444
413
  },
445
414
  {
446
415
  mode: "post",
447
- method: "postFormChangeProcessInterfereReturn",
448
- path: "form/change/process/interfere/return",
416
+ method: "postFormConvertSave",
417
+ path: "form-convert/save",
449
418
  hasData: true
450
419
  },
451
420
  {
452
- mode: "post",
453
- method: "postFormChangeProcessJump",
454
- path: "form/change/process/jump",
421
+ mode: "put",
422
+ method: "putFormConvertUpdate",
423
+ path: "form-convert/update",
455
424
  hasData: true
456
425
  },
457
426
  {
458
- mode: "post",
459
- method: "postFormChangeProcessReassign",
460
- path: "form/change/process/reassign",
461
- hasData: true
427
+ mode: "get",
428
+ method: "getFormConvertId",
429
+ path: "form-convert/{id}",
430
+ hasPathParams: true
462
431
  },
463
432
  {
464
- mode: "post",
465
- method: "postFormChangeProcessReturn",
466
- path: "form/change/process/return",
467
- hasData: true
433
+ mode: "delete",
434
+ method: "deleteFormConvertId",
435
+ path: "form-convert/{id}",
436
+ hasPathParams: true
468
437
  }
469
438
  ]
470
439
  },
@@ -563,6 +532,12 @@ const apiConfig$2 = [
563
532
  path: "batch",
564
533
  hasData: true
565
534
  },
535
+ {
536
+ mode: "get",
537
+ method: "getCheckUserNeedTransfer",
538
+ path: "checkUserNeedTransfer",
539
+ hasQuery: true
540
+ },
566
541
  {
567
542
  mode: "get",
568
543
  method: "getGrantedStatistic",
@@ -4801,36 +4776,6 @@ const apiConfig$2 = [
4801
4776
  path: "appendix/form/list",
4802
4777
  hasQuery: true
4803
4778
  },
4804
- {
4805
- mode: "post",
4806
- method: "postDataCollectionAbandon",
4807
- path: "data-collection/abandon",
4808
- hasData: true
4809
- },
4810
- {
4811
- mode: "post",
4812
- method: "postDataCollectionCreate",
4813
- path: "data-collection/create",
4814
- hasData: true
4815
- },
4816
- {
4817
- mode: "get",
4818
- method: "getDataCollectionListAll",
4819
- path: "data-collection/listAll",
4820
- hasQuery: true
4821
- },
4822
- {
4823
- mode: "post",
4824
- method: "postDataCollectionUpdateAlias",
4825
- path: "data-collection/update-alias",
4826
- hasData: true
4827
- },
4828
- {
4829
- mode: "post",
4830
- method: "postDataCollectionUpdateStatus",
4831
- path: "data-collection/update-status",
4832
- hasData: true
4833
- },
4834
4779
  {
4835
4780
  mode: "get",
4836
4781
  method: "getDataIds",
@@ -7689,34 +7634,6 @@ const apiConfig$2 = [
7689
7634
  }
7690
7635
  ]
7691
7636
  },
7692
- {
7693
- name: "ss",
7694
- entityName: "ss",
7695
- apis: [
7696
- {
7697
- mode: "post",
7698
- method: "postUploadExcel",
7699
- path: "upload/excel",
7700
- hasUpload: true,
7701
- hasQuery: true,
7702
- hasData: true
7703
- },
7704
- {
7705
- mode: "post",
7706
- method: "postUploadImportSerialWorkflow",
7707
- path: "upload/importSerialWorkflow",
7708
- hasUpload: true,
7709
- hasData: true
7710
- },
7711
- {
7712
- mode: "post",
7713
- method: "postUploadZip",
7714
- path: "upload/zip",
7715
- hasUpload: true,
7716
- hasData: true
7717
- }
7718
- ]
7719
- },
7720
7637
  {
7721
7638
  name: "stash",
7722
7639
  entityName: "stash",
@@ -8397,6 +8314,18 @@ const apiConfig$2 = [
8397
8314
  name: "api",
8398
8315
  entityName: "api",
8399
8316
  apis: [
8317
+ {
8318
+ mode: "post",
8319
+ method: "postAiFormConvertCallbackRestore",
8320
+ path: "ai/form-convert/callback/restore",
8321
+ hasData: true
8322
+ },
8323
+ {
8324
+ mode: "post",
8325
+ method: "postAiFormConvertCallbackStatus",
8326
+ path: "ai/form-convert/callback/status",
8327
+ hasData: true
8328
+ },
8400
8329
  {
8401
8330
  mode: "post",
8402
8331
  method: "postAppCreateBranch",
@@ -25994,7 +25923,7 @@ const _sfc_main$3i = /* @__PURE__ */ defineComponent({
25994
25923
  };
25995
25924
  }
25996
25925
  });
25997
- const GctSelect = /* @__PURE__ */ _export_sfc(_sfc_main$3i, [["__scopeId", "data-v-6ecd8ef9"]]);
25926
+ const GctSelect = /* @__PURE__ */ _export_sfc(_sfc_main$3i, [["__scopeId", "data-v-4756c59a"]]);
25998
25927
  const _hoisted_1$24 = ["value", "placeholder", "disabled"];
25999
25928
  const _hoisted_2$1h = {
26000
25929
  key: 1,
@@ -33231,7 +33160,7 @@ function toFormatValue(fieldType, value) {
33231
33160
  if ([FIELD_TYPE.INTEGER, FIELD_TYPE.LONG].includes(fieldType)) {
33232
33161
  const _val_ = parseInt(value);
33233
33162
  return isNaN(_val_) ? null : _val_;
33234
- } else if (fieldType === FIELD_TYPE.DECIMAL) {
33163
+ } else if ([FIELD_TYPE.DOUBLE, FIELD_TYPE.DECIMAL].includes(fieldType)) {
33235
33164
  const _val_ = parseFloat(value);
33236
33165
  return isNaN(_val_) ? null : _val_;
33237
33166
  } else if (fieldType === FIELD_TYPE.BOOLEAN) {
@@ -34590,6 +34519,20 @@ function resolveStocktakeQty(value, options = {}) {
34590
34519
  }
34591
34520
  return Math.max(MIN_STOCKTAKE_NUM, num);
34592
34521
  }
34522
+ function getScanQtyDeductionBlockReason(current, scanQty, type4 = "add") {
34523
+ if (type4 !== "minus" || isBlank(scanQty)) {
34524
+ return void 0;
34525
+ }
34526
+ const qtyNum = Number(scanQty);
34527
+ if (Number.isNaN(qtyNum) || qtyNum <= 0) {
34528
+ return void 0;
34529
+ }
34530
+ const base = isBlank(current) ? 0 : toNumber(current);
34531
+ if (base - qtyNum >= MIN_STOCKTAKE_NUM) {
34532
+ return void 0;
34533
+ }
34534
+ return "当前实盘数量小于本次条码扫码数量,无法扣减";
34535
+ }
34593
34536
  function applyScanQtyToStocktake(current, scanQty, type4 = "add") {
34594
34537
  if (isBlank(scanQty)) {
34595
34538
  return current;
@@ -34600,7 +34543,7 @@ function applyScanQtyToStocktake(current, scanQty, type4 = "add") {
34600
34543
  }
34601
34544
  const base = isBlank(current) ? 0 : toNumber(current);
34602
34545
  const next = base + (type4 === "minus" ? -qtyNum : qtyNum);
34603
- return Math.max(MIN_STOCKTAKE_NUM, next);
34546
+ return next;
34604
34547
  }
34605
34548
  function accumulateScanQtyOnRow(visibleRows, rowIndex, scanQty, type4 = "add") {
34606
34549
  const nextRows = [...visibleRows];
@@ -35218,7 +35161,14 @@ function getParseRuleValue(labelStr, labelRule) {
35218
35161
  if (val !== null) {
35219
35162
  switch (field.type) {
35220
35163
  case Config_Fields.qty:
35221
- val = Number(val);
35164
+ if (isBlank(val)) {
35165
+ val = null;
35166
+ } else {
35167
+ val = Number(val);
35168
+ if (Number.isNaN(val)) {
35169
+ val = null;
35170
+ }
35171
+ }
35222
35172
  break;
35223
35173
  case Config_Fields.expiration:
35224
35174
  val = dayjs(val, field.format).format("YYYY-MM-DD HH:mm:ss");
@@ -82861,10 +82811,19 @@ const fieldNameMap = {
82861
82811
  product_check_qty: "产品检验数量",
82862
82812
  material_check_qty: "材料检验数量",
82863
82813
  external_reference_no: "外部参考号",
82814
+ order_no: "订单号",
82815
+ related_lot_no: "关联批次",
82864
82816
  warehouse_receipt_no: "单据编号",
82865
82817
  warehouse_receipt_date: "单据日期",
82866
82818
  warehouse_manager: "仓管员",
82867
82819
  warehouse: "仓库",
82820
+ location: "库位",
82821
+ production_identifier: "物料批次(生产标识)",
82822
+ object_type: "对象",
82823
+ material_consume: "物料消耗",
82824
+ qty: "数量",
82825
+ qty_consumed: "已消耗数量",
82826
+ qty_required: "需求数量",
82868
82827
  device_ref: "设备关联",
82869
82828
  device_ref_multi: "设备多选",
82870
82829
  number: "数值",
@@ -82992,12 +82951,23 @@ const getField2Operators = (fieldType) => {
82992
82951
  case FIELD_TYPE.RELATED_LOT_NO:
82993
82952
  case FIELD_TYPE.SCRAP_MATERIAL_NO:
82994
82953
  case FIELD_TYPE.EXTERNAL_REF_NO:
82954
+ case FIELD_TYPE.ORDER_NO:
82955
+ case FIELD_TYPE.WAREHOUSE_RECEIPT_NO:
82995
82956
  options = StringOperators.slice();
82996
82957
  break;
82997
82958
  case FIELD_TYPE.INTEGER:
82998
82959
  case FIELD_TYPE.LONG:
82999
82960
  case FIELD_TYPE.DOUBLE:
83000
82961
  case FIELD_TYPE.DECIMAL:
82962
+ case FIELD_TYPE.QTY:
82963
+ case FIELD_TYPE.QTY_CONSUMED:
82964
+ case FIELD_TYPE.QTY_REQUIRED:
82965
+ case FIELD_TYPE.GOOD_QTY:
82966
+ case FIELD_TYPE.NOT_GOOD_QTY:
82967
+ case FIELD_TYPE.SCRAP_QTY:
82968
+ case FIELD_TYPE.DESTRUCTIVE_TEST_QTY:
82969
+ case FIELD_TYPE.PRODUCT_CHECK_QTY:
82970
+ case FIELD_TYPE.MATERIAL_CHECK_QTY:
83001
82971
  options = NumberOperators.slice();
83002
82972
  break;
83003
82973
  case FIELD_TYPE.BOOLEAN:
@@ -83006,6 +82976,9 @@ const getField2Operators = (fieldType) => {
83006
82976
  case FIELD_TYPE.DATE:
83007
82977
  case FIELD_TYPE.TIME:
83008
82978
  case FIELD_TYPE.DATE_TIME:
82979
+ case FIELD_TYPE.TRACE_DATE:
82980
+ case FIELD_TYPE.WAREHOUSE_RECEIPT_DATE:
82981
+ case FIELD_TYPE.PRODUCTION_DATE:
83009
82982
  options = TimeOperators.slice();
83010
82983
  break;
83011
82984
  case FIELD_TYPE.OPTION:
@@ -83015,6 +82988,7 @@ const getField2Operators = (fieldType) => {
83015
82988
  case FIELD_TYPE.REF:
83016
82989
  case FIELD_TYPE.RDO_REF:
83017
82990
  case FIELD_TYPE.WAREHOUSE:
82991
+ case FIELD_TYPE.LOCATION:
83018
82992
  options = OptionOperators.slice();
83019
82993
  break;
83020
82994
  case FIELD_TYPE.OPTION_MULTI:
@@ -83145,6 +83119,8 @@ async function loadDefaultValuesByFields(instances, ctx, context, masterSlaveLis
83145
83119
  const promises = instances.map(async (instance2) => {
83146
83120
  const { field, props } = instance2.widgetMeta;
83147
83121
  if (!field || !props) return;
83122
+ const isSpecialMaterialConsumeObjField = !!field.belongingObject && [FIELD_TYPE.PRODUCT, FIELD_TYPE.MATERIAL_NO].includes(field.fieldType);
83123
+ if (isSpecialMaterialConsumeObjField) return;
83148
83124
  mergeDefaultsIntoMap(
83149
83125
  defaultDataMap,
83150
83126
  await resolveFieldDefaults({ props, field, ctx, context, instances })
@@ -83167,7 +83143,7 @@ async function loadDefaultValuesByFields(instances, ctx, context, masterSlaveLis
83167
83143
  return defaultDataMap;
83168
83144
  }
83169
83145
  const handleParameterMapping = async (parameterMapping, paramsConfig, fieldPermission, instances, ctx) => {
83170
- if (!parameterMapping.length || !paramsConfig) {
83146
+ if (isEmpty(parameterMapping) || isEmpty(paramsConfig)) {
83171
83147
  return {};
83172
83148
  }
83173
83149
  const referenceMap = new Map(Object.entries(paramsConfig));
@@ -83934,9 +83910,13 @@ function buildRowFromResolve(resolved, scanQty, assignScanQty = false, scanAdjus
83934
83910
  [F$2.rowSource]: "scan"
83935
83911
  };
83936
83912
  if (assignScanQty && scanQty != null && scanQty !== "") {
83913
+ const blockReason = getScanQtyDeductionBlockReason(void 0, scanQty, scanAdjustType);
83914
+ if (blockReason) {
83915
+ return { rowData, deductionBlockedReason: blockReason };
83916
+ }
83937
83917
  rowData[F$2.stocktake] = applyScanQtyToStocktake(void 0, scanQty, scanAdjustType);
83938
83918
  }
83939
- return rowData;
83919
+ return { rowData };
83940
83920
  }
83941
83921
  function appendUnresolvedScanRecords(options) {
83942
83922
  const {
@@ -83951,12 +83931,12 @@ function appendUnresolvedScanRecords(options) {
83951
83931
  assignScanQty,
83952
83932
  scanQtyState
83953
83933
  } = options;
83954
- if (!unprocessed.length) return { rows: visibleRows };
83934
+ if (!unprocessed.length) return { rows: visibleRows, deductionBlockedReasons: [] };
83955
83935
  const { records: recordsForNewRow, productGroupCount } = pickRecordsForNewScanRow(
83956
83936
  unprocessed,
83957
83937
  groupByWarehouse
83958
83938
  );
83959
- if (!recordsForNewRow.length) return { rows: visibleRows };
83939
+ if (!recordsForNewRow.length) return { rows: visibleRows, deductionBlockedReasons: [] };
83960
83940
  if (productGroupCount > 1) {
83961
83941
  scanLog().info("待新建含多产品组,仅取第一组建一行", {
83962
83942
  productGroupCount,
@@ -83970,7 +83950,7 @@ function appendUnresolvedScanRecords(options) {
83970
83950
  row: { [F$2.rowSource]: "scan" },
83971
83951
  config: remoteSync
83972
83952
  });
83973
- if (!resolved) return { rows: visibleRows };
83953
+ if (!resolved) return { rows: visibleRows, deductionBlockedReasons: [] };
83974
83954
  const newRowIndex = visibleRows.length;
83975
83955
  const shouldWriteQty = shouldAssignScanQty({
83976
83956
  strategy: SCAN_QTY_ASSIGN_STRATEGY,
@@ -83980,20 +83960,27 @@ function appendUnresolvedScanRecords(options) {
83980
83960
  qtyAssignedOnScan: scanQtyState.qtyAssignedOnScan,
83981
83961
  qtyAssignedRowIndexes: scanQtyState.qtyAssignedRowIndexes
83982
83962
  });
83983
- const rowData = buildRowFromResolve(resolved, scanQty, shouldWriteQty, scanAdjustType);
83984
- if (shouldWriteQty) {
83963
+ const { rowData, deductionBlockedReason } = buildRowFromResolve(
83964
+ resolved,
83965
+ scanQty,
83966
+ shouldWriteQty,
83967
+ scanAdjustType
83968
+ );
83969
+ const deductionBlockedReasons = deductionBlockedReason ? [deductionBlockedReason] : [];
83970
+ if (shouldWriteQty && !deductionBlockedReason) {
83985
83971
  markScanQtyAssigned(scanQtyState, newRowIndex);
83986
83972
  }
83987
83973
  const appended = appendScanRowFromResolve(visibleRows, rowData);
83988
83974
  return {
83989
83975
  rows: appended.rows,
83990
83976
  mergedIndex: appended.mergedIndex,
83977
+ deductionBlockedReasons,
83991
83978
  appendMeta: {
83992
83979
  unprocessedCount: unprocessed.length,
83993
83980
  productGroupCount,
83994
83981
  usedForNewRow: recordsForNewRow.length,
83995
83982
  multiLocationPending: !groupByWarehouse && recordsForNewRow.length > 1,
83996
- qtyWritten: shouldWriteQty
83983
+ qtyWritten: shouldWriteQty && !deductionBlockedReason
83997
83984
  }
83998
83985
  };
83999
83986
  }
@@ -84012,9 +83999,11 @@ function processScanRecordGroup(options) {
84012
83999
  let visibleRows = options.visibleRows;
84013
84000
  const mergedIndexes = [];
84014
84001
  const unprocessed = [];
84002
+ const deductionBlockedReasons = [];
84015
84003
  let skippedForLocation = 0;
84016
84004
  let accumulated = 0;
84017
84005
  let qtyWritten = 0;
84006
+ let deductionBlocked = 0;
84018
84007
  for (const record of groupRecords) {
84019
84008
  const disposition = dispositionScanRecord(record, visibleRows, groupByWarehouse);
84020
84009
  if (disposition.kind === "accumulate") {
@@ -84029,6 +84018,30 @@ function processScanRecordGroup(options) {
84029
84018
  };
84030
84019
  const shouldAddQty = shouldAssignScanQty(qtyCheck);
84031
84020
  const qtySkippedReason = getScanQtySkipReason(qtyCheck);
84021
+ if (shouldAddQty) {
84022
+ const blockReason = getScanQtyDeductionBlockReason(
84023
+ visibleRows[disposition.index][F$2.stocktake],
84024
+ scanQty,
84025
+ scanAdjustType
84026
+ );
84027
+ if (blockReason) {
84028
+ deductionBlocked += 1;
84029
+ deductionBlockedReasons.push(blockReason);
84030
+ scanLog().info(
84031
+ `明细#${accumulated + skippedForLocation + unprocessed.length} → 命中行#${disposition.index},扣减被拦截`,
84032
+ {
84033
+ rowIndex: disposition.index,
84034
+ batch: record[F$2.batch],
84035
+ product: record[F$2.product],
84036
+ location: record[F$2.location],
84037
+ scanQty,
84038
+ scanAdjustType,
84039
+ blockReason
84040
+ }
84041
+ );
84042
+ continue;
84043
+ }
84044
+ }
84032
84045
  scanLog().info(
84033
84046
  shouldAddQty ? `明细#${accumulated + skippedForLocation + unprocessed.length} → 命中行#${disposition.index},写入盘点数` : `明细#${accumulated + skippedForLocation + unprocessed.length} → 命中行#${disposition.index},跳过写 qty`,
84034
84047
  {
@@ -84091,6 +84104,7 @@ function processScanRecordGroup(options) {
84091
84104
  scanQtyState
84092
84105
  });
84093
84106
  visibleRows = appended.rows;
84107
+ deductionBlockedReasons.push(...appended.deductionBlockedReasons);
84094
84108
  const appendedCount = appended.mergedIndex != null ? 1 : 0;
84095
84109
  if (appended.appendMeta?.qtyWritten) {
84096
84110
  qtyWritten += 1;
@@ -84110,10 +84124,11 @@ function processScanRecordGroup(options) {
84110
84124
  qtyWritten,
84111
84125
  skipped: skippedForLocation,
84112
84126
  unprocessed: unprocessed.length,
84113
- appended: appendedCount
84127
+ appended: appendedCount,
84128
+ deductionBlocked
84114
84129
  };
84115
84130
  scanLog().info("本组处理汇总", stats);
84116
- return { rows: visibleRows, mergedIndexes, skippedForLocation, stats };
84131
+ return { rows: visibleRows, mergedIndexes, skippedForLocation, deductionBlockedReasons, stats };
84117
84132
  }
84118
84133
  async function parseAndMergeScanRow(doc, subFieldKey, scanInput, scanRules, scanRuleProps) {
84119
84134
  const ctx = TableRuntimeContext.find(doc, subFieldKey);
@@ -84165,6 +84180,7 @@ async function parseAndMergeScanRow(doc, subFieldKey, scanInput, scanRules, scan
84165
84180
  let visibleRows = getVisibleRows(doc, subFieldKey);
84166
84181
  const mergedIndexes = [];
84167
84182
  let totalSkippedForLocation = 0;
84183
+ const deductionBlockedReasons = [];
84168
84184
  const groupStats = [];
84169
84185
  for (let i = 0; i < materialGroups.length; i += 1) {
84170
84186
  const groupRecords = materialGroups[i];
@@ -84184,6 +84200,7 @@ async function parseAndMergeScanRow(doc, subFieldKey, scanInput, scanRules, scan
84184
84200
  visibleRows = result.rows;
84185
84201
  mergedIndexes.push(...result.mergedIndexes);
84186
84202
  totalSkippedForLocation += result.skippedForLocation;
84203
+ deductionBlockedReasons.push(...result.deductionBlockedReasons);
84187
84204
  groupStats.push(result.stats);
84188
84205
  }
84189
84206
  scanLog().info("扫码结束汇总", {
@@ -84203,8 +84220,14 @@ async function parseAndMergeScanRow(doc, subFieldKey, scanInput, scanRules, scan
84203
84220
  totalSkippedForLocation === 1 ? "相同物料行尚未选择库位,已忽略 1 条扫码数据" : `相同物料行尚未选择库位,已忽略 ${totalSkippedForLocation} 条扫码数据`
84204
84221
  );
84205
84222
  }
84223
+ const uniqueDeductionBlockedReasons = [...new Set(deductionBlockedReasons)];
84224
+ if (uniqueDeductionBlockedReasons.length === 1) {
84225
+ GctMessage.error(uniqueDeductionBlockedReasons[0]);
84226
+ } else if (uniqueDeductionBlockedReasons.length > 1) {
84227
+ GctMessage.error(uniqueDeductionBlockedReasons.join(";"));
84228
+ }
84206
84229
  if (!mergedIndexes.length) {
84207
- if (totalSkippedForLocation === 0) {
84230
+ if (totalSkippedForLocation === 0 && uniqueDeductionBlockedReasons.length === 0) {
84208
84231
  GctMessage.error("扫描结果解析失败");
84209
84232
  }
84210
84233
  return;
@@ -84280,16 +84303,17 @@ async function changeWarehouseInventoryParseRule(options) {
84280
84303
  }
84281
84304
  const F$1 = {
84282
84305
  batch: "production_identification_id_",
84306
+ batchLb: "production_identification_id__lb_",
84283
84307
  product: "product_id_",
84284
84308
  productName: "product_id_name_",
84285
84309
  productCode: "product_id_code_",
84286
84310
  productSpec: "product_id_spec_",
84287
- matno: "material_no_",
84288
84311
  validity: "validity_",
84289
84312
  stock: "stock_num_",
84290
84313
  warehouse: "warehouse_id_",
84291
84314
  location: "location_id_",
84292
84315
  originWarehouseId: "origin_warehouse_id_",
84316
+ originWarehouseIdLb: "origin_warehouse_id__lb_",
84293
84317
  originLocationId: "origin_location_id_",
84294
84318
  originLocationIdLb: "origin_location_id__lb_",
84295
84319
  rowSource: "row_source_"
@@ -84360,15 +84384,15 @@ const fields = [
84360
84384
  clearOnLinkChange: []
84361
84385
  }
84362
84386
  },
84363
- {
84364
- // 源仓库 与 源库位 级联
84365
- match: { fieldKey: F$1.originLocationId },
84366
- select: {
84367
- linkFieldKey: F$1.originWarehouseId,
84368
- requireLinkWidget: false,
84369
- buildLinkQuery: ({ linkValue }) => linkValue ? { "warehouse_id_.eq": linkValue } : {}
84370
- }
84371
- },
84387
+ // {
84388
+ // // 源仓库 与 源库位 级联
84389
+ // match: { fieldKey: F.originLocationId },
84390
+ // select: {
84391
+ // linkFieldKey: F.originWarehouseId,
84392
+ // requireLinkWidget: false,
84393
+ // buildLinkQuery: ({ linkValue }) => (linkValue ? { 'warehouse_id_.eq': linkValue } : {}),
84394
+ // },
84395
+ // },
84372
84396
  {
84373
84397
  // 仓库 与 库位 级联
84374
84398
  match: { fieldKey: F$1.location },
@@ -84447,7 +84471,10 @@ function handleProductIdChange(doc, subFieldKey, rowIndex) {
84447
84471
  F$1.productName,
84448
84472
  F$1.productCode,
84449
84473
  F$1.productSpec,
84450
- F$1.matno,
84474
+ F$1.batch,
84475
+ F$1.batchLb,
84476
+ F$1.originWarehouseId,
84477
+ F$1.originWarehouseIdLb,
84451
84478
  F$1.originLocationId,
84452
84479
  F$1.originLocationIdLb,
84453
84480
  F$1.stock,
@@ -85154,7 +85181,7 @@ const DYN_CONFIG_BY_TYPE = {
85154
85181
  attrsTransform: [...basicAttrs.required, ...basicAttrs.placeholder]
85155
85182
  }
85156
85183
  };
85157
- const FIELD_TYPE_TO_FW$1 = {
85184
+ const FIELD_TYPE_TO_FW = {
85158
85185
  [FIELD_TYPE.TEXT]: "fw:input",
85159
85186
  [FIELD_TYPE.LONG_TEXT]: "fw:input",
85160
85187
  [FIELD_TYPE.INTEGER]: "fw:number",
@@ -85207,18 +85234,18 @@ function buildPropsFromRow(row, config2, baseProps = {}) {
85207
85234
  return patch;
85208
85235
  }
85209
85236
  function resolveFwType(fieldType, props) {
85210
- return FIELD_TYPE_TO_FW$1[fieldType] ?? "fw:input";
85237
+ return FIELD_TYPE_TO_FW[fieldType] ?? "fw:input";
85211
85238
  }
85212
85239
  function parseCrossIndices(path) {
85213
85240
  const m = path.match(/\[(\d+)\]\[(\d+)\](?:\.[^[]+)?$/);
85214
85241
  return m ? { y: Number(m[1]), x: Number(m[2]) } : null;
85215
85242
  }
85216
- function rowMetaPathOf(crossValuePath, y2) {
85243
+ function rowMetaPathOf(crossValuePath, y2, isLinkNotSet) {
85217
85244
  const parsed = parseValuePath(crossValuePath);
85218
- const subKey = parsed.isLink ? parsed.parentFieldKey : crossValuePath.replace(/^\$\./, "").split(":")[0]?.replace(/\[[^\]]*\]/g, "") ?? "";
85245
+ const subKey = parsed.isLink || isLinkNotSet ? parsed.parentFieldKey : crossValuePath.replace(/^\$\./, "").split(":")[0]?.replace(/\[[^\]]*\]/g, "") ?? "";
85219
85246
  return subKey ? `$.${subKey}[${y2}]` : "";
85220
85247
  }
85221
- function resolvePathsFromTemplate(templatePath, y2, x2, resolvePath) {
85248
+ function resolvePathsFromTemplate(templatePath, y2, x2, resolvePath, isLinkNotSet) {
85222
85249
  const valuePath = resolvePath?.(templatePath) ?? templatePath;
85223
85250
  const fromPath = parseCrossIndices(valuePath);
85224
85251
  const rowY = fromPath?.y ?? y2;
@@ -85227,7 +85254,7 @@ function resolvePathsFromTemplate(templatePath, y2, x2, resolvePath) {
85227
85254
  y: rowY,
85228
85255
  x: rowX,
85229
85256
  valuePath,
85230
- rowMetaPath: rowMetaPathOf(valuePath, rowY)
85257
+ rowMetaPath: rowMetaPathOf(valuePath, rowY, isLinkNotSet)
85231
85258
  };
85232
85259
  }
85233
85260
  function readRowMeta(doc, rowMetaPath) {
@@ -85267,7 +85294,7 @@ function isCheckTableCrossValueLayout(ctx) {
85267
85294
  if (!sub || sub.cellZone !== "cross" || !isLinkSubTableType(sub.type)) return false;
85268
85295
  return sub.type === "check-table";
85269
85296
  }
85270
- function prepareDynLayoutWr(ctx) {
85297
+ function prepareDynLayoutWr(ctx, isLinkNotSet) {
85271
85298
  const wr = cloneDeep(ctx.wr);
85272
85299
  const sub = ctx.context.cell?.subRenderer;
85273
85300
  const templatePath = wr.valuePath ?? wr.widgetMeta?.field?.valuePath ?? "";
@@ -85275,7 +85302,8 @@ function prepareDynLayoutWr(ctx) {
85275
85302
  templatePath,
85276
85303
  sub?.yDataIndex ?? 0,
85277
85304
  sub?.xDataIndex ?? 0,
85278
- (p) => ctx.context.getValuePath(p)
85305
+ (p) => ctx.context.getValuePath(p),
85306
+ isLinkNotSet
85279
85307
  );
85280
85308
  const rowMeta = readRowMeta(ctx.context.doc, paths.rowMetaPath);
85281
85309
  wr.widgetMeta = buildDynWidgetMeta(wr.widgetMeta, rowMeta);
@@ -95373,7 +95401,26 @@ function shouldShowFieldHyperlink(doc, widgetMeta, runtimePath) {
95373
95401
  }
95374
95402
  class FieldBaseHandler extends RunHandlerBase {
95375
95403
  static hasValue(value) {
95376
- return value !== void 0 && value !== null;
95404
+ return value !== void 0 && value !== null && value !== "";
95405
+ }
95406
+ /** 将展示文案拆成逐字 run;空串 split 会得到 [],需单独处理 */
95407
+ static toLayoutChars(label) {
95408
+ if (label === void 0 || label === null || label === "") {
95409
+ return [];
95410
+ }
95411
+ return String(label).split("");
95412
+ }
95413
+ /**
95414
+ * 展示内容为空时补一个带 widgetMeta/valuePath 的占位 run
95415
+ * 避免段落只剩默认 TextRun(isPlaceholder=true)导致 getWidgetInstances 收集不到
95416
+ */
95417
+ static ensureFieldWidgetAnchor(ctx, layoutStyle, extra) {
95418
+ const metrics = TextRun.measureText(TextRun.measurePayload(" ", layoutStyle));
95419
+ this.addSpace({
95420
+ ctx,
95421
+ textMetrics: metrics,
95422
+ extra
95423
+ });
95377
95424
  }
95378
95425
  static getModelRefId(context, wr) {
95379
95426
  return this.buildSplitModelRefId(context, wr.id);
@@ -95476,13 +95523,16 @@ class FieldBaseHandler extends RunHandlerBase {
95476
95523
  }
95477
95524
  const layoutStyle = this.resolveFieldTextLayoutStyle(ctx, wr, wr.valuePath);
95478
95525
  const fontSize = layoutStyle.fontSize ?? DEFAULT_FONT_SIZE;
95479
- const chars = String(label).split("");
95526
+ const chars = this.toLayoutChars(label);
95480
95527
  let doc = context.doc;
95481
95528
  this.addFieldMarker({
95482
95529
  ctx,
95483
95530
  fontSize,
95484
95531
  position: "left"
95485
95532
  });
95533
+ if (chars.length === 0) {
95534
+ this.ensureFieldWidgetAnchor(ctx, layoutStyle);
95535
+ }
95486
95536
  chars.forEach((char, charIndex) => {
95487
95537
  const { width, height, ascent, descent } = TextRun.measureText(
95488
95538
  TextRun.measurePayload(char, layoutStyle)
@@ -95524,13 +95574,16 @@ class FieldBaseHandler extends RunHandlerBase {
95524
95574
  const textStyle = TextStyleResolver.resolve(wr.rPr, context.doc.model?.styles);
95525
95575
  const layoutStyle = TextRun.textStyle2LayoutStyle(textStyle);
95526
95576
  const measureStyle = { ...layoutStyle, fontSize: 16 };
95527
- const { label, type: type4 } = this.getNoValueLabel(ctx);
95528
- const chars = label.split("");
95577
+ const { label } = this.getNoValueLabel(ctx);
95578
+ const chars = this.toLayoutChars(label);
95529
95579
  this.addFieldMarker({
95530
95580
  ctx,
95531
95581
  fontSize: 16,
95532
95582
  position: "left"
95533
95583
  });
95584
+ if (chars.length === 0) {
95585
+ this.ensureFieldWidgetAnchor(ctx, measureStyle, { isEmptyPlaceholder: true });
95586
+ }
95534
95587
  chars.forEach((char, charIndex) => {
95535
95588
  const { width, height, ascent, descent } = TextRun.measureText(
95536
95589
  TextRun.measurePayload(char, measureStyle)
@@ -95717,27 +95770,13 @@ class FieldBaseHandler extends RunHandlerBase {
95717
95770
  context.addRun(run);
95718
95771
  }
95719
95772
  }
95720
- const FIELD_TYPE_TO_FW = {
95721
- [FIELD_TYPE.TEXT]: "fw:input",
95722
- [FIELD_TYPE.LONG_TEXT]: "fw:input",
95723
- [FIELD_TYPE.INTEGER]: "fw:number",
95724
- [FIELD_TYPE.LONG]: "fw:number",
95725
- [FIELD_TYPE.DOUBLE]: "fw:double",
95726
- [FIELD_TYPE.DECIMAL]: "fw:number",
95727
- [FIELD_TYPE.DATE]: "fw:date",
95728
- [FIELD_TYPE.DATE_TIME]: "fw:date-time",
95729
- [FIELD_TYPE.TIME]: "fw:time",
95730
- [FIELD_TYPE.ENUM]: "fw:enum",
95731
- [FIELD_TYPE.ENUM_MULTI]: "fw:enum-multiple",
95732
- [FIELD_TYPE.MATERIAL_NO]: "fw:table-select",
95733
- [FIELD_TYPE.RELATED_LOT_NO]: "fw:table-select",
95734
- [FIELD_TYPE.PRODUCT]: "fw:rdo-table-select",
95735
- [FIELD_TYPE.DEVICE]: "fw:table-select",
95736
- [FIELD_TYPE.MFG_ORDER]: "fw:table-select",
95737
- [FIELD_TYPE.RECORD_NO]: "fw:input",
95738
- [FIELD_TYPE.ORDER_NO]: "fw:input",
95739
- [FIELD_TYPE.TRACE_DATE]: "fw:date"
95740
- };
95773
+ function resolveAttachFieldComponent(ctx, fieldType) {
95774
+ const component = ctx.context.doc.fieldModelQuery.getFieldManifest(fieldType)?.component;
95775
+ if (component && component !== "cascade") {
95776
+ return component;
95777
+ }
95778
+ return "fw:input";
95779
+ }
95741
95780
  class AttachFieldHandler extends FieldBaseHandler {
95742
95781
  static layoutOptionAttachFields(ctx, option, layoutStyle) {
95743
95782
  const items = option.attachFields;
@@ -95745,7 +95784,7 @@ class AttachFieldHandler extends FieldBaseHandler {
95745
95784
  const { context, wr } = ctx;
95746
95785
  const parentRuntimeValuePath = context.getValuePath(wr.valuePath);
95747
95786
  const gap = 2;
95748
- const { height, ascent, descent } = TextRun.measureText(
95787
+ const { width, height, ascent, descent } = TextRun.measureText(
95749
95788
  TextRun.measurePayload("0", { ...layoutStyle, fontSize: 16 })
95750
95789
  );
95751
95790
  this.addSpace({
@@ -95764,7 +95803,7 @@ class AttachFieldHandler extends FieldBaseHandler {
95764
95803
  }
95765
95804
  static buildWidgetMeta(ctx, item, parentWr, parentRuntimeValuePath, parentOptionValue, runtimePath) {
95766
95805
  const fieldType = item.fieldData.fieldType;
95767
- const type4 = FIELD_TYPE_TO_FW[fieldType] ?? "fw:input";
95806
+ const type4 = resolveAttachFieldComponent(ctx, fieldType);
95768
95807
  const parentMeta = parentWr.widgetMeta;
95769
95808
  const attachFieldParent = {
95770
95809
  parentModelRefId: this.getModelRefId(ctx.context, parentWr),
@@ -95845,7 +95884,7 @@ class OptionHandler extends FieldBaseHandler {
95845
95884
  AttachFieldHandler.layoutOptionAttachFields({ context, wr }, optionWithAttach, layoutStyle);
95846
95885
  }
95847
95886
  if (index2 === options.length - 1 && attachFields.length > 0) {
95848
- const { height, ascent, descent } = TextRun.measureText(
95887
+ const { width, height, ascent, descent } = TextRun.measureText(
95849
95888
  TextRun.measurePayload("0", { ...layoutStyle, fontSize: 16 })
95850
95889
  );
95851
95890
  this.addSpace({
@@ -96093,7 +96132,7 @@ class InputHandler extends FieldBaseHandler {
96093
96132
  }
96094
96133
  const layoutStyle = this.resolveFieldTextLayoutStyle(ctx, wr, wr.valuePath);
96095
96134
  const fontSize = layoutStyle.fontSize ?? DEFAULT_FONT_SIZE;
96096
- const chars = String(label).split("");
96135
+ const chars = this.toLayoutChars(label);
96097
96136
  let doc = context.doc;
96098
96137
  this.addFieldMarker({
96099
96138
  ctx,
@@ -96215,7 +96254,11 @@ class FieldHandler {
96215
96254
  static layout(context, wr) {
96216
96255
  const ctx = { context, wr };
96217
96256
  if (isCheckTableCrossValueLayout(ctx)) {
96218
- FieldHandler.layoutCheckTableCrossValue(ctx);
96257
+ FieldHandler.layoutCheckTableValue(ctx);
96258
+ return;
96259
+ }
96260
+ if (context.cell?.subRenderer?.type === "check-table" && wr.widgetMeta?.field?.fieldLink === "value_") {
96261
+ FieldHandler.layoutCheckTableValue(ctx, true);
96219
96262
  return;
96220
96263
  }
96221
96264
  if (wr.widgetMeta?.props?.renderComp === "checkbox") {
@@ -96233,8 +96276,8 @@ class FieldHandler {
96233
96276
  }
96234
96277
  }
96235
96278
  /** 检验表交叉区 value_:按同行检验项 type_ 渲染,值路径固定 value_ */
96236
- static layoutCheckTableCrossValue(ctx) {
96237
- const layoutCtx = prepareDynLayoutWr(ctx);
96279
+ static layoutCheckTableValue(ctx, isLinkNotSet) {
96280
+ const layoutCtx = prepareDynLayoutWr(ctx, isLinkNotSet);
96238
96281
  if (layoutCtx.context.doc.mode === DocModeTypeConst.Print) {
96239
96282
  FieldBaseHandler.layoutValue(layoutCtx);
96240
96283
  return;
@@ -106367,7 +106410,7 @@ class MaterialConsumeTableController {
106367
106410
  * 并判断是否能存入表中,返回对象则表示可以存入
106368
106411
  * @param str
106369
106412
  */
106370
- async parseScanStr(str, option, subModelKey) {
106413
+ async parseScanStr(str, option) {
106371
106414
  if (!this.isFirstBlankRow() && this.hasEditingRow()) {
106372
106415
  return;
106373
106416
  }
@@ -106418,11 +106461,14 @@ class MaterialConsumeTableController {
106418
106461
  const newArr = this.bomEntriesValidator.mergeRowInArr(row, this.actualTableData);
106419
106462
  await this.bomEntriesValidator.validateScanCanInsert(newArr);
106420
106463
  this.tableDataRef.value = newArr;
106421
- setTimeout(() => {
106464
+ setTimeout(async () => {
106422
106465
  const row2 = this.actualTableData.find((i) => !i.is_confirmed_);
106423
106466
  const rowIndex = this.actualTableData.findIndex((i) => !i.is_confirmed_);
106467
+ const { doc, subFieldKey, subModelKey } = option;
106468
+ await doc.dataManager.whenEmitSettled();
106469
+ await hydrateSubtableRowLabels(doc, subFieldKey, [rowIndex]);
106424
106470
  if (row2) {
106425
- this.confirm({ ...option, rowIndex }, subModelKey);
106471
+ this.confirm({ dataManager: doc.dataManager, subFieldKey, rowIndex }, subModelKey);
106426
106472
  }
106427
106473
  });
106428
106474
  } catch (e) {
@@ -106438,7 +106484,7 @@ class MaterialConsumeTableController {
106438
106484
  * 打开扫描弹窗
106439
106485
  * @param opts
106440
106486
  */
106441
- async openScanModal(title, option, subModelKey) {
106487
+ async openScanModal(title, option) {
106442
106488
  if (this.isScanOpen) return;
106443
106489
  if (!this.scanRuleInfo) {
106444
106490
  this.error(
@@ -106452,7 +106498,7 @@ class MaterialConsumeTableController {
106452
106498
  title,
106453
106499
  onScan: async (str) => {
106454
106500
  console.log("onScan", str);
106455
- await this.parseScanStr(str, option, subModelKey);
106501
+ await this.parseScanStr(str, option);
106456
106502
  }
106457
106503
  });
106458
106504
  this.isScanOpen = false;
@@ -106644,7 +106690,6 @@ class MaterialConsumeTableController {
106644
106690
  doc.dataManager.setMultiple(
106645
106691
  {
106646
106692
  [`${rowPath}.product_id_`]: selectedOption.product_id_
106647
- // [`${rowPath}.product_id__lb_`]: record.product_id__lb_, // 目前取不到
106648
106693
  },
106649
106694
  "user"
106650
106695
  );
@@ -108097,25 +108142,63 @@ async function prepareDocumentFieldContext(options) {
108097
108142
  if (loadSubModels) {
108098
108143
  await addSubModelsToFieldScope(mainModelKey, payload.ctx);
108099
108144
  }
108145
+ const fieldList = payload.ctx.runtime.getFieldList(mainModelKey);
108100
108146
  const masterSlaveList = payload.ctx.runtime.getMasterSlaveFieldList(mainModelKey);
108101
- return { mainModelKey, masterSlaveList };
108102
- }
108103
- const initObjectTypeFieldDefaultValue = (runtimeJson, rawData) => {
108147
+ return { mainModelKey, fieldList, masterSlaveList };
108148
+ }
108149
+ const initObjectTypeFieldDefaultValue = (rawData, instances, fieldList, runtimeJson) => {
108150
+ const usingObjectFieldMap = instances.map((i) => {
108151
+ const { belongingObject, fieldLink } = i.widgetMeta.field;
108152
+ return belongingObject ? { belongingObject, fieldLink } : null;
108153
+ }).reduce((map, cur) => {
108154
+ if (!cur) return map;
108155
+ const { belongingObject, fieldLink } = cur;
108156
+ if (!map[belongingObject]) {
108157
+ map[belongingObject] = [];
108158
+ }
108159
+ map[belongingObject].push(fieldLink);
108160
+ return map;
108161
+ }, {});
108162
+ const allObjectFieldMap = groupBy$1(
108163
+ fieldList.filter((f) => !!f.belongingObject),
108164
+ "belongingObject"
108165
+ );
108166
+ Object.entries(allObjectFieldMap).forEach(([belongingObject, fields2]) => {
108167
+ const allFieldKeys = fields2.map((f) => f.key);
108168
+ const isNotUsed = allFieldKeys.every(
108169
+ (fk) => !usingObjectFieldMap[belongingObject]?.includes(fk)
108170
+ );
108171
+ if (isNotUsed) {
108172
+ delete rawData[belongingObject];
108173
+ }
108174
+ });
108104
108175
  const res = JSON.parse(runtimeJson);
108105
108176
  const { objectInitialValues } = res?.document?.config?.dataInit || {};
108106
108177
  if (!objectInitialValues?.length) return;
108107
- objectInitialValues.forEach(({ values }) => {
108108
- if (!values) return;
108109
- for (const [key, value] of Object.entries(values)) {
108110
- if (value === void 0 || value === null) continue;
108111
- const existing = rawData[key];
108112
- if (existing !== void 0 && existing !== null) continue;
108113
- rawData[key] = value;
108178
+ objectInitialValues.forEach(
108179
+ ({ objectField, values }) => {
108180
+ if (!objectField || !values) return;
108181
+ for (const [key, value] of Object.entries(values)) {
108182
+ if (value === void 0 || value === null) continue;
108183
+ const existing = rawData[key];
108184
+ if (existing !== void 0 && existing !== null) continue;
108185
+ rawData[key] = value;
108186
+ }
108187
+ rawData[objectField] = null;
108114
108188
  }
108115
- });
108189
+ );
108116
108190
  };
108117
108191
  async function prepareDocumentRenderData(options) {
108118
- const { requestInfo, payload, materialNo, query, instances, subTableInfoList, masterSlaveList } = options;
108192
+ const {
108193
+ requestInfo,
108194
+ payload,
108195
+ materialNo,
108196
+ query,
108197
+ instances,
108198
+ subTableInfoList,
108199
+ fieldList,
108200
+ masterSlaveList
108201
+ } = options;
108119
108202
  const interfaceData = await fetchRenderData({
108120
108203
  info: requestInfo,
108121
108204
  fetchConfig: { _gct_materialNo_: materialNo },
@@ -108128,7 +108211,7 @@ async function prepareDocumentRenderData(options) {
108128
108211
  interfaceData,
108129
108212
  subTableInfoList
108130
108213
  });
108131
- initObjectTypeFieldDefaultValue(requestInfo.runtimeJson, rawData);
108214
+ initObjectTypeFieldDefaultValue(rawData, instances, fieldList, requestInfo.runtimeJson);
108132
108215
  return rawData;
108133
108216
  }
108134
108217
  async function loadDocumentInitMappings(options) {
@@ -108162,7 +108245,7 @@ async function initializeDocumentEngine(props, payload, result) {
108162
108245
  configurePipelineLoggingForDev();
108163
108246
  const { id, requestInfo, fillModeType, paramsConfig, tmplBomC } = result;
108164
108247
  const materialNo = paramsConfig?.materialNo || requestInfo.materialNo;
108165
- const { mainModelKey, masterSlaveList } = await prepareDocumentFieldContext({
108248
+ const { mainModelKey, fieldList, masterSlaveList } = await prepareDocumentFieldContext({
108166
108249
  requestInfo,
108167
108250
  payload,
108168
108251
  loadSubModels: true
@@ -108226,6 +108309,7 @@ async function initializeDocumentEngine(props, payload, result) {
108226
108309
  query: result.query,
108227
108310
  instances,
108228
108311
  subTableInfoList: docModel.getSubTableInfoList() ?? [],
108312
+ fieldList,
108229
108313
  masterSlaveList
108230
108314
  });
108231
108315
  const docRuntimeMeta = {
@@ -108394,7 +108478,7 @@ function useDocumentFactory(props, payload) {
108394
108478
  bpmnFieldAuthMap
108395
108479
  } = freshExecute;
108396
108480
  const materialNo = paramsConfig?.materialNo || props.materialNo;
108397
- const { masterSlaveList } = await prepareDocumentFieldContext({
108481
+ const { fieldList, masterSlaveList } = await prepareDocumentFieldContext({
108398
108482
  requestInfo,
108399
108483
  payload,
108400
108484
  loadSubModels: false
@@ -108422,6 +108506,7 @@ function useDocumentFactory(props, payload) {
108422
108506
  query,
108423
108507
  instances: doc.model?.getWidgetInstances() ?? [],
108424
108508
  subTableInfoList: doc.model?.getSubTableInfoList() ?? [],
108509
+ fieldList,
108425
108510
  masterSlaveList
108426
108511
  });
108427
108512
  doc.dataManager.setRawData(rawData);
@@ -108812,6 +108897,9 @@ class SuiteRuntime {
108812
108897
  getMasterSlaveFieldList(modelKey) {
108813
108898
  return this.fieldService.getFieldList(modelKey)?.filter((i) => i.type === FIELD_TYPE.MASTERSLAVE) || [];
108814
108899
  }
108900
+ getFieldManifest(type4) {
108901
+ return this.fieldManifestService.getManifestByType(type4);
108902
+ }
108815
108903
  reloadFields(modelKey) {
108816
108904
  this.fieldService.clear(modelKey);
108817
108905
  return this.loadFieldList(modelKey);
@@ -114084,21 +114172,22 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
114084
114172
  if (!tmplBomCRef?.value?.tableControllers || !valuePath || !subFieldKey) return;
114085
114173
  const mcTableController = tmplBomCRef.value.tableControllers[valuePath];
114086
114174
  if (!mcTableController) return;
114087
- const { dataManager } = docInst.value;
114175
+ const { doc } = props;
114176
+ const { dataManager, mainModelKey } = doc;
114088
114177
  if (val === "confirm") {
114089
114178
  checkTargetRowThen(() => {
114090
114179
  mcTableController.confirm({ dataManager, subFieldKey, rowIndex }, subModelKey);
114091
114180
  });
114092
114181
  } else if (val === "scan") {
114093
114182
  checkTargetRowThen(() => {
114094
- mcTableController.openScanModal(tableName, { dataManager, subFieldKey }, subModelKey);
114183
+ mcTableController.openScanModal(tableName, { doc, subFieldKey, subModelKey });
114095
114184
  });
114096
114185
  } else if (val === "edit-row") {
114097
114186
  mcTableController.editRow({ dataManager, subFieldKey, rowIndex });
114098
114187
  } else if (val === "view-bom") {
114099
114188
  mcTableController.openBomModal();
114100
114189
  } else if (val === "change-rule") {
114101
- mcTableController.changeScanRule(props.doc.mainModelKey, subModelKey);
114190
+ mcTableController.changeScanRule(mainModelKey, subModelKey);
114102
114191
  }
114103
114192
  };
114104
114193
  const handleWarehouseInventoryAction = async (val) => {
@@ -114360,7 +114449,7 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
114360
114449
  };
114361
114450
  }
114362
114451
  });
114363
- const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2G, [["__scopeId", "data-v-a4364e55"]]);
114452
+ const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2G, [["__scopeId", "data-v-2b5fa953"]]);
114364
114453
  const _sfc_main$2F = /* @__PURE__ */ defineComponent({
114365
114454
  __name: "index",
114366
114455
  props: {
@@ -114889,7 +114978,7 @@ function buildWidgetFieldMetaMap(instances) {
114889
114978
  metaKey: runtimeValuePath,
114890
114979
  cellType: fieldMeta.fieldType,
114891
114980
  modelId: instance2.modelRef.id,
114892
- points: instance2?.widgetMeta?.extra?.biz?.[instance2.modelRef.id] || {}
114981
+ points: instance2?.widgetMeta?.extra?.biz?.[instance2.valuePath] || {}
114893
114982
  };
114894
114983
  map.set(runtimeValuePath, value);
114895
114984
  }
@@ -114951,7 +115040,8 @@ function validateDocDesigner(doc) {
114951
115040
  }
114952
115041
  const errors = [];
114953
115042
  const children = doc.model.document.body.children || [];
114954
- const fixedTableRegions = children.filter((w2) => w2.name === "w:tbl" && w2.hasBounded).flatMap((w2) => w2.bounded);
115043
+ const tables = children.filter((w2) => w2.name === "w:tbl");
115044
+ const fixedTableRegions = tables.flatMap((w2) => w2.bounded);
114955
115045
  if (fixedTableRegions.some((r) => !r.itemRegion)) {
114956
115046
  errors.push({
114957
115047
  code: "item-region-required",
@@ -114959,7 +115049,20 @@ function validateDocDesigner(doc) {
114959
115049
  source: "doc"
114960
115050
  });
114961
115051
  }
114962
- const tables = children.filter((w2) => w2.name === "w:tbl");
115052
+ const checkTableRegions = tables.flatMap((w2) => w2.checkTable);
115053
+ checkTableRegions.forEach(((r) => {
115054
+ if (!r.itemRegion) return;
115055
+ const { linkFieldKey } = parseValuePath(r.valuePath);
115056
+ const { start: { row: startRow, col: startCol }, end: { row: endRow, col: endCol } } = r.itemRegion;
115057
+ const linkFieldList = r.table.children.slice(startRow, endRow + 1).flatMap((row) => row.children.slice(startCol, endCol + 1)).flatMap((cell) => cell?.children ?? []).flatMap((child) => child?.children ?? []).filter((f) => f?.widgetMeta?.field?.subFieldKey);
115058
+ if (!linkFieldList.some((f) => f.widgetMeta.field.subFieldKey === linkFieldKey)) {
115059
+ errors.push({
115060
+ code: "link-field-required",
115061
+ message: "请拖入动态关联字段",
115062
+ source: "doc"
115063
+ });
115064
+ }
115065
+ }));
114963
115066
  for (const { hasTable, getRegions, message } of BARCODE_PARSING_RULE_TABLES) {
114964
115067
  const regions = tables.filter(hasTable).flatMap(getRegions);
114965
115068
  if (regions.some((r) => !r.widgetMeta.props.barcode_parsing_rules_id_)) {
@@ -114970,6 +115073,14 @@ function validateDocDesigner(doc) {
114970
115073
  });
114971
115074
  }
114972
115075
  }
115076
+ const materialConsumeTableRegions = children.filter((w2) => w2.name === "w:tbl" && w2.hasMaterialConsumeTable).flatMap((w2) => w2.materialConsumeTable);
115077
+ if (materialConsumeTableRegions.some((r) => !r.widgetMeta.props.barcode_parsing_rules_id_)) {
115078
+ errors.push({
115079
+ code: "barcode-parsing-rules-required",
115080
+ message: "请给物料消耗表设置条码解析规则",
115081
+ source: "doc"
115082
+ });
115083
+ }
114973
115084
  return createDesignerValidationResult(errors);
114974
115085
  }
114975
115086
  function validateDesigner(doc) {
@@ -117535,6 +117646,7 @@ function createDesignFieldToWidgetFactory(getFieldManifestForField) {
117535
117646
  isLinkedModelField: false,
117536
117647
  fieldLink: field.key,
117537
117648
  modelLink: field.modelKey,
117649
+ belongingObject: field.belongingObject,
117538
117650
  valuePath,
117539
117651
  ...opts.parentFieldKey ? { subFieldKey: opts.parentFieldKey } : void 0
117540
117652
  },
@@ -117760,9 +117872,7 @@ const _sfc_main$2n = /* @__PURE__ */ defineComponent({
117760
117872
  const paletteField = toPaletteField(field);
117761
117873
  if (!paletteField) return [];
117762
117874
  if (paletteField?.isCascade) {
117763
- paletteField.children = fields2.value.filter((f) => {
117764
- return f.belongingObject === paletteField.field.key && f.createType === "USER_DEFINED";
117765
- }).map(toPaletteField).filter(Boolean);
117875
+ paletteField.children = fields2.value.filter((f) => f.belongingObject === paletteField.field.key).map(toPaletteField).filter(Boolean);
117766
117876
  }
117767
117877
  return [paletteField];
117768
117878
  });
@@ -117814,7 +117924,7 @@ const _sfc_main$2n = /* @__PURE__ */ defineComponent({
117814
117924
  };
117815
117925
  }
117816
117926
  });
117817
- const ToolkitContentFields = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__scopeId", "data-v-811ea2df"]]);
117927
+ const ToolkitContentFields = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__scopeId", "data-v-a7322f3e"]]);
117818
117928
  const _hoisted_1$1B = { class: "toolkit-content-widgets" };
117819
117929
  const _hoisted_2$Z = { key: 0 };
117820
117930
  const _hoisted_3$I = ["data-type", "draggable", "onDragstart"];
@@ -130264,7 +130374,10 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
130264
130374
  FIELD_TYPE.MFG_ORDER,
130265
130375
  FIELD_TYPE.RECORD_NO,
130266
130376
  FIELD_TYPE.ORDER_NO,
130267
- FIELD_TYPE.TRACE_DATE
130377
+ FIELD_TYPE.EXTERNAL_REF_NO,
130378
+ FIELD_TYPE.TRACE_DATE,
130379
+ FIELD_TYPE.WAREHOUSE_RECEIPT_NO,
130380
+ FIELD_TYPE.WAREHOUSE_RECEIPT_DATE
130268
130381
  ];
130269
130382
  if (!allowFieldTypes.includes(meta.field.fieldType)) {
130270
130383
  GctMessage.warning(props.customFieldMsg ?? "能绑定数值、文本、日期和追溯类型的字段");
@@ -130314,7 +130427,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
130314
130427
  };
130315
130428
  }
130316
130429
  });
130317
- const AttachFieldEditor = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-abcd1f7d"]]);
130430
+ const AttachFieldEditor = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-fc484054"]]);
130318
130431
  const _hoisted_1$Q = { class: "option-container" };
130319
130432
  const _hoisted_2$q = { class: "option-item" };
130320
130433
  const _hoisted_3$f = { class: "option" };
@@ -136132,6 +136245,22 @@ const selectStrategyMap = {
136132
136245
  },
136133
136246
  transform: transformLotData
136134
136247
  },
136248
+ [FIELD_TYPE.WAREHOUSE]: {
136249
+ columnsKey: "ref",
136250
+ fetcher: "ref",
136251
+ buildQuery({ keyword, searchField, extraParams }) {
136252
+ return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136253
+ },
136254
+ transform: transformLotData
136255
+ },
136256
+ [FIELD_TYPE.LOCATION]: {
136257
+ columnsKey: "ref",
136258
+ fetcher: "ref",
136259
+ buildQuery({ keyword, searchField, extraParams }) {
136260
+ return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136261
+ },
136262
+ transform: transformLotData
136263
+ },
136135
136264
  [FIELD_TYPE.REF]: {
136136
136265
  columnsKey: "ref",
136137
136266
  fetcher: "ref",