对物料操作进行了更新
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using System.Diagnostics;
|
||||
using DOAN.Model;
|
||||
using DOAN.Model.BZFM;
|
||||
using DOAN.Model.BZFM.Dto;
|
||||
using DOAN.Model.MES.base_;
|
||||
@@ -7,19 +5,12 @@ using DOAN.Model.MES.base_.Dto;
|
||||
using DOAN.Model.MES.order;
|
||||
using DOAN.Model.MES.product;
|
||||
using DOAN.Model.Mobile.ReportFlow.Dto;
|
||||
using DOAN.Model.Public;
|
||||
using DOAN.Model.System;
|
||||
using DOAN.Repository;
|
||||
using DOAN.Service.BZFM;
|
||||
using DOAN.Service.Mobile.IService;
|
||||
using DOAN.Service.Public.IPublicService;
|
||||
using Infrastructure.Attribute;
|
||||
using JinianNet.JNTemplate;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using SqlSugar.DistributedSystem.Snowflake;
|
||||
|
||||
namespace DOAN.Service.Mobile;
|
||||
|
||||
@@ -69,43 +60,69 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
string Worker
|
||||
)
|
||||
{
|
||||
int result = 0;
|
||||
// 是否首次提交
|
||||
bool Exist = Context
|
||||
.Queryable<ProReportwork01>()
|
||||
.Where(it => it.Workorder == workorder && it.ProcessId == processId)
|
||||
.Any();
|
||||
|
||||
string NickName = Context
|
||||
.Queryable<SysUser>()
|
||||
.Where(it => it.UserName == Worker)
|
||||
.Select(it => it.NickName)
|
||||
.First();
|
||||
Worker = string.IsNullOrEmpty(NickName) ? Worker + "|异常人员|" : NickName;
|
||||
if (Exist)
|
||||
try
|
||||
{
|
||||
result = Context
|
||||
.Updateable<ProReportwork01>()
|
||||
int result = 0;
|
||||
// 是否首次提交
|
||||
bool Exist = Context
|
||||
.Queryable<ProReportwork01>()
|
||||
.Where(it => it.Workorder == workorder && it.ProcessId == processId)
|
||||
.SetColumns(it => it.FinishNum == finish_num)
|
||||
.SetColumns(it => it.Worker == Worker)
|
||||
.SetColumns(it => it.JobDateTime == DateTime.Now)
|
||||
.SetColumns(it => it.RouteId == 32)
|
||||
.SetColumns(it => it.UpdatedBy == Worker)
|
||||
.SetColumns(it => it.UpdatedTime == DateTime.Now)
|
||||
.ExecuteCommand();
|
||||
Context
|
||||
.Updateable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.SetColumns(it => it.StoveCode == stove_code)
|
||||
.SetColumns(it => it.FeedOrder == feed_order)
|
||||
.ExecuteCommand();
|
||||
//XXX 触发修改领料出库操作(上边代码先不动)
|
||||
.Any();
|
||||
|
||||
string NickName = Context
|
||||
.Queryable<SysUser>()
|
||||
.Where(it => it.UserName == Worker)
|
||||
.Select(it => it.NickName)
|
||||
.First();
|
||||
Worker = string.IsNullOrEmpty(NickName) ? Worker + "|异常人员|" : NickName;
|
||||
|
||||
Context.Ado.BeginTran();
|
||||
if (Exist)
|
||||
{
|
||||
result = Context
|
||||
.Updateable<ProReportwork01>()
|
||||
.Where(it => it.Workorder == workorder && it.ProcessId == processId)
|
||||
.SetColumns(it => it.FinishNum == finish_num)
|
||||
.SetColumns(it => it.Worker == Worker)
|
||||
.SetColumns(it => it.JobDateTime == DateTime.Now)
|
||||
.SetColumns(it => it.RouteId == 32)
|
||||
.SetColumns(it => it.UpdatedBy == Worker)
|
||||
.SetColumns(it => it.UpdatedTime == DateTime.Now)
|
||||
.ExecuteCommand();
|
||||
Context
|
||||
.Updateable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.SetColumns(it => it.StoveCode == stove_code)
|
||||
.SetColumns(it => it.FeedOrder == feed_order)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
ProReportwork01 proReportwork01 = new ProReportwork01();
|
||||
proReportwork01.Id = XueHua;
|
||||
proReportwork01.Workorder = workorder;
|
||||
proReportwork01.ProcessId = processId;
|
||||
proReportwork01.FinishNum = finish_num;
|
||||
proReportwork01.RouteId = 32;
|
||||
proReportwork01.Worker = Worker;
|
||||
proReportwork01.JobDateTime = DateTime.Now;
|
||||
proReportwork01.CreatedBy = Worker;
|
||||
proReportwork01.CreatedTime = DateTime.Now;
|
||||
result = Context.Insertable(proReportwork01).ExecuteCommand();
|
||||
Context
|
||||
.Updateable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.SetColumns(it => it.StoveCode == stove_code)
|
||||
.SetColumns(it => it.FeedOrder == feed_order)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
//XXX 领料出库操作(上边代码先不动)
|
||||
MmRecordOutbound outRecordbound = Context
|
||||
.Queryable<MmRecordOutbound>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.Where(it => it.TransactionType == "领料出库")
|
||||
.Where(it => it.Remarks != "已撤销")
|
||||
.First();
|
||||
// 为空时依旧触发新建物料操作
|
||||
ProWorkorder proWorkorder = Context
|
||||
.Queryable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
@@ -114,6 +131,7 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
{
|
||||
throw new Exception($"工单异常,原材料无法出库:{workorder}");
|
||||
}
|
||||
|
||||
if (outRecordbound == null)
|
||||
{
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
@@ -131,111 +149,35 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
Remarks = $"生产领料,工单号:{workorder}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(
|
||||
revokeRecepitDto
|
||||
);
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(revokeRecepitDto);
|
||||
if (createReceiptresult != "ok")
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception(createReceiptresult);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 否则触发修改操作
|
||||
// 检查物料是否发生变动
|
||||
bool isUpdate = outRecordbound.Quantity != finish_num;
|
||||
if (isUpdate)
|
||||
if (outRecordbound.Quantity != finish_num)
|
||||
{
|
||||
// 检查是增加了还是减少了
|
||||
bool isAdd = (finish_num - outRecordbound.Quantity) > 0;
|
||||
if (isAdd)
|
||||
{
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
ReceiptType = 1,
|
||||
MaterialCode = proWorkorder.MaterialCode,
|
||||
BatchNo = feed_order,
|
||||
LocationCode = "YCL001",
|
||||
WarehouseCode = "WH003",
|
||||
OrderNo = proWorkorder.CustomerOrder,
|
||||
Workorder = workorder,
|
||||
Operator = Worker,
|
||||
Quantity = finish_num,
|
||||
TransactionType = "领料出库",
|
||||
Remarks = $"生产领料,数额调整,工单号:{workorder}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(
|
||||
revokeRecepitDto
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
ReceiptType = 2,
|
||||
MaterialCode = proWorkorder.MaterialCode,
|
||||
BatchNo = feed_order,
|
||||
LocationCode = "YCL001",
|
||||
WarehouseCode = "WH003",
|
||||
OrderNo = proWorkorder.CustomerOrder,
|
||||
Workorder = workorder,
|
||||
Operator = Worker,
|
||||
Quantity = finish_num,
|
||||
TransactionType = "出库红单",
|
||||
Remarks = $"生产领料,数额调整,工单号:{workorder}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(
|
||||
revokeRecepitDto
|
||||
);
|
||||
}
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("修改领料数量前请先撤销已有领料出库记录!");
|
||||
}
|
||||
if (outRecordbound.BatchNo != feed_order)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("修改领料号前请先撤销已有领料出库记录!");
|
||||
}
|
||||
}
|
||||
Context.Ado.CommitTran();
|
||||
return result > 0;
|
||||
}
|
||||
else
|
||||
catch (Exception)
|
||||
{
|
||||
ProReportwork01 proReportwork01 = new ProReportwork01();
|
||||
proReportwork01.Id = XueHua;
|
||||
proReportwork01.Workorder = workorder;
|
||||
proReportwork01.ProcessId = processId;
|
||||
proReportwork01.FinishNum = finish_num;
|
||||
proReportwork01.RouteId = 32;
|
||||
proReportwork01.Worker = Worker;
|
||||
proReportwork01.JobDateTime = DateTime.Now;
|
||||
proReportwork01.CreatedBy = Worker;
|
||||
proReportwork01.CreatedTime = DateTime.Now;
|
||||
result = Context.Insertable(proReportwork01).ExecuteCommand();
|
||||
Context
|
||||
.Updateable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.SetColumns(it => it.StoveCode == stove_code)
|
||||
.SetColumns(it => it.FeedOrder == feed_order)
|
||||
.ExecuteCommand();
|
||||
//XXX 触发创建领料出库单操作(上边代码先不动)
|
||||
// 做原材料库出库操作
|
||||
ProWorkorder proWorkorder = Context
|
||||
.Queryable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.First();
|
||||
if (proWorkorder == null)
|
||||
{
|
||||
throw new Exception($"工单异常,原材料无法出库:{workorder}");
|
||||
}
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
ReceiptType = 1,
|
||||
MaterialCode = proWorkorder.MaterialCode,
|
||||
BatchNo = feed_order,
|
||||
LocationCode = "YCL001",
|
||||
WarehouseCode = "WH003",
|
||||
OrderNo = proWorkorder.CustomerOrder,
|
||||
Workorder = workorder,
|
||||
Operator = Worker,
|
||||
Quantity = finish_num,
|
||||
TransactionType = "领料出库",
|
||||
Remarks = $"生产领料,工单号:{workorder}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(revokeRecepitDto);
|
||||
Context.Ado.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
return result > 0;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -255,82 +197,117 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
string Worker
|
||||
)
|
||||
{
|
||||
int result = 0;
|
||||
bool Exist = Context
|
||||
.Queryable<ProReportwork01>()
|
||||
.Where(it => it.Workorder == workorder && it.ProcessId == process)
|
||||
.Any();
|
||||
string NickName = Context
|
||||
.Queryable<SysUser>()
|
||||
.Where(it => it.UserName == Worker)
|
||||
.Select(it => it.NickName)
|
||||
.First();
|
||||
Worker = string.IsNullOrEmpty(NickName) ? Worker + "|异常人员|" : NickName;
|
||||
if (Exist)
|
||||
try
|
||||
{
|
||||
result = Context
|
||||
.Updateable<ProReportwork01>()
|
||||
int result = 0;
|
||||
bool Exist = Context
|
||||
.Queryable<ProReportwork01>()
|
||||
.Where(it => it.Workorder == workorder && it.ProcessId == process)
|
||||
.SetColumns(it => it.FinishNum == finish_num)
|
||||
.SetColumns(it => it.BadNum == bad_num)
|
||||
.SetColumns(it => it.Worker == Worker)
|
||||
.SetColumns(it => it.RouteId == 32)
|
||||
.SetColumns(it => it.JobDateTime == DateTime.Now)
|
||||
.SetColumns(it => it.UpdatedBy == Worker)
|
||||
.SetColumns(it => it.UpdatedTime == DateTime.Now)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
ProReportwork01 proReportwork01 = new ProReportwork01();
|
||||
proReportwork01.Id = XueHua;
|
||||
proReportwork01.Workorder = workorder;
|
||||
proReportwork01.ProcessId = process;
|
||||
proReportwork01.FinishNum = finish_num;
|
||||
proReportwork01.BadNum = bad_num;
|
||||
proReportwork01.Worker = Worker;
|
||||
proReportwork01.RouteId = 32;
|
||||
proReportwork01.JobDateTime = DateTime.Now;
|
||||
proReportwork01.CreatedBy = Worker;
|
||||
proReportwork01.CreatedTime = DateTime.Now;
|
||||
result = Context.Insertable(proReportwork01).ExecuteCommand();
|
||||
}
|
||||
|
||||
// XXX TODO 成品入库(临时使用)
|
||||
|
||||
if (process == 70)
|
||||
{
|
||||
// 成品入库
|
||||
ProWorkorder proWorkorder = Context
|
||||
.Queryable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.Any();
|
||||
string NickName = Context
|
||||
.Queryable<SysUser>()
|
||||
.Where(it => it.UserName == Worker)
|
||||
.Select(it => it.NickName)
|
||||
.First();
|
||||
if (proWorkorder == null)
|
||||
Worker = string.IsNullOrEmpty(NickName) ? Worker + "|异常人员|" : NickName;
|
||||
|
||||
Context.Ado.BeginTran();
|
||||
if (Exist)
|
||||
{
|
||||
throw new Exception($"工单异常,无法成品入库:{workorder}");
|
||||
result = Context
|
||||
.Updateable<ProReportwork01>()
|
||||
.Where(it => it.Workorder == workorder && it.ProcessId == process)
|
||||
.SetColumns(it => it.FinishNum == finish_num)
|
||||
.SetColumns(it => it.BadNum == bad_num)
|
||||
.SetColumns(it => it.Worker == Worker)
|
||||
.SetColumns(it => it.RouteId == 32)
|
||||
.SetColumns(it => it.JobDateTime == DateTime.Now)
|
||||
.SetColumns(it => it.UpdatedBy == Worker)
|
||||
.SetColumns(it => it.UpdatedTime == DateTime.Now)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
ProReportwork01 proReportwork01 = new ProReportwork01();
|
||||
proReportwork01.Id = XueHua;
|
||||
proReportwork01.Workorder = workorder;
|
||||
proReportwork01.ProcessId = process;
|
||||
proReportwork01.FinishNum = finish_num;
|
||||
proReportwork01.BadNum = bad_num;
|
||||
proReportwork01.Worker = Worker;
|
||||
proReportwork01.RouteId = 32;
|
||||
proReportwork01.JobDateTime = DateTime.Now;
|
||||
proReportwork01.CreatedBy = Worker;
|
||||
proReportwork01.CreatedTime = DateTime.Now;
|
||||
result = Context.Insertable(proReportwork01).ExecuteCommand();
|
||||
}
|
||||
|
||||
//做出库红单
|
||||
InboundReceiptDto revokeRecepitDto = new()
|
||||
// XXX TODO 成品入库(临时使用)
|
||||
|
||||
if (process == 70)
|
||||
{
|
||||
ReceiptType = 1,
|
||||
MaterialCode = proWorkorder.productionCode,
|
||||
BatchNo = proWorkorder.FeedOrder,
|
||||
LocationCode = "CP001",
|
||||
WarehouseCode = "WH001",
|
||||
SupplierCode = "",
|
||||
StoveCode = proWorkorder.StoveCode,
|
||||
Workorder = workorder,
|
||||
Operator = Worker,
|
||||
Quantity = finish_num,
|
||||
TransactionType = "生产入库",
|
||||
Remarks = $"成品入库,工单号:{workorder}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateInboundReceipt(revokeRecepitDto);
|
||||
// 成品入库
|
||||
ProWorkorder proWorkorder = Context
|
||||
.Queryable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.First();
|
||||
if (proWorkorder == null)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception($"工单异常,无法成品入库:{workorder}");
|
||||
}
|
||||
MmRecordInbound inboundRecord = Context
|
||||
.Queryable<MmRecordInbound>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.Where(it => it.TransactionType == "生产入库")
|
||||
.Where(it => it.Remarks != "已撤销")
|
||||
.First();
|
||||
if (inboundRecord == null)
|
||||
{
|
||||
//做生产入库单
|
||||
InboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
ReceiptType = 1,
|
||||
MaterialCode = proWorkorder.productionCode,
|
||||
BatchNo = proWorkorder.FeedOrder,
|
||||
LocationCode = "CP001",
|
||||
WarehouseCode = "WH001",
|
||||
SupplierCode = "",
|
||||
StoveCode = proWorkorder.StoveCode,
|
||||
Workorder = workorder,
|
||||
Operator = Worker,
|
||||
Quantity = finish_num,
|
||||
TransactionType = "生产入库",
|
||||
Remarks = $"成品入库,工单号:{workorder}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateInboundReceipt(
|
||||
revokeRecepitDto
|
||||
);
|
||||
if (createReceiptresult != "ok")
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception(createReceiptresult);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inboundRecord.Quantity != finish_num)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("修改数量前请先撤销已有生产入库记录!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Context.Ado.CommitTran();
|
||||
return result > 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -415,7 +392,27 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
CreatedTime = DateTime.Now,
|
||||
};
|
||||
result = Context.Insertable(proReportwork01).ExecuteCommand();
|
||||
// XXX 成品库出库
|
||||
}
|
||||
else
|
||||
{
|
||||
// 修改
|
||||
ReportWorkOrderDetail.FinishNum = finish_num;
|
||||
ReportWorkOrderDetail.BadNum = bad_num;
|
||||
ReportWorkOrderDetail.Worker = Worker;
|
||||
ReportWorkOrderDetail.UpdatedBy = Worker;
|
||||
ReportWorkOrderDetail.UpdatedTime = DateTime.Now;
|
||||
result = Context.Updateable(ReportWorkOrderDetail).ExecuteCommand();
|
||||
}
|
||||
|
||||
// XXX 成品库出库
|
||||
MmRecordOutbound outboundDto = Context
|
||||
.Queryable<MmRecordOutbound>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.Where(it => it.TransactionType == "出货出库")
|
||||
.Where(it => it.Remarks != "已撤销")
|
||||
.First();
|
||||
if (outboundDto == null)
|
||||
{
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
ReceiptType = 1,
|
||||
@@ -434,97 +431,21 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(
|
||||
revokeRecepitDto
|
||||
);
|
||||
if(createReceiptresult != "ok")
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception(createReceiptresult);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 修改
|
||||
ReportWorkOrderDetail.FinishNum = finish_num;
|
||||
ReportWorkOrderDetail.BadNum = bad_num;
|
||||
ReportWorkOrderDetail.Worker = Worker;
|
||||
ReportWorkOrderDetail.UpdatedBy = Worker;
|
||||
ReportWorkOrderDetail.UpdatedTime = DateTime.Now;
|
||||
result = Context.Updateable(ReportWorkOrderDetail).ExecuteCommand();
|
||||
//XXX 修改成品库出库
|
||||
MmRecordOutbound outRecordbound = Context
|
||||
.Queryable<MmRecordOutbound>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.First();
|
||||
if (outRecordbound == null)
|
||||
if (outboundDto.Quantity != finish_num)
|
||||
{
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
ReceiptType = 1,
|
||||
MaterialCode = workorderInfo.productionCode,
|
||||
BatchNo = workorderInfo.FeedOrder,
|
||||
LocationCode = "CP001",
|
||||
WarehouseCode = "WH001",
|
||||
OrderNo = customer_order,
|
||||
Workorder = workorder,
|
||||
Operator = Worker,
|
||||
Quantity = finish_num,
|
||||
TransactionType = "出货出库",
|
||||
Remarks = $"出货出库,工单号:{workorder},订单号{customer_order}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(
|
||||
revokeRecepitDto
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 否则触发修改操作
|
||||
// 检查物料是否发生变动
|
||||
bool isUpdate = outRecordbound.Quantity != finish_num;
|
||||
if (isUpdate)
|
||||
{
|
||||
// 检查是增加了还是减少了
|
||||
bool isAdd = (finish_num - outRecordbound.Quantity) > 0;
|
||||
if (isAdd)
|
||||
{
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
ReceiptType = 1,
|
||||
MaterialCode = workorderInfo.productionCode,
|
||||
BatchNo = workorderInfo.FeedOrder,
|
||||
LocationCode = "CP001",
|
||||
WarehouseCode = "WH001",
|
||||
OrderNo = customer_order,
|
||||
Workorder = workorder,
|
||||
Operator = Worker,
|
||||
Quantity = finish_num,
|
||||
TransactionType = "出货出库",
|
||||
Remarks =
|
||||
$"出货出库,数额调整,工单号:{workorder},订单号{customer_order}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(
|
||||
revokeRecepitDto
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
ReceiptType = 2,
|
||||
MaterialCode = workorderInfo.productionCode,
|
||||
BatchNo = workorderInfo.FeedOrder,
|
||||
LocationCode = "CP001",
|
||||
WarehouseCode = "WH001",
|
||||
OrderNo = customer_order,
|
||||
Workorder = workorder,
|
||||
Operator = Worker,
|
||||
Quantity = finish_num,
|
||||
TransactionType = "出库红单",
|
||||
Remarks = $"出货出库,数额调整,工单号:{workorder}",
|
||||
};
|
||||
MmInventoryService mmInventoryService = new();
|
||||
string createReceiptresult = mmInventoryService.CreateOutboundReceipt(
|
||||
revokeRecepitDto
|
||||
);
|
||||
}
|
||||
}
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("修改数量前请先撤销出货出库记录");
|
||||
}
|
||||
}
|
||||
|
||||
// 修改工单信息
|
||||
Context
|
||||
.Updateable<ProWorkorder>()
|
||||
|
||||
Reference in New Issue
Block a user