feat(钢卷打包): 新增钢卷打包功能及相关页面

- 在easycode页面添加打包按钮及跳转逻辑
- 新增packing页面用于钢卷打包操作
- 更新应用版本号至1.3.16
- 添加打包状态相关表单字段及样式
This commit is contained in:
砂糖
2025-12-12 15:15:06 +08:00
parent 2ac6d387e1
commit 133d41c4e5
6 changed files with 666 additions and 20 deletions

View File

@@ -8,7 +8,7 @@ module.exports = {
// 应用名称
name: "ruoyi-app",
// 应用版本
version: "1.3.5",
version: "1.3.16",
// 应用logo
logo: "/static/logo.jpg",
// 官方网站

View File

@@ -2,7 +2,7 @@
"name" : "科伦普",
"appid" : "__UNI__E781B49",
"description" : "",
"versionName" : "1.3.13",
"versionName" : "1.3.16",
"versionCode" : 1,
"transformPx" : false,
"app-plus" : {

View File

@@ -70,6 +70,13 @@
"navigationBarTitleText" : "查看钢卷"
}
},
{
"path" : "pages/easycode/packing",
"style" :
{
"navigationBarTitleText" : "钢卷打包"
}
},
{
"path": "pages/receive/receive",
"style": {

View File

@@ -38,6 +38,7 @@
<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>
<button class="type-btn packing-btn" @click="handlePack">打包</button>
</view>
</view>
@@ -74,7 +75,7 @@
<view class="form-card" v-if="form.coilId">
<view class="form-item form-item-optional">
<text class="form-label-optional">目标库区</text>
<!-- 未选择目标库区显示扫码按钮 -->
<view v-if="!targetWarehouse" class="scan-btn-wrapper" @click="handleScanWarehouseCode">
<view class="scan-icon">
@@ -163,12 +164,31 @@
})
})
},
async handlePack() {
const content = await this.getQRCodeContent()
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content
.current_coil_id : null;
if (!coilId) {
uni.showToast({
title: '二维码异常',
icon: 'none'
})
return;
}
uni.navigateTo({
url: '/pages/easycode/packing?coilId=' + coilId
})
},
handleSee() {
uni.scanCode({
success(scanRes) {
// 查询真实库区在此处的钢卷
listMaterialCoil({ actualWarehouseId: scanRes.result, dataType: 1 }).then(res => {
listMaterialCoil({
actualWarehouseId: scanRes.result,
dataType: 1
}).then(res => {
if (res.total == 0) {
uni.showToast({
title: '该库区未发现钢卷',
@@ -292,6 +312,7 @@
});
return;
}
uni.hideLoading();
const content = JSON.parse(qrcodeRecord.content);
console.log('解析后的内容:', content);
@@ -444,7 +465,9 @@
// 重置移库状态
this.targetWarehouse = null;
this.coilDetail = coilRes.data;
this.form = { ...coilRes.data };
this.form = {
...coilRes.data
};
// 打开移库弹窗
this.$refs.tranferPopup.open();
@@ -462,7 +485,9 @@
// 移库操作:第二步 - 扫描目标库区码(核心补充)
async handleScanWarehouseCode() {
try {
uni.showLoading({ title: '扫码中...' });
uni.showLoading({
title: '扫码中...'
});
// 扫描库区二维码
const scanRes = await new Promise((resolve, reject) => {
uni.scanCode({
@@ -484,7 +509,9 @@
console.log('扫描到的目标库区ID', targetWarehouseId);
// 调用接口获取库区详情关键通过库区ID查询名称等信息
uni.showLoading({ title: '验证库区...' });
uni.showLoading({
title: '验证库区...'
});
const warehouseRes = await getActualWarehouse(targetWarehouseId);
uni.hideLoading();
@@ -540,16 +567,24 @@
try {
// 再次校验:防止异常场景
if (!this.targetWarehouse || !this.form.warehouseId) {
uni.showToast({ title: '请先选择目标库区', icon: 'none' });
uni.showToast({
title: '请先选择目标库区',
icon: 'none'
});
return;
}
if (this.targetWarehouse.actualWarehouseId === this.coilDetail.warehouseId) {
uni.showToast({ title: '目标库区不能与当前库区相同', icon: 'none' });
uni.showToast({
title: '目标库区不能与当前库区相同',
icon: 'none'
});
return;
}
this.loading = true;
uni.showLoading({ title: '移库中...' });
uni.showLoading({
title: '移库中...'
});
// 1. 核心:更新钢卷的库区信息
const updateRes = await updateMaterialCoilSimple(this.form);
@@ -580,7 +615,11 @@
// 操作成功
uni.hideLoading();
uni.showToast({ title: '移库成功', icon: 'success', duration: 1500 });
uni.showToast({
title: '移库成功',
icon: 'success',
duration: 1500
});
// 关闭弹窗并重置状态
setTimeout(() => {
@@ -775,13 +814,21 @@
color: #e6a23c;
border-color: #e6a23c;
}
.see-btn {
background-color: #6fd2ff;
color: #0777ff;
border-color: #0777ff;
}
.packing-btn {
background-color: #f2e9ff;
/* 浅紫底色,与黄色#fff9e6、蓝色#6fd2ff等浅底色亮度/饱和度匹配 */
color: #722ed1;
/* 深紫文字色,延续「同色系饱和色」的文字/边框逻辑 */
border-color: #722ed1;
}
.move-btn:active {
background-color: #fff3cc;
opacity: 0.9;
@@ -894,14 +941,14 @@
}
}
}
/* 扫码按钮样式 */
.scan-btn-wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 20rpx;
.scan-icon {
width: 160rpx;
height: 160rpx;
@@ -911,22 +958,22 @@
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;

View File

@@ -0,0 +1,592 @@
<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 class="info-item">
<text class="item-label">当前钢卷号</text>
<text class="item-value">{{ coilDetail.currentCoilNo || '-' }}</text>
</view>
<!-- <view class="info-item">
<text class="item-label">逻辑库区</text>
<text class="item-value">{{ coilDetail.warehouseName || '-' }}</text>
</view>
<view class="info-item">
<text class="item-label">真实库区</text>
<text class="item-value">{{ coilDetail.actualWarehouseName || '-' }}</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 :class="{ 'form-input-disabled': true }" />
</view> -->
<!-- 班组 -->
<!-- <view class="form-item">
<text class="form-label">班组</text>
<input v-model="form.team" placeholder="请输入班组名称" class="form-input" disabled
:class="{ 'form-input-disabled': true }" />
</view> -->
<!-- 库区选择 -->
<!-- <view class="form-item form-item-optional">
<text class="form-label-optional">目标库位</text>
<klp-warehouse-picker v-model="form.warehouseId" disabled 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
: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 :class="{ 'form-input-disabled': true }" />
</view> -->
<!-- 净重 -->
<!-- <view class="form-item form-item-optional">
<text class="form-label-optional">净重 ()</text>
<input v-model="form.qualityStatus" type="digit" placeholder="请输入净重(选填)" class="form-input"
disabled :class="{ 'form-input-disabled': true }" />
</view> -->
<view class="form-item form-item-optional">
<text class="form-label-optional">质量状态</text>
<input v-model="form.trimmingRequirement" 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.packingStatus" type="digit" placeholder="请输入切边要求" class="form-input"
:disabled="coilDetail.dataType === 0" :class="{ 'form-input-disabled': false }" />
</view>
<view class="form-item form-item-optional">
<text class="form-label-optional">打包状态</text>
<input v-model="form.packagingRequirement" 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.packagingRequirement" 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: 405, // 405表示打包
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>

View File

@@ -1,5 +1,5 @@
{
"version": "klp 1.3.13",
"version": "klp 1.3.16",
"wgtUrl": "http://49.232.154.205:10900/fadapp-update/klp/klp.wgt",
"apkUrl": "http://49.232.154.205:10900/fadapp-update/klp/klp.apk"
}