Commit 9f9aa652 by wuqian

初版出库单

parent 79c91be7
......@@ -6,9 +6,9 @@ import {
InterWarehouseTree,
InterWarehouseDetail,
InterskuList,
InterWarehouseList,
ILocation,
AnyObject,
InterProductList,
} from '@/types/api/warehouse'
export interface LogListData {
createTime: string
......@@ -17,26 +17,26 @@ export interface LogListData {
}
export interface Address {
id: number; // 主键,自动递增
shipperName: string; // 发货人姓名
addressLine1: string; // 地址 1
addressLine2?: string | null; // 地址 2
addressLine3?: string | null; // 地址 3
city: string; // 城市
cityCode?: string | null; // 城市编码
district?: string | null; // 区
districtCode?: string | null; // 区编码
cspAccount?: string | null; // CSP账号
stateProvince?: string | null; // 州/省
stateProvinceAbbr?: string | null; // 州/省简称
postalCode?: string | null; // 邮编
countryName: string; // 国家名称
countryCode?: string | null; // 国家代码
phoneNumber?: string | null; // 电话
rfcTaxId?: string | null; // RFC税号
swDefault?: number | null; // 是否默认 1是,0不是
createTime: string; // 创建时间
updateTime: string; // 更新时间
id: number // 主键,自动递增
shipperName: string // 发货人姓名
addressLine1: string // 地址 1
addressLine2?: string | null // 地址 2
addressLine3?: string | null // 地址 3
city: string // 城市
cityCode?: string | null // 城市编码
district?: string | null // 区
districtCode?: string | null // 区编码
cspAccount?: string | null // CSP账号
stateProvince?: string | null // 州/省
stateProvinceAbbr?: string | null // 州/省简称
postalCode?: string | null // 邮编
countryName: string // 国家名称
countryCode?: string | null // 国家代码
phoneNumber?: string | null // 电话
rfcTaxId?: string | null // RFC税号
swDefault?: number | null // 是否默认 1是,0不是
createTime: string // 创建时间
updateTime: string // 更新时间
}
export interface PrintData {
......@@ -257,7 +257,7 @@ export function updateWarehouseApi(data: positionInfo | UpdateDefaulted) {
export function logisticsAddressGetAllList() {
return axios.get<never, BaseRespData<Address[]>>(
'/logisticsAddress/getAllList'
'/logisticsAddress/getAllList',
)
}
......@@ -371,7 +371,10 @@ export function getWarehouseInRecordDetailApi(id: number | undefined) {
},
)
}
export function getBySkuApi(warehouseId: number | null | undefined, sku: string | null) {
export function getBySkuApi(
warehouseId: number | string | undefined,
sku: string | null,
) {
return axios.get<never, BaseRespData<InterskuList[]>>(
'customProductItem/getBySku',
{
......@@ -383,7 +386,7 @@ export function getBySkuApi(warehouseId: number | null | undefined, sku: string
)
}
export function getByWareHouseIdAndCodeApi(
wareHouseId: number | null | undefined,
wareHouseId: number | string | undefined,
code: string | null,
) {
return axios.get<never, BaseRespData<ILocation[]>>(
......@@ -402,11 +405,6 @@ export function getInRecordStatusTree() {
)
}
export function getWarehouseListApi() {
return axios.get<never, BaseRespData<InterWarehouseList[]>>(
'factoryWarehouseInfo/getAll',
)
}
interface WarehouseParams {
id?: number
dataVersion?: number
......@@ -433,6 +431,78 @@ export function getOutRecordStatusTree() {
'factory/warehouseOutRecord/status_tree',
)
}
export function getBySkuAndWarehouseIdApi(
warehouseId: number | string | undefined,
sku: string | null,
) {
return axios.get<never, BaseRespData<InterskuList[]>>(
'factoryWarehouseInventory/getBySkuAndWarehouseId',
{
params: {
warehouseId,
sku,
},
},
)
}
export function rejectOutRecordApi({
list,
rejectReason,
}: {
list: WarehouseParams[]
rejectReason: string
}) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseOutRecord/reject',
{
list,
rejectReason,
},
)
}
export function getItemListByIdApi(id: number | undefined) {
return axios.get<never, BaseRespData<InterProductList[]>>(
'factory/warehouseOutRecord/getItemListById',
{
params: {
id,
},
},
)
}
export function getWarehouseOutRecordDetailApi(id: number | undefined) {
return axios.get<never, BaseRespData<InterWarehouseDetail>>(
'factory/warehouseOutRecord/get',
{
params: {
id,
},
},
)
}
export function addOutRecordApi(form: InterWarehouseDetail) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseOutRecord/add',
{
...form,
},
)
}
export function updateOutRecordApi(
form: InterWarehouseDetail | AnyObject | null,
) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseOutRecord/update',
{
...form,
},
)
}
export function getOutRecordLogApi(id?: number) {
return axios.get<never, BaseRespData<LogListData[]>>(
`factory/warehouseOutRecord/getLogById?id=${id}`,
)
}
export function warehouseOutRecordListPage(
data: warehouseSearchForm,
currentPage: number,
......
......@@ -27,7 +27,7 @@ import WarehouseManage from '@/views/warehouse/manage.vue'
import WarehouseWarning from '@/views/warehouse/warning.vue'
import WarehousePosition from '@/views/warehouse/position.vue'
import receiptDoc from '@/views/warehouse/receiptDoc.vue'
// import issueDoc from '@/views/warehouse/issueDoc.vue'
import issueDoc from '@/views/warehouse/issueDoc.vue'
const router = createRouter({
history: createWebHistory(),
routes: [
......@@ -134,13 +134,13 @@ const router = createRouter({
},
component: receiptDoc,
},
// {
// path: '/warehouse/issue-doc',
// meta: {
// title: '出库单',
// },
// component: issueDoc,
// },
{
path: '/warehouse/issue-doc',
meta: {
title: '出库单',
},
component: issueDoc,
},
{
path: '/warehouse/warning',
meta: {
......
......@@ -31,11 +31,11 @@ const menu: MenuItem[] = [
id: 123,
label: '入库单',
},
// {
// index: '/warehouse/issue-doc',
// id: 124,
// label: '出库单',
// },
{
index: '/warehouse/issue-doc',
id: 124,
label: '出库单',
},
{
index: '/warehouse/manage',
......
......@@ -8,7 +8,7 @@ export interface warehouseSearchForm {
createTimeStart?: string
orderNumber?: string
sku?: string
warehouseId?: number | null
warehouseId?: number | string
id?: number
}
export interface InterProductList {
......@@ -16,7 +16,8 @@ export interface InterProductList {
id?: number
inId?: number
productNo?: string | null //custom的货号
buyStored?: number | null
buyStored?: number | null //入库数量
outCount?: number | null //出库数量
remark?: string | null
skuImage?: string
skuName?: string
......@@ -32,9 +33,10 @@ export interface InterWarehouseBase {
id?: number
factoryId?: number
factoryCode?: string
warehouseId?: number | null
warehouseId?: number | string
warehouseName?: string | null
inNo?: string
outNo?: string
shipmentNumber?: string
skuAmount?: number
total?: number
......@@ -66,6 +68,8 @@ export interface InterProductList {
inId?: number
productNo?: string | null //货号
buyStored?: number | null //入库数量
outCount?: number | null //出库数量
usableInventory?: number | null //可用库存数量
// rejectsAmount?: number
// rejectsReason?: string
remark?: string | null
......@@ -84,20 +88,14 @@ export interface InterskuList {
sku?: string
skuName?: string
image?: string
factoryPrice?: number
factoryPrice?: number | null
productNo?: string | null //货号
productNumber?: string | null //出库单货号
locationId?: number | null
locationCode?: string | null
}
export interface InterWarehouseList {
id: number
name: string
code?: string
sort?: number
defaulted?: number
factoryId?: number
factoryCode?: string
remarks?: string | null
price?: number | null //出库单的
usableInventory?: number | null
warehouseSku?: string
}
export interface ILocation {
id?: number
......
......@@ -29,6 +29,7 @@ function isChange(arr: AnyObject[], arr1: AnyObject[]): boolean {
* @param {string} id 数组唯一值
* @param {Record<string, string>} other 其他属性
* @param {boolean} bool 是否为布尔值
* @param {boolean} isBackKeyName 是否将结果返回到xxChange里,针对只有一个list的情况
*/
export function checkUpdateParams(
newParams: AnyObject,
......@@ -36,6 +37,7 @@ export function checkUpdateParams(
id: string = 'id',
other: Record<string, string> = {},
bool: boolean = false,
isBackKeyName: boolean = true,
): AnyObject | null {
oldParams = JSON.parse(JSON.stringify(oldParams))
if (!oldParams) return newParams
......@@ -105,9 +107,16 @@ export function checkUpdateParams(
if (arr1.length > 0) {
removeList = arr1.map((item) => item['id'] as IdType)
}
if (isBackKeyName) {
// 将列表直接添加到 params 顶层
if (addList.length > 0) params['addList'] = addList || undefined
if (updateList.length > 0)
params['updateList'] = updateList || undefined
if (removeList.length > 0)
params['removeList'] = removeList || undefined
if (list.length > 0) params['list'] = list || undefined
} else {
const key_name = key.replace('List', 'Change')
params[key_name] = {}
if (addList.length > 0) {
;(params[key_name] as AnyObject).addList = addList
......@@ -125,6 +134,7 @@ export function checkUpdateParams(
delete params[key_name]
}
}
}
} else {
// 基础信息
params[key] = newParams[key]
......
......@@ -479,6 +479,7 @@
<ElSelect
v-model="editForm.warehouseId"
clearable
:disabled="formId"
placeholder="请选择仓库"
style="width: 160px"
@change="handleWarehouseChange(editForm.warehouseId)"
......@@ -561,13 +562,13 @@
label="总成本(¥)"
prop="totalPrice"
/>
<ElTableColumn align="center" label="库位" prop="loacationCode">
<ElTableColumn align="center" label="库位" prop="locationCode">
<template #default="{ row }">
<!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<!-- remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"-->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<span v-if="row.locationCode">{{ row.locationCode }}</span>
<ElSelect
v-else
v-model="row.locationId"
......@@ -592,7 +593,11 @@
width="240"
label="备注"
prop="remark"
/>
>
<template #default="{ row }">
<ElInput v-model="row.remark" clearable size="small" />
</template>
</ElTableColumn>
</ElTable>
</div>
<template #footer>
......@@ -653,7 +658,7 @@
show-overflow-tooltip
align="center"
label="库位"
prop="loacationCode"
prop="locationCode"
/>
<ElTableColumn
width="100"
......@@ -680,14 +685,14 @@
</el-button>
</template>
</el-popover>
<el-button
<!-- <el-button
style="margin-left: 6px"
type="success"
size="small"
@click="addPurchase"
>
批量新增
</el-button>
</el-button> -->
<el-button
type="danger"
style="margin-left: 10px"
......@@ -804,7 +809,7 @@ import {
warehouseInRecordListPageApi,
getWarehouseInRecordDetailApi,
getBySkuApi,
getWarehouseListApi,
warehouseInfoGetAll,
getByWareHouseIdAndCodeApi,
addInRecordApi,
updateInRecordApi,
......@@ -813,6 +818,7 @@ import {
getInRecordLogApi,
rejectInRecordApi,
LogListData,
warehouseInfo,
} from '@/api/warehouse'
// factoryWarehouseInventoryPrint,
// import { filePath } from '@/api/axios.ts'
......@@ -825,14 +831,13 @@ import {
InterWarehouseTree,
InterProductList,
InterskuList,
InterWarehouseList,
ILocation,
InterWarehouseDetail,
} from '@/types/api/warehouse'
import ImageView from '@/components/ImageView.vue'
import UploadExcel from '@/components/UploadExcel.vue'
// import { debounce } from 'lodash-es'
const warehouseList = ref<InterWarehouseList[]>([])
const warehouseList = ref<warehouseInfo[]>([])
const pickerOptions = {
shortcuts: [
{
......@@ -1195,7 +1200,7 @@ const submitExportForm = () => {
}
const getWarehouseList = async () => {
try {
const res = await getWarehouseListApi()
const res = await warehouseInfoGetAll()
warehouseList.value = res.data
await nextTick(() => {
treeRef.value!.setCurrentKey(nodeCode.value, true)
......@@ -1225,7 +1230,7 @@ const skudblclick = (val: InterskuList) => {
// 使用可选链和空值合并运算符处理可能的null值
const {
locationCode = '',
factoryPrice = 0,
factoryPrice = null,
productNo = '',
sku = '',
skuName = '',
......@@ -1269,7 +1274,7 @@ const tabsClick = async () => {
}
const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '',
warehouseId: null,
warehouseId: '',
warehouseName: '',
remark: '',
factoryCode: '',
......@@ -1286,7 +1291,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
if (v) formId.value = v.id
if (v) getProduct(v.id)
if (!formId.value) return ElMessage('请勾选至少一条记录')
editForm.value = JSON.parse(JSON.stringify(v))
// editForm.value = JSON.parse(JSON.stringify(v))
} else {
await nextTick()
editForm.value = JSON.parse(JSON.stringify(editForm2.value))
......@@ -1297,6 +1302,13 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
const userData = JSON.parse(userJson)
editForm.value.factoryCode = userData.factoryCode || ''
editForm.value.factoryId = userData.factoryId || 0
const defaultWarehouse = warehouseList.value.find(
(item: warehouseInfo) => item.defaulted === 1,
)
if (defaultWarehouse) {
editForm.value.warehouseId = defaultWarehouse.id
editForm.value.warehouseName = defaultWarehouse.name
}
} catch {
// ignore
}
......@@ -1413,7 +1425,7 @@ watch(
watch(
() => editForm.value.warehouseId,
(newVal: number | null | undefined) => {
(newVal: number | string | undefined) => {
if (newVal) {
fetchLocationList('')
}
......@@ -1531,9 +1543,9 @@ const upSection = async () => {
console.error(e)
}
}
const addPurchase = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
}
// const addPurchase = async () => {
// if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
// }
const deleteOtherWarehousing = () => {
const arr = otherWarehouseSelection.value
if (arr.length === 0) return
......@@ -1560,7 +1572,8 @@ const handleBatchDelete = async () => {
const str = selections.value.map((el: InterWarehousePage) => el.id).join(',')
await deleteWarehouseInRecordApi(str)
ElMessage.success('删除成功')
await search()
search()
await getTreeNum()
}
const nodeClick = (data: InterWarehouseTree) => {
nodeCode.value = data.code ?? ''
......@@ -1624,9 +1637,9 @@ const handleLocationChange = (val: number, row: InterProductList) => {
)
row.locationCode = found ? found.locationCode : ''
}
const handleWarehouseChange = (val: number | null | undefined) => {
const handleWarehouseChange = (val: number | string | undefined) => {
const found = warehouseList.value.find(
(item: InterWarehouseList) => item.id === val,
(item: warehouseInfo) => item.id === val,
)
editForm.value.warehouseName = found ? found.name : ''
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment