<template>
|
<!-- 看板详情 -->
|
<el-dialog v-model="dialogVisible" width="80%" @close="closeDialog" :close-on-click-modal="false">
|
<template #header>
|
<div style="color: #fff">
|
<span>看板详情</span>
|
</div>
|
</template>
|
<div class="msi-content" style="margin-top: 10px">
|
<div class="msi-form" style="padding-top: 0px">
|
<el-form :model="materialForm">
|
<el-row>
|
<el-col :span="8">
|
<el-form-item label="物料编号">
|
<el-input v-model="materialForm.materialCode" placeholder="请输入物料编号" clearable></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label-width="20px">
|
<el-button type="primary" icon="el-icon-search" @click="getMaterialList">查询</el-button>
|
<!-- <el-button icon="el-icon-refresh-right" @click="resetMaterialForm">重置</el-button> -->
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<el-table :data="warehousOrderDetails" border style="width: 100%" row-key="setRowKey" ref="detailRef" max-height="480">
|
<el-table-column label="序号" align="center" width="60" type="index" />
|
|
<el-table-column label="物料编号" min-width="140" prop="materialCode" align="center" show-overflow-tooltip />
|
<el-table-column prop="materialName" min-width="110px" label="物料名称" show-overflow-tooltip="" />
|
<el-table-column prop="materialUnit" min-width="110px" label="单位" show-overflow-tooltip="" />
|
<el-table-column prop="abcClassName" label="ABC分类" show-overflow-tooltip="" />
|
<!-- <el-table-column prop="snCode" min-width="110px" label="跟踪码" show-overflow-tooltip="" /> -->
|
<el-table-column prop="quantity" label="数量" show-overflow-tooltip="" />
|
</el-table>
|
|
<Pagination :total="materialTotal" v-model:page="materialForm.Page" v-model:limit="materialForm.PageSize" @pagination="getMaterialList" style="margin-top: 20px; text-align: center"></Pagination>
|
|
</div>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="dialogVisible = false">取消</el-button>
|
<!-- <el-button type="primary" :disabled="disabled_btn" @click="confirm">确认</el-button> -->
|
</span>
|
</template>
|
</el-dialog>
|
<!-- 添加物料 -->
|
<el-dialog v-model="addMaterialVisible" width="70%" @close="closeMaterialDialog">
|
<template #header>
|
<div style="color: #fff">
|
<span v-if="isMaterialBox == 1">添加物料详情</span>
|
<span v-if="isPoBox == 1">关联ASN单物料</span>
|
</div>
|
</template>
|
|
<div class="msi-form" style="padding-top: 0px">
|
<el-form :model="materialForm">
|
<el-row>
|
<el-col :span="8" v-if="isMaterialBox == 1">
|
<el-form-item label="物料编号">
|
<el-input v-model="materialForm.Code" placeholder="请输入物料编号" clearable></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8" v-if="isPoBox == 1">
|
<el-form-item label="关联ASN单号:">
|
<el-input v-model="materialForm.poNo" placeholder="请输入关联ASN单号" clearable></el-input>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="8">
|
<el-form-item label-width="20px">
|
<el-button type="primary" icon="el-icon-search" @click="getMaterialList">查询</el-button>
|
<!-- <el-button icon="el-icon-refresh-right" @click="resetMaterialForm">重置</el-button> -->
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<div class="msi-content" style="padding-top: 0; margin-top: 10px">
|
<el-table :data="materialList" border style="width: 100%" row-key="id" ref="materialRef" @selection-change="materialSelectionChange" :max-height="480" v-if="isMaterialBox == 1">
|
<el-table-column align="center" width="60" type="selection" />
|
<el-table-column label="序号" align="center" width="60" type="index" />
|
<el-table-column label="物料编号" prop="materialCode" align="center" min-width="140" show-overflow-tooltip />
|
<el-table-column label="物料名称" prop="materialName" align="center" min-width="140" show-overflow-tooltip />
|
|
<el-table-column label="单位" prop="poUnit" align="center" min-width="140" show-overflow-tooltip />
|
</el-table>
|
|
<Pagination :total="materialTotal" v-model:page="materialForm.Page" v-model:limit="materialForm.PageSize" @pagination="getMaterialList" style="margin-top: 20px; text-align: center"></Pagination>
|
</div>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="addMaterialVisible = false">取消</el-button>
|
<el-button type="primary" @click="confirmAddMaterial">确认</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
<!-- 单详情 -->
|
<el-drawer v-model="drawerVisible" :title="`${detailForm.asnId}订单详情`" direction="rtl" size="80%" @close="handleDrawerClose">
|
<template #title>
|
<div class="slot_title">
|
<div class="title_orderNo">{{ title }}</div>
|
<div>订单详情</div>
|
</div>
|
</template>
|
|
<div class="detailBoxWrap">
|
<!-- 详情组件 -->
|
<open-details ref="propDetailRef"></open-details>
|
<div class="msi-form">
|
<el-form :model="detailForm">
|
<el-row>
|
<el-col :span="6">
|
<el-form-item label="物料编号">
|
<el-input v-model="detailForm.materialCode" clearable placeholder="请输入物料编号" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="2">
|
<el-form-item label-width="20px">
|
<el-button type="primary" icon="el-icon-search" @click="getDetail">查询</el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<div class="msi-content">
|
<!-- <p style="margin-bottom: 10px">物料明细</p> -->
|
<el-table :data="drawerList" border striped :max-height="480">
|
<el-table-column label="序号" align="center" width="60" type="index" />
|
|
|
|
<el-table-column prop="materialCode" min-width="130px" label="物料编号" show-overflow-tooltip="" />
|
<el-table-column prop="materialName" min-width="110px" label="物料名称" show-overflow-tooltip="" />
|
<el-table-column prop="qcQuantity" label="实检数量" show-overflow-tooltip="" />
|
<!-- <el-table-column prop="qCStatus" label="质检状态" show-overflow-tooltip="" >
|
<template #default="scope">
|
<el-tag>{{ getEnumDesc(scope.row.qCStatus, getEnumQCStatusData_Index)}}</el-tag>
|
</template>
|
</el-table-column> -->
|
<el-table-column prop="qcStatus" label="质检状态" show-overflow-tooltip="">
|
<template #default="scope">
|
<el-tag>{{ getEnumDesc(scope.row.qCStatus, getEnumQCStatusData_Index) }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="passQuantity" label="合格数量" show-overflow-tooltip="" />
|
<el-table-column prop="rejectQuantity" label="不合格数量" show-overflow-tooltip="" />
|
<el-table-column prop="goodsQuantity" label="已收数量" show-overflow-tooltip="" />
|
|
<el-table-column prop="businessTypeName" label="业务类型" show-overflow-tooltip="" />
|
<el-table-column prop="qCOrderStatus" label="单据状态" show-overflow-tooltip="">
|
<template #default="scope">
|
<el-tag>{{ getEnumDesc(scope.row.qcOrderStatus, getEnumAsnStatusData_Index) }}</el-tag>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column prop="qcOrderStatusName" label="单据状态" show-overflow-tooltip="" /> -->
|
|
<el-table-column prop="unit" label="单位" show-overflow-tooltip="" />
|
<el-table-column prop="supplierName" label="供应商名称" show-overflow-tooltip="" />
|
<el-table-column prop="supplierCode" label="供应商编号" show-overflow-tooltip="" />
|
<el-table-column prop="custCode" label="客户编号" show-overflow-tooltip="" />
|
<el-table-column prop="custChinaName" min-width="110px" label="客户中文名称" show-overflow-tooltip="" />
|
<el-table-column prop="custEnglishName" min-width="110px" label="客户英文名称" show-overflow-tooltip="" />
|
<el-table-column prop="relationNo" label="关联单号" show-overflow-tooltip="" />
|
<!-- <el-table-column prop="relationOrderType" label="关联单据类型" show-overflow-tooltip="" /> -->
|
<el-table-column prop="relationOrderTypeName" min-width="110px" label="关联单据类型" show-overflow-tooltip="" />
|
<!-- <el-table-column prop="factoryId" label="工厂ID" show-overflow-tooltip="" /> -->
|
<!-- <el-table-column prop="factoryName" label="工厂名称" show-overflow-tooltip="" /> -->
|
<!-- <el-table-column prop="factoryCode" label="工厂编号" show-overflow-tooltip="" /> -->
|
<el-table-column prop="remarks" label="备注" show-overflow-tooltip="" />
|
<el-table-column prop="createTime" label="创建时间" width="130" :formatter="formatDate_T_Time" show-overflow-tooltip="" />
|
<el-table-column prop="updateTime" label="修改时间" width="130" :formatter="formatDate_T_Time" show-overflow-tooltip="" />
|
<el-table-column prop="createUserName" label="创建人" show-overflow-tooltip="" />
|
<el-table-column prop="updateUserName" label="修改人" show-overflow-tooltip="" />
|
</el-table>
|
<Pagination :total="detailCount" v-model:page="detailForm.PageNo" v-model:limit="detailForm.PageSize" @pagination="getDetail" style="margin-top: 20px; text-align: center"></Pagination>
|
|
<div></div>
|
</div>
|
</div>
|
</el-drawer>
|
|
<el-dialog v-model="outVisible2" title="SPA获取" width="20%" @close="closeOutDialog2">
|
<el-form :model="outerForm2" label-width="120px">
|
<el-row style="font-size: 16px">
|
<el-col :span="23">
|
<el-form-item label="单号:" required>
|
<el-input v-model="outerForm2.purchaseNo" clearable placeholder="请输入单号" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="outVisible2 = false">取消</el-button>
|
<el-button type="primary" @click="getSapOrderPO">确认</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</template>
|
<script lang="ts" setup>
|
import Pagination from '/@/components/Pagination/index.vue';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ref, nextTick, computed, getCurrentInstance, watch, defineExpose, defineProps, onMounted } from 'vue';
|
|
import { formatDecimalData } from '/@/utils/formate';
|
|
import cache from '/@/utils/cache';
|
import { pageWmsMaterial } from '/@/api/main/WmsBase/wmsMaterial';
|
import { getTypeStatus } from '/@/utils/formate';
|
import { getAPI } from '/@/utils/axios-utils';
|
import { SysEnumApi } from '/@/api-services/api';
|
import { addWmsOrderPurchase, updateWmsOrderPurchase, detailWmsOrderPurchase } from '/@/api/main/WmsOrder/wmsOrderPurchase';
|
import OpenDetails from '/@/components/openDetails/openDetails.vue';
|
import { pageBaseCustomer } from '/@/api/main/WmsBase/baseCustomer';
|
import { pageWmsOrderPurchaseDetails } from '/@/api/main/WmsOrder/wmsOrderPurchaseDetails';
|
import { pageWmsOrderAsnDetails, deleteWmsOrderAsnDetails } from '/@/api/main/WmsOrder/wmsOrderAsnDetails';
|
import commonFunction from '/@/utils/commonFunction';
|
import { addWmsOrderAsn, updateWmsOrderAsn, detailWmsOrderAsn } from '/@/api/main/WmsOrder/wmsOrderAsn';
|
|
import { addWmsQc, updateWmsQc, detailWmsQc, confirmWmsQc } from '/@/api/main/WmsQC/wmsOrderQc';
|
import { pageWmsQcDetails } from '/@/api/main/WmsQC/wmsOrderQcDetails';
|
import { pageWmsAbcDetails } from '/@/api/main/ReportCenter/wmsStockBoardabc';
|
const { proxy }: any = getCurrentInstance(); // 访问实例上下文 proxy同时支持开发 线上环境
|
const getEnumOrderTypeData = ref<any>([]);
|
const getEnumBusinessTypeData = ref<any>([]);
|
const getEnumPoStatusData = ref<any>([]);
|
const { getEnumDesc } = commonFunction();
|
const emits = defineEmits(['getTabelData']);
|
const getEnumAsnStatusData_Index = ref<any>([]);
|
const getEnumOrderTypeData_Index = ref<any>([]);
|
const getEnumQCStatusData_Index = ref<any>([]);
|
|
const getEnumDockData = ref<any>([]);
|
const props = defineProps({
|
titleAuthor: {
|
type: Number,
|
required: true,
|
},
|
hexiao: {
|
type: Number,
|
default: 1,
|
required: true,
|
},
|
});
|
//控制订单类型 - 下拉菜单
|
const titleAuthor = computed(() => props.titleAuthor);
|
// 是否显示核销按钮
|
const hexiao = computed(() => props.hexiao);
|
const loading = ref(false);
|
|
|
|
// form表单展开
|
|
const orderType = ref('');
|
const orderDoRuType = ref(); // 用于导入的变量
|
const itemBtn = ref(1);
|
// 控制bom物料权限
|
const isShowBomBtn = ref(0);
|
|
// 禁止之前的日期
|
const disabledDate = (time: Date) => {
|
return time.getTime() + 3600 * 1000 * 24 < Date.now();
|
};
|
// 上传窗口
|
const uploadVisible = ref(false);
|
//打开导入窗口
|
const openUploadDialog = (param: any) => {
|
orderDoRuType.value = param;
|
uploadVisible.value = true;
|
};
|
//关闭窗口
|
const closeUploadDialog = () => {
|
getTabelData();
|
};
|
//sap获取
|
const getSapOrder = () => {
|
ElMessageBox.confirm('是否确认获取更新?', '提示', {
|
confirmButtonText: '确认',
|
cancelButtonText: '取消',
|
type: 'warning',
|
}).then(() => {
|
});
|
};
|
|
//------------sap获取PO单
|
const outVisible2 = ref(false);
|
const outerForm2 = ref({
|
purchaseNo: '',
|
});
|
const getSapOrderPO = (param?: number) => {
|
if (param && param == 1) {
|
outVisible2.value = true;
|
return;
|
}
|
if (outerForm2.value.purchaseNo == '') {
|
ElMessage.warning('请输入单号');
|
return;
|
}
|
};
|
//关闭出库窗口的回调
|
const closeOutDialog2 = () => {
|
outerForm2.value.purchaseNo = '';
|
};
|
|
//------------sap获取PO单
|
|
// --------------------PO单列表-----------------------------------
|
//查询
|
const formModel = ref({
|
WareMaterialCode: '',
|
WareMaterialName: '',
|
PurchaseNo: '',
|
CreatedUserName: '',
|
CreatedTimeBegin: '',
|
CreatedTimeEnd: '',
|
CreateDate: [],
|
IssueTimeBegin: '',
|
IssueTimeEnd: '',
|
IssueDate: [],
|
MaterialTypeStaus: '',
|
SourceBy: '',
|
WriteOffState: '',
|
signStatus: '',
|
status: '',
|
freeOrderType: '',
|
IsQueryAll: false, //是否显示全部数据
|
// LoginUserID: LoginUserID, //用户id
|
OrderMenuType: '', //判断是哪个菜单入库
|
Page: 1,
|
PageSize: 10,
|
poApprovalStatus: '',
|
keyCode: '',
|
IsDisable: '', //是否作废
|
});
|
|
//入库单列表数据
|
let tableData = ref([]);
|
const tableRef = ref();
|
|
//列表的数据条数
|
const totalItems = ref<number>(0);
|
|
//缓存枚举
|
const enumList: any = cache.getCache('enumList');
|
console.log(enumList.inEnumOrderType);
|
|
// .inEnumOrderType
|
|
//获取PO单列表
|
const getTabelData = () => {
|
//判断创建时间是否有选择
|
if (formModel.value.CreateDate && formModel.value.CreateDate.length > 0) {
|
formModel.value.CreatedTimeBegin = formModel.value.CreateDate[0];
|
formModel.value.CreatedTimeEnd = ''; //addDate(formModel.value.CreateDate[1], 1); //日期查询 结束时间 需要加一天
|
} else {
|
// 日历清空 再查询bug
|
if (formModel.value.CreatedTimeBegin || formModel.value.CreatedTimeEnd) {
|
formModel.value.CreatedTimeBegin = '';
|
formModel.value.CreatedTimeEnd = '';
|
}
|
}
|
//判断下发时间是否有选择
|
if (formModel.value.IssueDate && formModel.value.IssueDate.length > 0) {
|
formModel.value.IssueTimeBegin = formModel.value.IssueDate[0];
|
formModel.value.IssueTimeEnd = formModel.value.IssueDate[1];
|
} else {
|
// 日历清空 再查询bug
|
if (formModel.value.IssueTimeBegin || formModel.value.IssueTimeEnd) {
|
formModel.value.IssueTimeBegin = '';
|
formModel.value.IssueTimeEnd = '';
|
}
|
}
|
};
|
getTabelData();
|
|
//重置搜索
|
const resetForm = () => {
|
formModel.value = {
|
WareMaterialCode: '',
|
WareMaterialName: '',
|
PurchaseNo: '',
|
CreatedUserName: '',
|
CreatedTimeBegin: '',
|
CreatedTimeEnd: '',
|
CreateDate: [],
|
IssueTimeBegin: '',
|
IssueTimeEnd: '',
|
IssueDate: [],
|
MaterialTypeStaus: '',
|
SourceBy: '',
|
WriteOffState: '',
|
signStatus: '',
|
status: '',
|
freeOrderType: '',
|
IsQueryAll: false, //是否显示全部数据
|
// LoginUserID: LoginUserID, //用户id
|
OrderMenuType: '', //判断是哪个菜单入库
|
Page: 1,
|
PageSize: 10,
|
poApprovalStatus: '',
|
keyCode: '',
|
IsDisable: '', //是否作废
|
};
|
getTabelData();
|
};
|
// -----------------删除、导出操作--------------------------
|
//选中的行
|
const checkRows = ref<{ id: number }[]>([]);
|
// 选择
|
const handleSelectionChange = (val: any) => {
|
checkRows.value = val;
|
};
|
//导出PO单详情
|
const handExport = () => {
|
// rkExport(formModel.value)
|
// .then((res) => {
|
// const link = document.createElement("a"); //创建a标签
|
// let blob = new Blob([res], { type: "application/vnd.ms-excel" }); // response就是接口返回的文件流
|
// let objectUrl = URL.createObjectURL(blob);
|
// link.href = objectUrl;
|
// link.download = `入库管理导出${formatUtcToData(
|
// new Date().toString(),
|
// "YYYY-MM-DD hh:mm:ss"
|
// )}`; // 自定义文件名
|
// link.click(); // 下载文件
|
// URL.revokeObjectURL(objectUrl); // 释放内存
|
// }).catch((err) => ElMessage.error(JSON.stringify(err)));
|
//导出调用接口
|
// let entozh = entozhExcell
|
// const { PageNo, PageSize, ...rest } = formModel.value
|
// getPurchasePage({ Page: 1, PageSize: 1000000, ...rest }).then(res => {
|
// if(res.code==200){
|
// res.data.rows.forEach((item)=>{
|
// item.writeOffState = EnumWriteOffState.value.filter((v: any) => v.value == item.writeOffState)[0].title;
|
// item.sourceBy = sourceEnum.value.filter((v: any) => v.value == item.sourceBy)[0].title;
|
// })
|
// exportExcel(res.data.rows, entozh, "xlsx", `入库管理表${formatUtcToData(new Date().toString(), 'YYYY-MM-DD hh:mm:ss')}`);
|
// }
|
// })
|
// 后端导出-字段不全
|
// if (checkRows.value.length <= 0) {
|
// ElMessage.warning("请选择一个订单!");
|
// return
|
// }
|
// const arr = checkRows.value.reduce((curr, item) => {
|
// curr.push(item.purchaseNo);
|
// return curr;
|
// }, []);
|
// puchaseExport({ PurchaseNo: arr })
|
// .then((res) => {
|
// const link = document.createElement("a"); //创建a标签
|
// let blob = new Blob([res], { type: "application/vnd.ms-excel" }); // response就是接口返回的文件流
|
// let objectUrl = URL.createObjectURL(blob);
|
// link.href = objectUrl;
|
// link.download = `入库管理导出${formatUtcToData(
|
// new Date().toString(),
|
// "YYYY-MM-DD hh:mm:ss"
|
// )}`; // 自定义文件名
|
// link.click(); // 下载文件
|
// URL.revokeObjectURL(objectUrl); // 释放内存
|
// })
|
// .catch((err) => ElMessage.error(JSON.stringify(err)));
|
};
|
|
// -------------------获取PO单下物料详情-----------------------------------
|
//入库单下物料详情请求
|
const detailForm = ref({
|
materialCode: '',
|
Page: 1,
|
PageSize: 10,
|
});
|
|
// 物料详情抽屉
|
const drawerVisible = ref(false);
|
const drawerType = ref('drawerAll');
|
// const
|
//单号
|
const purchaseNo = ref('');
|
const detailCount2 = ref(0);
|
const detailForm2 = ref({
|
Page: 1,
|
PageSize: 10,
|
qcOrderId: '',
|
IsConfirmQC: true, //质检单确认传参:1质检状态不是待检验 2单据状态是新建
|
});
|
const getEnumPoDetailStatusData_Index = ref<any>([]);
|
|
const drawerList2 = ref<DetailType[]>([]);
|
//------------------获取物料列表物料明细
|
const getDetail = async () => {
|
loading.value = true;
|
var res = await pageWmsQcDetails(Object.assign(detailForm.value));
|
var listD = res.data.result?.items ?? [];
|
drawerList.value = listD;
|
detailCount.value = res.data.result?.total;
|
loading.value = false;
|
getEnumPoDetailStatusData_Index.value = (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet('OrderStatusEnum')).data.result ?? [];
|
|
getEnumAsnStatusData_Index.value = (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet('OrderStatusEnum')).data.result ?? [];
|
};
|
|
//----------------物料明细
|
//打开抽屉
|
const openDrawer = async (type: number, scope: any = {}, entozhExcell?: any) => {
|
detailForm.value.PageNo = 1;
|
detailForm.value.PageSize = 10;
|
if (scope.asnNo) {
|
title.value = `${scope.asnNo}`;
|
}
|
drawerType.value = 'drawerAll';
|
drawerVisible.value = true;
|
//当前入库单号id
|
detailForm.value.asnId = scope.id;
|
//入库单
|
purchaseNo.value = scope.purchaseNo;
|
detailForm2.value.asnId = scope.id;
|
//获取物料列表
|
if (detailForm2.value.asnId == '') {
|
drawerList2.value = [];
|
detailCount2.value = 0;
|
return;
|
}
|
// 获取物料列表物料明细
|
getDetail();
|
|
getEnumPoDetailStatusData_Index.value = (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet('OrderStatusEnum')).data.result ?? [];
|
let scopetrans = JSON.parse(JSON.stringify(scope));
|
scopetrans.qcOrderStatus = getEnumDesc(scopetrans.qcOrderStatus, getEnumPoDetailStatusData_Index.value);
|
nextTick(() => {
|
proxy.$refs['propDetailRef'].openADialog(scopetrans, entozhExcell);
|
});
|
};
|
|
//关闭抽屉
|
const handleDrawerClose = () => {
|
detailForm.value = {
|
materialCode: '',
|
asnId: '',
|
Page: 1,
|
PageSize: 10,
|
};
|
deltailList.value = [];
|
detailCount.value = 0;
|
drawerList.value = [];
|
drawerList2.value = [];
|
detailCount2.value = 0;
|
drawerList2.value = [];
|
};
|
|
//物料详情类型
|
interface DetailType {
|
id: number;
|
}
|
|
//入库单详情列表
|
const deltailList = ref<DetailType[]>([]);
|
//弹出层数据
|
const drawerList = ref<DetailType[]>([]);
|
|
//入库单详情列表数据条数
|
const detailCount = ref(0);
|
|
//弹出层标题
|
let title = ref('');
|
|
// ----------------新增、编辑-------------------------------
|
//窗口类型
|
const dialogType = ref('add');
|
|
const dialogVisible = ref(false);
|
|
//添加编辑表单ref
|
const dialogRef = ref();
|
|
//添加/编辑参数
|
let addForm = ref({
|
hasTMCode: false,
|
asnType: '',
|
dock: '',
|
projectNo: '',
|
OrderDetails: [] as any[],
|
});
|
//物料基础数据form
|
const materialForm = ref({
|
materialCode:'',
|
aBCClass: '',
|
Page: 1,
|
PageSize: 10,
|
recordInsertTimeRange:[]
|
});
|
|
//打开
|
const openDialog = async (type: number, scope: any = {}) => {
|
debugger
|
materialForm.value.aBCClass = scope.aBCClass;
|
materialForm.value.recordInsertTimeRange = scope.recordInsertTimeRange;
|
//------------------获取物料列表物料明细
|
getMaterialList()
|
//----------------物料明细
|
dialogVisible.value = true;
|
disabled_btn.value = false;
|
//清除选中项
|
// nextTick(() => {
|
// dialogRef.value.clearValidate();
|
// });
|
};
|
|
//物料详情的table ref
|
const detailRef = ref();
|
const setRowKey = (row: any) => {
|
return row.id + row.asnLineNumber;
|
};
|
//关闭窗口
|
const closeDialog = () => {
|
addForm.value = {
|
hasTMCode: false,
|
asnType: '',
|
dock: '',
|
projectNo: '',
|
OrderDetails: [] as any[],
|
};
|
warehousOrderDetails.value = [];
|
checkedDetails.value = [];
|
deltailList.value = [];
|
detailCount.value = 0;
|
disabled_btn.value = false;
|
detailRef.value.clearSelection();
|
};
|
|
//添加编辑窗口物料列表
|
const warehousOrderDetails = ref<any[]>([]);
|
|
//物料详情列表选中的物料
|
const checkedDetails = ref<any[]>([]);
|
|
//物料详情列表中勾选事件
|
const detailsCheckChange = (val: any) => {
|
checkedDetails.value = val;
|
};
|
|
//删除选中的物料详情
|
const delCheckedDetails = () => {
|
ElMessageBox.confirm('是否确认删除?', '提示', {
|
confirmButtonText: '确认',
|
cancelButtonText: '取消',
|
type: 'warning',
|
})
|
.then(() => {
|
let arr = [];
|
if (checkedDetails.value[0].diRelationID) {
|
checkedDetails.value.forEach((item) => {
|
console.log(item);
|
let index = warehousOrderDetails.value.findIndex((detail) => detail.materialCode == item.materialCode && detail.diRelationID == item.diRelationID);
|
if (index > -1) {
|
warehousOrderDetails.value.splice(index, 1);
|
}
|
});
|
} else {
|
checkedDetails.value.forEach((item) => {
|
let index = warehousOrderDetails.value.findIndex((detail) => detail.materialCode == item.materialCode && detail.asnLineNumber == item.asnLineNumber);
|
warehousOrderDetails.value.splice(index, 1);
|
});
|
}
|
arr = warehousOrderDetails.value;
|
warehousOrderDetails.value = [];
|
//bug 相同物料 不同Bom
|
nextTick(() => {
|
warehousOrderDetails.value = arr;
|
checkedDetails.value = [];
|
detailRef.value.clearSelection();
|
});
|
})
|
.catch(() => ElMessage.info('已取消删除'));
|
};
|
//编辑、添加提交
|
const disabled_btn = ref(false);
|
const confirm = async () => {
|
console.log('确认');
|
if (warehousOrderDetails.value.length <= 0) {
|
ElMessage.warning('没有需要完成质检的物料!');
|
return;
|
}
|
addForm.value.OrderDetails = [];
|
warehousOrderDetails.value.forEach((item) => {
|
const obj = {
|
...item,
|
QCQuantity: item.quantity,
|
asnLineNumber: item.asnLineNumber,
|
};
|
addForm.value.OrderDetails.push(obj);
|
});
|
disabled_btn.value = true;
|
let res = await confirmWmsQc(addForm.value);
|
if (res.data && res.data.code == 200) {
|
ElMessage.success('完成质检成功');
|
dialogVisible.value = false;
|
emits('getTabelData');
|
}
|
disabled_btn.value = false;
|
};
|
// -----------------添加物料操作-------------------------
|
//物料基础数据窗口
|
const addMaterialVisible = ref(false);
|
|
//物料基础数据列表
|
const materialList = ref([]);
|
|
//物料基础数据条数
|
const materialTotal = ref(0);
|
|
|
//获取物料基础列表
|
const getMaterialList = async () => {
|
loading.value = true;
|
var res = await pageWmsAbcDetails({
|
...materialForm.value
|
});
|
var listD = res.data.result?.items ?? [];
|
warehousOrderDetails.value = listD;
|
materialList.value = res.data.result?.items ?? [];
|
materialTotal.value = res.data.result?.total;
|
loading.value = false;
|
};
|
|
|
|
//选中的基础物料数据
|
const checkedMaterial = ref<any[]>([]);
|
|
//物料基础数据勾选
|
const materialSelectionChange = (val: any) => {
|
checkedMaterial.value = val;
|
};
|
const isMaterialBox: any = ref(true);
|
const isPoBox: any = ref(true);
|
//打开新增物料窗口
|
const addMaterialDialog = (param?: any) => {
|
if (param && param == 'po') {
|
isPoBox.value = 1;
|
isMaterialBox.value = 0;
|
} else {
|
isPoBox.value = 0;
|
isMaterialBox.value = 1;
|
}
|
getMaterialList();
|
addMaterialVisible.value = true;
|
};
|
|
//基础物料table的ref对象
|
const materialRef = ref();
|
|
//确认添加材料
|
const confirmAddMaterial = () => {
|
//物料列表没数据,直接添加
|
if (warehousOrderDetails.value.length == 0) {
|
// 自动给行号复值
|
checkedMaterial.value.forEach((item, index) => {
|
item.unit = item.poUnit || item.unit;
|
item.asnLineNumber = index + 1;
|
if (!item.asnLineNumber) {
|
item.asnLineNumber = index + 1 + warehousOrderDetails.value.length;
|
}
|
});
|
|
warehousOrderDetails.value.push(...checkedMaterial.value);
|
} else {
|
for (let i = 0; i < checkedMaterial.value.length; i++) {
|
let idx = warehousOrderDetails.value.findIndex(
|
(item: { poLineNumber: any; code: any }) => item.code == checkedMaterial.value[i].materialCode && item.asnLineNumber == checkedMaterial.value[i].asnLineNumber
|
);
|
if (idx > -1) {
|
return ElMessage.warning(`物料编号${checkedMaterial.value[i].materialCode},ASN行号:${checkedMaterial.value[i].asnLineNumber || ''}在物料列表中已存在,请去除勾选`);
|
}
|
}
|
|
// 自动给行号复值
|
checkedMaterial.value.forEach((item, index) => {
|
item.unit = item.poUnit || item.unit;
|
if (!item.asnLineNumber) {
|
item.asnLineNumber = index + 1 + warehousOrderDetails.value.length;
|
}
|
});
|
warehousOrderDetails.value.push(...checkedMaterial.value);
|
}
|
|
addMaterialVisible.value = false;
|
};
|
|
//关闭新增物料窗口
|
const closeMaterialDialog = () => {
|
materialForm.value = {
|
poNo: '',
|
Code: '',
|
Page: 1,
|
PageSize: 10,
|
};
|
materialList.value = [];
|
checkedMaterial.value = [];
|
materialRef.value.clearSelection();
|
};
|
|
// 页面加载时
|
onMounted(async () => {});
|
|
// 暴露方法
|
defineExpose({ openDialog, openDrawer });
|
</script>
|
<style lang="less" scoped>
|
.detailBoxWrap {
|
margin: 10px;
|
}
|
|
.msi-form {
|
margin-top: 10px;
|
}
|
|
.msi-form {
|
margin-bottom: 10px;
|
}
|
|
.slot_title {
|
display: flex;
|
align-items: center;
|
|
// margin-left: 20px;
|
.title_orderNo {
|
font-size: 18px;
|
color: #f18201;
|
font-weight: bold;
|
margin-right: 5px;
|
}
|
}
|
</style>
|