main
liangzongpeng 2024-07-02 15:31:27 +08:00
parent 4623d4780e
commit 2cb5175727
5 changed files with 64 additions and 82 deletions

View File

@ -283,33 +283,6 @@ public class InvoiceService : IDynamicApiController, ITransient
foreach (var item in list) foreach (var item in list)
{ {
var report = await GetReport(item.ReportTableId); var report = await GetReport(item.ReportTableId);
//var retrospect1 = new AddProductRetrospectInput()
//{
// BaseCount = item.BaseCount,
// BaseUnit = item.BaseUnit,
// //Batch = report.Batch,
// BusinessType = report.ProductType,
// CodeType = item.CodeName,
// Location=addOutbound.Consignee,
// Department = report.ProductionLine,
// //WarehouseID = input.WarehouseId,
// WarehousingDate = DateTime.Now,
// Count = 1,
// CreateTime = DateTime.Now,
// ScanCodeTime = DateTime.Now,
// CreateUserId = userId,
// CreateUserName = userName,
// MaterialsId = report.MaterialsId,
// OddNumber = report.OddNumber,
// Receipt = "发货通知单",
// SourceId = outbound,
// Unit = item.Unit,
// Name = item.CodeName,
// Code = item.Code,
// Destination = invoice.Consignee
//};
//await _productRetrospect.Add(retrospect1);
await _productRetrospect.AddRetrospect(item.Adapt<PrintCodeDetail>(), report, "发货通知单", addOutbound.Consignee, outbound, input.WarehousingTableId); await _productRetrospect.AddRetrospect(item.Adapt<PrintCodeDetail>(), report, "发货通知单", addOutbound.Consignee, outbound, input.WarehousingTableId);
} }

View File

@ -36,5 +36,5 @@ public class WarehousingInputData
/// <summary> /// <summary>
/// 条码数据 /// 条码数据
/// </summary> /// </summary>
public List<string> CodeDatas { get; set; } public List<string> CodeDatas { get; set; } = new List<string>();
} }

View File

@ -182,6 +182,8 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
ReportTable reportTable = null; ReportTable reportTable = null;
var warehouse = await _warehouseService.Detail(new QueryByIdWarehouseInput() { Id = input.WarehouseId.Value }); var warehouse = await _warehouseService.Detail(new QueryByIdWarehouseInput() { Id = input.WarehouseId.Value });
var warehouseName = warehouse == null ? "" : warehouse.Name; var warehouseName = warehouse == null ? "" : warehouse.Name;
var baseCount = input.CodeDatas.Count;
var tempAddList = new List<PrintCodeDetail>();
foreach (var item in input.CodeDatas) foreach (var item in input.CodeDatas)
{ {
var product = await _codeDetailService.GetByProductCode(item); var product = await _codeDetailService.GetByProductCode(item);
@ -189,6 +191,7 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
{ {
continue; continue;
} }
tempAddList.Add(product);
//product.WarehouseID = input.WarehouseId; //product.WarehouseID = input.WarehouseId;
reportTable = await _reportTableService.Detail(new QueryByIdReportTableInput() { Id = product.ReportTableId.Value,SourceId=product.ReportTableId }); reportTable = await _reportTableService.Detail(new QueryByIdReportTableInput() { Id = product.ReportTableId.Value,SourceId=product.ReportTableId });
if (reportTable==null) if (reportTable==null)
@ -225,12 +228,12 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
var units = await _sysUnitService.ListByGroupId(materials.UnitGroupId); var units = await _sysUnitService.ListByGroupId(materials.UnitGroupId);
var baseUnit = units.FirstOrDefault().Name; var baseUnit = units.FirstOrDefault().Name;
var unit = units.Find(a => a.Name == reportTable.Unit); var unit = units.Find(a => a.Name == product.Unit);
if (unit == null) if (unit == null)
unit = units.FirstOrDefault(); unit = units.FirstOrDefault();
baseCount = baseCount * unit.Rate.Value;
if (details != null && details.Any(a => a.MaterialsId == reportTable.MaterialsId && a.Unit == reportTable.Unit)) if (details != null && details.Any(a => a.MaterialsId == reportTable.MaterialsId && a.Unit == reportTable.Unit))
{ {
var detail = details.Find(a => a.MaterialsId == reportTable.MaterialsId && a.Unit == reportTable.Unit); var detail = details.Find(a => a.MaterialsId == reportTable.MaterialsId && a.Unit == reportTable.Unit);
detail.Count += 1; detail.Count += 1;
if (unit != null) if (unit != null)
@ -259,23 +262,27 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
var currentUnit = units.FirstOrDefault(a => a.Name == childs.FirstOrDefault().Unit); var currentUnit = units.FirstOrDefault(a => a.Name == childs.FirstOrDefault().Unit);
foreach (var c1 in childs) foreach (var c1 in childs)
{ {
await _productRetrospect.AddRetrospect(c1.Adapt<PrintCodeDetail>(), reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId); var chEnt1 = c1.Adapt<PrintCodeDetail>();
await _productRetrospect.AddRetrospect(chEnt1, reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId);
tempAddList.Add(chEnt1);
var childs3 = codeDetails.FindAll(a => a.FatherCode == c1.Code); var childs3 = codeDetails.FindAll(a => a.FatherCode == c1.Code);
if (childs3.Count > 0) if (childs3.Count > 0)
{ {
var currentUnit3 = units.FirstOrDefault(a => a.Name == childs3.FirstOrDefault().Unit); var currentUnit3 = units.FirstOrDefault(a => a.Name == childs3.FirstOrDefault().Unit);
foreach (var c3 in childs3) foreach (var c3 in childs3)
{ {
await _productRetrospect.AddRetrospect(c3.Adapt<PrintCodeDetail>(), reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId); var chEnt3 = c3.Adapt<PrintCodeDetail>();
await _productRetrospect.AddRetrospect(chEnt3, reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId);
tempAddList.Add(chEnt3);
var childs4 = codeDetails.FindAll(a => a.FatherCode == c3.Code); var childs4 = codeDetails.FindAll(a => a.FatherCode == c3.Code);
if (childs4.Count > 0) if (childs4.Count > 0)
{ {
var currentUnit4 = units.FirstOrDefault(a => a.Name == childs4.FirstOrDefault().Unit); var currentUnit4 = units.FirstOrDefault(a => a.Name == childs4.FirstOrDefault().Unit);
foreach (var c4 in childs4) foreach (var c4 in childs4)
{ {
await _productRetrospect.AddRetrospect(c4.Adapt<PrintCodeDetail>(), reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId); var chEnt4 = c4.Adapt<PrintCodeDetail>();
await _productRetrospect.AddRetrospect(chEnt4, reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId);
tempAddList.Add(chEnt4);
} }
} }
} }
@ -284,14 +291,23 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
} }
} }
} }
var newDetail = reportTable.Adapt<AddWarehousingStatisticsInput>(); var newDetail = reportTable.Adapt<AddWarehousingStatisticsInput>();
if (reportTable!=null) newDetail.Count = input.CodeDatas.Count;
newDetail.BaseCount = baseCount;
if (reportTable != null)
{ {
newDetail.SourceId = reportTable?.Id; newDetail.SourceId = reportTable?.Id;
} }
await Add(newDetail); var warehousingStaId = await Add(newDetail);
foreach (var item in tempAddList)
{
item.ReportTableId = warehousingStaId;
item.Id = 0;
await _codeDetailService.Add(item.Adapt<AddPrintCodeDetailInput>());
}
} }

View File

@ -195,7 +195,7 @@
// //
const readReportDetailTable = (row: any) => { const readReportDetailTable = (row: any) => {
printDetailTableTitle.value = '条码详情'; printDetailTableTitle.value = '条码详情';
console.log(row.sourceId); //console.log(row.sourceId);
printDetailDialogRef.value.openDialog(row.sourceId); printDetailDialogRef.value.openDialog(row.sourceId);
}; };

View File

@ -140,18 +140,18 @@
<el-table-column prop="brand" label="品牌" width="140" show-overflow-tooltip="" /> <el-table-column prop="brand" label="品牌" width="140" show-overflow-tooltip="" />
<el-table-column prop="specifications" label="规格" width="140" show-overflow-tooltip="" /> <el-table-column prop="specifications" label="规格" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehousingType" label="入库类型" width="140" show-overflow-tooltip="" /> <el-table-column prop="warehousingType" label="入库类型" width="140" show-overflow-tooltip="" />
<el-table-column prop="materialsId" label="物料ID" width="140" show-overflow-tooltip="" /> <!-- <el-table-column prop="materialsId" label="物料ID" width="140" show-overflow-tooltip="" />
<el-table-column prop="sourceId" label="来源ID" width="140" show-overflow-tooltip="" /> <el-table-column prop="sourceId" label="来源ID" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehouseId" label="入库仓库ID" width="90" show-overflow-tooltip="" /> -->
<el-table-column prop="warehousingDate" label="入库日期" width="140" show-overflow-tooltip="" /> <el-table-column prop="warehousingDate" label="入库日期" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehouseId" label="入库仓库ID" width="90" show-overflow-tooltip="" />
<el-table-column prop="warehouseLocation" label="库位" width="140" show-overflow-tooltip="" /> <el-table-column prop="warehouseLocation" label="库位" width="140" show-overflow-tooltip="" />
<el-table-column prop="supplier" label="供应商" width="140" show-overflow-tooltip="" /> <el-table-column prop="supplier" label="供应商" width="140" show-overflow-tooltip="" />
<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 label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('warehousingStatistics:update') || auth('warehousingStatistics:delete')"> <el-table-column label="操作" width="120" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('warehousingStatistics:update') || auth('warehousingStatistics:delete')">
<template #default="scope"> <template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:update'"> </el-button> <!-- <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:update'"> </el-button> -->
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="readReportDetailTable(scope.row.id)" v-auth="'reportDetailTable:update'"> </el-button> <el-button icon="ele-Edit" size="small" text="" type="primary" @click="readReportDetailTable(scope.row)" v-auth="'reportDetailTable:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:delete'"> </el-button> <!-- <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:delete'"> </el-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -166,10 +166,11 @@
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
/> />
<printDialog
ref="printDialogRef" <printDetailDialog
:title="printWarehousingStatisticsTitle" ref="printDetailDialogRef"
@reloadTable="handleQuery" /> :title="printDetailTableTitle"
/>
<editDialog <editDialog
ref="editDialogRef" ref="editDialogRef"
:title="editWarehousingStatisticsTitle" :title="editWarehousingStatisticsTitle"
@ -184,8 +185,6 @@
import { ElMessageBox, ElMessage } from "element-plus"; import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction'; import { auth } from '/@/utils/authFunction';
import printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue'
import printDetailDialog from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue' import printDetailDialog from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue'
import editDialog from '/@/views/warehouseManagement/warehousingStatistics/component/editDialog.vue' import editDialog from '/@/views/warehouseManagement/warehousingStatistics/component/editDialog.vue'
import { pageWarehousingStatistics, deleteWarehousingStatistics } from '/@/api/main/warehousingStatistics'; import { pageWarehousingStatistics, deleteWarehousingStatistics } from '/@/api/main/warehousingStatistics';
@ -193,7 +192,6 @@
const showAdvanceQueryUI = ref(false); const showAdvanceQueryUI = ref(false);
const printDetailDialogRef = ref(); const printDetailDialogRef = ref();
const printDialogRef = ref();
const editDialogRef = ref(); const editDialogRef = ref();
const loading = ref(false); const loading = ref(false);
const tableData = ref<any>([]); const tableData = ref<any>([]);
@ -204,7 +202,6 @@
total: 0, total: 0,
}); });
const printWarehousingStatisticsTitle = ref("");
const editWarehousingStatisticsTitle = ref(""); const editWarehousingStatisticsTitle = ref("");
const printDetailTableTitle = ref(""); const printDetailTableTitle = ref("");
@ -230,45 +227,41 @@
await handleQuery(); await handleQuery();
}; };
// // //
const openAddWarehousingStatistics = () => { // const openAddWarehousingStatistics = () => {
editWarehousingStatisticsTitle.value = '添加入库统计'; // editWarehousingStatisticsTitle.value = '';
editDialogRef.value.openDialog({}); // editDialogRef.value.openDialog({});
}; // };
//
const openPrintWarehousingStatistics = async (row: any) => { // //
printWarehousingStatisticsTitle.value = '打印入库统计'; // const openEditWarehousingStatistics = (row: any) => {
} // editWarehousingStatisticsTitle.value = '';
// editDialogRef.value.openDialog(row);
// // };
const openEditWarehousingStatistics = (row: any) => {
editWarehousingStatisticsTitle.value = '编辑入库统计';
editDialogRef.value.openDialog(row);
};
// //
const readReportDetailTable = (row: any) => { const readReportDetailTable = (row: any) => {
printDetailTableTitle.value = '条码详情'; printDetailTableTitle.value = '条码详情';
//console.log(row); //console.log(row);
printDetailDialogRef.value.openDialog(row); printDetailDialogRef.value.openDialog(row.id);
}; };
// //
const delWarehousingStatistics = (row: any) => { // const delWarehousingStatistics = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", { // ElMessageBox.confirm(`?`, "", {
confirmButtonText: "确定", // confirmButtonText: "",
cancelButtonText: "取消", // cancelButtonText: "",
type: "warning", // type: "warning",
}) // })
.then(async () => { // .then(async () => {
await deleteWarehousingStatistics(row); // await deleteWarehousingStatistics(row);
handleQuery(); // handleQuery();
ElMessage.success("删除成功"); // ElMessage.success("");
}) // })
.catch(() => {}); // .catch(() => {});
}; // };
// //
const handleSizeChange = (val: number) => { const handleSizeChange = (val: number) => {