diff --git a/src/api/check/index.ts b/src/api/check/index.ts index 139fd63..a2036aa 100644 --- a/src/api/check/index.ts +++ b/src/api/check/index.ts @@ -31,4 +31,16 @@ export function checkmarkAudit(data: any) { method: 'post', data: data, }); +} + +/** + * 创建盘点单 + * @param ChangeParams + */ +export function createCheckPlan(data: any) { + return request({ + url: '/api/api/checkmark/createCheckPlan', + method: 'post', + data: data + }) } \ No newline at end of file diff --git a/src/api/label/index.ts b/src/api/label/index.ts index 5dbe337..d7ed687 100644 --- a/src/api/label/index.ts +++ b/src/api/label/index.ts @@ -81,7 +81,7 @@ export function getUnitList(data: any) { export function getTrackOutBox(data: any) { return request({ - url: '/api/label/TrackOutBox', + url: '/api/api/label/TrackOutBox', method: 'post', data: data, }); diff --git a/src/views/check/buildSheet/index.vue b/src/views/check/buildSheet/index.vue index 0712d1a..c9941a3 100644 --- a/src/views/check/buildSheet/index.vue +++ b/src/views/check/buildSheet/index.vue @@ -33,7 +33,7 @@ - 创建盘点单 @@ -155,6 +155,7 @@ import exportDataToExcel from '@/utils/export-excel'; import { IFTRUE, areAllNotEmpty, msToDate } from "@/utils/CommonUtil" import { bTableHeight } from "../../../composables/calcTableHeight"; import { getORG } from '@/api/auth'; +import { createCheckPlan } from '@/api/check' const { tableContainer, tableHeight, updateTableHeight, handleResize } = bTableHeight(120); const { proxy }: any = getCurrentInstance(); @@ -171,6 +172,7 @@ const state = reactive({ pageNum: 1, pageSize: 10 }, + commitDate:'', filList: [], filListhw: [], allfilterListhw: [] as any, @@ -187,6 +189,7 @@ const state = reactive({ ReservoirAreaList: [] as any,//库区下拉选项 erpLocationList: [] as any,//erp库位下拉选项 ERPLocationList: [] as any, + MATERIALRECEIVEACT: [] as any, checkTypeOption: [ { label: "全盘", @@ -220,7 +223,7 @@ const state = reactive({ list: [] as any, loading: false, column: [] as any, - + button_loading: false, }); const { queryParamsERPLocation, allfilterListhw,filList, ERPLocationList, formData, column, list, loading, rules, queryParams,checkAll,indeterminate,checkAllhw,indeterminatehw } = toRefs(state); @@ -310,7 +313,7 @@ onMounted(() => { hide: false, }] - let pwd: any = localStorage.getItem('remeberPwd'); + //let pwd: any = localStorage.getItem('remeberPwd'); // state.queryParams.ERPFACTORY = JSON.parse(pwd).orgNo; getFactoryList() @@ -807,7 +810,108 @@ function formatDate(dateString: any) { // 拼接结果 return `${year}${month}${day}`; -} +} + +async function stocktakingCreate() { + // CreateNumber() //写入到DOM元素 + if (!areAllNotEmpty(state.queryParams.checkType)) { + ElMessageBox.alert("盘点方式不能为空", "提示框", { + confirmButtonText: 'OK', + }) + return + } + if (state.list.length === 0) { + proxy.$ElMessage.warning("批次信息为空") + return + } + + if (state.formData.PLANDATE == null || state.formData.PLANDATE == undefined || state.formData.PLANDATE == '') { + ElMessageBox.alert("请选择日期", "提示框", { + confirmButtonText: 'OK', + }) + return + } + if (!areAllNotEmpty(state.formData.MOVEFLAG)) { + ElMessageBox.alert("请选择盘点方式", "提示框", { + confirmButtonText: 'OK', + }) + return + } + let time = formatDate(msToDate(formData.value.PLANDATE).withoutTime) + await getQueryList({ + queryId: "GeCheckPlanNumber", + version: "00002", + params: { + SITENAME: 'SDK', + PLANTYPE: state.queryParams.checkType, //盘点类型 + PLANDATE: time + } + }).then(async (res: any) => { + if (res.data.length == 0) { + state.formData.CHECKPLANNAME = time + '0001' + } else { + let WaterNumber = parseInt(res.data[0].CHECKPLANNAME.substring(8))//后四位流水号 + WaterNumber += 1; // 将数字加1 + let formattedNum = '' + formattedNum = WaterNumber.toString().padStart(4, '0'); // 将数字转换为4位字符串,不足的部分用0填充 + state.formData.CHECKPLANNAME = time + formattedNum + + } + }) + state.loading2 = true + state.button_state = true + formDataRef.value.validate(async (isValid: boolean) => { + + let PLANCONDITION = `ERPFACTORY:${state.queryParams.ERPFACTORY || '空'},MATERIALSPECNAME:${state.queryParams.MATERIALSPECNAME || '空'},AREANAME:${state.queryParams.AREANAME || '空'},erpLocation:${state.queryParams.erpLocation || '空'}` + + let list = state.list.map((item: any) => { + return { + CHECKMATERIALTYPE: '1', + CHECKPACKINGTYPE: '1', + CHECKPLANSTATE: 'Created', + PLANTYPE: state.queryParams.checkType, + PLANTYPENAME: state.queryParams.checkType, + SYSLOCATION: item.LOCATIONNAME, + BOXSTATE: item.STOCKSTATE, + LASTACTION: item.LASTEVENTNAME, + PLANCONDITION, + ...item + } + }) + if (isValid) { + createCheckPlan({ + commitDate : state.commitDate, + USER : localStorage.getItem('userId'), + SITENAME: localStorage.getItem("siteName") == null ? "SDK" : localStorage.getItem("siteName"), + PLANDATE: dayjs(state.formData.PLANDATE).format('YYYYMMDD'), + CHECKPLANNAME: state.formData.CHECKPLANNAME, + MOVEFLAG: state.formData.MOVEFLAG, + BOXLIST: list + }).then((res: any) => { + if (res.errorCode=='0' || res.errorCode=='200') { + ElMessageBox.alert('盘点计划创建完成', '提醒框', { + confirmButtonText: 'OK', + }) + state.button_loading = false + state.loading = false + } else { + ElMessageBox.alert('盘点计划创建失败:' + res.message, '提醒框', { + confirmButtonText: 'OK', + }) + state.button_loading = false + state.loading = false + } + }).catch((err: any) => { + ElMessageBox.alert('盘点计划创建失败' + err.message, '提醒框', { + confirmButtonText: 'OK', + }) + state.loading = false + }) + } + }); + state.loading2 = false + state.button_state = false +}