@gct-paas/word 0.2.31-beta.1 → 0.2.31-beta.2
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.
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** 兼容生产标识扫码记录和列表记录的物料、批次字段。 */
|
|
2
|
+
export declare function normalizeMaterialSubstitutionScanRecord(record: Record<string, unknown>): Record<string, unknown>;
|
|
3
|
+
/** 根据映射选择回填侧;产品字段写真实 ID,数量和自定义映射沿用用户配置。 */
|
|
4
|
+
export declare function buildMaterialSubstitutionScanRow(record: Record<string, unknown>, fillData: Record<string, unknown>): Record<string, unknown>;
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @gct-paas/word v0.2.31-beta.
|
|
1
|
+
/*! @gct-paas/word v0.2.31-beta.2 */
|
|
2
2
|
import { Fragment, Suspense, Teleport, Transition, TransitionGroup, cloneVNode, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, render, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowReactive, shallowRef, toDisplayString, toHandlers, toRaw, toRef, toValue, unref, useAttrs, useCssVars, useModel, useSlots, vModelRadio, vModelSelect, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
3
3
|
import fa, { PopperWrapper } from "floating-vue";
|
|
4
4
|
import VueKonva from "vue-konva";
|
|
@@ -122883,15 +122883,18 @@ async function matchProductionIdentificationScanRecords(parsed) {
|
|
|
122883
122883
|
if (!body.material_no_ && !body.unique_code_) return [];
|
|
122884
122884
|
const result = await callBizService(PRODUCTION_IDENTIFICATION_SCAN_API, body, { __useWordMessage: false });
|
|
122885
122885
|
if (isBizServiceFailure(result)) return null;
|
|
122886
|
-
|
|
122886
|
+
const records = unwrapBizServiceList(result);
|
|
122887
|
+
if (records.length) return records;
|
|
122888
|
+
const record = unwrapBizServiceData(result);
|
|
122889
|
+
return record && "product_id_" in record ? [record] : [];
|
|
122887
122890
|
}
|
|
122888
122891
|
/** 多条候选 → 公共多选弹框 */
|
|
122889
122892
|
async function pickProductionIdentificationScanRecord(records) {
|
|
122890
122893
|
if (records.length === 1) return records[0];
|
|
122891
122894
|
const { success, result } = await G2("SCAN_MULTI_ROWS_MODAL", { rows: records.map((record) => ({
|
|
122892
122895
|
...record,
|
|
122893
|
-
productId: record.product_id_name_ ?? record.product_id_code_,
|
|
122894
|
-
materialNo: record.material_no_ ?? record.name_
|
|
122896
|
+
productId: String(record.product_id_name_ ?? record.product_id_code_ ?? ""),
|
|
122897
|
+
materialNo: String(record.material_no_ ?? record.name_ ?? "")
|
|
122895
122898
|
})) });
|
|
122896
122899
|
if (!success || !result) return void 0;
|
|
122897
122900
|
return result;
|
|
@@ -126465,6 +126468,64 @@ var init_register_handlers$3 = __esmMin((() => {
|
|
|
126465
126468
|
registerRowHandler(TABLE_TYPE$4, "on-target-product-change", handleTargetProductChange);
|
|
126466
126469
|
}));
|
|
126467
126470
|
//#endregion
|
|
126471
|
+
//#region src/domain/table/business/material/material-substitution/runtime/scan-fill.ts
|
|
126472
|
+
/** 兼容生产标识扫码记录和列表记录的物料、批次字段。 */
|
|
126473
|
+
function normalizeMaterialSubstitutionScanRecord(record) {
|
|
126474
|
+
const result = {
|
|
126475
|
+
...record,
|
|
126476
|
+
name_: record.name_ ?? record.material_no_,
|
|
126477
|
+
id_: record.production_identification_id_ ?? record.id_
|
|
126478
|
+
};
|
|
126479
|
+
const foreign = record.__FOREIGN__;
|
|
126480
|
+
const option = record._OPCT;
|
|
126481
|
+
for (const key of [
|
|
126482
|
+
"name_",
|
|
126483
|
+
"code_",
|
|
126484
|
+
"spec_"
|
|
126485
|
+
]) {
|
|
126486
|
+
const field = `product_id_${key}`;
|
|
126487
|
+
const foreignField = `product_id_.${key}`;
|
|
126488
|
+
result[field] = record[field] ?? record[`product_${key}`] ?? record[foreignField] ?? (foreign === null || foreign === void 0 ? void 0 : foreign[foreignField]) ?? (option === null || option === void 0 ? void 0 : option[foreignField]);
|
|
126489
|
+
}
|
|
126490
|
+
return result;
|
|
126491
|
+
}
|
|
126492
|
+
/** 根据映射选择回填侧;产品字段写真实 ID,数量和自定义映射沿用用户配置。 */
|
|
126493
|
+
function buildMaterialSubstitutionScanRow(record, fillData) {
|
|
126494
|
+
const material = normalizeMaterialSubstitutionScanRecord(record);
|
|
126495
|
+
const row = { ...fillData };
|
|
126496
|
+
for (const fields of [{
|
|
126497
|
+
product: F$5.sourceProduct,
|
|
126498
|
+
materialNo: F$5.sourceMaterialNo,
|
|
126499
|
+
name: F$5.sourceProductName,
|
|
126500
|
+
code: F$5.sourceProductCode,
|
|
126501
|
+
spec: F$5.sourceProductSpec
|
|
126502
|
+
}, {
|
|
126503
|
+
product: F$5.targetProduct,
|
|
126504
|
+
materialNo: F$5.targetMaterialNo,
|
|
126505
|
+
name: F$5.targetProductName,
|
|
126506
|
+
code: F$5.targetProductCode,
|
|
126507
|
+
spec: F$5.targetProductSpec
|
|
126508
|
+
}]) {
|
|
126509
|
+
if (!(fields.product in fillData) && !(fields.materialNo in fillData)) continue;
|
|
126510
|
+
Object.assign(row, {
|
|
126511
|
+
[fields.product]: material.product_id_,
|
|
126512
|
+
[getLabelPath(fields.product)]: material.product_id_name_ ?? null,
|
|
126513
|
+
[fields.materialNo]: material.name_ ?? null,
|
|
126514
|
+
[getIdPath(fields.materialNo)]: material.id_ ?? null,
|
|
126515
|
+
[getLabelPath(fields.materialNo)]: resolveLotDisplayLabel(material) ?? null,
|
|
126516
|
+
[fields.name]: material.product_id_name_ ?? null,
|
|
126517
|
+
[fields.code]: material.product_id_code_ ?? null,
|
|
126518
|
+
[fields.spec]: material.product_id_spec_ ?? null
|
|
126519
|
+
});
|
|
126520
|
+
}
|
|
126521
|
+
return row;
|
|
126522
|
+
}
|
|
126523
|
+
var init_scan_fill$1 = __esmMin((() => {
|
|
126524
|
+
init_field_paths();
|
|
126525
|
+
init_lot_display_label();
|
|
126526
|
+
init_field_keys$5();
|
|
126527
|
+
}));
|
|
126528
|
+
//#endregion
|
|
126468
126529
|
//#region src/domain/table/business/material/material-substitution/actions/scan.ts
|
|
126469
126530
|
/** SN / 工序属于行上下文,不影响该行是否可承接扫码结果。 */
|
|
126470
126531
|
function isEmptyMaterialSubstitutionRow(row) {
|
|
@@ -126481,15 +126542,34 @@ var init_scan$2 = __esmMin((() => {
|
|
|
126481
126542
|
init_data();
|
|
126482
126543
|
init_core$1();
|
|
126483
126544
|
init_scan_action();
|
|
126545
|
+
init_production_identification_scan_api();
|
|
126484
126546
|
init_field_keys$5();
|
|
126547
|
+
init_scan_fill$1();
|
|
126485
126548
|
handleMaterialSubstitutionScan = async (ctx, input) => {
|
|
126486
126549
|
const fillData = resolveScanFillData(input);
|
|
126487
126550
|
if (!Object.keys(fillData).length) {
|
|
126488
126551
|
GctMessage.warning("未配置条码字段映射");
|
|
126489
126552
|
return;
|
|
126490
126553
|
}
|
|
126554
|
+
const parsed = resolveScanParsedValue(input);
|
|
126555
|
+
if (!parsed || !hasProductionIdentificationScanKey(parsed)) {
|
|
126556
|
+
GctMessage.error(PRODUCTION_IDENTIFICATION_SCAN_LOT_OR_UNIQUE_REQUIRED_MSG);
|
|
126557
|
+
return;
|
|
126558
|
+
}
|
|
126559
|
+
const records = await matchProductionIdentificationScanRecords(parsed);
|
|
126560
|
+
if (records == null) return;
|
|
126561
|
+
if (!records.length) {
|
|
126562
|
+
GctMessage.error(PRODUCTION_IDENTIFICATION_SCAN_NOT_FOUND_MSG);
|
|
126563
|
+
return;
|
|
126564
|
+
}
|
|
126565
|
+
const selected = await pickProductionIdentificationScanRecord(records.map(normalizeMaterialSubstitutionScanRecord));
|
|
126566
|
+
if (!selected) return;
|
|
126567
|
+
if (isBlank$1(selected.product_id_)) {
|
|
126568
|
+
GctMessage.error(PRODUCTION_IDENTIFICATION_SCAN_NOT_FOUND_MSG);
|
|
126569
|
+
return;
|
|
126570
|
+
}
|
|
126491
126571
|
const { doc, subFieldKey } = ctx;
|
|
126492
|
-
const rowIndex = appendOrFillScanRow(doc, subFieldKey, fillData, isEmptyMaterialSubstitutionRow);
|
|
126572
|
+
const rowIndex = appendOrFillScanRow(doc, subFieldKey, buildMaterialSubstitutionScanRow(selected, fillData), isEmptyMaterialSubstitutionRow);
|
|
126493
126573
|
await doc.dataManager.whenEmitSettled();
|
|
126494
126574
|
await hydrateSubtableRowLabels(doc, subFieldKey, [rowIndex]);
|
|
126495
126575
|
};
|