版本号2.6.0,添加退货并发送U8入库红单功能

This commit is contained in:
2025-10-09 23:21:33 +08:00
parent 1ad01c2ec1
commit 4ea76510d1
8 changed files with 647 additions and 42 deletions

View File

@@ -20,16 +20,14 @@
<view v-if="searchType === 2" class="color2 aciton-box">请扫箱码</view>
<!-- 扫描操作 -->
<view class="pda-search-box">
<PdaScanInput @getInfo="handleGetInfo" :type="searchType" :warehouseInfo="warehouseInfo">
</PdaScanInput>
<PdaScanInput @getInfo="handleGetInfo" :type="searchType" :warehouseInfo="warehouseInfo"></PdaScanInput>
</view>
</view>
</view>
</view>
<!-- 上次批次号 -->
<view class="last-batch-info">
<view class="scroll-view-last" v-if="newMaterialList.length > 1">上次批次号{{
newMaterialList[newMaterialList.length - 2].patchCode }}</view>
<view class="scroll-view-last" v-if="newMaterialList.length > 1">上次批次号{{ newMaterialList[newMaterialList.length - 2].patchCode }}</view>
<view class="scroll-view-last" v-if="newMaterialList.length <= 1">上次批次号</view>
</view>
<!-- 货物列表 -->
@@ -37,16 +35,13 @@
<view class="scroll-view-title">{{ this.isStrict ? '' : '无校验' }}入库清单</view>
<view class="scroll-view-content">
<!-- 优化后的packageCard组件使用 -->
<packageCard v-for="(item, index) in newMaterialList" :packageInfo="item" :key="item.originalCode"
@delete="handleDeleteItem"></packageCard>
<packageCard v-for="(item, index) in newMaterialList" :packageInfo="item" :key="item.originalCode" @delete="handleDeleteItem"></packageCard>
</view>
</view>
<!-- 底部按钮 -->
<view class="button-box">
<u-button style="width: 40%" type="error" @click="clear" :disabled="loading"
:loading="loading">全部重置</u-button>
<u-button style="width: 40%" type="success" @click="handlerSubmit" :disabled="loading"
:loading="loading">入库</u-button>
<u-button style="width: 40%" type="error" @click="clear" :disabled="loading" :loading="loading">全部重置</u-button>
<u-button style="width: 40%" type="success" @click="handlerSubmit" :disabled="loading" :loading="loading">入库</u-button>
</view>
</view>
</template>
@@ -155,13 +150,14 @@ export default {
this.newMaterialList = [];
this.loading = false;
} else if (type === 2) {
if (this.loading) {
if (this.loading) {
showOperationConfirm('提示', '请等待加载完成!', false);
return;
}
// 此时扫描的是箱号
// 当前录入的箱号是否在同一批次录入过
// 曾经是否扫过
if (this.newMaterialList.length > 0) {
// 检查是否为重复箱
if (isRepeatPackage(this.newMaterialList, data.patchCode)) {
@@ -171,7 +167,7 @@ export default {
}
// 检查是否更换了批次
if (isChangeBatch(this.newMaterialList, data.workoderID)) {
if (isChangeBatch(this.newMaterialList, data.productionTime)) {
showOperationConfirm('提示', '已更换入库批次!', false);
}
}
@@ -227,7 +223,7 @@ export default {
handleDeleteItem(item) {
showOperationConfirm('删除提示', '是否从列表中删除此货物?', true).then((res) => {
if (res.confirm) {
const index = this.newMaterialList.findIndex(i => i.originalCode === item.originalCode);
const index = this.newMaterialList.findIndex((i) => i.originalCode === item.originalCode);
if (index > -1) {
this.newMaterialList.splice(index, 1);
}
@@ -272,30 +268,32 @@ export default {
// 设置新的定时器执行入库操作
timeoutId = setTimeout(() => {
WarehoseApi.handlerIntoProductWarehouse(data).then((res) => {
if (res.code === 200) {
if (res.data === 0 || !res.data) {
showOperationConfirm('提示', '入库失败:' + res.msg, false);
WarehoseApi.handlerIntoProductWarehouse(data)
.then((res) => {
if (res.code === 200) {
if (res.data === 0 || !res.data) {
showOperationConfirm('提示', '入库失败:' + res.msg, false);
this.loading = false;
return;
}
uni.showToast({
icon: 'none',
title: '入库成功!' + res.msg
});
this.loading = false;
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
} else {
showOperationConfirm('提示', '入库失败!', false);
this.loading = false;
return;
}
uni.showToast({
icon: 'none',
title: '入库成功!' + res.msg
});
})
.catch((error) => {
// 处理请求失败的情况确保loading状态被重置
//console.error('入库请求失败:', error);
//showOperationConfirm('提示', '请求失败,请重试!', false);
this.loading = false;
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
} else {
showOperationConfirm('提示', '入库失败!', false);
this.loading = false;
}
}).catch((error) => {
// 处理请求失败的情况确保loading状态被重置
console.error('入库请求失败:', error);
showOperationConfirm('提示', '请求失败,请重试!', false);
this.loading = false;
});
});
}, 1000); // 1秒防抖延迟
};
})();
@@ -337,7 +335,11 @@ export default {
});
this.newMaterialList = newArray;
// 增强用户交互提示信息
showOperationConfirm('重复箱清除', `检测到${repeatPackage.length}个重复箱,已自动清除。原箱数:${oldArray.length} 现箱数:${newArray.length} 重复箱:${repeatPackage.join(', ')}`, false);
showOperationConfirm(
'重复箱清除',
`检测到${repeatPackage.length}个重复箱,已自动清除。原箱数:${oldArray.length} 现箱数:${newArray.length} 重复箱:${repeatPackage.join(', ')}`,
false
);
}
}
};