修改生产单交互信息

main
ljh 2024-07-13 01:18:35 +09:00
parent e0bc3ed073
commit c5d1b5afe6
13 changed files with 179 additions and 53 deletions

View File

@ -25,4 +25,10 @@ public class ProductionLine : EntityTenant
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 64)]
public string? Remarks { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnName = "State", ColumnDescription = "状态", Length = 64)]
public int? State { get; set; }
}

View File

@ -31,12 +31,12 @@ public class ReportDetailTable : EntityTenant
/// </summary>
[Required]
[SugarColumn(ColumnName = "State", ColumnDescription = "状态", Length = 32)]
public string State { get; set; }
public int State { get; set; }
/// <summary>
/// 生产类型
/// </summary>
[SugarColumn(ColumnName = "ProductType", ColumnDescription = "生产类型", Length = 32)]
[SugarColumn(ColumnName = "ProductType", ColumnDescription = "生产类型")]
public string? ProductType { get; set; }
/// <summary>
@ -170,4 +170,10 @@ public class ReportDetailTable : EntityTenant
/// </summary>
[SugarColumn(ColumnName = "UnitGroupId", ColumnDescription = "单位组ID")]
public long? UnitGroupId { get; set; }
/// <summary>
/// 生产状态
/// </summary>
[SugarColumn(ColumnName = "ProductState", ColumnDescription = "生产状态")]
public int? ProductState { get; set; }
}

View File

@ -83,7 +83,7 @@ public class ReportTable : EntityTenant
/// 基本完工数量
/// </summary>
[SugarColumn(ColumnName = "BaseProductCount", ColumnDescription = "基本完工数量")]
public int? BaseProductCount { get; set; }
public decimal? BaseProductCount { get; set; }
/// <summary>
/// 单位
@ -103,4 +103,10 @@ public class ReportTable : EntityTenant
[SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)]
public string? Name { get; set; }
/// <summary>
/// 生产状态
/// </summary>
[SugarColumn(ColumnName = "ProductState", ColumnDescription = "生产状态")]
public int? ProductState { get; set; }
}

View File

@ -125,6 +125,21 @@ namespace Admin.NET.Application;
}
public class UpdateStateProductionLineInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
/// <summary>
/// 状态
/// </summary>
public int State { get; set; }
}
/// <summary>
/// 生产线主键查询输入参数
/// </summary>

View File

@ -102,9 +102,20 @@ public class ProductionLineService : IDynamicApiController, ITransient
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<ProductionLineOutput>().ToListAsync();
}
/// <summary>
/// 更新生产线状态
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "UpdateState")]
public async Task UpdateState(UpdateStateProductionLineInput input)
{
var entity = await _rep.GetByIdAsync(input.Id);
if(entity==null)
entity.State = input.State;
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
}

View File

@ -26,7 +26,7 @@ public class ReportDetailTableBaseInput
/// <summary>
/// 状态
/// </summary>
public virtual string State { get; set; }
public virtual int State { get; set; }
/// <summary>
/// 生产类型
@ -213,7 +213,7 @@ public class ReportDetailTableInput : BasePageInput
/// <summary>
/// 状态
/// </summary>
public string? State { get; set; }
public int? State { get; set; }
/// <summary>
/// 生产类型
@ -350,7 +350,7 @@ public class AddReportDetailTableInput : ReportDetailTableBaseInput
/// 状态
/// </summary>
[Required(ErrorMessage = "状态不能为空")]
public override string State { get; set; }
public override int State { get; set; }
/// <summary>
/// 软删除
@ -403,5 +403,27 @@ public class UpdateStateReportDetailTableInput
/// <summary>
/// 是否启用
/// </summary>
public string State { get; set; }
public int State { get; set; }
}
/// <summary>
/// 更新生产状态输入参数
/// </summary>
public class UpdateProductStateReportDetailTableInput
{
/// <summary>
/// 订单号
/// </summary>
public string OddNumber { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long MaterialsId { get; set; }
/// <summary>
/// 生产状态
/// </summary>
public int ProductState { get; set; }
}

View File

@ -28,7 +28,7 @@ public class ReportDetailTableOutput
/// <summary>
/// 状态
/// </summary>
public string State { get; set; }
public int? State { get; set; }
/// <summary>
/// 生产类型

View File

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Http;
using Admin.NET.Application.Utils;
using AngleSharp.Dom;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
namespace Admin.NET.Application;
/// <summary>
@ -59,7 +60,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
u.ProductName.Contains(input.SearchKey.Trim())
|| u.ProductCodeNum.Contains(input.SearchKey.Trim())
|| u.OddNumber.Contains(input.SearchKey.Trim())
|| u.State.Contains(input.SearchKey.Trim())
|| u.State==(input.State)
|| u.ProductType.Contains(input.SearchKey.Trim())
|| u.ProductionLine.Contains(input.SearchKey.Trim())
|| u.CodeNum.Contains(input.SearchKey.Trim())
@ -77,7 +78,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductName), u => u.ProductName.Contains(input.ProductName.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductCodeNum), u => u.ProductCodeNum.Contains(input.ProductCodeNum.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.OddNumber), u => u.OddNumber.Contains(input.OddNumber.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.State), u => u.State.Contains(input.State.Trim()))
.WhereIF(input.State!=null, u => u.State==input.State)
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductType), u => u.ProductType.Contains(input.ProductType.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductionLine), u => u.ProductionLine.Contains(input.ProductionLine.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeNum), u => u.CodeNum.Contains(input.CodeNum.Trim()))
@ -185,10 +186,6 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
}
}
}
else
{
codesToKeep.Add(repeatCode);
}
}
repeatCodes = codesToKeep;
if (repeatCodes != null && repeatCodes.Count > 0)
@ -227,7 +224,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
ProductType = warehousing.ProductType,
ProductionLine = warehousing.ProductionLine,
BaseProductCount = repeatCodes.Count,
ProductCount = repeatCodes.Count,
ProductCount = warehousing.ProductCount,
Batch = warehousing.Batch,
CodeNum = materials.CodeNum,
Name = materials.Name,
@ -259,13 +256,18 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var reportTable = await _reportTableService.Detail(new QueryByIdReportTableInput { Id = upPrintCodeDetail.ReportTableId??0 });
if (reportTable.ProductType.Equals("返工生产"))
{
if (!upPrintCodeDetail.Code.Contains("#"))
{
upPrintCodeDetail.Code = "#" + upPrintCodeDetail.Code;
var year = DateTime.Now.ToString("yy");
var month = DateTime.Now.Month;
var day = DateTime.Now.Day;
int milliseconds = DateTime.Now.Millisecond; // 获取当前时间的毫秒部分0-999
upPrintCodeDetail.Code = "F"+ year + month + day + milliseconds + "#" + upPrintCodeDetail.Code;
await _codeDetailService.UpdateByEntity(upPrintCodeDetail);
}
}
}
var unitRate = Convert.ToDecimal(units.Where(t => t.Name == item.PackageName).FirstOrDefault()?.Rate);
var productRate = Convert.ToDecimal(units.Where(t => t.Name == warehousing.Package).FirstOrDefault()?.Rate);
decimal unitCount = Math.Round(unitRate / productRate, 2);
var detail = new AddPrintCodeDetailInput()
{
ReportTableId = reprotId,
@ -274,8 +276,8 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
ChildCount = unit.ChildUnitCount,
Count = 1,
Unit = item.PackageName,
BaseCount = unit.Rate,
BaseUnit = baseUnit,
BaseCount = unitCount,
BaseUnit = warehousing.Package,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
@ -298,8 +300,8 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
ChildCount = unit2.ChildUnitCount,
Count = 1,
Unit = child.PackageName,
BaseCount = unit2.Rate,
BaseUnit = baseUnit,
BaseCount =1,
BaseUnit = warehousing.Package,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
@ -324,8 +326,8 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
ChildCount = unit3.ChildUnitCount,
Count = 1,
Unit = child3.PackageName,
BaseCount = unit3.Rate,
BaseUnit = baseUnit,
BaseCount = 1,
BaseUnit = warehousing.Package,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
@ -351,8 +353,8 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
ChildCount = unit4.ChildUnitCount,
Count = 1,
Unit = child4.PackageName,
BaseCount = unit4.Rate,
BaseUnit = baseUnit,
BaseCount = 1,
BaseUnit = warehousing.Package,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
@ -378,8 +380,8 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
ChildCount = unit5.ChildUnitCount,
Count = 1,
Unit = child5.PackageName,
BaseCount = unit5.Rate,
BaseUnit = baseUnit,
BaseCount = 1,
BaseUnit = warehousing.Package,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
CreateUserName = userName,
@ -403,7 +405,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
var item = dic.Key;
var retrospect1 = new AddProductRetrospectInput()
{
BaseCount = item.BaseCount,
BaseCount = (int?)(item.BaseCount),
BaseUnit = baseUnit,
Batch = warehousing.Batch,
BusinessType = "生产任务单",
@ -427,7 +429,21 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
await _productRetrospect.Add(retrospect1);
}
var upReportTable = await _reportTableService.GetBySource(warehousing.Id);
var printCodeDetails = await _codeDetailService.GetByReportTableId(upReportTable.Id);
var count = printCodeDetails.Where(a => !a.IsDelete && a.Unit == a.BaseUnit).Sum(t=>t.Count);
decimal unitSumCount = 0;
foreach (var item in printCodeDetails.Where(a => !a.IsDelete && a.Unit != a.BaseUnit))
{
var unitRate = Convert.ToDecimal(units.Where(t => t.Name == item.Unit).FirstOrDefault()?.Rate);
var productRate = Convert.ToDecimal(units.Where(t => t.Name == item.BaseUnit).FirstOrDefault()?.Rate);
decimal unitCount = Math.Round(unitRate / productRate,2);
unitSumCount += unitCount;
}
upReportTable.BaseProductCount = unitSumCount + count;
var updateReportTableInput = upReportTable.Adapt<UpdateReportTableInput>();
await _reportTableService.Update(updateReportTableInput);
//upReportTable.
//var details = await _warehouseDetails.List();
//if (details != null && details.Any(a => a.MaterialsId == warehousing.MaterialsId && a.Unit == warehousing.Unit))
//{
@ -502,7 +518,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
[ApiDescriptionSettings(Name = "List")]
public async Task<List<ReportDetailTableOutput>> List()
{
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<ReportDetailTableOutput>().ToListAsync();
return await _rep.AsQueryable().Where(a => !a.IsDelete && a.State==1).Select<ReportDetailTableOutput>().ToListAsync();
}
/// <summary>
@ -522,6 +538,38 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
}
/// <summary>
/// 更新生产状态
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost]
[ApiDescriptionSettings(Name = "UpdateProductState")]
public async Task UpdateProductState(UpdateProductStateReportDetailTableInput input)
{
var reportDetailTable = await _rep.AsQueryable()
.Where(t => !t.IsDelete)
.Where(t => t.OddNumber == input.OddNumber && t.MaterialsId == input.MaterialsId)
.FirstAsync();
if (reportDetailTable != null)
{
reportDetailTable.ProductState = input.ProductState;
await _rep.AsUpdateable(reportDetailTable).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
var reportTable = await _reportTableService.GetBySource(reportDetailTable.Id);
if (reportTable != null)
{
var entity = reportTable.Adapt<UpdateReportTableInput>();
reportTable.ProductState = input.ProductState;
if (reportTable.ProductState == 0)
{
reportTable.EndDate = DateTime.Now;
}
await _reportTableService.Update(entity);
}
}
}
}

View File

@ -67,7 +67,7 @@ public class ReportTableBaseInput
/// <summary>
/// 基本完工数量
/// </summary>
public int? BaseProductCount { get; set; }
public decimal? BaseProductCount { get; set; }
/// <summary>
/// 单位
@ -237,3 +237,4 @@ public class QueryByIdReportTableInput : DeleteReportTableInput
public string? Code { get; set; }
public long? SourceId { get; set; }
}

View File

@ -8,6 +8,7 @@ using Nest;
using Admin.NET.Application.Utils;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using SkiaSharp;
using AngleSharp.Dom;
namespace Admin.NET.Application;
/// <summary>
@ -469,5 +470,7 @@ public class ReportTableService : IDynamicApiController, ITransient
var entity = input.Adapt<ReportTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
}

View File

@ -58,7 +58,7 @@
</el-form-item>
</el-col>
<el-col :xs="12" :sm="12" :md="6" :lg="6" :xl="6" class="mb20">
<el-form-item label="单位" prop="package" :rules="[{ required: true, message: '单位不能为空', trigger: 'blur' }]">
<el-form-item label="生产单位" prop="package" :rules="[{ required: true, message: '生产单位不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.package" placeholder="请选择" clearable >
<el-option :label="item.name" :value="item.name" v-for="item, index in units"
:key="index" />
@ -312,7 +312,7 @@
if (isValid) {
let values = ruleForm.value;
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
values.state="待审核";
values.state="0";
await addReportDetailTable(values);
} else {
await updateReportDetailTable(values);

View File

@ -73,8 +73,8 @@
<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 type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddReportDetailTable" v-auth="'reportDetailTable:add'"> </el-button>
<el-button type="success" style="margin-left:5px;" icon="ele-Check" @click="handleStateChange('已审核')" > 审核 </el-button>
<el-button type="danger" style="margin-left:5px;" icon="ele-CloseBold" @click="handleStateChange('待审核')" > 反审核 </el-button>
<el-button type="success" style="margin-left:5px;" icon="ele-Check" @click="handleStateChange(1)" > 审核 </el-button>
<el-button type="danger" style="margin-left:5px;" icon="ele-CloseBold" @click="handleStateChange(0)" > 反审核 </el-button>
</el-button-group>
</el-form-item>
@ -104,12 +104,12 @@
<el-table-column prop="unit" label="单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseUnit" label="基本单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="productionLine" label="生产线" width="140" show-overflow-tooltip="" />
<el-table-column prop="state" label="状态" show-overflow-tooltip="" />
<el-table-column prop="state" label="状态" show-overflow-tooltip="" :formatter="formatAuditState"/>
<el-table-column prop="updateUserName" label="修改人" show-overflow-tooltip=""/>
<el-table-column prop="updateTime" label="修改时间" show-overflow-tooltip=""/>
<el-table-column label="操作" width="200" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('reportDetailTable:update') || auth('reportDetailTable:delete')">
<template #default="scope">
<div v-if="scope.row.state==='已审核'">
<div v-if="scope.row.state===1">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openBrowseReportDetailTable(scope.row)" v-auth="'reportDetailTable:update'"> </el-button>
</div>
<div v-else>
@ -183,7 +183,9 @@ import {
pageSize: 10,
total: 0,
});
const formatAuditState = (row, column, cellValue) => {
return cellValue === 1 ? '已审核' : '未审核';
}
const editReportDetailTableTitle = ref("");
const printDetailTableTitle = ref("");

View File

@ -59,6 +59,11 @@
<el-input-number v-model="ruleReportForm.productCount" placeholder="请输入计划生产数量" clearable disabled/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="生产数量" prop="baseProductCount" >
<el-input-number v-model="ruleReportForm.baseProductCount" clearable disabled/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="备注" prop="remarks" >
<el-input v-model="ruleReportForm.remarks" clearable disabled/>
@ -102,8 +107,8 @@
<el-table-column prop="codeName" label="条码类型" width="100" show-overflow-tooltip="" />
<el-table-column prop="count" label="数量" width="80" show-overflow-tooltip="" />
<el-table-column prop="unit" label="单位" width="80" show-overflow-tooltip="" />
<el-table-column prop="baseCount" label="基本数量" width="100" show-overflow-tooltip="" />
<el-table-column prop="baseUnit" label="基本单位" width="100" show-overflow-tooltip="" />
<el-table-column prop="baseCount" label="生产数量" width="100" show-overflow-tooltip="" />
<el-table-column prop="baseUnit" label="生产单位" width="100" show-overflow-tooltip="" />
<el-table-column prop="childCount" label="子码数" width="80" show-overflow-tooltip="" />
<el-table-column prop="scanCodeTime" label="扫描时间" width="110" show-overflow-tooltip="" />
<el-table-column prop="scanCodeName" label="提交人" width="80" show-overflow-tooltip="" />
@ -239,6 +244,7 @@ onMounted(async () => {
ruleForm.value=[];
if(typeof(row.id) === 'number'){
var res = await getPrintDetail(row.id);
debugger
ruleForm.value = res.data.result;
ruleReportForm.value = {...row};
}else{