feat(hand-factory): 新增移库和查看钢卷功能并优化UI
- 新增移库操作流程,包括扫描钢卷和目标库区 - 添加查看存储钢卷功能,支持快速查看库区钢卷信息 - 优化material-picker组件,显示物料类型信息 - 更新版本号至1.3.13并调整API基础地址 - 改进UI样式,包括按钮布局和扫码界面 - 修复更新弹窗取消按钮文本问题
This commit is contained in:
@@ -49,7 +49,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 严格遍历产品过滤列表 -->
|
<!-- 严格遍历产品过滤列表 -->
|
||||||
<view class="warehouse-item" v-for="product in filteredProducts" :key="'product_' + product.productId" @click="selectProduct(product)" v-else>
|
<view class="warehouse-item" v-for="product in filteredProducts" :key="'product_' + product.productId" @click="selectProduct(product)" v-else>
|
||||||
<text class="warehouse-name">{{ product.productName }}【{{ product.specification || '暂无规格' }}】</text>
|
<text class="warehouse-name">{{ product.productName }}【{{ product.specification || '暂无规格' }}】({{ product.material }})</text>
|
||||||
<text class="warehouse-check" v-if="itemId === product.productId">✓</text>
|
<text class="warehouse-check" v-if="itemId === product.productId">✓</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="empty-tip" v-if="!loadingProducts && (!filteredProducts || filteredProducts.length === 0)">
|
<view class="empty-tip" v-if="!loadingProducts && (!filteredProducts || filteredProducts.length === 0)">
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 严格遍历原材料过滤列表 -->
|
<!-- 严格遍历原材料过滤列表 -->
|
||||||
<view class="warehouse-item" v-for="material in filteredRawMaterials" :key="'material_' + material.rawMaterialId" @click="selectRawMaterial(material)" v-else>
|
<view class="warehouse-item" v-for="material in filteredRawMaterials" :key="'material_' + material.rawMaterialId" @click="selectRawMaterial(material)" v-else>
|
||||||
<text class="warehouse-name">{{ material.rawMaterialName }}【{{ material.specification || '暂无规格' }}】</text>
|
<text class="warehouse-name">{{ material.rawMaterialName }}【{{ material.specification || '暂无规格' }}】({{ material.material }})</text>
|
||||||
<text class="warehouse-check" v-if="itemId === material.rawMaterialId">✓</text>
|
<text class="warehouse-check" v-if="itemId === material.rawMaterialId">✓</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="empty-tip" v-if="!loadingRawMaterials && (!filteredRawMaterials || filteredRawMaterials.length === 0)">
|
<view class="empty-tip" v-if="!loadingRawMaterials && (!filteredRawMaterials || filteredRawMaterials.length === 0)">
|
||||||
@@ -122,6 +122,10 @@
|
|||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: undefined
|
default: undefined
|
||||||
},
|
},
|
||||||
|
materialType: {
|
||||||
|
type: String,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@@ -270,6 +274,7 @@
|
|||||||
|
|
||||||
this.$emit('update:itemId', product.productId);
|
this.$emit('update:itemId', product.productId);
|
||||||
this.$emit('update:itemType', 'product');
|
this.$emit('update:itemType', 'product');
|
||||||
|
this.$emit('update:materialType', '成品')
|
||||||
this.selectedName = product.productName;
|
this.selectedName = product.productName;
|
||||||
uni.showToast({ title: `已选择产品:${product.productName}`, icon: 'success' });
|
uni.showToast({ title: `已选择产品:${product.productName}`, icon: 'success' });
|
||||||
this.closeProductPicker();
|
this.closeProductPicker();
|
||||||
@@ -282,6 +287,7 @@
|
|||||||
|
|
||||||
this.$emit('update:itemId', material.rawMaterialId);
|
this.$emit('update:itemId', material.rawMaterialId);
|
||||||
this.$emit('update:itemType', 'raw_material');
|
this.$emit('update:itemType', 'raw_material');
|
||||||
|
this.$emit('update:materialType', '原料')
|
||||||
this.selectedName = material.rawMaterialName;
|
this.selectedName = material.rawMaterialName;
|
||||||
uni.showToast({ title: `已选择原材料:${material.rawMaterialName}`, icon: 'success' });
|
uni.showToast({ title: `已选择原材料:${material.rawMaterialName}`, icon: 'success' });
|
||||||
this.closeRawMaterialPicker();
|
this.closeRawMaterialPicker();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// 应用全局配置
|
// 应用全局配置
|
||||||
module.exports = {
|
module.exports = {
|
||||||
baseUrl: 'http://192.168.31.116:8080',
|
// baseUrl: 'http://192.168.31.116:8080',
|
||||||
// baseUrl: 'http://140.143.206.120:8080',
|
baseUrl: 'http://140.143.206.120:8080',
|
||||||
// baseUrl: 'http://localhost:8080',
|
// baseUrl: 'http://localhost:8080',
|
||||||
// 应用信息
|
// 应用信息
|
||||||
appInfo: {
|
appInfo: {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name" : "科伦普",
|
"name" : "科伦普",
|
||||||
"appid" : "__UNI__E781B49",
|
"appid" : "__UNI__E781B49",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.3.12",
|
"versionName" : "1.3.13",
|
||||||
"versionCode" : 1,
|
"versionCode" : 1,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
@@ -55,6 +55,20 @@
|
|||||||
{
|
{
|
||||||
"navigationBarTitleText" : "扫码结果"
|
"navigationBarTitleText" : "扫码结果"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/easycode/tranfer",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "移库操作"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/easycode/editby",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "查看钢卷"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
// "path": "pages/register",
|
// "path": "pages/register",
|
||||||
|
|||||||
@@ -7,10 +7,7 @@
|
|||||||
<text class="title-text">分条操作</text>
|
<text class="title-text">分条操作</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-grid">
|
<view class="btn-grid">
|
||||||
<button
|
<button v-for='item in splitTypes' :key="item.dictValue" @click="handleScan(item.dictValue)"
|
||||||
v-for='item in splitTypes'
|
|
||||||
:key="item.dictValue"
|
|
||||||
@click="handleScan(item.dictValue)"
|
|
||||||
class="type-btn split-btn">
|
class="type-btn split-btn">
|
||||||
{{ item.dictLabel }}
|
{{ item.dictLabel }}
|
||||||
</button>
|
</button>
|
||||||
@@ -24,10 +21,7 @@
|
|||||||
<text class="title-text">其他操作</text>
|
<text class="title-text">其他操作</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-grid">
|
<view class="btn-grid">
|
||||||
<button
|
<button v-for='item in otherTypes' :key="item.dictValue" @click="handleScan(item.dictValue)"
|
||||||
v-for='item in otherTypes'
|
|
||||||
:key="item.dictValue"
|
|
||||||
@click="handleScan(item.dictValue)"
|
|
||||||
class="type-btn other-btn">
|
class="type-btn other-btn">
|
||||||
{{ item.dictLabel }}
|
{{ item.dictLabel }}
|
||||||
</button>
|
</button>
|
||||||
@@ -41,13 +35,14 @@
|
|||||||
<text class="title-text">快捷操作</text>
|
<text class="title-text">快捷操作</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-grid quick-grid">
|
<view class="btn-grid quick-grid">
|
||||||
<!-- <button class="type-btn move-btn" @click="handleTranfer">移库</button> -->
|
|
||||||
<button class="type-btn ship-btn" @click="handleShip">发货</button>
|
<button class="type-btn ship-btn" @click="handleShip">发货</button>
|
||||||
|
<button class="type-btn move-btn" @click="handleTranfer">移库</button>
|
||||||
|
<button class="type-btn see-btn" @click="handleSee">查看存储钢卷</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<uni-popup ref="tranferPopup" type="bottom">
|
<uni-popup ref="tranferPopup" type="bottom">
|
||||||
<view style="background-color: white;">
|
<view style="background-color: white; padding: 20rpx;">
|
||||||
<view class="info-card" v-if="form.coilId">
|
<view class="info-card" v-if="form.coilId">
|
||||||
<view class="card-title">
|
<view class="card-title">
|
||||||
<text class="title-dot"></text>
|
<text class="title-dot"></text>
|
||||||
@@ -70,21 +65,40 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="item-label">当前库区</text>
|
<text class="item-label">当前库区</text>
|
||||||
<text class="item-value">{{ coilDetail.actualWarehouseName }}</text>
|
<text class="item-value">{{ coilDetail.actualWarehouseName || '-' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 移库表单区域:扫码选择目标库区 + 回显 -->
|
||||||
<view class="form-card" v-if="form.coilId">
|
<view class="form-card" v-if="form.coilId">
|
||||||
<view class="form-item form-item-optional">
|
<view class="form-item form-item-optional">
|
||||||
<text class="form-label-optional">真实库区</text>
|
<text class="form-label-optional">目标库区</text>
|
||||||
<klp-warehouse-picker v-model="form.actualWarehouseId" :disabled="coilDetail.dataType === 0"
|
|
||||||
placeholder="请选择目标库区" ware-type="actual" />
|
<!-- 未选择目标库区:显示扫码按钮 -->
|
||||||
|
<view v-if="!targetWarehouse" class="scan-btn-wrapper" @click="handleScanWarehouseCode">
|
||||||
|
<view class="scan-icon">
|
||||||
|
<text class="icon-camera">📷</text>
|
||||||
|
</view>
|
||||||
|
<text class="scan-tip">扫描库区码</text>
|
||||||
|
<text class="scan-hint">请扫描目标库区的二维码</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 已选择目标库区:回显信息 + 重新扫码按钮 -->
|
||||||
|
<view v-else class="selected-warehouse">
|
||||||
|
<view class="warehouse-info">
|
||||||
|
<text class="warehouse-label">已选中:</text>
|
||||||
|
<text class="warehouse-value">{{ targetWarehouse.actualWarehouseName }}</text>
|
||||||
|
</view>
|
||||||
|
<button class="re-scan-btn" @click="handleReScan">重新选择</button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="action-buttons">
|
<view class="action-buttons">
|
||||||
<button class="btn btn-secondary" @click="handleReScan">重新扫码</button>
|
<button class="btn btn-secondary" @click="handleClosePopup">取消</button>
|
||||||
<button v-if="coilDetail.dataType === 1" class="btn btn-primary" @click="handleConfirm" :disabled="loading">
|
<!-- 已选择目标库区才启用提交按钮 -->
|
||||||
{{ loading ? '提交中...' : '保存' }}
|
<button class="btn btn-primary" @click="handleConfirm" :disabled="loading || !targetWarehouse">
|
||||||
|
{{ loading ? '提交中...' : '确认移库' }}
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -109,11 +123,17 @@
|
|||||||
} from '@/api/wms/code.js'
|
} from '@/api/wms/code.js'
|
||||||
import {
|
import {
|
||||||
getMaterialCoil,
|
getMaterialCoil,
|
||||||
updateMaterialCoilSimple
|
updateMaterialCoilSimple,
|
||||||
|
listMaterialCoil,
|
||||||
|
updateMaterialCoil
|
||||||
} from '@/api/wms/coil.js'
|
} from '@/api/wms/coil.js'
|
||||||
import {
|
import {
|
||||||
addPendingAction
|
addPendingAction
|
||||||
} from '@/api/wms/pendingAction.js'
|
} from '@/api/wms/pendingAction.js'
|
||||||
|
// 导入获取库区详情的接口(需确保接口存在,若接口名不同请调整)
|
||||||
|
import {
|
||||||
|
getActualWarehouse
|
||||||
|
} from '@/api/wms/actualWarehouse.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -121,7 +141,9 @@
|
|||||||
types: [],
|
types: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
coilDetail: {},
|
coilDetail: {},
|
||||||
form: {}
|
form: {},
|
||||||
|
targetWarehouse: null, // 存储选中的目标库区信息
|
||||||
|
bomDialogShow: false // BOM参数弹窗控制(原有功能补充)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -149,45 +171,37 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 扫码并创建待操作
|
handleSee() {
|
||||||
handleScan(actionType) {
|
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: async (res) => {
|
success(scanRes) {
|
||||||
console.log('=== 开始扫码流程 ===');
|
// 查询真实库区在此处的钢卷
|
||||||
console.log('扫码结果:', res.result);
|
listMaterialCoil({ actualWarehouseId: scanRes.result, dataType: 1 }).then(res => {
|
||||||
console.log('操作类型:', actionType);
|
if (res.total == 0) {
|
||||||
uni.showLoading({
|
uni.showToast({
|
||||||
title: '处理中...'
|
title: '该库区未发现钢卷',
|
||||||
});
|
icon: 'none'
|
||||||
|
|
||||||
try {
|
|
||||||
const qrcodeId = res.result;
|
|
||||||
// 1. 通过二维码ID获取二维码详情
|
|
||||||
console.log('1. 获取二维码详情,ID:', qrcodeId);
|
|
||||||
const qrcodeRes = await getGenerateRecord(qrcodeId);
|
|
||||||
console.log('二维码响应:', qrcodeRes);
|
|
||||||
|
|
||||||
if (qrcodeRes.code !== 200) {
|
|
||||||
throw new Error('未找到二维码记录');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 解析二维码的content,获取coil_id
|
|
||||||
const qrcodeRecord = qrcodeRes.data;
|
|
||||||
console.log('2. 二维码记录:', qrcodeRecord);
|
|
||||||
|
|
||||||
// 检查二维码状态(0=失效,1=有效)
|
|
||||||
if (qrcodeRecord.status === 0) {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '该二维码已失效,无法创建待操作任务',
|
|
||||||
showCancel: false
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (res.rows.length == 1) {
|
||||||
|
const coilId = res.rows[0].coilId;
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/easycode/editby?coilId=' + coilId
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '数据异常',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
const content = JSON.parse(qrcodeRecord.content);
|
// 扫码并创建待操作(原有方法不变)
|
||||||
console.log('解析后的内容:', content);
|
async handleScan(actionType) {
|
||||||
|
const content = await this.getQRCodeContent()
|
||||||
|
|
||||||
// 优先使用current_coil_id(当前有效的钢卷ID),如果没有则使用coil_id(兼容旧数据)
|
// 优先使用current_coil_id(当前有效的钢卷ID),如果没有则使用coil_id(兼容旧数据)
|
||||||
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content
|
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content
|
||||||
@@ -247,46 +261,15 @@
|
|||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/scansuccess/scansuccess'
|
url: '/pages/scansuccess/scansuccess'
|
||||||
})
|
})
|
||||||
// uni.showToast({
|
|
||||||
// title: '创建成功',
|
|
||||||
// icon: 'success',
|
|
||||||
// duration: 2000
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // 延迟后返回或跳转
|
|
||||||
// setTimeout(() => {
|
|
||||||
// // 可以跳转到待操作列表或返回上一页
|
|
||||||
// uni.navigateBack();
|
|
||||||
// }, 2000);
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('=== 扫码处理失败 ===');
|
|
||||||
console.error('错误信息:', err);
|
|
||||||
console.error('错误堆栈:', err.stack);
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: err.message || '处理失败',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
console.error('扫码失败:', err);
|
|
||||||
uni.showToast({
|
|
||||||
title: '扫码失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleShip() {
|
// 通用扫码获取二维码内容(原有方法不变)
|
||||||
|
async getQRCodeContent() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
console.log('=== 开始扫码流程 ===');
|
console.log('=== 开始扫码流程 ===');
|
||||||
console.log('扫码结果:', res.result);
|
console.log('扫码结果:', res.result);
|
||||||
// console.log('操作类型:', actionType);
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '处理中...'
|
title: '处理中...'
|
||||||
});
|
});
|
||||||
@@ -319,6 +302,34 @@
|
|||||||
|
|
||||||
const content = JSON.parse(qrcodeRecord.content);
|
const content = JSON.parse(qrcodeRecord.content);
|
||||||
console.log('解析后的内容:', content);
|
console.log('解析后的内容:', content);
|
||||||
|
resolve(content)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('=== 扫码处理失败 ===');
|
||||||
|
console.error('错误信息:', err);
|
||||||
|
console.error('错误堆栈:', err.stack);
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message || '处理失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '扫码失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 发货操作(原有方法不变)
|
||||||
|
async handleShip() {
|
||||||
|
const content = await this.getQRCodeContent();
|
||||||
|
|
||||||
// 优先使用current_coil_id(当前有效的钢卷ID),如果没有则使用coil_id(兼容旧数据)
|
// 优先使用current_coil_id(当前有效的钢卷ID),如果没有则使用coil_id(兼容旧数据)
|
||||||
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content
|
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content
|
||||||
@@ -334,7 +345,6 @@
|
|||||||
throw new Error('二维码中未包含有效的钢卷ID');
|
throw new Error('二维码中未包含有效的钢卷ID');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 3. 直接通过钢卷ID获取钢卷详情
|
// 3. 直接通过钢卷ID获取钢卷详情
|
||||||
console.log('3. 获取钢卷详情,钢卷ID:', coilId);
|
console.log('3. 获取钢卷详情,钢卷ID:', coilId);
|
||||||
const coilRes = await getMaterialCoil(coilId);
|
const coilRes = await getMaterialCoil(coilId);
|
||||||
@@ -374,8 +384,8 @@
|
|||||||
await addPendingAction({
|
await addPendingAction({
|
||||||
coilId: coilRes.data.coilId,
|
coilId: coilRes.data.coilId,
|
||||||
currentCoilNo: coilRes.data.currentCoilNo,
|
currentCoilNo: coilRes.data.currentCoilNo,
|
||||||
actionType: 4, // 4=发货
|
actionType: 402, // 402=发货
|
||||||
actionStatus: 2, // 2=已完成
|
actionStatus: 2, // 直接标记为完成状态
|
||||||
scanTime: new Date(),
|
scanTime: new Date(),
|
||||||
scanDevice: this.getDeviceInfo(),
|
scanDevice: this.getDeviceInfo(),
|
||||||
priority: 0, // 0=普通
|
priority: 0, // 0=普通
|
||||||
@@ -405,67 +415,12 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
} catch (err) {
|
|
||||||
console.error('=== 扫码处理失败 ===');
|
|
||||||
console.error('错误信息:', err);
|
|
||||||
console.error('错误堆栈:', err.stack);
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: err.message || '处理失败',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
console.error('扫码失败:', err);
|
|
||||||
uni.showToast({
|
|
||||||
title: '扫码失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleTranfer() {
|
// 移库操作:第一步 - 扫描钢卷,打开移库弹窗(原有方法优化)
|
||||||
uni.scanCode({
|
async handleTranfer() {
|
||||||
success: async (res) => {
|
|
||||||
console.log('=== 开始扫码流程 ===');
|
|
||||||
console.log('扫码结果:', res.result);
|
|
||||||
// console.log('操作类型:', actionType);
|
|
||||||
uni.showLoading({
|
|
||||||
title: '处理中...'
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const qrcodeId = res.result;
|
const content = await this.getQRCodeContent()
|
||||||
// 1. 通过二维码ID获取二维码详情
|
|
||||||
console.log('1. 获取二维码详情,ID:', qrcodeId);
|
|
||||||
const qrcodeRes = await getGenerateRecord(qrcodeId);
|
|
||||||
console.log('二维码响应:', qrcodeRes);
|
|
||||||
|
|
||||||
if (qrcodeRes.code !== 200) {
|
|
||||||
throw new Error('未找到二维码记录');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 解析二维码的content,获取coil_id
|
|
||||||
const qrcodeRecord = qrcodeRes.data;
|
|
||||||
console.log('2. 二维码记录:', qrcodeRecord);
|
|
||||||
|
|
||||||
// 检查二维码状态(0=失效,1=有效)
|
|
||||||
if (qrcodeRecord.status === 0) {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '该二维码已失效,无法创建待操作任务',
|
|
||||||
showCancel: false
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const content = JSON.parse(qrcodeRecord.content);
|
|
||||||
console.log('解析后的内容:', content);
|
|
||||||
|
|
||||||
// 优先使用current_coil_id(当前有效的钢卷ID),如果没有则使用coil_id(兼容旧数据)
|
// 优先使用current_coil_id(当前有效的钢卷ID),如果没有则使用coil_id(兼容旧数据)
|
||||||
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content
|
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content
|
||||||
.current_coil_id : null;
|
.current_coil_id : null;
|
||||||
@@ -480,7 +435,6 @@
|
|||||||
throw new Error('二维码中未包含有效的钢卷ID');
|
throw new Error('二维码中未包含有效的钢卷ID');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 3. 直接通过钢卷ID获取钢卷详情
|
// 3. 直接通过钢卷ID获取钢卷详情
|
||||||
console.log('3. 获取钢卷详情,钢卷ID:', coilId);
|
console.log('3. 获取钢卷详情,钢卷ID:', coilId);
|
||||||
const coilRes = await getMaterialCoil(coilId);
|
const coilRes = await getMaterialCoil(coilId);
|
||||||
@@ -494,67 +448,172 @@
|
|||||||
throw new Error('未找到钢卷信息');
|
throw new Error('未找到钢卷信息');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置移库状态
|
||||||
|
this.targetWarehouse = null;
|
||||||
this.coilDetail = coilRes.data;
|
this.coilDetail = coilRes.data;
|
||||||
this.form = coilRes.data;
|
this.form = { ...coilRes.data };
|
||||||
|
|
||||||
|
// 打开移库弹窗
|
||||||
this.$refs.tranferPopup.open();
|
this.$refs.tranferPopup.open();
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
console.error('=== 扫码处理失败 ===');
|
|
||||||
console.error('错误信息:', err);
|
|
||||||
console.error('错误堆栈:', err.stack);
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.message || '处理失败',
|
title: error.message || '打开移库失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 移库操作:第二步 - 扫描目标库区码(核心补充)
|
||||||
|
async handleScanWarehouseCode() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({ title: '扫码中...' });
|
||||||
|
// 扫描库区二维码
|
||||||
|
const scanRes = await new Promise((resolve, reject) => {
|
||||||
|
uni.scanCode({
|
||||||
|
success: resolve,
|
||||||
|
fail: (err) => {
|
||||||
|
reject(new Error('扫码取消或失败'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
uni.hideLoading();
|
||||||
|
|
||||||
|
const warehouseQrCode = scanRes.result;
|
||||||
|
if (!warehouseQrCode) {
|
||||||
|
throw new Error('未识别到库区信息');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析库区二维码(假设二维码内容是库区ID,若为JSON格式需调整解析逻辑)
|
||||||
|
const targetWarehouseId = warehouseQrCode;
|
||||||
|
console.log('扫描到的目标库区ID:', targetWarehouseId);
|
||||||
|
|
||||||
|
// 调用接口获取库区详情(关键:通过库区ID查询名称等信息)
|
||||||
|
uni.showLoading({ title: '验证库区...' });
|
||||||
|
const warehouseRes = await getActualWarehouse(targetWarehouseId);
|
||||||
|
uni.hideLoading();
|
||||||
|
|
||||||
|
if (warehouseRes.code !== 200 || !warehouseRes.data) {
|
||||||
|
throw new Error('获取库区信息失败,请确认库区码有效');
|
||||||
|
}
|
||||||
|
|
||||||
|
const targetWarehouse = warehouseRes.data;
|
||||||
|
// 校验:目标库区不能与原库区相同
|
||||||
|
if (targetWarehouse.actualWarehouseId === this.coilDetail.actualWarehouseId) {
|
||||||
|
throw new Error('目标库区不能与当前库区相同');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存储目标库区信息(用于回显和提交)
|
||||||
|
this.targetWarehouse = targetWarehouse;
|
||||||
|
// 更新表单中的目标库区ID(提交时需要)
|
||||||
|
this.form.actualWarehouseId = targetWarehouse.actualWarehouseId;
|
||||||
|
this.form.actualWarehouseName = targetWarehouse.actualWarehouseName;
|
||||||
|
|
||||||
|
uni.showToast({
|
||||||
|
title: `已选中库区:${targetWarehouse.actualWarehouseName}`,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || '扫描库区失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2500
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 移库操作:重新扫描目标库区
|
||||||
|
handleReScan() {
|
||||||
|
this.targetWarehouse = null;
|
||||||
|
this.form.warehouseId = this.coilDetail.warehouseId; // 重置为原库区ID
|
||||||
|
this.form.actualWarehouseName = this.coilDetail.actualWarehouseName;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 移库操作:关闭弹窗
|
||||||
|
handleClosePopup() {
|
||||||
|
this.$refs.tranferPopup.close();
|
||||||
|
// 重置状态
|
||||||
|
this.targetWarehouse = null;
|
||||||
|
this.form = {};
|
||||||
|
this.coilDetail = {};
|
||||||
|
},
|
||||||
|
|
||||||
|
// 移库操作:第三步 - 确认移库(核心补充)
|
||||||
|
async handleConfirm() {
|
||||||
|
try {
|
||||||
|
// 再次校验:防止异常场景
|
||||||
|
if (!this.targetWarehouse || !this.form.warehouseId) {
|
||||||
|
uni.showToast({ title: '请先选择目标库区', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.targetWarehouse.actualWarehouseId === this.coilDetail.warehouseId) {
|
||||||
|
uni.showToast({ title: '目标库区不能与当前库区相同', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading = true;
|
||||||
|
uni.showLoading({ title: '移库中...' });
|
||||||
|
|
||||||
|
// 1. 核心:更新钢卷的库区信息
|
||||||
|
const updateRes = await updateMaterialCoilSimple(this.form);
|
||||||
|
|
||||||
|
if (updateRes.code !== 200) {
|
||||||
|
throw new Error(updateRes.msg || '更新钢卷库区失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 创建移库操作记录(标记为已完成)
|
||||||
|
const pendingData = {
|
||||||
|
coilId: this.form.coilId,
|
||||||
|
currentCoilNo: this.form.currentCoilNo,
|
||||||
|
actionType: 403, // 403=移库(需与字典表action_type的移库编码一致)
|
||||||
|
actionStatus: 2, // 2=已完成
|
||||||
|
scanTime: new Date().toISOString(),
|
||||||
|
scanDevice: this.getDeviceInfo(),
|
||||||
|
priority: 0, // 普通优先级
|
||||||
|
sourceType: 'scan', // 扫码来源
|
||||||
|
processTime: new Date().toISOString(),
|
||||||
|
completeTime: new Date().toISOString(),
|
||||||
|
remark: `移库操作:${this.coilDetail.actualWarehouseName} → ${this.form.actualWarehouseName}`
|
||||||
|
};
|
||||||
|
|
||||||
|
const addRes = await addPendingAction(pendingData);
|
||||||
|
if (addRes.code !== 200) {
|
||||||
|
throw new Error(addRes.msg || '创建移库记录失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 操作成功
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({ title: '移库成功', icon: 'success', duration: 1500 });
|
||||||
|
|
||||||
|
// 关闭弹窗并重置状态
|
||||||
|
setTimeout(() => {
|
||||||
|
this.handleClosePopup();
|
||||||
|
}, 1500);
|
||||||
|
} catch (error) {
|
||||||
|
this.loading = false;
|
||||||
|
uni.hideLoading();
|
||||||
|
console.error('移库失败详情:', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || '移库失败,请重试',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
|
||||||
console.error('扫码失败:', err);
|
// 显示BOM参数弹窗(原有功能补充实现)
|
||||||
uni.showToast({
|
showBomDialog() {
|
||||||
title: '扫码失败,请重试',
|
this.bomDialogShow = true;
|
||||||
icon: 'none'
|
// 可扩展BOM参数弹窗内容,此处省略弹窗组件实现
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async handleConfirm() {
|
// 获取设备信息(原有方法不变)
|
||||||
try {
|
|
||||||
// 1. 更新钢卷信息(移库)
|
|
||||||
await updateMaterialCoilSimple(this.form);
|
|
||||||
|
|
||||||
// 2. 插入一条已完成的待操作记录
|
|
||||||
await addPendingAction({
|
|
||||||
coilId: this.form.coilId,
|
|
||||||
currentCoilNo: this.form.currentCoilNo,
|
|
||||||
actionType: 5, // 5=移库
|
|
||||||
actionStatus: 2, // 2=已完成
|
|
||||||
scanTime: new Date(),
|
|
||||||
scanDevice: this.getDeviceInfo(),
|
|
||||||
priority: 0, // 0=普通
|
|
||||||
sourceType: 'scan',
|
|
||||||
warehouseId: this.form.warehouseId,
|
|
||||||
processTime: new Date(),
|
|
||||||
completeTime: new Date()
|
|
||||||
});
|
|
||||||
|
|
||||||
uni.showToast({
|
|
||||||
title: '移库成功',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
this.$refs.tranferPopup.close();
|
|
||||||
} catch (error) {
|
|
||||||
console.error('移库失败:', error);
|
|
||||||
uni.showToast({
|
|
||||||
title: error.message || '移库失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 获取设备信息
|
|
||||||
getDeviceInfo() {
|
getDeviceInfo() {
|
||||||
try {
|
try {
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
@@ -564,7 +623,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取操作类型名称
|
// 获取操作类型名称(原有方法不变)
|
||||||
getActionTypeName(actionType) {
|
getActionTypeName(actionType) {
|
||||||
const type = this.types.find(t => t.dictValue === String(actionType));
|
const type = this.types.find(t => t.dictValue === String(actionType));
|
||||||
return type ? type.dictLabel : '未知操作';
|
return type ? type.dictLabel : '未知操作';
|
||||||
@@ -724,6 +783,12 @@
|
|||||||
border-color: #e6a23c;
|
border-color: #e6a23c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.see-btn {
|
||||||
|
background-color: #6fd2ff;
|
||||||
|
color: #0777ff;
|
||||||
|
border-color: #0777ff;
|
||||||
|
}
|
||||||
|
|
||||||
.move-btn:active {
|
.move-btn:active {
|
||||||
background-color: #fff3cc;
|
background-color: #fff3cc;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
@@ -836,4 +901,168 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 扫码按钮样式 */
|
||||||
|
.scan-btn-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
|
||||||
|
.scan-icon {
|
||||||
|
width: 160rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(135deg, #34c759 0%, #30b350 100%);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 8rpx 24rpx rgba(52, 199, 89, 0.3);
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-camera {
|
||||||
|
font-size: 70rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tip {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-hint {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 已选中库区样式 */
|
||||||
|
.selected-warehouse {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
background-color: #f0f9ff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warehouse-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warehouse-label {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warehouse-value {
|
||||||
|
color: #1976d2;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.re-scan-btn {
|
||||||
|
padding: 10rpx 30rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #409eff;
|
||||||
|
background-color: transparent;
|
||||||
|
border: 2rpx solid #409eff;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 操作按钮组样式 */
|
||||||
|
.action-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #409eff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 信息网格样式 */
|
||||||
|
.info-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10rpx 0;
|
||||||
|
border-bottom: 2rpx solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-label {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #666;
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-value {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #333;
|
||||||
|
width: 70%;
|
||||||
|
text-align: right;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 卡片标题样式 */
|
||||||
|
.card-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-dot {
|
||||||
|
display: inline-block;
|
||||||
|
width: 12rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
background-color: #409eff;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5rpx;
|
||||||
|
color: #409eff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-more {
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
556
apps/hand-factory/pages/easycode/editby.vue
Normal file
556
apps/hand-factory/pages/easycode/editby.vue
Normal file
@@ -0,0 +1,556 @@
|
|||||||
|
<template>
|
||||||
|
<view class="typing-container">
|
||||||
|
<view class="info-grid">
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="item-label">入场钢卷号</text>
|
||||||
|
<text class="item-value">{{ coilDetail.enterCoilNo || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<view class="form-card" v-if="form.coilId">
|
||||||
|
<view class="card-title">
|
||||||
|
<text class="title-dot"></text>
|
||||||
|
<text class="title-text">钢卷信息</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 当前钢卷号 -->
|
||||||
|
<view class="form-item">
|
||||||
|
<text class="form-label">当前钢卷号</text>
|
||||||
|
<input v-model="form.currentCoilNo" placeholder="请输入当前钢卷号" class="form-input"
|
||||||
|
:disabled="coilDetail.dataType === 0" :class="{ 'form-input-disabled': coilDetail.dataType === 0 }" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 班组 -->
|
||||||
|
<view class="form-item">
|
||||||
|
<text class="form-label">班组</text>
|
||||||
|
<input v-model="form.team" placeholder="请输入班组名称" class="form-input" :disabled="coilDetail.dataType === 0"
|
||||||
|
:class="{ 'form-input-disabled': coilDetail.dataType === 0 }" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 库区选择 -->
|
||||||
|
<view class="form-item form-item-optional">
|
||||||
|
<text class="form-label-optional">目标库位</text>
|
||||||
|
<klp-warehouse-picker v-model="form.warehouseId" :disabled="coilDetail.dataType === 0" placeholder="请选择目标库区" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- <view class="form-item form-item-optional">
|
||||||
|
<text class="form-label-optional">真实库区</text>
|
||||||
|
<klp-warehouse-picker v-model="form.actualWarehouseId" :disabled="coilDetail.dataType === 0"
|
||||||
|
placeholder="请选择目标库区" ware-type="actual" />
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
<!-- 物品类型、产品、原材料选择(使用封装组件) -->
|
||||||
|
<klp-material-picker
|
||||||
|
:item-type.sync="form.itemType"
|
||||||
|
:item-id.sync="form.itemId"
|
||||||
|
:material-type.sync="form.materialType"
|
||||||
|
:disabled="coilDetail.dataType === 0"
|
||||||
|
:page-size="2000"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 毛重 -->
|
||||||
|
<view class="form-item form-item-optional">
|
||||||
|
<text class="form-label-optional">毛重 (吨)</text>
|
||||||
|
<input v-model="form.grossWeight" type="digit" placeholder="请输入毛重(选填)" class="form-input"
|
||||||
|
:disabled="coilDetail.dataType === 0" :class="{ 'form-input-disabled': coilDetail.dataType === 0 }" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 净重 -->
|
||||||
|
<view class="form-item form-item-optional">
|
||||||
|
<text class="form-label-optional">净重 (吨)</text>
|
||||||
|
<input v-model="form.netWeight" type="digit" placeholder="请输入净重(选填)" class="form-input"
|
||||||
|
:disabled="coilDetail.dataType === 0" :class="{ 'form-input-disabled': coilDetail.dataType === 0 }" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 操作者信息 -->
|
||||||
|
<view class="operator-info">
|
||||||
|
<text class="operator-label">操作人:</text>
|
||||||
|
<text class="operator-name">{{ operatorName }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<view class="action-buttons">
|
||||||
|
<button v-if="coilDetail.dataType === 1" class="btn btn-primary" @click="handleConfirm" :disabled="loading">
|
||||||
|
{{ loading ? '提交中...' : '更新钢卷信息' }}
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getMaterialCoil, updateMaterialCoil } from '@/api/wms/coil';
|
||||||
|
import { addPendingAction } from '@/api/wms/pendingAction';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {},
|
||||||
|
coilDetail: {},
|
||||||
|
loading: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 获取当前操作者昵称
|
||||||
|
operatorName() {
|
||||||
|
return this.$store.state.user.nickName || this.$store.state.user.name || '未知'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchCoil(coilId) {
|
||||||
|
getMaterialCoil(coilId).then(res => {
|
||||||
|
this.form = res.data;
|
||||||
|
this.coilDetail = res.data;
|
||||||
|
console.log(this.form, '钢卷信息')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取设备信息(原有方法不变)
|
||||||
|
getDeviceInfo() {
|
||||||
|
try {
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
return `${systemInfo.platform} ${systemInfo.model}`;
|
||||||
|
} catch (e) {
|
||||||
|
return 'Unknown Device';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async handleConfirm() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在更新钢卷信息'
|
||||||
|
})
|
||||||
|
try {
|
||||||
|
this.loading = true;
|
||||||
|
// 1. 更新钢卷
|
||||||
|
console.log('待提交数据', this.form)
|
||||||
|
await updateMaterialCoil(this.form)
|
||||||
|
// 2. 创建操作记录
|
||||||
|
await addPendingAction({
|
||||||
|
actionType: 404,
|
||||||
|
coilId: this.form.coilId,
|
||||||
|
currentCoilNo: this.form.currentCoilNo,
|
||||||
|
actionStatus: 2 ,// 直接完成的操作记录
|
||||||
|
sourceType: 'scan', // 扫码来源
|
||||||
|
scanTime: new Date().toISOString(),
|
||||||
|
scanDevice: this.getDeviceInfo(),
|
||||||
|
warehouseId: this.form.warehouseId,
|
||||||
|
processTime: new Date(),
|
||||||
|
completeTime: new Date()
|
||||||
|
})
|
||||||
|
// 3. 提示操作成功
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
// 4. 延时0.5s后返回上一级页面
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 500)
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
// 根据传递来的信息展示在表单上
|
||||||
|
const coilId = options.coilId;
|
||||||
|
if (!coilId) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/easycode/easycode'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.fetchCoil(coilId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.typing-container {
|
||||||
|
padding-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 扫码区域 */
|
||||||
|
.scan-section {
|
||||||
|
padding: 80rpx 40rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||||
|
|
||||||
|
.scan-btn-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 30rpx;
|
||||||
|
|
||||||
|
.scan-icon {
|
||||||
|
width: 160rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(135deg, #007aff 0%, #0051d5 100%);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 8rpx 24rpx rgba(0, 122, 255, 0.3);
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-camera {
|
||||||
|
font-size: 70rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tip {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 卡片样式 */
|
||||||
|
.info-card,
|
||||||
|
.material-card,
|
||||||
|
.form-card {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 警告卡片 */
|
||||||
|
.warning-card {
|
||||||
|
background: #fff2f0;
|
||||||
|
border: 2rpx solid #ffccc7;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
|
||||||
|
.warning-icon {
|
||||||
|
font-size: 48rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning-content {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.warning-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #cf1322;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning-desc {
|
||||||
|
display: block;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #a8071a;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 25rpx;
|
||||||
|
padding-bottom: 20rpx;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
|
.title-dot {
|
||||||
|
width: 8rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
background: #007aff;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
margin-right: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-text {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
font-size: 22rpx;
|
||||||
|
padding: 4rpx 12rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
|
||||||
|
&.status-1 {
|
||||||
|
background: #d1f2eb;
|
||||||
|
color: #0c6957;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-0 {
|
||||||
|
background: #f8d7da;
|
||||||
|
color: #721c24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.more-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8rpx;
|
||||||
|
padding: 8rpx 16rpx;
|
||||||
|
background: #f0f7ff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
border: 1rpx solid #007aff;
|
||||||
|
|
||||||
|
.icon-more {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #007aff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #007aff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 信息网格 */
|
||||||
|
.info-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 20rpx;
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 45%;
|
||||||
|
background: #f8f9fa;
|
||||||
|
padding: 20rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
|
||||||
|
&.full-width {
|
||||||
|
flex: 0 0 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-label {
|
||||||
|
display: block;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-value {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单项 */
|
||||||
|
.form-item {
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
|
&:last-of-type {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 15rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '*';
|
||||||
|
color: #ff4d4f;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label-optional {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 15rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border: 2rpx solid #e8e8e8;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
box-sizing: border-box;
|
||||||
|
transition: all 0.3s;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
background: #fff;
|
||||||
|
border-color: #007aff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.form-input-disabled {
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #999;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 操作者信息 */
|
||||||
|
.operator-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
|
||||||
|
.operator-label {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operator-name {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #007aff;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 操作按钮 */
|
||||||
|
.action-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 88rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
border: none;
|
||||||
|
transition: all 0.2s;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: linear-gradient(135deg, #007aff 0%, #0051d5 100%);
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 4rpx 16rpx rgba(0, 122, 255, 0.3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BOM弹窗 */
|
||||||
|
.bom-popup {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 24rpx 24rpx 0 0;
|
||||||
|
max-height: 70vh;
|
||||||
|
|
||||||
|
.popup-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
|
.popup-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-close {
|
||||||
|
font-size: 40rpx;
|
||||||
|
color: #999;
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-body {
|
||||||
|
padding: 30rpx;
|
||||||
|
max-height: 500rpx;
|
||||||
|
|
||||||
|
.bom-item {
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
padding: 24rpx;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bom-index {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
background: #007aff;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bom-content {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.bom-row {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bom-label {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #666;
|
||||||
|
min-width: 120rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bom-value {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-tip {
|
||||||
|
text-align: center;
|
||||||
|
padding: 60rpx 0;
|
||||||
|
color: #999;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
45
apps/hand-factory/pages/easycode/tranfer.vue
Normal file
45
apps/hand-factory/pages/easycode/tranfer.vue
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getMaterialCoil, updateMaterialCoil } from '@/api/wms/coil';
|
||||||
|
import { addPendingAction } from '@/api/wms/pendingAction';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchCoil(coilId) {
|
||||||
|
getMaterialCoil(coilId).then(res => {
|
||||||
|
this.form = res.data;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async confirm() {
|
||||||
|
// 1. 更新钢卷
|
||||||
|
|
||||||
|
// 2. 创建操作记录
|
||||||
|
|
||||||
|
// 3. 提示操作成功
|
||||||
|
|
||||||
|
// 4. 延时0.5s后返回上一级页面
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
// 根据传递来的信息展示在表单上
|
||||||
|
const coilId = options.coilId;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -155,13 +155,15 @@ function checkUpdate(forceCheck = false) {
|
|||||||
title: '发现新版本',
|
title: '发现新版本',
|
||||||
content: `检测到新版本(${remoteVersion}),是否立即下载并更新?`,
|
content: `检测到新版本(${remoteVersion}),是否立即下载并更新?`,
|
||||||
confirmText: '立即更新',
|
confirmText: '立即更新',
|
||||||
cancelText: '暂不更新',
|
cancelText: '退出',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: (modalRes) => {
|
success: (modalRes) => {
|
||||||
if (modalRes.confirm) {
|
if (modalRes.confirm) {
|
||||||
// 用户确认更新:检查存储空间 -> 下载 -> 安装
|
// 用户确认更新:检查存储空间 -> 下载 -> 安装
|
||||||
handleConfirmUpdate(wgtUrl, remoteVersion);
|
handleConfirmUpdate(wgtUrl, remoteVersion);
|
||||||
} else {
|
} else {
|
||||||
|
// 直接退出
|
||||||
|
|
||||||
// 用户取消更新:询问是否忽略该版本
|
// 用户取消更新:询问是否忽略该版本
|
||||||
handleCancelUpdate(remoteVersion);
|
handleCancelUpdate(remoteVersion);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "klp 1.3.11",
|
"version": "klp 1.3.13",
|
||||||
"wgtUrl": "http://49.232.154.205:10900/fadapp-update/klp/klp.wgt",
|
"wgtUrl": "http://49.232.154.205:10900/fadapp-update/klp/klp.wgt",
|
||||||
"apkUrl": "http://49.232.154.205:10900/fadapp-update/klp/klp.apk"
|
"apkUrl": "http://49.232.154.205:10900/fadapp-update/klp/klp.apk"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user