| | |
| | | type="icon" |
| | | icon="scan" |
| | | color="#0d867f" |
| | | @click="openScan" |
| | | style="color: #0d867f" |
| | | @click="openScan" |
| | | ></wd-button> |
| | | </template> |
| | | </CardTitle> |
| | | |
| | | <!-- 当前物料信息 --> |
| | | <view class="material-info" v-if="currentMaterial"> |
| | | <view v-if="currentMaterial" class="material-info"> |
| | | <wd-card custom-class="info-card"> |
| | | <view class="info-compact"> |
| | | <view class="icon_box"> |
| | |
| | | <text class="outbound_item_label">生产批次号:</text> |
| | | <text class="outbound_item_value">{{ item.monofilamentNumber || "-" }}</text> |
| | | </view> |
| | | <template v-if="!item.isMesMissing"> |
| | | <view class="outbound_item_row"> |
| | | <text class="outbound_item_label">规格型号:</text> |
| | | <text class="outbound_item_value">{{ item.model || "-" }}</text> |
| | |
| | | <text class="outbound_item_label">生产日期:</text> |
| | | <text class="outbound_item_value">{{ item.productionDate || "-" }}</text> |
| | | </view> |
| | | </template> |
| | | </view> |
| | | </view> |
| | | <view class="outbound_item_action"> |
| | |
| | | |
| | | <!-- 底部按钮 --> |
| | | <view v-if="goodsList.length > 0" class="outbound_footer"> |
| | | <wd-button block @click="handleOutbound" style="background: #0d867f"> |
| | | <wd-button block style="background: #0d867f" @click="handleOutbound"> |
| | | <text class="text-[#fff]">出库</text> |
| | | </wd-button> |
| | | </view> |
| | |
| | | // 格式化时间 |
| | | const formatTime = (date: Date) => { |
| | | return dayjs(date).format("YYYY-MM-DD HH:mm:ss"); |
| | | }; |
| | | |
| | | const handleMonofilamentNumber = (value?: string) => { |
| | | if (!value) return ""; |
| | | if (!value.includes("-")) { |
| | | if (value.length < 3) { |
| | | toast.error("单丝编号长度不足,无法添加 '-'"); |
| | | return ""; |
| | | } |
| | | const insertIndex = value.length - 3; |
| | | return `${value.slice(0, insertIndex)}-${value.slice(insertIndex)}`; |
| | | } |
| | | return value; |
| | | }; |
| | | |
| | | // 直接扫码 |
| | |
| | | let scanData; |
| | | try { |
| | | scanData = JSON.parse(scanText); |
| | | } catch (e) { |
| | | } catch { |
| | | toast.error("二维码格式错误"); |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | // 调用拉丝接口:GET /mes/app/getTagByLsMonofilamentNumber?monofilamentNumber=xxxx |
| | | const { data } = await OutboundApi.getTagByLsMonofilamentNumber({ |
| | | let data; |
| | | try { |
| | | const response = await OutboundApi.getTagByLsMonofilamentNumber({ |
| | | monofilamentNumber, |
| | | }); |
| | | data = response.data; |
| | | } catch { |
| | | data = null; |
| | | } |
| | | |
| | | const list = Array.isArray(data) ? data : data ? [data] : []; |
| | | if (!list.length) { |
| | | toast.error("未查询到条码信息"); |
| | | const formattedMonofilamentNumber = handleMonofilamentNumber(monofilamentNumber); |
| | | if (!formattedMonofilamentNumber) { |
| | | return; |
| | | } |
| | | const newItem = { |
| | | id: monofilamentNumber || "-", |
| | | contractNo: "未在mes中生产", |
| | | monofilamentNumber: formattedMonofilamentNumber, |
| | | model: "-", |
| | | weight: "-", |
| | | clienteleName: "-", |
| | | actuallyLength: "-", |
| | | productionDate: "-", |
| | | type: "", |
| | | devicemodel: "", |
| | | state: "", |
| | | projectId: "", |
| | | productuser: "", |
| | | rawData: null, |
| | | scanCode: scanText, |
| | | scanTime: formatTime(new Date()), |
| | | isMesMissing: true, |
| | | }; |
| | | goodsList.value.push(newItem); |
| | | toast.success("扫码成功"); |
| | | return; |
| | | } |
| | | |
| | |
| | | const requestData = goodsList.value.map((item) => ({ |
| | | outPutId: item.id, |
| | | projectId: item.projectId || "", |
| | | monofilamentNumber: item.monofilamentNumber || "", |
| | | })); |
| | | |
| | | // 按出库单明细构建请求体 |
| | |
| | | try { |
| | | // 如果是编码过的(包含 %),decode 一次;否则直接返回 |
| | | return val.includes("%") ? decodeURIComponent(val) : val; |
| | | } catch (e) { |
| | | } catch { |
| | | return val; |
| | | } |
| | | }; |