diff --git a/api/warehouse/warehose.js b/api/warehouse/warehose.js
index 6606cea..9dd25d6 100644
--- a/api/warehouse/warehose.js
+++ b/api/warehouse/warehose.js
@@ -90,6 +90,16 @@ export function handlErexitwarehouse(params) {
})
}
+// 退货到成品库
+export function returnProductwarehouse(data) {
+ return request({
+ url: '/mes/wm/entrywarehouse/ReturnProductwarehouse',
+ method: 'post',
+ data
+ })
+}
+
+
// 2 根据箱标签的批次号,获取成品库内的信息
export function getInfoByPatchCode(params) {
return request({
diff --git a/manifest.json b/manifest.json
index 0fbc35a..013d1de 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,8 @@
"name" : "上海干巷涂装PDA",
"appid" : "__UNI__A67E78B",
"description" : "",
- "versionName" : "2.5.1",
- "versionCode" : 251,
+ "versionName" : "2.6.0",
+ "versionCode" : 260,
"transformPx" : false,
"sassImplementationName" : "node-sass",
"app-plus" : {
diff --git a/pages.json b/pages.json
index b9347f7..9edd7d6 100644
--- a/pages.json
+++ b/pages.json
@@ -271,6 +271,13 @@
{
"navigationBarTitleText" : "出库计划"
}
+ },
+ {
+ "path" : "pages/returnWarehouse/returnProductwarehouse",
+ "style" :
+ {
+ "navigationBarTitleText" : "退货到成品库"
+ }
}
]
diff --git a/pages/inWarehouse/inWarehouse.vue b/pages/inWarehouse/inWarehouse.vue
index 4eea65a..d6a30d0 100644
--- a/pages/inWarehouse/inWarehouse.vue
+++ b/pages/inWarehouse/inWarehouse.vue
@@ -20,16 +20,14 @@
请扫箱码
-
-
+
- 上次批次号:{{
- newMaterialList[newMaterialList.length - 2].patchCode }}
+ 上次批次号:{{ newMaterialList[newMaterialList.length - 2].patchCode }}
上次批次号:
@@ -37,16 +35,13 @@
{{ this.isStrict ? '' : '无校验' }}入库清单
-
+
- 全部重置
- 入库
+ 全部重置
+ 入库
@@ -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
+ );
}
}
};
diff --git a/pages/inWarehouse/utils.js b/pages/inWarehouse/utils.js
index fe59f5f..9172775 100644
--- a/pages/inWarehouse/utils.js
+++ b/pages/inWarehouse/utils.js
@@ -44,14 +44,14 @@ export function isRepeatPackage(list, patchCode) {
/**
* 检查是否更换了批次
* @param {Array} list - 箱子列表
- * @param {string} workoderID - 工单号
+ * @param {string} productionTime - 批次时间
* @returns {boolean} 是否更换批次
*/
-export function isChangeBatch(list, workoderID) {
+export function isChangeBatch(list, productionTime) {
if (!list || list.length === 0) return false;
const lastItem = list[list.length - 1];
- return lastItem.workoderID !== workoderID;
+ return lastItem.productionTime !== productionTime;
}
/**
diff --git a/pages/index/index.vue b/pages/index/index.vue
index ce87428..cca0fbb 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -92,9 +92,9 @@ export default {
index: 6
},
{
- name: '退货',
+ name: '退货到\n成品库',
icon: 'outbound/return',
- url: '',
+ url: '/pages/returnWarehouse/returnProductwarehouse',
type: 2,
index: 7
},
diff --git a/pages/returnWarehouse/returnProductwarehouse.vue b/pages/returnWarehouse/returnProductwarehouse.vue
new file mode 100644
index 0000000..a98a5fd
--- /dev/null
+++ b/pages/returnWarehouse/returnProductwarehouse.vue
@@ -0,0 +1,468 @@
+
+
+
+
+
+
+
+ 总货物数:{{ quantityTotal }}
+ 总箱数:{{ newMaterialList.length }}
+
+
+
+ 请扫箱码
+
+
+
+
+
+
+
+
+
+ 上次批次号:{{ newMaterialList[newMaterialList.length - 2].patchCode }}
+ 上次批次号:
+
+
+
+ {{ this.isStrict ? '' : '' }}退货清单
+
+
+
+
+
+
+
+ 全部重置
+ 退货
+
+
+
+
+
+
+
diff --git a/pages/returnWarehouse/utils.js b/pages/returnWarehouse/utils.js
new file mode 100644
index 0000000..9172775
--- /dev/null
+++ b/pages/returnWarehouse/utils.js
@@ -0,0 +1,118 @@
+/**
+ * 入库通用工具方法
+ */
+
+/**
+ * 显示操作确认模态框
+ * @param {string} title - 标题
+ * @param {string} content - 内容
+ * @param {boolean} showCancel - 是否显示取消按钮
+ * @returns {Promise} Promise对象
+ */
+export function showOperationConfirm(title, content, showCancel = true) {
+ return new Promise((resolve) => {
+ uni.showModal({
+ title: title || '提示',
+ content: content || '',
+ showCancel: showCancel,
+ cancelText: '取消',
+ confirmText: '确定',
+ success: function(res) {
+ resolve(res);
+ }
+ });
+ });
+}
+
+/**
+ * 检查是否为重复箱
+ * @param {Array} list - 箱子列表
+ * @param {string} patchCode - 批次号
+ * @returns {boolean} 是否重复
+ */
+export function isRepeatPackage(list, patchCode) {
+ if (!list || list.length === 0) return false;
+
+ for (let item of list) {
+ if (item.patchCode === patchCode) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * 检查是否更换了批次
+ * @param {Array} list - 箱子列表
+ * @param {string} productionTime - 批次时间
+ * @returns {boolean} 是否更换批次
+ */
+export function isChangeBatch(list, productionTime) {
+ if (!list || list.length === 0) return false;
+
+ const lastItem = list[list.length - 1];
+ return lastItem.productionTime !== productionTime;
+}
+
+/**
+ * 检查是否为重复箱(基于originalCode)
+ * @param {Array} list - 箱子列表
+ * @param {string} originalCode - 原始编码
+ * @returns {boolean} 是否重复
+ */
+export function isRepeatPackageByCode(list, originalCode) {
+ if (!list || list.length === 0) return false;
+
+ for (let item of list) {
+ if (item.originalCode === originalCode) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * 清除重复箱
+ * @param {Array} list - 箱子列表
+ * @returns {Array} 清除重复后的列表和重复箱信息
+ */
+export function clearRepeatPackages(list) {
+ let newArray = [];
+ let seen = new Map();
+ let repeatPackage = [];
+
+ list.forEach((item) => {
+ if (!seen.has(item.originalCode)) {
+ seen.set(item.originalCode, true);
+ newArray.push(item);
+ } else {
+ repeatPackage.push(item.patchCode);
+ }
+ });
+
+ return {
+ clearedList: newArray,
+ repeatPackages: repeatPackage
+ };
+}
+
+/**
+ * 防抖函数
+ * @param {Function} func - 要防抖的函数
+ * @param {number} delay - 延迟时间(ms)
+ * @returns {Function} 防抖后的函数
+ */
+export function debounce(func, delay) {
+ let timeoutId;
+ return function (...args) {
+ // 清除之前的定时器
+ if (timeoutId) {
+ clearTimeout(timeoutId);
+ }
+
+ // 设置新的定时器
+ timeoutId = setTimeout(() => {
+ func.apply(this, args);
+ }, delay);
+ };
+}
\ No newline at end of file