添加掌上工厂应用

This commit is contained in:
砂糖
2025-10-27 13:21:43 +08:00
parent f5c313421a
commit 718f0efc76
408 changed files with 64677 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
import { IO_TYPE_LABEL, ITEM_TYPE_LABEL, CODE_STATUS } from '@/constants/wms';
/**
* 格式化IO类型支持根据二维码状态修正显示如状态1的入库→显示出库
* @param {string} ioType - 原始IO类型如'in'
* @param {number} codeStatus - 二维码状态
* @returns {string} 格式化后的文案
*/
export const formatIoType = (ioType, codeStatus) => {
// 业务规则状态1已入库的原始入库→显示为出库
if (codeStatus === CODE_STATUS.IN_STOCK && ioType === IO_TYPE.IN) {
return IO_TYPE_LABEL[IO_TYPE.OUT];
}
return IO_TYPE_LABEL[ioType] || '未知操作';
};
/**
* 格式化物品类型
* @param {string} itemType - 原始物品类型(如'raw_material'
* @returns {string} 格式化后的文案
*/
export const formatItemType = (itemType) => {
return ITEM_TYPE_LABEL[itemType] || '未知类型';
};
/**
* 格式化当前时间(统一时间格式来源)
* @returns {string} 格式化时间(如"2024-05-20 14:30"
*/
export const formatCurrentTime = () => {
const date = new Date();
const pad = (num) => num.toString().padStart(2, '0');
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
};