完善单位物料功能

main
ljh 2024-07-09 01:33:59 +09:00
parent 82d925fa5e
commit 3976c54e34
4 changed files with 162 additions and 45 deletions

View File

@ -261,7 +261,7 @@ public class ReportTableService : IDynamicApiController, ITransient
if (unit == null) if (unit == null)
throw new ArgumentNullException(nameof(unitGroup)); throw new ArgumentNullException(nameof(unitGroup));
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 1 }; var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0 };
var addReport = await Add(newReport); var addReport = await Add(newReport);
var others = units.FindAll(a => a.Rate < unit.Rate); var others = units.FindAll(a => a.Rate < unit.Rate);
@ -436,5 +436,38 @@ public class ReportTableService : IDynamicApiController, ITransient
} }
return result; return result;
} }
/// <summary>
/// 更新状态
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost]
[ApiDescriptionSettings(Name = "UpdateState")]
public async Task UpdateState(AddReportContext input)
{
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
if (unitGroup == null)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var units = await _repUnit.ListByGroupId(unitGroup.Id);
if (units == null || units.Count < 1)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var unit = units.Find(a => a.Name == input.Name);
if (unit == null)
throw new ArgumentNullException(nameof(unitGroup));
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0 };
var addReport = await Add(newReport);
var others = units.FindAll(a => a.Rate < unit.Rate);
var entity = input.Adapt<ReportTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
} }

View File

@ -5,6 +5,7 @@ enum Api {
UpdateInvoice = '/api/invoice/update', UpdateInvoice = '/api/invoice/update',
PageInvoice = '/api/invoice/page', PageInvoice = '/api/invoice/page',
DetailInvoice = '/api/invoice/detail', DetailInvoice = '/api/invoice/detail',
UpdateAuditStateInvoice = '/api/invoice/UpdateAuditState',
} }
// 增加发货通知单 // 增加发货通知单
@ -47,4 +48,13 @@ export const detailInvoice = (id: any) =>
data: { id }, data: { id },
}); });
// 审核汇报单
export const updateAuditStateInvoice = (params?: any) =>
request({
url: Api.UpdateAuditStateInvoice,
method: 'post',
data: params,
});

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="invoice-container" style="height: 100vh"> <div class="invoice-container" >
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" > <el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" >
<el-card class="box-card"> <el-card class="box-card">
<el-row :gutter="35"> <el-row :gutter="35">
@ -114,8 +114,9 @@
<el-card class="box-card" > <el-card class="box-card" >
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<span>明细信息</span> <el-button type="primary" icon="ele-Plus" @click="addColumn"></el-button>
</div> </div>
</template> </template>
<el-table <el-table
:data="ruleForm.tableData" :data="ruleForm.tableData"
@ -125,28 +126,43 @@
row-key="id" row-key="id"
border="" border=""
> >
<el-table-column prop="materialsId" label="物料" width="180" align="center"> <el-table-column prop="materialsId" label="商品名称" width="180" align="center">
<template #default="scope"> <template #default="scope">
<el-select v-model="scope.row.materialsId" placeholder="请选择" autocomplete="off" controls-position="right" clearable @change="materialsChange"> <el-select v-model="scope.row.materialsId" placeholder="请选择" autocomplete="off" controls-position="right" clearable @change="materialsChange(scope.row)">
<el-option :label="item.name" :value="item.id" v-for="item, index in materials" :key="index" /> <el-option :label="item.name" :value="item.id" v-for="item, index in materials" :key="index" />
</el-select> </el-select>
</template> </template>
</el-table-column>
<el-table-column prop="codeNum" label="商品编码" width="100" show-overflow-tooltip="" >
<template #default="scope">
<el-input v-model="scope.row.codeNum" autocomplete="off" controls-position="right"/>
</template>
</el-table-column>
<el-table-column prop="specifications" label="规格型号" width="100" show-overflow-tooltip="" >
<template #default="scope">
<el-input v-model="scope.row.specifications" autocomplete="off" controls-position="right"/>
</template>
</el-table-column>
<el-table-column prop="planQty" label="计划数量" width="120" show-overflow-tooltip="" >
<template #default="scope">
<el-input-number v-model="scope.row.planQty" autocomplete="off" controls-position="right" @change="qtyChange(scope.row)"/>
</template>
</el-table-column>
<el-table-column prop="shipmentQty" label="发货数量" width="120" show-overflow-tooltip="" >
<template #default="scope">
<el-input-number v-model="scope.row.shipmentQty" autocomplete="off" controls-position="right" @change="qtyChange(scope.row)"/>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="unit" label="单位" width="120" show-overflow-tooltip="" > <el-table-column prop="unit" label="单位" width="120" show-overflow-tooltip="" >
<template #default="scope"> <template #default="scope">
<el-select v-model="scope.row.unit" placeholder="请选择" clearable autocomplete="off" > <el-select v-model="scope.row.unit" placeholder="请选择" autocomplete="off" controls-position="right" clearable>
<el-option :label="item.name" :value="item.name" v-for="item, index in units" :key="index" /> <el-option :label="item.name" :value="item.id" v-for="item, index in units" :key="index" />
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="count" label="数量" width="100" show-overflow-tooltip="" > <el-table-column prop="scanRate" label="行扫描率" width="120" show-overflow-tooltip="" >
<template #default="scope"> <template #default="scope">
<el-input-number v-model="scope.row.count" autocomplete="off" controls-position="right"/> <el-input v-model="scope.row.scanRate" autocomplete="off" controls-position="right" :formatter="formatScanRate"/>
</template>
</el-table-column>
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" >
<template #default="scope">
<el-input v-model="scope.row.remarks" autocomplete="off" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" > <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" >
@ -156,7 +172,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
<el-button icon="ele-Plus" @click="addColumn"></el-button>
<div class="footer" align="right" > <div class="footer" align="right" >
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit" :disabled="props.disabled"> </el-button> <el-button type="primary" @click="submit" :disabled="props.disabled"> </el-button>
@ -174,15 +190,14 @@
} }
</style> </style>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted, reactive } from 'vue'; import {onMounted, ref} from 'vue';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessage } from "element-plus";
import type {FormRules} from "element-plus"; import type {FormRules} from "element-plus";
import { addInvoice, updateInvoice, detailInvoice } from "/@/api/main/invoice"; import {ElMessage} from "element-plus";
import {addInvoice, detailInvoice, updateInvoice} from "/@/api/main/invoice";
import {listWarehouse} from '/@/api/main/warehouse'; import {listWarehouse} from '/@/api/main/warehouse';
import {listSupplier} from '/@/api/main/supplier'; import {listSupplier} from '/@/api/main/supplier';
import {listCustom} from '/@/api/main/custom'; import {listCustom} from '/@/api/main/custom';
import { listMaterials, detailMaterials, materialListBySourceId } from '/@/api/main/materials'; import {detailMaterials, listMaterials, materialListBySourceId} from '/@/api/main/materials';
import {listUnitGroup} from '/@/api/main/unit'; import {listUnitGroup} from '/@/api/main/unit';
import {getCurrentDate} from '/@/utils/formatTime'; import {getCurrentDate} from '/@/utils/formatTime';
@ -209,6 +224,13 @@
const units = ref<any>([]); const units = ref<any>([]);
const tableData = ref<any>([]); const tableData = ref<any>([]);
const formatScanRate = (value) => {
if (value) {
return `${value}%`;
}
return value;
}
// //
const rules = ref<FormRules>({ const rules = ref<FormRules>({
// businessType: [{required: true, message: '', trigger: 'blur',},], // businessType: [{required: true, message: '', trigger: 'blur',},],
@ -255,10 +277,13 @@
* 物料值变更 * 物料值变更
* @param clearBindUserId 是否清空 * @param clearBindUserId 是否清空
*/ */
const materialsChange = async (value : any) => { const materialsChange = async (row : any) => {
//ruleForm.value.materialsId=value.id; //ruleForm.value.materialsId=value.id;
let material = (await detailMaterials(value)).data.result; let material = (await detailMaterials(row.materialsId)).data.result;
//console.log(material); //console.log(material);
row.specifications = material.specifications;
row.codeNum = material.codeNum;
row.unit = material.unit;
if(material.id){ if(material.id){
var res = await listUnitGroup(material.unitGroupId ?? 0); var res = await listUnitGroup(material.unitGroupId ?? 0);
units.value = res.data.result ?? []; units.value = res.data.result ?? [];
@ -266,9 +291,21 @@
}; };
/**
* 数量change事件
* @param row
*/
const qtyChange = async (row : any) => {
if(row.shipmentQty && row.shipmentQty) {
row.scanRate=Math.round((row.shipmentQty / row.planQty) * 100);
}
};
// //
function addColumn() { function addColumn() {
if(!ruleForm.value.tableData){
ruleForm.value.tableData=[];
}
ruleForm.value.tableData.push({ ruleForm.value.tableData.push({
materialsId: null, materialsId: null,
unit: '箱', unit: '箱',

View File

@ -107,6 +107,8 @@
<el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> </el-button> <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> </el-button> <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddInvoice" v-auth="'invoice:add'"> </el-button> <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddInvoice" v-auth="'invoice:add'"> </el-button>
<el-button type="primary" style="margin-left:5px;" icon="ele-Check" @click="handleAuditStateChange('1')" > 审核 </el-button>
<el-button type="primary" style="margin-left:5px;" icon="ele-CloseBold" @click="handleAuditStateChange('0')" > 反审核 </el-button>
</el-button-group> </el-button-group>
</el-form-item> </el-form-item>
@ -123,7 +125,9 @@
tooltip-effect="light" tooltip-effect="light"
row-key="id" row-key="id"
@sort-change="sortChange" @sort-change="sortChange"
@selection-change="handleSelectionChange"
border=""> border="">
<el-table-column type="selection" width="60"/>
<el-table-column type="index" label="序号" width="55" align="center"/> <el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="codeNum" label="单号" width="140" show-overflow-tooltip="" /> <el-table-column prop="codeNum" label="单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="startDate" label="业务日期" width="140" show-overflow-tooltip="" /> <el-table-column prop="startDate" label="业务日期" width="140" show-overflow-tooltip="" />
@ -140,12 +144,19 @@
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" /> <el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
<el-table-column prop="customExpand" label="方案客户拓展" width="90" show-overflow-tooltip="" /> <el-table-column prop="customExpand" label="方案客户拓展" width="90" show-overflow-tooltip="" />
<el-table-column prop="sendOutExpand" label="发货拓展" width="140" show-overflow-tooltip="" /> <el-table-column prop="sendOutExpand" label="发货拓展" width="140" show-overflow-tooltip="" />
<el-table-column prop="state" label="发货状态" width="140" show-overflow-tooltip :formatter="formatState"> <el-table-column prop="state" label="发货状态" width="140" show-overflow-tooltip :formatter="formatState"/>
</el-table-column> <el-table-column prop="auditState" label="审核状态" width="140" show-overflow-tooltip="" :formatter="formatAuditState"/>
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('invoice:update') || auth('invoice:delete')"> <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('invoice:update') || auth('invoice:delete')">
<template #default="scope"> <template #default="scope">
<div v-if="scope.row.auditState===1">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openBrowseInvoice(scope.row)" v-auth="'reportDetailTable:update'"> </el-button>
</div>
<div v-else>
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditInvoice(scope.row)" v-auth="'invoice:update'"> </el-button> <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditInvoice(scope.row)" v-auth="'invoice:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delInvoice(scope.row)" v-auth="'invoice:delete'"> </el-button> <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delInvoice(scope.row)" v-auth="'invoice:delete'"> </el-button>
</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -167,7 +178,7 @@
</el-card> </el-card>
</div> </div>
<div v-else class="reportDetailTable-container"> <div v-else class="reportDetailTable-container">
<el-card > <el-card style="height: 100vh;overflow-y:scroll">
<editDialog <editDialog
ref="editDialogRef" ref="editDialogRef"
:row = "state.editRow" :row = "state.editRow"
@ -188,7 +199,8 @@ import {reactive, ref} from "vue";
import printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue' import printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue'
import editDialog from '/@/views/inventoryManagement/invoice/component/editDialog.vue' import editDialog from '/@/views/inventoryManagement/invoice/component/editDialog.vue'
import { pageInvoice, deleteInvoice } from '/@/api/main/invoice'; import {pageInvoice, deleteInvoice, updateAuditStateInvoice} from '/@/api/main/invoice';
import {updateStateReportDetailTable} from "/@/api/main/reportDetailTable";
const showAdvanceQueryUI = ref(false); const showAdvanceQueryUI = ref(false);
@ -210,6 +222,20 @@ import {reactive, ref} from "vue";
const printInvoiceTitle = ref(""); const printInvoiceTitle = ref("");
const editInvoiceTitle = ref(""); const editInvoiceTitle = ref("");
const multipleSelection = ref([])
const handleSelectionChange = (val: []) => {
multipleSelection.value = val
}
//
const handleAuditStateChange = async (val: any) => {
if(multipleSelection.value.length === 0){ return ElMessage.error("至少选择一条数据")}
let ids = [] as any;
multipleSelection.value.forEach(item => {
ids.push(item.id);
})
await updateAuditStateInvoice({ids,auditStatus:val});
await handleQuery();
};
// //
const changeAdvanceQueryUI = () => { const changeAdvanceQueryUI = () => {
@ -220,6 +246,10 @@ import {reactive, ref} from "vue";
return cellValue === 1 ? '装货中' : '未装货'; return cellValue === 1 ? '装货中' : '未装货';
} }
const formatAuditState = (row, column, cellValue) => {
return cellValue === 1 ? '已审核' : '未审核';
}
// //
const close = () => { const close = () => {
state.editShow = false; state.editShow = false;
@ -261,6 +291,13 @@ import {reactive, ref} from "vue";
state.editDisabled = false; state.editDisabled = false;
}; };
//
const openBrowseInvoice = (row: any) => {
state.editRow = row;
state.editShow = true;
state.editDisabled = true;
};
// //
const delInvoice = (row: any) => { const delInvoice = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", { ElMessageBox.confirm(`确定要删除吗?`, "提示", {