"use strict"; const common_vendor = require("../../../common/vendor.js"); const api_user = require("../../../api/user.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"); require("../../../store/uaeUserStore.js"); if (!Array) { const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar"); const _component_saomiao2 = common_vendor.resolveComponent("saomiao2"); const _component_tips = common_vendor.resolveComponent("tips"); (_easycom_u_navbar2 + _component_saomiao2 + _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: "ScanUp", setup(__props) { common_vendor.inject("utils"); const tip = common_vendor.ref(null); let details = common_vendor.reactive({ checkstate: 1, upshelfScanType: "", scancode: "", allocationId: "", //库位id datalist: [], reqobj: {}, uplistarr: [], renderList: [] }); common_vendor.watchEffect(() => { if (Number(details.upshelfScanType) == 1 || Number(details.upshelfScanType) == 2) { details.uplistarr = fn2(details.uplistarr, "orderCode"); } else if (Number(details.upshelfScanType) == 3) ; else if (Number(details.upshelfScanType) == 4) { details.uplistarr = fn2(details.uplistarr, "orderCode"); } }); common_vendor.onLoad((op) => { details.upshelfScanType = op.type; }); common_vendor.onShow(() => { common_vendor.index.$on("scancodedate", function(code) { if (code) { details.scancode = code; scandata(); } }); }); common_vendor.onHide(() => { common_vendor.index.$off("scancodedate"); }); async function scandata() { var _a; if (!details.allocationId) { let data = { allocationId: details.scancode }; let res = await api_user.warehouseUpdownTypeupShelfScanAllocation(data); console.log(res); if (res.code == 200) { details.reqobj = res.data; details.allocationId = res.data.allocationId; details.datalist = ((_a = res.data) == null ? void 0 : _a.list) || []; if (details.checkstate === 2) return details.renderList = details.datalist; } } else { if (Number(details.upshelfScanType) == 4 && details.reqobj.trayCode) { tip.value.setdetails({ title: "提示", content: "该库位已绑托盘", confirmTxt: "确认", isshow: true, isshowcancel: true, success: () => { tip.value.setisshow(false); }, cancel: () => { tip.value.setisshow(false); }, close: () => { tip.value.setisshow(false); } }); return; } let data = { upshelfScanType: details.upshelfScanType, code: details.scancode }; let res = await api_user.warehouseUpdownTypeupShelfScanGoods(data); console.log(res); if (res.code == 200) { details.uplistarr = details.uplistarr.concat(res.data); if (details.checkstate === 1) return details.renderList = details.uplistarr; } } } function goorderdetail(item, type) { if (type !== 1) return; common_vendor.index.navigateTo({ url: "/pagesHome/pages/orderDetails/orderDetails?orderCode=" + item.orderCode }); } function uplist() { tip.value.setdetails({ title: "提示", content: "确认上架?", confirmTxt: "确认", isshow: true, isshowcancel: true, success: async () => { if (details.uplistarr.length == 0) { let content = ""; if (Number(details.upshelfScanType) == 4) { content = "请先扫描托盘码"; } else { content = "请先扫描包件数据"; } tip.value.setdetails({ title: "警告", content, confirmTxt: "确认", isshow: true, isshowcancel: true, success: () => { tip.value.setisshow(false); }, cancel: () => { tip.value.setisshow(false); }, close: () => { tip.value.setisshow(false); } }); return; } let res = null; if (Number(details.upshelfScanType) == 1 || Number(details.upshelfScanType) == 2) { let data = { allocationId: details.allocationId, upShelfOrderList: details.uplistarr }; res = await api_user.warehouseUpdownTypeupShelfOrder(data); } else if (Number(details.upshelfScanType) == 3) { let data = { allocationId: details.allocationId, upShelfPackageList: details.uplistarr }; res = await api_user.warehouseUpdownTypeupShelfPackage(data); } else if (Number(details.upshelfScanType) == 4) { let data = { allocationId: details.allocationId, trayCode: details.uplistarr[0].trayCode }; res = await api_user.warehouseUpdownTypeupShelfTray(data); } if (res.code == 200) { details.uplistarr = []; details.scancode = details.allocationId; details.allocationId = ""; scandata(); } tip.value.setisshow(false); }, cancel: () => { tip.value.setisshow(false); }, close: () => { tip.value.setisshow(false); } }); } function fn2(tempArr, fnname) { let result = []; tempArr.map((item) => { if (result.length == 0) { item.enterNum = Number(item.enterNum); result.push(item); } else { let ckindex = -1; result.map((ite, index) => { if (ite[fnname] == item[fnname]) { ckindex = index; } }); if (ckindex != -1) { result[ckindex].enterNum += Number(item.enterNum); } else { item.enterNum = Number(item.enterNum); result.push(item); } } }); return result; } function setstate(state) { details.checkstate = state; if (state === 1) return details.renderList = details.uplistarr; else if (state === 2) return details.renderList = details.datalist; } const { uplistarr, checkstate, upshelfScanType, allocationId, datalist, reqobj, renderList } = common_vendor.toRefs(details); return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.p({ title: "扫描上架", bgColor: "#D3832A", leftIconColor: "#ffffff", titleStyle: "color:#ffffff", placeholder: true, autoBack: true, leftIconSize: "35" }), b: common_vendor.t((common_vendor.unref(reqobj).warehouseName || "") + "-" + (common_vendor.unref(reqobj).areaTitle || "") + "-" + (common_vendor.unref(reqobj).shelfTitle || "") + "-" + (common_vendor.unref(reqobj).allocationTitle || "")), c: common_vendor.t(common_vendor.unref(reqobj).warehouseName), d: common_vendor.t(common_vendor.unref(reqobj).areaTitle), e: common_vendor.t(common_vendor.unref(reqobj).totalNum || 0), f: common_vendor.t(common_vendor.unref(reqobj).orderNum || 0), g: common_vendor.t(common_vendor.unref(reqobj).stockTotalNum || 0), h: common_vendor.t(common_vendor.unref(reqobj).stockNum || 0), i: common_vendor.o(($event) => setstate(1)), j: common_vendor.n(common_vendor.unref(checkstate) == 1 ? "xz" : ""), k: common_vendor.o(($event) => setstate(2)), l: common_vendor.n(common_vendor.unref(checkstate) == 2 ? "xz" : ""), m: common_vendor.o(($event) => setstate(3)), n: common_vendor.n(common_vendor.unref(checkstate) == 3 ? "xz" : ""), o: common_vendor.unref(details).checkstate === 1 || common_vendor.unref(details).checkstate === 2 }, common_vendor.unref(details).checkstate === 1 || common_vendor.unref(details).checkstate === 2 ? { p: common_vendor.f(common_vendor.unref(renderList), (item, k0, i0) => { return common_vendor.e({ a: item.goodsType == 0 }, item.goodsType == 0 ? { b: common_vendor.t(item.orderPackageCode) } : {}, { c: item.goodsType == 0 }, item.goodsType == 0 ? { d: common_vendor.t(item.orderCode), e: common_vendor.o(($event) => goorderdetail(item, item.goodsType)) } : {}, { f: item.goodsType === 1 }, item.goodsType === 1 ? { g: common_vendor.t(item.serviceNum), h: common_vendor.t(item.orderCode), i: common_vendor.o(($event) => goorderdetail(item, item.goodsType)) } : {}, { j: item.goodsType === 2 }, item.goodsType === 2 ? { k: common_vendor.t(item.waybillNo), l: common_vendor.t(item.orderCode) } : {}, { m: item.goodsType === 3 }, item.goodsType === 3 ? { n: common_vendor.t(item.materialCode), o: common_vendor.t(item.materialName), p: common_vendor.t(item.orderCode), q: common_vendor.t(item.marketName), r: common_vendor.t(item.incomingBatch) } : {}, { s: common_vendor.t(item.totalNum) }, Number(common_vendor.unref(details).upshelfScanType) != 3 ? { t: item.totalNum == item.shelfNum ? "/pagesHome/static/qitao.png" : "/pagesHome/static/weiqitao.png" } : {}); }), q: Number(common_vendor.unref(details).upshelfScanType) != 3 } : {}, { r: common_vendor.unref(checkstate) == 3 && common_vendor.unref(reqobj).trayCode }, common_vendor.unref(checkstate) == 3 && common_vendor.unref(reqobj).trayCode ? { s: common_vendor.t(common_vendor.unref(reqobj).trayCode), t: common_vendor.t(common_vendor.unref(reqobj).trayNum) } : {}, { v: common_vendor.o(uplist), w: common_vendor.sr(tip, "62de3784-2", { "k": "tip" }) }); }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/worksp/logpm/pagesHome/pages/ScanUp/ScanUp.vue"]]); wx.createPage(MiniProgramPage);