| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686 |
- <template>
- <view class="">
- <view class="sticky-subsection" :style="{ top: `${stickyTop}px` }">
- <view class="subsection-wrap">
- <u-subsection
- fontSize="25"
- mode="subsection"
- :list="tabList"
- :current="curNow"
- @change="sectionChange"
- activeColor="#157A2C"
- ></u-subsection>
- </view>
- </view>
- <view
- class="sticky-subsection-placeholder"
- :style="{ height: `${stickyPlaceholderHeight}px` }"
- ></view>
- <!-- Tab 0: 入库单详情 -->
- <view v-show="curNow === 0" class="basic_info">
- <view class="info_header">
- <view class="info_title">入库单详情</view>
- <u-gap height="4" bgColor="#1890FF"></u-gap>
- </view>
- <view class="info_content">
- <u-row>
- <u-col span="4">
- <view class="label">物品名称:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ form.categoryName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">物品编码:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ form.categoryCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">物品分类:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ form.categoryLevelName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">包装数量:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ totalPackage || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">计量数量:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ totalCount || "—" }}</view>
- </u-col>
- </u-row>
- </view>
- </view>
- <!-- Tab 1: 基本信息 -->
- <view v-show="curNow === 1" class="basic_info">
- <view class="info_header">
- <view class="info_title">基本信息</view>
- <u-gap height="4" bgColor="#1890FF"></u-gap>
- </view>
- <view class="info_content">
- <u-row>
- <u-col span="4">
- <view class="label">物品类型:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ assetTypeLabel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">入库类型:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ bizTypeLabel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">单据来源:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.sourceBizNo || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">入库时间:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.storageTime || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">入库登记人:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.createUserName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">审核人:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.approvalUserName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">备注:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.remark || "—" }}</view>
- </u-col>
- </u-row>
- </view>
- </view>
- <!-- Tab 2: 产品信息 -->
- <view v-show="curNow === 2" class="basic_info">
- <view class="info_header">
- <view class="info_title">产品信息</view>
- <u-gap height="4" bgColor="#1890FF"></u-gap>
- </view>
- <view v-if="!productList.length" class="empty_text"> 暂无产品信息 </view>
- <view v-for="(row, idx) in productList" :key="idx" class="card_box">
- <view class="card_title">产品 {{ idx + 1 }}</view>
- <u-row>
- <u-col span="3">
- <view class="label">编码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">名称:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">牌号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.brandNum || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">型号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryModel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">规格:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.specification || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">批次号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.batchNo || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">包装数量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(
- row.packingQuantityDisplay,
- row.packingQuantity,
- row.packingUnit,
- )
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">计量数量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(
- row.measureQuantityDisplay,
- row.measureQuantity,
- row.measureUnit,
- )
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">重量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(row.weightDisplay, row.weight, row.weightUnit)
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">包装规格:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.packingSpecification || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">仓库:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.warehouseName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">供应商:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.supplierName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">供应商代号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.supplierCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">机型:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ formatField(row.modelKey) }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">颜色:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ formatField(row.colorKey) }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">生产要求:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.productionRequirements || "—" }}</view>
- </u-col>
- </u-row>
- </view>
- </view>
- <!-- Tab 3: 包装明细 -->
- <view v-show="curNow === 3" class="basic_info">
- <view class="info_header">
- <view class="info_title">包装明细</view>
- <u-gap height="4" bgColor="#1890FF"></u-gap>
- </view>
- <view v-if="!packingList.length" class="empty_text"> 暂无包装明细 </view>
- <view v-for="(row, idx) in packingList" :key="idx" class="card_box">
- <view class="card_title">包装 {{ idx + 1 }}</view>
- <u-row>
- <u-col span="3">
- <view class="label">编码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">名称:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">批次号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.batchNo || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">包装编码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.packageNo || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">包装数量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(
- row.packingQuantityDisplay,
- row.packingQuantity,
- row.packingUnit,
- )
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">计量数量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(
- row.measureQuantityDisplay,
- row.measureQuantity,
- row.measureUnit,
- )
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">重量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(row.weightDisplay, row.weight, row.weightUnit)
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">仓库:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.warehouseName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">物料代号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.materielDesignation || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">客户代号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.clientCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">发货条码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.barcodes || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">刻码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.engrave || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">供应商:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.supplierName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">供应商代号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.supplierCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">机型:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ formatField(row.modelKey) }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">颜色:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ formatField(row.colorKey) }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">质检结果:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.resultLabel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">质检状态:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.statusLabel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">生产日期:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.productionDate || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">采购日期:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.purchaseDate || "—" }}</view>
- </u-col>
- </u-row>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getStorageDetail,
- allCategoryLevel,
- getLoginUser,
- } from "@/api/wt/index.js";
- import {
- getListByNameOrModeType,
- getCategoryPackageDisposition,
- getCode,
- getAssetNum,
- isVerifyRepeatIsStock,
- } from "@/api/warehouseManagement/index.js";
- const INPUT_SCENE_STATE = [
- { code: 1, label: "生产入库" },
- { code: 2, label: "采购入库" },
- { code: 3, label: "退货入库" },
- { code: 4, label: "委外入库" },
- { code: 5, label: "受托入库" },
- { code: 6, label: "调拨入库" },
- { code: 7, label: "委外退货入库" },
- { code: 8, label: "委外采购入库" },
- { code: 9, label: "仓库委外入库" },
- { code: 10, label: "采购退货入库" },
- { code: 99, label: "其他入库" },
- ];
- const QUALITY_RESULTS = {
- 0: "无",
- 1: "合格",
- 2: "不合格",
- 3: "让步接收",
- };
- const QUALITY_STATUS = {
- 0: "未质检",
- 1: "待检",
- 2: "已质检",
- };
- export default {
- props: {
- businessId: {
- default: "",
- },
- taskDefinitionKey: {
- default: "",
- },
- },
- data() {
- return {
- form: {},
- formData: {
- type: 1,
- bizType: "",
- sourceBizNo: "",
- storageTime: "",
- createUserId: "",
- createUserName: "",
- approvalUserId: "",
- approvalUserName: "",
- remark: "",
- extInfo: {
- assetType: [],
- assetTypeName: "",
- deptCode: "",
- deptName: "",
- createUserName: "",
- createUserId: "",
- deliveryPhone: "",
- documentSource: "",
- supplierName: "",
- },
- outInDetailList: [],
- },
- tabList: ["入库单详情", "基本信息", "产品信息", "包装明细"],
- curNow: 0,
- productList: [],
- packingList: [],
- assetTypeMapping: {},
- isDetail: false,
- totalPackage: "",
- totalCount: "",
- stickyPlaceholderHeight: 0,
- stickyTop: 44,
- };
- },
- computed: {
- bizType() {
- return this.taskDefinitionKey === "wmsBizType4" ? 4 : 1;
- },
- bizTypeLabel() {
- const item = INPUT_SCENE_STATE.find(
- (s) => s.code === Number(this.formData.bizType),
- );
- return item ? item.label : "";
- },
- assetTypeLabel() {
- const types = this.formData.extInfo.assetType;
- if (Array.isArray(types)) {
- return types
- .map((id) => this.assetTypeMapping[id] || "")
- .filter(Boolean)
- .join("、");
- }
- if (typeof types === "string" && types) {
- return types
- .split(",")
- .map((id) => this.assetTypeMapping[id.trim()] || "")
- .filter(Boolean)
- .join("、");
- }
- return "";
- },
- },
- async mounted() {
- this.initStickyTop();
- await this.loadAssetTypeMapping();
- await this.getDetailData(this.businessId);
- await this.getLoginUserData();
- this.updateStickyPlaceholderHeight();
- },
- methods: {
- padNumber(n) {
- return n < 10 ? `0${n}` : String(n);
- },
- arrayIncludes(list, value) {
- return Array.isArray(list) && list.indexOf(value) !== -1;
- },
- initStickyTop() {
- try {
- const systemInfo = uni.getSystemInfoSync();
- const statusBarHeight = Number(systemInfo.statusBarHeight || 0);
- // `uni-nav-bar` 在开启 statusBar 后,内容区默认高度约为 44px。
- this.stickyTop = statusBarHeight + 44;
- } catch (error) {
- this.stickyTop = 50;
- }
- },
- updateStickyPlaceholderHeight() {
- this.$nextTick(() => {
- const query = uni.createSelectorQuery().in(this);
- query
- .select(".sticky-subsection")
- .boundingClientRect((rect) => {
- if (rect && rect.height) {
- this.stickyPlaceholderHeight = rect.height;
- }
- })
- .exec();
- });
- },
- sectionChange(index) {
- this.curNow = index;
- },
- formatField(val) {
- if (Array.isArray(val)) return val.join(",") || "—";
- return val || "—";
- },
- formatValueWithUnit(displayValue, value, unit) {
- if (displayValue || displayValue === 0 || displayValue === "0") {
- return String(displayValue);
- }
- if (value === null || value === undefined || value === "") {
- return "—";
- }
- return `${value}${unit || ""}`;
- },
- async loadAssetTypeMapping() {
- try {
- const data = await allCategoryLevel();
- const list = Array.isArray(data) ? data : data?.data || [];
- const obj = {};
- list.forEach((item) => {
- obj[item.id] = item.name;
- });
- this.assetTypeMapping = obj;
- } catch (e) {
- console.warn("加载物品分类失败", e);
- }
- },
- async getDetailData(id) {
- try {
- const data = await getStorageDetail(id);
- this.form = data;
- this.isDetail = data.detailList?.[0]?.isAllPackageData == 1;
- this.totalPackage = this.isDetail
- ? (data.detailList[0].packingCount || "") +
- (data.detailList[0]?.packingUnit || "")
- : data.detailList.length + (data.detailList[0]?.packingUnit || "");
- this.totalCount =
- (data.totalCount || "") + (data.detailList?.[0]?.measuringUnit || "");
- this.form.detailList = (data.detailList || []).map((item) => ({
- ...item,
- productName: item.categoryName,
- productCode: item.categoryCode,
- }));
- let categoryLevelTopIds = data.detailList.map(
- (item) => item.rootCategoryLevelId,
- );
- let filterCategoryLevelTopIds = [
- ...new Set(categoryLevelTopIds.filter(Boolean)),
- ];
- data.categoryLevelTopId = filterCategoryLevelTopIds.join(",");
- if (this.taskDefinitionKey === "wmsBizType4") {
- this.form.totalCount = data.detailList.reduce(
- (sum, item) => sum + (item.quantity || 0),
- 0,
- );
- }
- await this.initFormData();
- await this.initProducts();
- } catch (e) {
- console.warn("获取入库单详情失败", e);
- }
- },
- async initFormData() {
- this.formData.type = 1;
- this.formData.bizType = this.bizType;
- this.formData.sourceBizNo = this.form.code || "";
- const categoryLevelTopIds = (this.form.detailList || [])
- .map((item) => item.rootCategoryLevelId)
- .filter(Boolean);
- this.formData.extInfo.assetType = [...new Set(categoryLevelTopIds)];
- this.formData.extInfo.documentSource = this.form.code || "";
- this.formData.extInfo.supplierName = this.form.supplierName || "";
- this.getNowFormatDate();
- },
- getNowFormatDate() {
- const now = new Date();
- const pad = (n) => this.padNumber(n);
- this.formData.storageTime = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
- },
- async getLoginUserData() {
- try {
- const data = await getLoginUser();
- this.formData.createUserId =
- this.form.createUserId || data.userId || "";
- this.formData.createUserName =
- this.form.createUserName || data.name || "";
- this.formData.approvalUserId =
- this.form.approvalUserId || data.userId || "";
- this.formData.approvalUserName =
- this.form.approvalUserName || data.name || "";
- this.formData.extInfo.createUserId =
- this.form.createUserId || data.userId || "";
- this.formData.extInfo.createUserName =
- this.form.createUserName || data.name || "";
- this.formData.extInfo.deliveryPhone = data.phone || "";
- this.formData.extInfo.deptName =
- this.form.deptName || data.deptName || "";
- } catch (e) {
- console.warn("获取登录用户数据失败", e);
- }
- },
- async initProducts() {
- const detailList = this.form.detailList || [];
- if (!detailList.length) return;
- const codeList = detailList
- .map((item) => item.productCode || item.categoryCode)
- .filter(Boolean);
- if (!codeList.length) {
- this.buildFromDetailList(detailList);
- return;
- }
- try {
- const categoryList = await getListByNameOrModeType({ codeList });
- if (!categoryList || !categoryList.length) {
- this.buildFromDetailList(detailList);
- return;
- }
- const assetTypes = [
- ...new Set(
- categoryList
- .map((item) => item.categoryLevelPathIdParent)
- .filter(Boolean),
- ),
- ];
- if (assetTypes.length) {
- this.formData.extInfo.assetType = assetTypes;
- }
- let batchNo = "";
- try {
- batchNo = await getCode("lot_number_code");
- } catch (e) {
- console.warn("获取批次号失败", e);
- }
- let packingSpecs = [];
- try {
- packingSpecs = await getCategoryPackageDisposition({
- categoryIds: categoryList.map((item) => item.id),
- });
- } catch (e) {
- console.warn("获取包装规格失败", e);
- }
- const isMoreProduct = categoryList.length > 1;
- this.productList = categoryList.map((item, index) => {
- const detail =
- detailList.find(
- (d) => item.code === (d.productCode || d.categoryCode),
- ) ||
- detailList[index] ||
- {};
- const weightUnit = item.weightUnit || "";
- const itemPackingSpecs = (packingSpecs || [])
- .filter((s) => s.categoryId === item.id)
- .sort((a, b) => a.sort - b.sort);
- const packingSpecLabel = itemPackingSpecs
- .map((s) =>
- s.sort > 0
- ? `${s.packageCell}${s.packageUnit}/${s.conversionUnit}`
- : null,
- )
- .filter(Boolean)
- .join(", ");
- let packingQuantity,
- measureQuantity,
- packUnit,
- measureUnit,
- warehouseId,
- warehouseName,
- warehouseIds,
- warehouseNames,
- modelKey,
- colorKey,
- packingUnitId;
- if (this.isDetail) {
- // isAllPackageData==1: 对齐PC端 saleProductList 路径
- packUnit = detail.packingUnit || item.packingUnit || "";
- measureUnit = detail.measuringUnit || item.measuringUnit || "";
- packingQuantity = detail.packingCount || detail.quantity || 0;
- measureQuantity = detail.quantity || 0;
- warehouseId = detail.warehouseId || "";
- warehouseName = detail.warehouseName || "";
- warehouseIds = detail.warehouseId ? [detail.warehouseId] : [];
- warehouseNames = detail.warehouseName ? [detail.warehouseName] : [];
- modelKey = detail.modelKey ? detail.modelKey.split(",") : "";
- colorKey = detail.colorKey ? detail.colorKey.split(",") : "";
- packingUnitId = detail.purchaseUnitId || detail.saleUnitId || "";
- } else {
- // isAllPackageData!=1: 对齐PC端 detailList 路径
- packUnit = item.packingUnit || "";
- measureUnit = item.measuringUnit || "";
- const matchDetails = detailList.filter(
- (d) => (d.productCode || d.categoryCode) === item.code,
- );
- packingQuantity = isMoreProduct
- ? matchDetails.length
- : detailList.length;
- measureQuantity = isMoreProduct
- ? matchDetails.reduce((sum, d) => sum + (d.quantity || 0), 0)
- : this.form.totalCount || 0;
- if (isMoreProduct) {
- warehouseId = matchDetails[0]?.warehouseId || "";
- warehouseName = matchDetails[0]?.warehouseName || "";
- warehouseIds = matchDetails.map((d) => d.warehouseId);
- warehouseNames = matchDetails.map((d) => d.warehouseName);
- } else {
- warehouseId = this.form.warehouseId || "";
- warehouseName = this.form.warehouseName || "";
- warehouseIds = Array(detailList.length).fill(
- this.form.warehouseId || "",
- );
- warehouseNames = Array(detailList.length).fill(
- this.form.warehouseName || "",
- );
- }
- if (this.bizType == 1) {
- modelKey = this.form.modelKey
- ? this.form.modelKey.split(",")
- : "";
- colorKey = this.form.colorKey
- ? this.form.colorKey.split(",")
- : "";
- } else {
- modelKey = item.modelKey ? item.modelKey.split(",") : "";
- colorKey = item.colorKey ? item.colorKey.split(",") : "";
- }
- packingUnitId = "";
- }
- let weight = detail.weight || 0;
- if (
- (detail.sendTotalWeight || detail.receiveTotalWeight) &&
- item.weightUnit === item.measuringUnit
- ) {
- weight = detail.sendTotalWeight || detail.receiveTotalWeight;
- }
- const singleWeight = detail.singleWeight || 0;
- if (!weight && singleWeight) {
- weight = singleWeight * measureQuantity;
- }
- return {
- index,
- categoryId: item.id,
- categoryName: item.name,
- categoryCode: item.code,
- categoryModel: item.modelType || "",
- specification: item.specification || "",
- brandNum: item.brandNum || "",
- batchNo: this.isDetail
- ? detail.batchNo || batchNo
- : this.arrayIncludes([1, 3, 6], this.bizType)
- ? detailList[0]?.batchNo || batchNo
- : batchNo,
- packingQuantity,
- packingUnit: packUnit,
- packingQuantityDisplay:
- packingQuantity !== 0 ? `${packingQuantity}${packUnit}` : "",
- measureQuantity,
- measureUnit: measureUnit,
- measuringUnit: measureUnit,
- measureQuantityDisplay:
- measureQuantity !== 0 ? `${measureQuantity}${measureUnit}` : "",
- measureType: item.measureType,
- weight,
- weightUnit,
- weightDisplay: weight !== 0 ? `${weight}${weightUnit}` : "",
- singleWeight,
- warehouseId,
- warehouseName,
- warehouseIds,
- warehouseNames,
- supplierName: detail.supplierName || item.supplierName || "",
- supplierCode: detail.supplierCode || item.supplierCode || "",
- supplierId: detail.supplierId || this.form.supplierId || "",
- productionRequirements: detail.productionRequirements || "",
- packingSpecification:
- item.packingSpecification || packingSpecLabel || "",
- packingSpecificationOption: itemPackingSpecs,
- packingUnitId,
- modelKey,
- colorKey,
- netWeight: item.netWeight > -1 ? item.netWeight : 0,
- isUnpack: item.isUnpack,
- qualityControl: detail.qualityControl,
- extField: item.extField || {},
- isSave: true,
- outInDetailRecordRequestList: [],
- };
- });
- await this.buildPackingList(batchNo);
- console.log("this.productList", this.productList);
- this.formData.outInDetailList = this.productList;
- } catch (e) {
- console.warn("初始化产品数据失败", e);
- this.buildFromDetailList(detailList);
- }
- },
- buildFromDetailList(detailList) {
- this.productList = detailList.map((item, index) => {
- const packUnit = item.packingUnit || "";
- const measureUnit = item.measuringUnit || "";
- const pQty = item.packingCount || item.quantity || 0;
- const mQty = item.quantity || item.measureQuantity || 0;
- return {
- index,
- categoryId: item.categoryId || item.id || "",
- categoryName: item.categoryName || "",
- categoryCode: item.categoryCode || "",
- categoryModel: item.modelType || "",
- specification: item.specification || "",
- brandNum: item.brandNum || "",
- batchNo: item.batchNo || "",
- packingQuantity: pQty,
- packingUnit: packUnit,
- packingQuantityDisplay: pQty ? `${pQty}${packUnit}` : "",
- measureQuantity: mQty,
- measureUnit: measureUnit,
- measuringUnit: measureUnit,
- measureQuantityDisplay: mQty ? `${mQty}${measureUnit}` : "",
- weight: item.weight || 0,
- weightUnit: item.weightUnit || "",
- weightDisplay: item.weight
- ? `${item.weight}${item.weightUnit || ""}`
- : "",
- singleWeight: item.singleWeight || 0,
- warehouseId: item.warehouseId || "",
- warehouseName: item.warehouseName || "",
- warehouseIds: item.warehouseId ? [item.warehouseId] : [],
- warehouseNames: item.warehouseName ? [item.warehouseName] : [],
- supplierName: item.supplierName || "",
- supplierCode: item.supplierCode || "",
- supplierId: item.supplierId || "",
- productionRequirements: item.productionRequirements || "",
- packingSpecification: item.packingSpecification || "",
- isSave: true,
- outInDetailRecordRequestList: [],
- };
- });
- this.productList.forEach((product) => {
- product.outInDetailRecordRequestList = [
- this.buildDefaultPackingEntry(product),
- ];
- });
- this.packingList = this.productList.reduce((list, product) => {
- return list.concat(product.outInDetailRecordRequestList || []);
- }, []);
- this.formData.outInDetailList = this.productList;
- },
- buildDefaultPackingEntry(product) {
- const detail =
- (this.form.detailList || []).find(
- (d) => (d.productCode || d.categoryCode) === product.categoryCode,
- ) || {};
- return {
- packageNo: "",
- categoryCode: product.categoryCode,
- categoryName: product.categoryName,
- batchNo: product.batchNo,
- packingQuantity: product.packingQuantity,
- packingUnit: product.packingUnit,
- packingQuantityDisplay: product.packingQuantityDisplay,
- measureQuantity: product.measureQuantity,
- measureUnit: product.measureUnit,
- measureQuantityDisplay: product.measureQuantityDisplay,
- weight: product.weight,
- weightUnit: product.weightUnit,
- weightDisplay: product.weightDisplay,
- warehouseId: product.warehouseId,
- warehouseName: product.warehouseName,
- materielDesignation: "",
- clientCode: "",
- barcodes: "",
- engrave: "",
- supplierName: product.supplierName,
- supplierCode: product.supplierCode,
- result: 0,
- status: 0,
- resultLabel: QUALITY_RESULTS[0],
- statusLabel: QUALITY_STATUS[0],
- productionDate: "",
- purchaseDate: "",
- modelKey: product.modelKey || "",
- colorKey: product.colorKey || "",
- workOrderId: detail.workOrderId || "",
- taskId: detail.taskId || "",
- };
- },
- _getNowDateStr() {
- const now = new Date();
- const pad = (n) => this.padNumber(n);
- return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
- },
- _isNonSplitUnit(unit) {
- if (!unit) return false;
- const u = unit.toUpperCase();
- return this.arrayIncludes(["KG", "G", "L", "ML"], u) || unit === "立方";
- },
- async buildPackingList(batchNo) {
- const detailList = this.form.detailList || [];
- const isMoreProduct = this.productList.length > 1;
- let productionDate = "";
- let purchaseDate = "";
- if (this.bizType == 1) {
- productionDate = this._getNowDateStr();
- }
- if (this.isDetail) {
- // isAllPackageData == 1: 对齐PC端 saleProductList → batchSave → generateWrappers 路径
- // 从 productList 生成包装明细
- try {
- for (const product of this.productList) {
- if (!product.packingQuantity || product.packingQuantity <= 0)
- continue;
- const packingSpecOption = product.packingSpecificationOption || [];
- const packingBoolen = this._isNonSplitUnit(product.packingUnit);
- const measureBoolen = this._isNonSplitUnit(product.measureUnit);
- let packingNum = Number(product.packingQuantity);
- let filterArr = [];
- if (packingBoolen) {
- if (!product.isUnpack && product.packingUnit === "立方") {
- packingNum = 1;
- } else {
- filterArr = packingSpecOption.filter(
- (s) =>
- s.packageUnit === product.packingUnit &&
- s.packageUnit !== s.conversionUnit,
- );
- if (filterArr.length) {
- packingNum = Math.ceil(
- product.packingQuantity / filterArr[0].packageCell,
- );
- }
- }
- } else {
- if (product.isUnpack) {
- if (measureBoolen) {
- let splitIndex = packingSpecOption.findIndex(
- (s) =>
- s.conversionUnit === product.packingUnit &&
- s.packageUnit !== s.conversionUnit,
- );
- let num = product.packingQuantity;
- for (; splitIndex > 1; splitIndex--) {
- num = num * packingSpecOption[splitIndex].packageCell;
- }
- packingNum = Math.ceil(num);
- } else {
- if (product.packingUnitId) {
- let splitIndex = packingSpecOption.findIndex(
- (s) => s.id == product.packingUnitId,
- );
- if (splitIndex == 0) {
- packingNum = Math.ceil(
- product.measureQuantity /
- (packingSpecOption[1]?.packageCell || 1),
- );
- } else if (splitIndex == 1) {
- packingNum = product.packingQuantity;
- } else {
- for (; splitIndex > 1; splitIndex--) {
- packingNum = Math.ceil(
- product.packingQuantity *
- packingSpecOption[splitIndex].packageCell,
- );
- }
- }
- } else if (packingSpecOption[1]?.packageCell) {
- packingNum = Math.ceil(
- product.measureQuantity /
- packingSpecOption[1].packageCell,
- );
- filterArr = packingSpecOption.filter(
- (s) =>
- s.packageUnit === product.packingUnit &&
- s.packageUnit !== s.conversionUnit,
- );
- }
- }
- } else {
- if (product.measureUnit === product.packingUnit) {
- packingNum = 0;
- } else {
- packingNum = Number(product.packingQuantity);
- }
- }
- }
- if (packingNum <= 0) packingNum = 1;
- let packageNos = [];
- try {
- const assetNumRes = await getAssetNum([
- {
- assetCode: product.categoryCode + product.index,
- batchNum: product.batchNo,
- num: packingNum,
- },
- ]);
- packageNos = assetNumRes?.data || [];
- } catch (e) {
- console.warn("获取包装编码失败", e);
- }
- const qualityStatus = product.qualityControl == 1 ? 0 : 2;
- const packingEntries = [];
- for (let i = 0; i < packageNos.length; i++) {
- let measureQuantity = 1;
- let packingQuantity = 1;
- if (packingBoolen) {
- const cell = filterArr[0]?.packageCell || 1;
- measureQuantity =
- Number(product.packingQuantity) > cell * (i + 1)
- ? cell
- : Number(product.packingQuantity) - cell * i;
- } else {
- if (
- product.weightUnit === product.measureUnit &&
- product.weight
- ) {
- measureQuantity =
- Math.trunc((product.weight / packageNos.length) * 10000) /
- 10000;
- } else if (measureBoolen) {
- let splitIndex = packingSpecOption.findIndex(
- (s) =>
- s.conversionUnit === product.packingUnit &&
- s.packageUnit !== s.conversionUnit,
- );
- measureQuantity = 1;
- for (; splitIndex > 0; splitIndex--) {
- measureQuantity =
- measureQuantity *
- packingSpecOption[splitIndex].packageCell;
- }
- } else {
- measureQuantity = packingSpecOption[1]?.packageCell || 1;
- }
- }
- let clientCode = "";
- if (this.bizType == 2) {
- clientCode = product.customerMark || "";
- } else {
- clientCode = product.extInfo?.clientCode || "";
- }
- let packingUnit = product.packingUnit;
- if (product.isUnpack) {
- if (packingBoolen) {
- packingUnit =
- packingSpecOption[1]?.conversionUnit || product.packingUnit;
- } else if (measureBoolen) {
- packingUnit =
- (packingSpecOption[1] || packingSpecOption[0])
- ?.conversionUnit || product.packingUnit;
- } else {
- packingUnit =
- packingSpecOption[1]?.conversionUnit || product.packingUnit;
- }
- }
- let measureUnit = product.isUnpack
- ? measureBoolen
- ? (packingSpecOption[1] || packingSpecOption[0])
- ?.packageUnit || product.measureUnit
- : product.measureUnit
- : product.measureUnit;
- let weight = 0;
- if (product.weightUnit === product.measureUnit) {
- weight = measureQuantity ? Number(measureQuantity) : 0;
- } else if (product.singleWeight && measureQuantity) {
- weight = Number(measureQuantity) * Number(product.singleWeight);
- }
- packingEntries.push({
- index: product.index + "-" + i,
- warehouseId: product.warehouseId || "",
- warehouseName: product.warehouseName || "",
- categoryName: product.categoryName || "",
- categoryCode: product.categoryCode || "",
- categoryModel: product.categoryModel || "",
- specification: product.specification || "",
- supplierCode: product.supplierCode || "",
- supplierName: product.supplierName || "",
- brandNum: product.brandNum || "",
- parentIndex: product.index,
- batchNo: product.batchNo || batchNo,
- packageNo: packageNos[i]?.onlyCode || "",
- packingQuantity: packingQuantity,
- modelKey: product.modelKey || "",
- colorKey: product.colorKey || "",
- packingUnit: packingUnit,
- packingQuantityDisplay: this.formatValueWithUnit(
- "",
- packingQuantity,
- packingUnit,
- ),
- measureQuantity: measureQuantity,
- measureUnit: measureUnit,
- measureQuantityDisplay: this.formatValueWithUnit(
- "",
- measureQuantity,
- measureUnit,
- ),
- weight: weight,
- weightDisplay: this.formatValueWithUnit(
- "",
- weight,
- product.weightUnit || "",
- ),
- packingSpecificationOption:
- product.packingSpecificationOption || [],
- weightUnit: product.weightUnit || "",
- netWeight: product.netWeight || 0,
- barcodes: "",
- clientCode: clientCode,
- materielDesignation: product.extInfo?.materielCode || "",
- engrave: "",
- isUnpack: product.isUnpack,
- productionDate: productionDate,
- purchaseDate: "",
- result: 1,
- qualityControl: product.qualityControl,
- status: qualityStatus,
- resultLabel: QUALITY_RESULTS[1] || "合格",
- statusLabel: QUALITY_STATUS[qualityStatus] || "未质检",
- workOrderId: "",
- taskId: "",
- });
- }
- // 处理尾包余数
- if (
- product.weightUnit !== product.measureUnit &&
- packingSpecOption[1]?.packageCell
- ) {
- const remainder =
- product.measureQuantity % packingSpecOption[1].packageCell;
- if (remainder > 0 && packingEntries.length > 0) {
- const lastEntry = packingEntries[packingEntries.length - 1];
- lastEntry.measureQuantity = remainder;
- lastEntry.measureQuantityDisplay = this.formatValueWithUnit(
- "",
- remainder,
- lastEntry.measureUnit,
- );
- if (product.singleWeight) {
- lastEntry.weight = product.singleWeight * remainder;
- lastEntry.weightDisplay = this.formatValueWithUnit(
- "",
- lastEntry.weight,
- lastEntry.weightUnit,
- );
- }
- }
- }
- product.outInDetailRecordRequestList = packingEntries;
- this.packingList.push(...packingEntries);
- }
- } catch (e) {
- console.warn("生成包装明细失败", e);
- }
- } else {
- // isAllPackageData != 1: 对齐PC端 detailList 路径
- // detailList 每条记录即是一个包装, 直接映射
- const product0 = this.productList[0] || {};
- let getAssetNumPr = isMoreProduct
- ? detailList.map((val) => ({
- assetCode: val.productCode,
- batchNum: val.productBrand ? val.productBrand : val.batchNo,
- num: 1,
- }))
- : [
- {
- assetCode:
- (product0.categoryCode || "") + (product0.index ?? 0),
- batchNum: product0.batchNo || "",
- num: detailList.length,
- },
- ];
- let packingCodeList = [];
- try {
- const assetNumRes = await getAssetNum(getAssetNumPr);
- packingCodeList = assetNumRes?.data || [];
- } catch (e) {
- console.warn("获取包装编码失败", e);
- }
- this.packingList = detailList.map((item, index) => {
- const matchProduct = isMoreProduct
- ? this.productList.find(
- (val) => val.categoryCode === item.productCode,
- ) || product0
- : product0;
- let clientCode = "";
- if (this.bizType == 2) {
- clientCode = item.customerMark || "";
- } else {
- clientCode = item.clientCode || item.extInfo?.clientCode || "";
- }
- return {
- index:
- (isMoreProduct ? matchProduct.index : product0.index) +
- "-" +
- index,
- warehouseId:
- item.warehouseId || (product0.warehouseIds || [])[index] || "",
- warehouseName:
- item.warehouseName ||
- (product0.warehouseNames || [])[index] ||
- "",
- categoryName: item.productName || product0.categoryName || "",
- categoryCode: item.productCode || product0.categoryCode || "",
- categoryModel: item.modelType || product0.categoryModel || "",
- specification: item.specification || product0.specification || "",
- brandNum: item.productBrand || product0.brandNum || "",
- colorKey:
- (item.colorKey ? item.colorKey.split(",") : "") ||
- product0.colorKey ||
- "",
- modelKey:
- (item.modelKey ? item.modelKey.split(",") : "") ||
- product0.modelKey ||
- "",
- parentIndex: isMoreProduct ? matchProduct.index : product0.index,
- batchNo: product0.batchNo || batchNo,
- packageNo:
- item.packageNo ||
- item.packingCode ||
- packingCodeList[index]?.onlyCode ||
- "",
- packingQuantity: 1,
- packingUnit: item.packingUnit || "",
- packingQuantityDisplay: this.formatValueWithUnit(
- "",
- 1,
- item.packingUnit || "",
- ),
- measureQuantity: item.quantity || item.measureQuantity || 0,
- measureUnit: item.measuringUnit || item.measureUnit || "",
- measureQuantityDisplay: this.formatValueWithUnit(
- "",
- item.quantity || item.measureQuantity || 0,
- item.measuringUnit || item.measureUnit || "",
- ),
- supplierCode: item.supplierCode || "",
- supplierId: item.supplierId || "",
- supplierName: item.supplierName || "",
- weight: item.packingWeight || 0,
- weightDisplay: this.formatValueWithUnit(
- "",
- item.packingWeight || 0,
- item.weightUnit || product0.weightUnit || "",
- ),
- singleWeight: item.singleWeight || 0,
- pricingWay: item.pricingWay || "",
- weightUnit: item.weightUnit || product0.weightUnit || "",
- packingSpecificationOption: isMoreProduct
- ? matchProduct.packingSpecificationOption || []
- : product0.packingSpecificationOption || [],
- netWeight: product0.netWeight || 0,
- barcodes: item.barcodes || item.sendCode || "",
- clientCode: clientCode,
- materielDesignation:
- item.materielDesignation || item.extInfo?.materielCode || "",
- engrave: item.engrave || item.extInfo?.engrave || "",
- isUnpack: product0.isUnpack,
- productionDate: productionDate,
- purchaseDate: purchaseDate,
- result: 1,
- status: 2,
- resultLabel: QUALITY_RESULTS[1] || "合格",
- statusLabel: QUALITY_STATUS[2] || "已质检",
- serialNumber: item.productSequence || "",
- workOrderId: item.workOrderId || "",
- taskId: item.taskId || "",
- };
- });
- this.productList.forEach((product) => {
- product.outInDetailRecordRequestList = this.packingList.filter(
- (p) => p.categoryCode === product.categoryCode,
- );
- });
- }
- },
- async getReturnStorage() {
- if (!this.productList.length) {
- uni.showToast({ title: "暂无产品信息!", icon: "none" });
- return null;
- }
- const detailList = this.form.detailList || [];
- const _packingList = this.packingList.map((packingItem) => {
- let _workOrderId = null;
- let _taskId = null;
- if (this.arrayIncludes([1], this.bizType)) {
- _workOrderId = detailList[0]?.workOrderId;
- _taskId = detailList[0]?.taskId;
- }
- const processed = { ...packingItem };
- if (processed.modelKey) {
- processed.modelKey = processed.modelKey.toString();
- }
- if (processed.colorKey) {
- processed.colorKey = processed.colorKey.toString();
- }
- return {
- ...processed,
- workOrderId: _workOrderId,
- taskId: _taskId,
- materialDetailList: [],
- };
- });
- const processedProductList = this.productList.map((productItem) => {
- const processed = { ...productItem };
- if (processed.modelKey) {
- processed.modelKey = processed.modelKey.toString();
- }
- if (processed.colorKey) {
- processed.colorKey = processed.colorKey.toString();
- }
- return {
- ...processed,
- outInDetailRecordRequestList: _packingList.filter(
- (item) => item.parentIndex === productItem.index,
- ),
- };
- });
- const obj = JSON.parse(JSON.stringify(this.formData));
- obj.type = 1;
- if (Array.isArray(obj.extInfo.assetType)) {
- obj.extInfo.assetType = obj.extInfo.assetType.join(",");
- }
- obj.extInfo.documentSource = obj.sourceBizNo;
- obj.extInfo.deptName = this.formData.extInfo.deptName || "";
- obj.extInfo.supplierName = this.form.supplierName || "";
- const warehouseId = [];
- const warehouseName = [];
- processedProductList.forEach((item) => {
- const ids = item.warehouseIds || [];
- const names = item.warehouseNames || [];
- ids.forEach((id, idx) => {
- if (id && warehouseId.indexOf(id) === -1) {
- warehouseId.push(id);
- warehouseName.push(names[idx] || "");
- }
- });
- });
- obj.warehouseIds = warehouseId;
- obj.warehouseNames = warehouseName;
- obj.outInDetailList = processedProductList;
- obj._packingList = _packingList;
- try {
- const isVerifyData = await isVerifyRepeatIsStock({
- categoryCodes: this.productList.map((item) => item.categoryCode),
- batchNos: this.productList.map((item) => item.batchNo),
- });
- if (isVerifyData?.length) {
- return new Promise((resolve) => {
- uni.showModal({
- title: "提示",
- content: `当前批次:${isVerifyData[0].batchNo},物品${isVerifyData
- .map((item) => item.categoryName)
- .join(",")}已有入库记录,是否继续入库!`,
- confirmText: "是",
- cancelText: "否",
- success: (modalRes) => {
- if (modalRes.confirm) {
- resolve(obj);
- } else {
- resolve(false);
- }
- },
- });
- });
- }
- } catch (e) {
- console.warn("验证重复入库失败", e);
- }
- return obj;
- },
- async getTableValue() {
- const returnStorageData = await this.getReturnStorage();
- return {
- form: this.form,
- returnStorageData: returnStorageData || {},
- };
- },
- },
- };
- </script>
- <style lang="scss">
- .sticky-subsection {
- position: fixed;
- left: 0;
- right: 0;
- z-index: 99;
- width: 100%;
- box-sizing: border-box;
- background: #f5f7fa;
- }
- .sticky-subsection-placeholder {
- width: 100%;
- }
- .subsection-wrap {
- background: #f5f7fa;
- padding: 0 16rpx 12rpx;
- width: 100%;
- box-sizing: border-box;
- }
- .basic_info {
- box-sizing: border-box;
- padding: 0 20rpx;
- }
- .info_header {
- margin-top: 10rpx;
- }
- .info_title {
- position: relative;
- padding: 16rpx 50rpx;
- font-size: 36rpx;
- color: #606266;
- }
- .info_title::after {
- content: "";
- position: absolute;
- top: 16rpx;
- left: 0px;
- width: 16rpx;
- height: 50rpx;
- background: #1890ff;
- }
- .info_content {
- .label {
- padding: 20rpx 0;
- text-align: right;
- font-size: 28rpx;
- font-weight: 700;
- color: #6e6e6e;
- }
- .value {
- padding: 20rpx 0;
- font-size: 28rpx;
- color: #606266;
- }
- }
- .card_box {
- box-sizing: border-box;
- padding: 20rpx;
- margin: 20rpx;
- width: calc(100% - 40rpx);
- border-radius: 20rpx;
- box-shadow: 0 0 12rpx -6rpx #000;
- .card_title {
- font-size: 32rpx;
- font-weight: 700;
- color: #666;
- margin-bottom: 10rpx;
- }
- .label {
- padding: 18rpx 0;
- text-align: right;
- font-size: 28rpx;
- font-weight: 700;
- color: #6e6e6e;
- }
- .value {
- padding: 18rpx 0;
- font-size: 28rpx;
- color: #606266;
- }
- }
- .empty_text {
- text-align: center;
- color: #909399;
- font-size: 28rpx;
- padding: 80rpx 0;
- }
- </style>
|