| | |
| | | }); |
| | | }, |
| | | |
| | | // 拉丝单丝二维码查询(通过单丝号) |
| | | getTagByLsMonofilamentNumber(params: { monofilamentNumber: string }) { |
| | | return request<BaseResult<any[]>>({ |
| | | url: "/app/getTagByLsMonofilamentNumber", |
| | | // 拉丝单丝二维码查询(通过单丝号,返回对象) |
| | | getTagByMonofilamentNumber(params: { monofilamentNumber: string }) { |
| | | return request<BaseResult<any>>({ |
| | | url: "/app/getTagByMonofilamentNumber", |
| | | method: "GET", |
| | | data: params, |
| | | }); |
| | |
| | | }); |
| | | }, |
| | | |
| | | // 单丝领用扫码(按单丝编号) |
| | | getScarnTag(params: { monofilamentNumber: string; twistId: number | string }) { |
| | | return request<BaseResult<any>>({ |
| | | url: "/app/scarnTag", |
| | | method: "GET", |
| | | data: params, |
| | | }); |
| | | }, |
| | | |
| | | // 拉丝二维码查询 |
| | | getTagByIdLs(params: { outPutId: string | number }) { |
| | | return request<BaseResult<any>>({ |
| | |
| | | <view class="flex justify-between w-full"> |
| | | <text class="font-medium text-[#252525]">设备编号: {{ data[map.deviceModel] }}</text> |
| | | <wd-tag |
| | | v-if="data.type !== '绞线'" |
| | | :color="data[map.isMonofil] == 1 ? '#0D867F' : '#e6a23c'" |
| | | :bg-color="data[map.isMonofil] == 1 ? '#E7F4EC' : '#fdf6ec'" |
| | | > |
| | |
| | | } |
| | | |
| | | outPutId = scanData.id; |
| | | monofilamentNumber = scanData.monofilamentNumber; |
| | | |
| | | if (!outPutId) { |
| | | toast.error("二维码格式错误,缺少id信息"); |
| | | if (outPutId) { |
| | | //TODO兼容目前已打印的二维码 |
| | | // 有 id:按 id 查重并调 getTagByIdAll(返回数组) |
| | | const exists = goodsList.value.some((item) => { |
| | | const itemId = item.id; |
| | | return itemId && itemId === outPutId && itemId !== "-"; |
| | | }); |
| | | if (exists) { |
| | | toast.error("该条码已存在,请勿重复扫码"); |
| | | return; |
| | | } |
| | | const { data } = await OutboundApi.getTagByIdAll({ |
| | | outPutId: outPutId, |
| | | }); |
| | | const list = data || []; |
| | | if (!list.length) { |
| | | toast.error("未查询到条码信息"); |
| | | return; |
| | | } |
| | | tagData = list[0]; |
| | | needContractCheck = true; |
| | | } else if (monofilamentNumber) { |
| | | // 有 monofilamentNumber:按单丝号查重并调 getTagByMonofilamentNumber(返回对象) |
| | | const exists = goodsList.value.some((item) => { |
| | | const itemMono = item.monofilamentNumber; |
| | | return itemMono && itemMono === monofilamentNumber && itemMono !== "-"; |
| | | }); |
| | | if (exists) { |
| | | toast.error("该条码已存在,请勿重复扫码"); |
| | | return; |
| | | } |
| | | const { data } = await OutboundApi.getTagByMonofilamentNumber({ |
| | | monofilamentNumber, |
| | | }); |
| | | if (!data || (Array.isArray(data) && !data.length)) { |
| | | toast.error("未查询到条码信息"); |
| | | return; |
| | | } |
| | | tagData = Array.isArray(data) ? data[0] : data; |
| | | outPutId = tagData?.id || monofilamentNumber; |
| | | needContractCheck = true; |
| | | } else { |
| | | toast.error("二维码格式错误,缺少id或单丝编号信息"); |
| | | return; |
| | | } |
| | | |
| | | // 检查是否已存在(根据 id 判断) |
| | | const exists = goodsList.value.some((item) => { |
| | | const itemId = item.id; |
| | | return itemId && itemId === outPutId && itemId !== "-"; |
| | | }); |
| | | |
| | | if (exists) { |
| | | toast.error("该条码已存在,请勿重复扫码"); |
| | | return; |
| | | } |
| | | |
| | | // 调用接口获取绞线/拉丝详细信息(含出库状态) |
| | | const { data } = await OutboundApi.getTagByIdAll({ |
| | | outPutId: outPutId, |
| | | }); |
| | | |
| | | const list = data || []; |
| | | if (!list.length) { |
| | | toast.error("未查询到条码信息"); |
| | | return; |
| | | } |
| | | |
| | | tagData = list[0]; |
| | | needContractCheck = true; // 只有绞线需要做合同号校验 |
| | | } else { |
| | | // ===== 单丝拉丝二维码逻辑(纯字符串) ===== |
| | | // 示例:ZD7z30202616101201#[@]01,Φ5.6,-,750826011001001,600.6 |
| | |
| | | return; |
| | | } |
| | | |
| | | // 调用拉丝接口:GET /mes/app/getTagByLsMonofilamentNumber?monofilamentNumber=xxxx |
| | | // 调用拉丝接口:GET /mes/app/getTagByMonofilamentNumber?monofilamentNumber=xxxx |
| | | let data; |
| | | try { |
| | | const response = await OutboundApi.getTagByLsMonofilamentNumber({ |
| | | const response = await OutboundApi.getTagByMonofilamentNumber({ |
| | | monofilamentNumber, |
| | | }); |
| | | data = response.data; |
| | |
| | | |
| | | const paramsId = ref(); |
| | | const cardData = reactive({ |
| | | type: "绞线", |
| | | deviceModel: undefined, |
| | | model: undefined, |
| | | systemNo: undefined, |
| | |
| | | return; |
| | | } |
| | | |
| | | // 解析扫码数据,现在二维码只包含id |
| | | // 解析扫码数据:可能包含 id(outPutId) 或 monofilamentNumber |
| | | const scanData = JSON.parse(code.code); |
| | | const outPutId = scanData.id; |
| | | const monofilamentNumber = scanData.monofilamentNumber; |
| | | |
| | | if (!outPutId) { |
| | | toast.error("二维码格式错误,缺少id信息"); |
| | | let data: any; |
| | | |
| | | if (outPutId) { |
| | | // 有 outPutId:先查层级,再调 scarn |
| | | const { data: tagData } = await TwistApi.getTagByIdLs({ |
| | | outPutId: outPutId, |
| | | }); |
| | | if (tagData.layer && tagData.layer !== currentLayer.twistedLayer) { |
| | | toast.error( |
| | | `领用层级不对,当前层是:${currentLayer.twistedLayer},领用单丝层是:${tagData.layer}` |
| | | ); |
| | | } |
| | | const res = await TwistApi.getScarn({ |
| | | outPutId: outPutId, |
| | | twistId: currentLayer.twistId, |
| | | }); |
| | | data = res.data; |
| | | } else if (monofilamentNumber) { |
| | | // 无 outPutId 有 monofilamentNumber:只调 scarnTag,返回含 layer 用于提示 |
| | | const res = await TwistApi.getScarnTag({ |
| | | monofilamentNumber, |
| | | twistId: currentLayer.twistId, |
| | | }); |
| | | data = res.data; |
| | | if (data.layer && data.layer !== currentLayer.twistedLayer) { |
| | | toast.error( |
| | | `领用层级不对,当前层是:${currentLayer.twistedLayer},领用单丝层是:${data.layer}` |
| | | ); |
| | | } |
| | | } else { |
| | | toast.error("二维码格式错误,缺少id或单丝编号信息"); |
| | | return; |
| | | } |
| | | |
| | | // 调用接口获取拉丝详细信息 |
| | | const { data: tagData } = await TwistApi.getTagByIdLs({ |
| | | outPutId: outPutId, |
| | | }); |
| | | |
| | | // 判断层级是否匹配(如果接口返回的数据中有layer字段) |
| | | if (tagData.layer && tagData.layer !== currentLayer.twistedLayer) { |
| | | toast.error( |
| | | `领用层级不对,当前层是:${currentLayer.twistedLayer},领用单丝层是:${tagData.layer}` |
| | | ); |
| | | // return; |
| | | } |
| | | |
| | | // 调用单丝领用扫码接口 |
| | | const { data } = await TwistApi.getScarn({ |
| | | outPutId: outPutId, |
| | | twistId: currentLayer.twistId, |
| | | }); |
| | | |
| | | // 检查当前层是否已存在该单丝 |
| | | const exists = currentLayer.strandedWireDish?.some( |