Commit 9f9aa652 by wuqian

初版出库单

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