"use strict"; const common_vendor = require("../../../common/vendor.js"); const api_user = require("../../../api/user.js"); const utils_utils = require("../../../utils/utils.js"); const store_useSystemSettingsStore = require("../../../store/useSystemSettingsStore.js"); const store_useStorageStore = require("../../../store/useStorageStore.js"); require("../../../utils/request.js"); require("../../../store/index.js"); require("../../../utils/functions.js"); require("../../../utils/IDCardVerification.js"); require("../../../utils/base64.js"); require("../../../config/host.js"); require("../../../utils/md5.js"); if (!Array) { const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar"); const _component_tips = common_vendor.resolveComponent("tips"); (_easycom_u_navbar2 + _component_tips)(); } const _easycom_u_navbar = () => "../../../uni_modules/uview-plus/components/u-navbar/u-navbar.js"; if (!Math) { _easycom_u_navbar(); } const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "Relocation", setup(__props) { const { HANDLE_ISSTORAGECODE } = store_useStorageStore.useStorageStore(); common_vendor.storeToRefs(store_useSystemSettingsStore.useSystemSettingsStore()); const tip = common_vendor.ref(null); let details = common_vendor.reactive({ scancode: "", pagetype: "", allocationId: "", dtilobj: {}, trayCode: "", scanlist: [], obldate: {}, codenumer: 0, isshowtot: false, // 当前正在请求的包条码 scancodeList: [] }); common_vendor.onLoad((op) => { details.pagetype = op.type; utils_utils.utils.ttsspke(`当前移库方式为${op.pageName}, 请先扫描库位码`); }); common_vendor.onShow(() => { }); common_vendor.onPullDownRefresh(() => { const timer = setTimeout(() => { details.scancode = ""; details.allocationId = ""; details.dtilobj = {}; details.obldate = {}; details.trayCode = ""; details.scanlist = []; details.isshowtot = false; details.scancodeList = []; common_vendor.index.stopPullDownRefresh(); clearTimeout(timer); }, 500); }); function goorderdetail(item) { common_vendor.index.navigateTo({ url: "/pagesHome/pages/orderDetails/orderDetails?orderCode=" + item.orderCode }); } const traynumber = common_vendor.computed(() => { let numbers = 0; details.scanlist.map((item) => { if (item.shelfNum) { numbers += item.shelfNum; } else if (item.num) { numbers += item.num; } }); return numbers; }); common_vendor.watchEffect(() => { details.scanlist.map((item) => { details.codenumer += item.shelfNum; }); console.log(details.codenumer); }); const scanStorage = async (scancode2) => { let data = { allocationId: scancode2 }; const res = await api_user.warehouseUpdownTypemoveAllocationScanTarget(data); console.log("res1 :>> ", res); if (res.code == 200) { details.dtilobj = res.data; details.allocationId = res.data.allocationId; details.scancode = ""; if (details.pagetype === "1") { if (details.dtilobj.trayCode) { utils_utils.utils.ttsspke("该库位已绑托盘"); return common_vendor.index.startPullDownRefresh({}); } utils_utils.utils.ttsspke("扫描成功, 请扫描需要移动的托盘"); } else if (details.pagetype === "2") utils_utils.utils.ttsspke("扫描成功, 请扫描需要移动的包条"); } }; const scanOther = async (scancode2) => { let res = null; if (details.scancodeList.includes(scancode2)) { common_vendor.index.showToast({ title: "重复扫描", icon: "none" }); return; } try { if (details.pagetype == "1") { let data = { trayCode: scancode2 }; res = await api_user.warehouseUpdownTypemoveAllocationScanTrayCode(data); console.log("res :>> ", res); if (res.code !== 200) return; details.trayCode = scancode2; details.scanlist = res.data.list; details.obldate = res.data; } else if (details.pagetype == "2") { let data = { allocationId: details.allocationId, orderPackageCode: scancode2 }; res = await api_user.warehouseUpdownTypemoveAllocationScanPackage(data); console.log("res :>> ", res); if (res.code == 200) { details.scanlist.push(res.data); } } details.scancodeList.push(scancode2); } catch (err) { console.log("err :>> ", err); } }; async function scandata() { const { scancode: scancode2 } = details; if (HANDLE_ISSTORAGECODE(scancode2)) return scanStorage(scancode2); else scanOther(scancode2); } async function uplist() { let res = null; common_vendor.index.showLoading({ mask: true, title: "移库中" }); if (details.pagetype == "1") { let data = { allocationId: details.allocationId, trayCode: details.trayCode }; res = await api_user.warehouseUpdownTypemoveAllocationByTrayCode(data); } else if (details.pagetype == "2") { let data = { allocationId: details.allocationId, upShelfPackageList: details.scanlist }; res = await api_user.warehouseUpdownTypemoveAllocationPackageList(data); } common_vendor.index.hideLoading(); if (res.code == 200) { console.log("res :>> ", res); common_vendor.index.showToast({ title: "移库成功", icon: "success" }); common_vendor.index.startPullDownRefresh({}); } else { common_vendor.index.showToast({ title: "移库失败", icon: "error" }); } } function setstate(flg) { let returnContent = ""; if (flg && !details.allocationId) returnContent = "请先扫描库位码"; else if (flg && !details.trayCode && details.pagetype == "1") returnContent = "请扫描正确的托盘码"; else if (flg && details.scanlist.length == 0 && details.pagetype == "2") returnContent = "请扫描正确的包件码"; if (returnContent) { common_vendor.index.showToast({ title: returnContent, icon: "none" }); return; } if (Number(details.pagetype) === 1) details.scanlist.reduce((curr, item) => curr + item.shelfNum, 0); else if (Number(details.pagetype) === 2) details.scanlist.length; details.isshowtot = flg; } const { obldate, isshowtot, scancode, pagetype, dtilobj, scanlist, trayCode } = common_vendor.toRefs(details); return (_ctx, _cache) => { var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p; return common_vendor.e({ a: common_vendor.p({ title: common_vendor.unref(pagetype) == "1" ? "托盘移库" : "按件移库", bgColor: "#D3832A", leftIconColor: "#ffffff", titleStyle: "color:#ffffff", placeholder: true, autoBack: true, leftIconSize: "35" }), b: common_vendor.t((((_a = common_vendor.unref(dtilobj)) == null ? void 0 : _a.warehouseName) || "") + "-" + (((_b = common_vendor.unref(dtilobj)) == null ? void 0 : _b.areaTitle) || "") + "-" + (((_c = common_vendor.unref(dtilobj)) == null ? void 0 : _c.shelfTitle) || "") + "-" + (((_d = common_vendor.unref(dtilobj)) == null ? void 0 : _d.allocationTitle) || "")), c: common_vendor.t(((_e = common_vendor.unref(dtilobj)) == null ? void 0 : _e.warehouseName) || "暂无数据"), d: common_vendor.unref(pagetype) == 2 }, common_vendor.unref(pagetype) == 2 ? { e: common_vendor.unref(scancode), f: common_vendor.o(($event) => common_vendor.isRef(scancode) ? scancode.value = $event.detail.value : null), g: common_vendor.o(scandata) } : {}, { h: common_vendor.t(((_f = common_vendor.unref(dtilobj)) == null ? void 0 : _f.trayCode) || "暂无数据"), i: common_vendor.t(common_vendor.unref(dtilobj).trayNum || "0"), j: common_vendor.unref(pagetype) == 2 }, common_vendor.unref(pagetype) == 2 ? { k: common_vendor.t(traynumber.value || "0") } : {}, { l: common_vendor.f(common_vendor.unref(scanlist), (item, index, i0) => { return common_vendor.e(Number(common_vendor.unref(pagetype)) === 1 ? common_vendor.e({ a: item.goodsType === 1 }, item.goodsType === 1 ? { b: common_vendor.t(item.serviceNum), c: common_vendor.t(item.trayCode + `(${item.trayName})`), d: common_vendor.t(item.orderCode), e: common_vendor.o(($event) => goorderdetail(item)), f: common_vendor.t(item.totalNum - item.shelfNum) } : {}, { g: item.goodsType === 2 }, item.goodsType === 2 ? { h: common_vendor.t(item.waybillNo), i: common_vendor.t(item.trayCode + `(${item.trayName})`), j: common_vendor.t(item.orderCode), k: common_vendor.t(item.totalNum - item.shelfNum) } : {}, { l: item.goodsType === 3 }, item.goodsType === 3 ? { m: common_vendor.t(item.materialCode), n: common_vendor.t(item.materialName), o: common_vendor.t(item.trayCode + `(${item.trayName})`), p: common_vendor.t(common_vendor.unref(obldate).warehouseName), q: common_vendor.t(common_vendor.unref(obldate).areaName + "-" + common_vendor.unref(obldate).allocationName), r: common_vendor.t(item.orderCode), s: common_vendor.t(item.marketName), t: common_vendor.t(item.incomingBatch), v: common_vendor.t(item.totalNum - item.shelfNum) } : {}, { w: common_vendor.t(item.totalNum), x: common_vendor.t(item.shelfNum), y: item.totalNum == item.shelfNum ? "/pagesHome/static/qitao.png" : "/pagesHome/static/weiqitao.png" }) : {}, Number(common_vendor.unref(pagetype)) === 2 ? { z: common_vendor.f(common_vendor.unref(scanlist), (item2, k1, i1) => { return { a: common_vendor.t(item2.orderCode), b: common_vendor.o(($event) => goorderdetail(item2)), c: common_vendor.t(item2.orderPackageCode), d: common_vendor.t(item2.positionCode) }; }) } : {}); }), m: Number(common_vendor.unref(pagetype)) === 1, n: Number(common_vendor.unref(pagetype)) === 2, o: common_vendor.o(($event) => setstate(true)), p: common_vendor.unref(isshowtot) }, common_vendor.unref(isshowtot) ? common_vendor.e({ q: common_vendor.unref(pagetype) == "1" }, common_vendor.unref(pagetype) == "1" ? { r: common_vendor.t((((_g = common_vendor.unref(obldate)) == null ? void 0 : _g.areaName) || "") + "-" + (((_h = common_vendor.unref(obldate)) == null ? void 0 : _h.shelfName) || "") + "-" + (((_i = common_vendor.unref(obldate)) == null ? void 0 : _i.allocationName) || "")), s: common_vendor.t(common_vendor.unref(trayCode)), t: common_vendor.t(traynumber.value), v: common_vendor.t((((_j = common_vendor.unref(dtilobj)) == null ? void 0 : _j.areaTitle) || "") + "-" + (((_k = common_vendor.unref(dtilobj)) == null ? void 0 : _k.shelfTitle) || "") + "-" + (((_l = common_vendor.unref(dtilobj)) == null ? void 0 : _l.allocationTitle) || "")), w: common_vendor.o(($event) => setstate(false)), x: common_vendor.o(uplist) } : {}, { y: common_vendor.unref(pagetype) == "2" }, common_vendor.unref(pagetype) == "2" ? common_vendor.e({ z: common_vendor.t(traynumber.value), A: common_vendor.t((((_m = common_vendor.unref(dtilobj)) == null ? void 0 : _m.areaTitle) || "") + "-" + (((_n = common_vendor.unref(dtilobj)) == null ? void 0 : _n.shelfTitle) || "") + "-" + (((_o = common_vendor.unref(dtilobj)) == null ? void 0 : _o.allocationTitle) || "")), B: common_vendor.unref(dtilobj).trayCode }, common_vendor.unref(dtilobj).trayCode ? { C: common_vendor.t((_p = common_vendor.unref(dtilobj)) == null ? void 0 : _p.trayCode) } : {}, { D: common_vendor.o(($event) => setstate(false)), E: common_vendor.o(uplist) }) : {}) : {}, { F: common_vendor.sr(tip, "6e763ec5-1", { "k": "tip" }) }); }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6e763ec5"], ["__file", "D:/worksp/logpm/pagesHome/pages/Relocation/Relocation.vue"]]); wx.createPage(MiniProgramPage);