| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391 |
- <template>
- <view class="">
- <u-sticky offset-top="50">
- <view class="subsection-wrap">
- <u-subsection
- fontSize="25"
- mode="subsection"
- :list="list"
- :current="curNow"
- @change="sectionChange"
- activeColor="#157A2C"
- ></u-subsection>
- </view>
- </u-sticky>
- <view v-show="curNow === 0" class="out-info-wrap">
- <view class="out-info-title">
- <text class="out-info-title-bar"></text>
- <text class="out-info-title-text">领料信息</text>
- </view>
- <view class="out-info-divider"></view>
- <view class="out-info-card">
- <view
- v-for="(item, index) in pickInfoItems"
- :key="index"
- class="out-info-row"
- >
- <text class="out-info-label">{{ item.label }}</text>
- <text class="out-info-value">{{ item.value || "—" }}</text>
- </view>
- </view>
- </view>
- <view v-show="curNow === 1" class="pick-list-wrap">
- <view class="out-info-title">
- <text class="out-info-title-bar"></text>
- <text class="out-info-title-text">领料清单</text>
- </view>
- <view class="out-info-divider"></view>
- <view
- v-if="!form.detailList || !form.detailList.length"
- class="pick-list-empty"
- >
- 暂无领料明细
- </view>
- <view
- v-for="(row, idx) in form.detailList"
- :key="idx"
- class="pick-list-card"
- >
- <view class="pick-list-card-head">
- <text class="pick-list-index">序号 {{ idx + 1 }}</text>
- </view>
- <view class="pick-list-card-body">
- <view
- v-for="(field, fieldIdx) in pickListFieldItems"
- :key="`${idx}-${fieldIdx}`"
- class="pick-list-row"
- >
- <text class="out-info-label">{{ field.label }}</text>
- <text class="out-info-value">{{
- formatPickListField(row, field.key)
- }}</text>
- </view>
- </view>
- </view>
- </view>
- <view v-show="curNow === 2" class="out-info-wrap">
- <view class="out-info-title">
- <text class="out-info-title-bar"></text>
- <text class="out-info-title-text">出库信息</text>
- </view>
- <view class="out-info-divider"></view>
- <view class="out-info-card">
- <view
- v-for="(item, index) in outboundInfoItems"
- :key="index"
- class="out-info-row"
- >
- <text class="out-info-label">{{ item.label }}</text>
- <text class="out-info-value">{{ item.value || "—" }}</text>
- </view>
- </view>
- </view>
- <view v-show="curNow === 3" class="outbound-wrap">
- <view class="outbound-title">
- <text class="outbound-title-bar"></text>
- <text class="outbound-title-text">出库物品清单</text>
- </view>
- <view class="out-info-divider"></view>
- <view v-if="!outboundItemRows.length" class="outbound-empty">
- 暂无出库物品明细
- </view>
- <view
- v-for="(row, index) in outboundItemRows"
- :key="index"
- class="outbound-card"
- >
- <view class="outbound-card-head">
- <text class="outbound-index">序号 {{ row.seq }}</text>
- </view>
- <view
- v-for="(line, li) in outboundItemGrid"
- :key="li"
- class="outbound-grid"
- :class="{
- 'outbound-grid-last': li === outboundItemGrid.length - 1,
- 'outbound-grid--full': !line.right,
- }"
- >
- <block v-if="line.right">
- <view class="outbound-col">
- <text class="outbound-label">{{ line.left[0] }}</text>
- <text class="outbound-value">{{ dash(row[line.left[1]]) }}</text>
- </view>
- <view class="outbound-col outbound-col-right">
- <text class="outbound-label">{{ line.right[0] }}</text>
- <text class="outbound-value">{{ dash(row[line.right[1]]) }}</text>
- </view>
- </block>
- </view>
- </view>
- </view>
- <view v-show="curNow === 4" class="outbound-wrap">
- <view class="outbound-title">
- <text class="outbound-title-bar"></text>
- <text class="outbound-title-text">包装清单</text>
- </view>
- <view class="out-info-divider"></view>
- <view v-if="!packingListRows.length" class="outbound-empty">
- 暂无包装明细
- </view>
- <view
- v-for="(row, index) in packingListRows"
- :key="index"
- class="outbound-card"
- >
- <view class="outbound-card-head">
- <text class="outbound-index">序号 {{ row.seq }}</text>
- </view>
- <view
- v-for="(line, li) in packingItemGrid"
- :key="li"
- class="outbound-grid"
- :class="{
- 'outbound-grid-last': li === packingItemGrid.length - 1,
- 'outbound-grid--full': !line.right,
- }"
- >
- <block v-if="line.right">
- <view class="outbound-col">
- <text class="outbound-label">{{ line.left[0] }}</text>
- <text class="outbound-value">{{ dash(row[line.left[1]]) }}</text>
- </view>
- <view class="outbound-col outbound-col-right">
- <text class="outbound-label">{{ line.right[0] }}</text>
- <text class="outbound-value">{{ dash(row[line.right[1]]) }}</text>
- </view>
- </block>
- <!-- <block v-if="line.right">
- <view class="outbound-col">
- <text class="outbound-label">{{ line.left[0] }}</text>
- <text
- class="outbound-value"
- :class="{ 'outbound-value--mono': line.mono }"
- >{{ dash(row[line.left[1]]) }}</text
- >
- </view>
- <view class="outbound-col outbound-col-right">
- <text class="outbound-label">{{ line.right[0] }}</text>
- <text
- class="outbound-value"
- :class="{ 'outbound-value--mono': line.mono }"
- >{{ dash(row[line.right[1]]) }}</text
- >
- </view>
- </block>
- <view v-else class="outbound-col outbound-col--full">
- <text class="outbound-label">{{ line.left[0] }}</text>
- <text class="outbound-value outbound-highlight">{{
- dash(row[line.left[1]])
- }}</text>
- </view> -->
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getPickOrderById,
- getOutInBySourceBizNo,
- allCategoryLevel,
- getLoginUser,
- getGroupList,
- getUserPageByGroupId,
- getUserById,
- } from "@/api/wt/index.js";
- import { getHierarchyFifo } from "@/api/warehouseManagement/index.js";
- const OUTPUT_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: 11, label: "自选领用出库" },
- { code: 12, label: "配料出库" },
- { code: 13, label: "质检出库" },
- { code: 14, label: "物料需求清单出库" },
- { code: 99, label: "其他出库" },
- ];
- const qualityResults = {
- 0: "无",
- 1: "合格",
- 2: "不合格",
- 3: "让步接收",
- };
- const qualityStatus = {
- 0: "未质检",
- 1: "待检",
- 2: "已质检",
- };
- /** 出库物品卡片:每行左右两列的字段 key(与 outboundItemRows 一致) */
- const OUTBOUND_ITEM_GRID = [
- { left: ["名称", "name"], right: ["编码", "code"] },
- { left: ["批次号", "batchNo"], right: ["型号", "categoryModel"] },
- { left: ["规格", "specification"], right: ["包装数量", "packQtyDisplay"] },
- { left: ["计量数量", "countDisplay"], right: ["重量", "weightDisplay"] },
- { left: ["库存数量", "stockDisplay"], right: ["锁库数", "lockDisplay"] },
- { left: ["仓库", "warehouse"], right: ["包装规格", "packingSpecification"] },
- { left: ["供应商", "supplierName"], right: ["供应商编号", "supplierCode"] },
- ];
- /** 包装清单卡片:字段 key 与 packingListRows 一致 */
- const PACKING_ITEM_GRID = [
- { left: ["名称", "name"], right: ["编码", "code"] },
- {
- left: ["批次号", "batchNo"],
- right: ["发货条码", "shipBarcode"],
- mono: true,
- },
- {
- left: ["包装编码", "packageCode"],
- right: ["客户代号", "customerCode"],
- mono: true,
- },
- {
- left: ["包装数量", "packageQtyDisplay"],
- right: ["计量数量", "measureQtyDisplay"],
- },
- { left: ["重量", "weightDisplay"], right: ["刻码", "engrave"] },
- { left: ["质检结果", "resultLabel"], right: ["质检状态", "statusLabel"] },
- { left: ["生产日期", "productionDate"], right: ["采购日期", "purchaseDate"] },
- { left: ["供应商", "supplierName"], right: ["供应商代号", "supplierCode"] },
- // { left: ["物料代号", "materialAlias"], right: ["客户代号", "customerCode"] },
- ];
- export default {
- props: {
- businessId: {
- default: "",
- },
- taskDefinitionKey: {
- default: "",
- },
- },
- data() {
- return {
- form: {},
- list: ["领料信息", "领料清单", "出库信息", "出库物品", "包装清单"],
- curNow: 0,
- isStorage: false,
- outFormData: {
- bizType: "",
- sourceBizNo: "",
- fromId: "",
- fromUser: "",
- fromUserPhone: "",
- storageTime: "",
- type: 2,
- createUserId: "",
- remark: "",
- clientName: "",
- outInDetailList: [],
- extInfo: {
- assetType: [],
- assetTypeName: "",
- deptCode: "",
- deptName: "",
- verifyDeptCode: "",
- verifyDeptName: "",
- createUserName: "",
- createUserId: "",
- fromUserPhone: "",
- sourceBizNo: "",
- },
- },
- warehousingMaterialList: [],
- batchDetailsVOList: [],
- assetTypeMapping: {},
- extractedList: [],
- productList: [],
- packingList: [],
- wwType: null,
- outboundItemGrid: OUTBOUND_ITEM_GRID,
- packingItemGrid: PACKING_ITEM_GRID,
- };
- },
- computed: {
- typeOptions() {
- return [
- { label: "自建领料", value: 1 },
- { label: "工单领料", value: 2 },
- { label: "委外领料", value: 3 },
- ];
- },
- typeLabel() {
- const current = this.typeOptions.find(
- (item) => item.value === Number(this.form.type),
- );
- return current ? current.label : "";
- },
- typeIndex() {
- const index = this.typeOptions.findIndex(
- (item) => item.value === Number(this.form.type),
- );
- return index > -1 ? index : 0;
- },
- pickInfoItems() {
- return [
- { label: "领料单名称", value: this.form.name || "" },
- { label: "领料单号", value: this.form.code || "" },
- { label: "物品编码", value: this.form.categoryCode || "" },
- { label: "物品名称", value: this.form.categoryName || "" },
- { label: "型号", value: this.form.modelType || "" },
- { label: "规格", value: this.form.specification || "" },
- { label: "数量", value: this.form.formingNum || "" },
- { label: "计量单位", value: this.form.unit || "" },
- { label: "机型", value: this.form.modelKey || "" },
- { label: "颜色", value: this.form.colorKey || "" },
- { label: "领料时间", value: this.form.createTime || "" },
- { label: "领料部门", value: this.form.executorDeptName || "" },
- { label: "领料人", value: this.form.executorName || "" },
- { label: "类型", value: this.typeLabel || "" },
- ];
- },
- pickListFieldItems() {
- return [
- { label: "工单编号", key: "workOrderCode" },
- { label: "物品编码", key: "categoryCode" },
- { label: "物品名称", key: "categoryName" },
- { label: "数量", key: "demandQuantity" },
- { label: "领料仓库", key: "warehouseName" },
- ];
- },
- outboundSceneLabel() {
- const code = Number(this.outFormData.bizType);
- const item = OUTPUT_SCENE_STATE.find((s) => s.code === code);
- return item ? item.label : "";
- },
- assetTypeLabel() {
- const assetType = this.outFormData.extInfo.assetType;
- if (Array.isArray(assetType)) {
- return assetType
- .map((id) => this.assetTypeMapping[id] || "")
- .filter(Boolean)
- .join("、");
- }
- if (typeof assetType === "string" && assetType.includes(",")) {
- return assetType
- .split(",")
- .map((id) => this.assetTypeMapping[id.trim()] || "")
- .filter(Boolean)
- .join("、");
- }
- return this.assetTypeMapping[assetType] || "";
- },
- outboundInfoItems() {
- const fd = this.outFormData;
- const ext = fd.extInfo || {};
- return [
- { label: "出库场景", value: this.outboundSceneLabel },
- { label: "领料单", value: fd.sourceBizNo || this.form.code || "" },
- { label: "出库物品类型", value: this.assetTypeLabel },
- { label: "出库时间", value: fd.storageTime || "" },
- { label: "出库登记人", value: ext.createUserName || "" },
- { label: "领料人部门", value: ext.verifyDeptName || "" },
- { label: "领料人", value: fd.fromUser || "" },
- { label: "客户名称", value: fd.clientName || "" },
- { label: "备注", value: fd.remark || "" },
- ];
- },
- outboundItemRows() {
- return this.warehousingMaterialList.map((item, i) => {
- const countUnit = item.measuringUnit || "";
- const wu = item.weightUnit || "";
- const packUnit = item.packingUnit || item.minUnit || "";
- const pb = item.packingCountBase;
- return {
- seq: i + 1,
- code: item.assetCode || item.categoryCode || item.code || "",
- name: item.assetName || item.name || "",
- manualBatchNo: item.manualBatchNo || "",
- batchNo: item.batchNo || "",
- minPacking:
- item.minPackingCount != null
- ? `${item.minPackingCount}${countUnit}/${item.minUnit || ""}`
- : "",
- packQtyDisplay: pb != null && pb !== "" ? `${pb}${packUnit}` : "",
- countDisplay:
- item.availableCountBase !== "" && item.availableCountBase != null
- ? `${item.availableCountBase}${countUnit}`
- : "",
- weightDisplay:
- item.weight !== "" && item.weight != null
- ? `${item.weight}${wu}`
- : "",
- stockDisplay:
- item.stockNum !== "" && item.stockNum != null
- ? `${item.stockNum}${countUnit}`
- : "",
- lockDisplay:
- item.lockQuantity !== "" && item.lockQuantity != null
- ? `${item.lockQuantity}${countUnit}`
- : "",
- warehouse: item.warehouseName || item.position || "",
- supplierName: item.supplierName || "",
- supplierCode: item.supplierCode || "",
- stockNum: item.stockNum ?? "",
- categoryModel: item.categoryModel || "",
- specification: item.specification || "",
- brandNum: item.brandNum || "",
- lockQuantity: item.lockQuantity ?? "",
- packingSpecification: item.packingSpecification || "",
- };
- });
- },
- packingListRows() {
- return this.batchDetailsVOList.map((item, i) => {
- const packUnit = item.packingUnit || item.minUnit || "";
- const measureUnit = item.measuringUnit || "";
- const weightUnit = item.weightUnit || "";
- return {
- seq: i + 1,
- code: item.categoryCode || item.onlyCode || "",
- name: item.name || item.assetName || "",
- manualBatchNo: item.manualBatchNo || "",
- batchNo: item.batchNo || "",
- shipBarcode: item.barcodes || "",
- packageCode:
- item.packageNo ||
- item.code ||
- item.onlyCode ||
- item.packageCode ||
- "",
- packageQtyDisplay:
- item.packingCountBase !== "" && item.packingCountBase != null
- ? `${item.packingCountBase}${packUnit}`
- : "",
- measureQtyDisplay:
- item.availableCountBase !== "" && item.availableCountBase != null
- ? `${item.availableCountBase}${measureUnit}`
- : "",
- materialAlias: item.materielCode || "",
- customerCode: item.clientCode || "",
- weightDisplay:
- item.weight !== "" && item.weight != null
- ? `${item.weight}${weightUnit}`
- : "",
- engrave: item.engrave || "",
- resultLabel: qualityResults[item.result] || "无",
- statusLabel: qualityStatus[item.status] || "未质检",
- productionDate: item.productionDate || "",
- purchaseDate: item.purchaseDate || "",
- supplierName: item.supplierName || "",
- supplierCode: item.supplierCode || "",
- };
- });
- },
- },
- async mounted() {
- await this.loadAssetTypeMapping();
- await this.getDetailData(this.businessId);
- await this.getLoginUserData();
- },
- methods: {
- dash(val) {
- if (val === null || val === undefined) return "—";
- if (typeof val === "string" && val.trim() === "") return "—";
- return val;
- },
- formatPickListField(row, key) {
- if (key === "demandQuantity") {
- const qty = row?.demandQuantity ?? "";
- const unit = row?.unit ?? "";
- return qty !== "" || unit !== "" ? `${qty}${unit}` : "";
- }
- return row?.[key] ?? "";
- },
- 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) {
- const data = await getPickOrderById(id);
- this.form = data;
- this.extractedList = this.form.detailList.map((item) => {
- return {
- taskId: item.taskId,
- workOrderId: item.workOrderId,
- };
- });
- console.log(this.extractedList, "this.extractedList");
- await this.loadOutboundData(data);
- },
- async loadOutboundData(pickData) {
- const code = pickData.code;
- if (!code) return;
- const categoryLevelTopIds = (pickData.detailList || [])
- .map((item) => item.rootCategoryLevelId)
- .filter(Boolean);
- const uniqueAssetTypes = [...new Set(categoryLevelTopIds)];
- const rootCategoryLevelId =
- Array.isArray(this.form.detailList) && this.form.detailList[0]
- ? this.form.detailList[0].rootCategoryLevelId
- : "";
- try {
- const outData = await getOutInBySourceBizNo(code);
- if (!outData || !outData.id) {
- throw new Error("No outbound data");
- }
- this.isStorage = true;
- this.outFormData = {
- bizType: outData.bizType || "11",
- sourceBizNo:
- outData.sourceBizNo || outData.extInfo?.sourceBizNo || code,
- fromId: outData.fromId || "",
- fromUser: outData.fromUser || "",
- fromUserPhone: outData.fromUserPhone || "",
- storageTime: outData.storageTime || "",
- type: outData.type || 2,
- createUserId: outData.createUserId || "",
- clientName: outData.clientName || "",
- remark: outData.remark || "",
- outInDetailList: outData.outInDetailVOList || [],
- extInfo: {
- ...(outData.extInfo || {}),
- createUserName:
- outData.extInfo?.createUserName ||
- this.outFormData.extInfo?.createUserName ||
- "",
- assetType:
- uniqueAssetTypes.length > 0
- ? uniqueAssetTypes
- : rootCategoryLevelId || outData.extInfo?.assetType || "",
- },
- };
- this.parseOutInDetailList(outData.outInDetailVOList || []);
- } catch (e) {
- this.isStorage = false;
- const savedCreateUserName =
- this.outFormData.extInfo?.createUserName || "";
- this.outFormData = {
- bizType: "11",
- sourceBizNo: code,
- fromId: "",
- fromUser: "",
- fromUserPhone: "",
- storageTime: "",
- type: 2,
- createUserId: "",
- clientName: "",
- remark: "",
- outInDetailList: [],
- extInfo: {
- assetType:
- uniqueAssetTypes.length > 0
- ? uniqueAssetTypes
- : rootCategoryLevelId || "",
- assetTypeName: "",
- deptCode: "",
- deptName: "",
- verifyDeptCode: "",
- verifyDeptName: "",
- createUserName: savedCreateUserName,
- createUserId: "",
- fromUserPhone: "",
- sourceBizNo: "",
- },
- };
- this.warehousingMaterialList = [];
- this.batchDetailsVOList = [];
- if (
- this.taskDefinitionKey === "storeman" ||
- this.taskDefinitionKey === "storemanAudit"
- ) {
- await this.initOutboundFromHierarchy(pickData);
- }
- }
- },
- parseOutInDetailList(list) {
- const materials = [];
- const packages = [];
- list.forEach((goodsItem) => {
- materials.push({
- ...goodsItem,
- assetName: goodsItem.name || goodsItem.assetName,
- assetCode: goodsItem.categoryCode || goodsItem.assetCode,
- outInNum: goodsItem.packingCount,
- });
- const records = goodsItem.outInDetailRecordVOList || [];
- records.forEach((wrapItem) => {
- packages.push({
- ...wrapItem,
- assetName: goodsItem.name || goodsItem.assetName,
- assetCode: goodsItem.categoryCode || goodsItem.assetCode,
- });
- });
- });
- this.warehousingMaterialList = materials;
- this.batchDetailsVOList = packages;
- },
- onTypeChange(e) {
- const index = e?.detail?.value;
- const selected = this.typeOptions[index];
- this.form.type = selected ? selected.value : this.form.type;
- },
- async getLoginUserData() {
- try {
- const data = await getLoginUser();
- if (!this.outFormData.extInfo) {
- this.$set(this.outFormData, "extInfo", {});
- }
- this.$set(this.outFormData.extInfo, "createUserName", data.name || "");
- } catch (e) {
- console.warn("获取登录用户数据失败", e);
- }
- },
- getNowFormatDate() {
- const now = new Date();
- const pad = (n) => String(n).padStart(2, "0");
- this.outFormData.storageTime = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
- },
- async getStaffList(groupId) {
- try {
- const res = await getUserPageByGroupId({
- groupId,
- size: 9999,
- page: 1,
- });
- return res.list || [];
- } catch (e) {
- console.warn("获取员工列表失败", e);
- return [];
- }
- },
- async initOutboundFromHierarchy(pickData) {
- const code = pickData.code;
- this.wwType = pickData.type;
- const categoryLevelTopIds = (pickData.detailList || [])
- .map((item) => item.rootCategoryLevelId)
- .filter(Boolean);
- const uniqueAssetTypes = [...new Set(categoryLevelTopIds)];
- this.outFormData.bizType = 11;
- this.outFormData.sourceBizNo = code;
- this.outFormData.type = 2;
- this.outFormData.extInfo.assetType = uniqueAssetTypes;
- this.outFormData.extInfo.sourceBizNo = code;
- this.getNowFormatDate();
- try {
- const userData = await getLoginUser();
- this.outFormData.extInfo.createUserName = userData.name || "";
- this.outFormData.extInfo.createUserId = userData.userId || "";
- this.outFormData.createUserId = userData.userId || "";
- } catch (e) {
- console.warn("获取登录用户失败", e);
- }
- if (pickData.executorDeptId) {
- try {
- const staffList = await this.getStaffList(pickData.executorDeptId);
- this.outFormData.fromId = pickData.executorId || "";
- this.outFormData.fromUser = pickData.executorName || "";
- this.outFormData.extInfo.verifyDeptCode =
- pickData.executorDeptId || "";
- this.outFormData.extInfo.verifyDeptName =
- pickData.executorDeptName || "";
- } catch (e) {
- console.warn("设置领料人信息失败", e);
- }
- } else if (pickData.createUserId) {
- this.outFormData.fromId = pickData.createUserId;
- try {
- const userInfo = await getUserById(pickData.createUserId);
- this.outFormData.fromUser = userInfo.name || "";
- this.outFormData.extInfo.verifyDeptCode = userInfo.groupId || "";
- this.outFormData.extInfo.verifyDeptName = userInfo.groupName || "";
- } catch (e) {
- console.warn("获取领料人部门信息失败", e);
- }
- }
- if (pickData.makerId) {
- try {
- const makerInfo = await getUserById(pickData.makerId);
- this.outFormData.extInfo.verifyDeptCode =
- this.outFormData.extInfo.verifyDeptCode || makerInfo.groupId || "";
- this.outFormData.extInfo.verifyDeptName =
- this.outFormData.extInfo.verifyDeptName ||
- makerInfo.groupName ||
- "";
- } catch (e) {
- console.warn("获取makerId部门失败", e);
- }
- }
- const detailList = pickData.detailList || [];
- if (!detailList.length) return;
- let requestData;
- if (Number(this.wwType) === 3) {
- requestData = {
- type: this.wwType,
- deliveryNo: code,
- taskIds: this.extractedList.map((item) => item.taskId),
- workOrderIds: this.extractedList.map((item) => item.workOrderId),
- };
- } else {
- requestData = {
- type: "1",
- deliveryNo: code,
- builders: detailList.map((item) => ({
- categoryId:
- item.categoryId || item.instanceId || item.productId || "",
- num: item.demandQuantity || item.measurementCount || 0,
- warehouseId: item.warehouseId || "",
- batchNo: item.batchNo || "",
- })),
- };
- }
- try {
- const data = await getHierarchyFifo(requestData);
- this.processHierarchyData(data, pickData);
- } catch (err) {
- console.warn("获取出库物品数据失败", err);
- }
- },
- processHierarchyData(data, pickData) {
- if (!Array.isArray(data) || !data.length) return;
- const firstDetail =
- Array.isArray(pickData?.detailList) && pickData.detailList[0]
- ? pickData.detailList[0]
- : {};
- this.productList = data.map((productItem) => ({
- ...productItem,
- suspendBatchNo: productItem.batchNo || "",
- outInDetailRecordRequestList: (
- productItem.outInDetailRecordRequestList || []
- ).map((packingItem) => ({
- ...packingItem,
- workOrderId: firstDetail.workOrderId || "",
- pickOrderId: firstDetail.pickOrderId || "",
- taskId: firstDetail.taskId || "",
- categoryName: productItem.categoryName || packingItem.categoryName,
- categoryCode: productItem.categoryCode || packingItem.categoryCode,
- supplierCode:
- productItem.supplierCode || packingItem.supplierCode || "",
- supplierName:
- productItem.supplierName || packingItem.supplierName || "",
- materialDetailList: (packingItem.materialDetailList || []).map(
- (materialItem) => ({
- ...materialItem,
- categoryName:
- productItem.categoryName || materialItem.categoryName,
- categoryCode:
- productItem.categoryCode || materialItem.categoryCode,
- supplierCode:
- productItem.supplierCode ||
- packingItem.supplierCode ||
- materialItem.supplierCode ||
- "",
- supplierName:
- productItem.supplierName ||
- packingItem.supplierName ||
- materialItem.supplierName ||
- "",
- }),
- ),
- })),
- }));
- console.log(this.productList, "productList");
- this.productList.sort((a, b) =>
- (a.categoryCode || "").localeCompare(b.categoryCode || ""),
- );
- const materials = [];
- const packages = [];
- console.log(this.productList, "productList1111");
- this.productList.forEach((item) => {
- materials.push({
- assetCode: item.categoryCode,
- assetName: item.categoryName,
- categoryCode: item.categoryCode,
- categoryName: item.categoryName,
- name: item.categoryName,
- manualBatchNo: item.manualBatchNo || "",
- batchNo: item.batchNo || "",
- packingCountBase: item.packingQuantity,
- minPackingCount: item.minPackingCount,
- minUnit: item.packingUnit,
- availableCountBase: item.measureQuantity,
- measuringUnit: item.measureUnit,
- weight: item.weight,
- weightUnit: item.weightUnit,
- warehouseName: item.warehouseName,
- warehouseId: item.warehouseId,
- outInNum: item.packingQuantity,
- stockNum: item.stockNum,
- categoryModel: item.categoryModel,
- specification: item.specification,
- brandNum: item.brandNum,
- lockQuantity: item.lockQuantity,
- packingSpecification: item.extField?.packingSpecification || "",
- supplierName:
- item.supplierName ||
- (item.outInDetailRecordRequestList &&
- item.outInDetailRecordRequestList[0] &&
- item.outInDetailRecordRequestList[0].supplierName) ||
- "",
- supplierCode:
- item.supplierCode ||
- (item.outInDetailRecordRequestList &&
- item.outInDetailRecordRequestList[0] &&
- item.outInDetailRecordRequestList[0].supplierCode) ||
- "",
- });
- console.log(materials, "materialsmaterialsmaterials");
- const records = item.outInDetailRecordRequestList || [];
- records.forEach((record) => {
- packages.push({
- code: record.packageNo,
- onlyCode: record.packageNo,
- assetName: item.categoryName,
- name: item.categoryName,
- categoryCode: item.categoryCode,
- categoryName: item.categoryName,
- manualBatchNo: record.manualBatchNo || "",
- batchNo: record.batchNo || "",
- barcodes: record.barcodes || "",
- packingCountBase: record.packingQuantity,
- packingUnit: record.packingUnit,
- minUnit: record.packingUnit,
- availableCountBase: record.measureQuantity,
- measuringUnit: record.measureUnit,
- materielCode: record.materielDesignation || "",
- clientCode: record.clientCode || "",
- weight: record.weight,
- weightUnit: record.weightUnit,
- supplierCode: item.supplierCode || record.supplierCode || "",
- supplierName: item.supplierName || record.supplierName || "",
- modelKey: record.modelKey || "",
- colorKey: record.colorKey || "",
- result: record.result,
- status: record.status,
- productionDate: record.productionDate || "",
- purchaseDate: record.purchaseDate || "",
- engrave: record.engrave || "",
- });
- });
- });
- this.warehousingMaterialList = materials;
- this.batchDetailsVOList = packages;
- this.packingList = packages;
- this.outFormData.outInDetailList = this.productList;
- },
- async getReturnStorage() {
- if (!this.productList || !this.productList.length) {
- uni.showToast({ title: "请添加出库明细!", icon: "none" });
- return null;
- }
- const obj = JSON.parse(JSON.stringify({ ...this.outFormData, type: 2 }));
- obj.extInfo.sourceBizNo = obj.sourceBizNo;
- obj.fromType = obj.type;
- if (Array.isArray(obj.extInfo.assetType)) {
- obj.extInfo.assetType = obj.extInfo.assetType.join(",");
- }
- const warehouseId = [];
- const warehouseName = [];
- this.productList.forEach((item) => {
- if (item.warehouseId && !warehouseId.includes(item.warehouseId)) {
- warehouseId.push(item.warehouseId);
- warehouseName.push(item.warehouseName || "");
- }
- });
- obj.warehouseIds = warehouseId;
- obj.warehouseNames = warehouseName;
- obj.outInDetailList = this.productList;
- return obj;
- },
- async getTableValue() {
- const outboundData = {
- // 原始数据(接口/提交更稳定)
- warehousingMaterialList: this.warehousingMaterialList || [],
- batchDetailsVOList: this.batchDetailsVOList || [],
- // 展示映射数据(便于前端直接渲染)
- outboundItemRows: this.outboundItemRows || [],
- packingListRows: this.packingListRows || [],
- };
- if (!this.isStorage && this.productList.length > 0) {
- const returnStorageData = await this.getReturnStorage();
- return {
- form: this.form,
- returnStorageData: returnStorageData || {},
- ...outboundData,
- };
- }
- return {
- form: this.form,
- returnStorageData: {},
- ...outboundData,
- };
- },
- sectionChange(index) {
- this.curNow = index;
- },
- },
- };
- </script>
- <style scoped>
- .btnConcel {
- margin-top: 20rpx;
- }
- .subsection-wrap {
- background: #f5f7fa;
- padding: 12rpx 16rpx;
- }
- .pick-info-wrap {
- padding: 0 0 24rpx;
- }
- .pick-info-title {
- display: flex;
- align-items: center;
- margin: 20rpx 24rpx 12rpx;
- }
- .pick-info-title-bar {
- width: 8rpx;
- height: 30rpx;
- background: #157a2c;
- border-radius: 4rpx;
- margin-right: 14rpx;
- flex-shrink: 0;
- }
- .pick-info-title-text {
- font-size: 30rpx;
- font-weight: 600;
- color: #303133;
- }
- .pick-info-form {
- background: #ffffff;
- border-radius: 16rpx;
- padding: 6rpx 20rpx;
- box-sizing: border-box;
- box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.04);
- }
- .pick-info-form :deep(.u-form-item) {
- padding: 8rpx 0;
- }
- .pick-info-form :deep(.u-form-item__body) {
- min-height: 88rpx;
- }
- .pick-info-form :deep(.u-form-item__body__left__content__label) {
- font-size: 28rpx;
- color: #303133;
- }
- .pick-info-form :deep(.u-border-bottom::after) {
- border-color: #ebeef5 !important;
- }
- .pick-info-form :deep(.u-input) {
- background: #f6f8fc !important;
- border: 1rpx solid #e7ebf1 !important;
- border-radius: 12rpx !important;
- padding: 12rpx 16rpx !important;
- }
- .pick-info-form :deep(.u-input__content__field-wrapper__field) {
- font-size: 28rpx !important;
- color: #4a4f57 !important;
- }
- .pick-list-wrap {
- padding: 0 24rpx 32rpx;
- box-sizing: border-box;
- }
- .pick-list-section-title {
- display: flex;
- align-items: center;
- padding: 24rpx 0 16rpx;
- }
- .pick-list-section-bar {
- width: 8rpx;
- height: 32rpx;
- background: #1890ff;
- border-radius: 4rpx;
- margin-right: 16rpx;
- flex-shrink: 0;
- }
- .pick-list-section-text {
- font-size: 32rpx;
- font-weight: 600;
- color: #303133;
- }
- .pick-list-divider {
- height: 2rpx;
- background: linear-gradient(
- 90deg,
- rgba(24, 144, 255, 0.35) 0%,
- rgba(24, 144, 255, 0.08) 100%
- );
- margin-bottom: 8rpx;
- }
- .pick-list-empty {
- text-align: center;
- color: #909399;
- font-size: 28rpx;
- padding: 80rpx 0;
- }
- .pick-list-card {
- background: #fff;
- border-radius: 16rpx;
- margin-top: 24rpx;
- box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.06);
- border: 1rpx solid #eef0f4;
- overflow: hidden;
- }
- .pick-list-card-head {
- background: #f5f7fa;
- padding: 20rpx 24rpx;
- border-bottom: 1rpx solid #eef0f4;
- }
- .pick-list-index {
- font-size: 26rpx;
- font-weight: 600;
- color: #606266;
- }
- .pick-list-card-body {
- padding: 8rpx 24rpx 20rpx;
- }
- .pick-list-row {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- padding: 18rpx 0;
- border-bottom: 1rpx solid #f0f2f5;
- }
- .pick-list-row:last-child {
- border-bottom: none;
- }
- .pick-list-row--highlight .pick-list-value {
- color: #157a2c;
- font-weight: 600;
- }
- .pick-list-row--two {
- display: flex;
- gap: 24rpx;
- align-items: flex-start;
- }
- .pick-list-cell {
- flex: 1;
- min-width: 0;
- display: flex;
- flex-direction: column;
- gap: 8rpx;
- }
- .pick-list-cell--right {
- align-items: flex-end;
- text-align: right;
- }
- .pick-list-cell--right .pick-list-label,
- .pick-list-cell--right .pick-list-value {
- text-align: right;
- }
- .pick-list-label {
- font-size: 24rpx;
- color: #909399;
- flex-shrink: 0;
- margin-right: 16rpx;
- min-width: 140rpx;
- }
- .pick-list-row--two .pick-list-label {
- margin-right: 0;
- min-width: 0;
- }
- .pick-list-value {
- font-size: 28rpx;
- color: #303133;
- word-break: break-all;
- flex: 1;
- text-align: right;
- }
- .pick-list-row--two .pick-list-value {
- text-align: left;
- }
- .pick-list-cell--right .pick-list-value {
- text-align: right;
- }
- .pick-list-value--mono {
- font-family: ui-monospace, monospace;
- font-size: 26rpx;
- }
- .out-info-wrap {
- padding: 0 24rpx 32rpx;
- box-sizing: border-box;
- }
- .out-info-title {
- display: flex;
- align-items: center;
- padding: 24rpx 0 12rpx;
- }
- .out-info-title-bar {
- width: 8rpx;
- height: 32rpx;
- background: #1890ff;
- border-radius: 4rpx;
- margin-right: 16rpx;
- flex-shrink: 0;
- }
- .out-info-title-text {
- font-size: 32rpx;
- font-weight: 600;
- color: #303133;
- }
- .out-info-divider {
- height: 2rpx;
- background: linear-gradient(
- 90deg,
- rgba(24, 144, 255, 0.35) 0%,
- rgba(24, 144, 255, 0.08) 100%
- );
- margin-bottom: 8rpx;
- }
- .out-info-card {
- margin-top: 20rpx;
- background: #fff;
- border: 1rpx solid #eef0f4;
- border-radius: 16rpx;
- box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
- overflow: hidden;
- }
- .out-info-row {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- padding: 22rpx;
- border-bottom: 1rpx solid #f0f2f5;
- gap: 16rpx;
- }
- .out-info-row:last-child {
- border-bottom: none;
- }
- .out-info-label {
- font-size: 28rpx;
- color: #303133;
- min-width: 160rpx;
- word-break: break-all;
- }
- .out-info-value {
- flex: 1;
- text-align: right;
- color: #303133;
- font-size: 28rpx;
- word-break: break-all;
- }
- .outbound-wrap {
- padding: 0 24rpx 32rpx;
- }
- .outbound-title {
- display: flex;
- align-items: center;
- padding: 24rpx 0 14rpx;
- }
- .outbound-title-bar {
- width: 8rpx;
- height: 32rpx;
- background: #1890ff;
- border-radius: 4rpx;
- margin-right: 14rpx;
- }
- .outbound-title-text {
- font-size: 32rpx;
- font-weight: 600;
- color: #303133;
- }
- .outbound-empty {
- text-align: center;
- color: #909399;
- font-size: 28rpx;
- padding: 80rpx 0;
- }
- .outbound-card {
- margin-top: 20rpx;
- background: #fff;
- border: 1rpx solid #eef0f4;
- border-radius: 16rpx;
- box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
- overflow: hidden;
- }
- .outbound-card-head {
- background: #f7f9fc;
- border-bottom: 1rpx solid #eef0f4;
- padding: 18rpx 22rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .outbound-index {
- font-size: 25rpx;
- color: #606266;
- font-weight: 600;
- }
- .outbound-code {
- font-size: 25rpx;
- color: #303133;
- font-family: ui-monospace, monospace;
- }
- .outbound-grid {
- padding: 18rpx 22rpx;
- border-bottom: 1rpx solid #f0f2f5;
- display: flex;
- gap: 20rpx;
- }
- .outbound-grid-last {
- border-bottom: none;
- }
- .outbound-grid--full {
- flex-wrap: wrap;
- }
- .outbound-col--full {
- flex: 1;
- min-width: 0;
- width: 100%;
- display: flex;
- flex-direction: column;
- gap: 10rpx;
- }
- .outbound-col {
- flex: 1;
- min-width: 0;
- display: flex;
- flex-direction: column;
- gap: 10rpx;
- }
- .outbound-col-right {
- align-items: flex-end;
- text-align: right;
- }
- .outbound-label {
- font-size: 24rpx;
- color: #303133;
- }
- .outbound-value {
- font-size: 28rpx;
- color: #205dd9;
- word-break: break-all;
- }
- .outbound-col-right .outbound-value {
- text-align: right;
- }
- .outbound-value--mono {
- font-family: ui-monospace, monospace;
- font-size: 26rpx;
- }
- .outbound-highlight {
- color: #157a2c;
- font-weight: 600;
- }
- </style>
|