feat(工单): 实现工单标签打印功能并优化相关逻辑
- 添加Bartender打印工具类实现工单标签打印功能 - 修改PrintTicketsByTemplate方法返回类型为string并实现完整打印逻辑 - 优化工单领料逻辑,增加原材料工单信息获取 - 调整工单查询条件,移除PlanNum>0的限制 - 修复出库单操作符赋值错误 - 优化不良品处理流程,统一使用不良库代替报废库 - 完善领料报工逻辑,增加计划数校验和原材料工单处理
This commit is contained in:
@@ -45,13 +45,13 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
/// <summary>
|
||||
/// 首工序报工(领料报工)
|
||||
/// </summary>
|
||||
/// <param name="workorder"></param>
|
||||
/// <param name="processId"></param>
|
||||
/// <param name="finish_num"></param>
|
||||
/// <param name="stove_code"></param>
|
||||
/// <param name="feed_order"></param>
|
||||
/// <param name="Worker"></param>
|
||||
/// <param name="workorderRaw">原材料工单号</param>
|
||||
/// <param name="workorder">领料工单</param>
|
||||
/// <param name="processId">工序</param>
|
||||
/// <param name="finish_num">领料数</param>
|
||||
/// <param name="stove_code">炉号</param>
|
||||
/// <param name="feed_order">领料批次号</param>
|
||||
/// <param name="Worker">操作人</param>
|
||||
/// <param name="workorderRaw">领料的原材料工单号</param>
|
||||
/// <param name="inventoryId">领料库存id</param>
|
||||
/// <returns></returns>
|
||||
public bool FeedProcessReportwork(
|
||||
@@ -77,6 +77,10 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
{
|
||||
throw new Exception($"工单不存在,原材料无法出库:{workorder}");
|
||||
}
|
||||
if (proWorkorder.PlanNum == 0)
|
||||
{
|
||||
throw new Exception($"工单计划数为0,不可领料");
|
||||
}
|
||||
|
||||
int routeId = Context
|
||||
.Queryable<BaseWorkRoute>()
|
||||
@@ -97,27 +101,47 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
.First();
|
||||
Worker = string.IsNullOrEmpty(NickName) ? Worker + "|异常人员|" : NickName;
|
||||
string stoveCode = stove_code;
|
||||
// 检查采购记录
|
||||
// 检查采购记录获取炉号
|
||||
var purchaseInfo = Context
|
||||
.Queryable<MmRecordInbound>()
|
||||
.Where(it => it.BatchNo == feed_order)
|
||||
.Where(it => it.TransactionType == "采购入库")
|
||||
.Where(it => it.Remarks == null || it.Remarks != "已撤销")
|
||||
.First();
|
||||
string newFeedOrder = feed_order;
|
||||
if (purchaseInfo != null)
|
||||
{
|
||||
stoveCode = purchaseInfo.StoveCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"未找到原材料采购批号:{feed_order}");
|
||||
// 根据原料工单领料逻辑获取炉号与原材料号
|
||||
if (!string.IsNullOrEmpty(workorderRaw))
|
||||
{
|
||||
ProWorkorder proWorkorderRawInfo = Context
|
||||
.Queryable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorderRaw)
|
||||
.First();
|
||||
if (proWorkorderRawInfo == null)
|
||||
{
|
||||
throw new Exception($"原材料工单不存在,无法领料:{workorderRaw}");
|
||||
}
|
||||
stoveCode = proWorkorderRawInfo.StoveCode;
|
||||
newFeedOrder = proWorkorderRawInfo.FeedOrder;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"未找到原材料采购批号:{feed_order}");
|
||||
}
|
||||
|
||||
}
|
||||
Context.Ado.BeginTran();
|
||||
// 工单数据调整
|
||||
Context
|
||||
.Updateable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.SetColumns(it => it.StoveCode == stoveCode)
|
||||
.SetColumns(it => it.FeedOrder == feed_order)
|
||||
.SetColumnsIF(!string.IsNullOrEmpty(stoveCode),it => it.StoveCode == stoveCode)
|
||||
.SetColumnsIF(!string.IsNullOrEmpty(newFeedOrder),it => it.FeedOrder == newFeedOrder)
|
||||
.ExecuteCommand();
|
||||
if (Exist)
|
||||
{
|
||||
@@ -153,6 +177,7 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
.Where(it => it.TransactionType == "领料出库")
|
||||
.Where(it => it.Remarks != "已撤销")
|
||||
.First();
|
||||
//1.检查领料是否超出限额
|
||||
|
||||
if (outRecordbound == null || proWorkorder.RouteCode == "10")
|
||||
{
|
||||
@@ -193,7 +218,7 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
.Where(it => it.Workorder == workorderRaw)
|
||||
.SetColumns(it => it.ShipmentNum == newShipmentNum)
|
||||
.ExecuteCommand();
|
||||
inboundRecord.Remarks += $"[已领料{finish_num}]";
|
||||
inboundRecord.Remarks += $"[{workorder}已领料{finish_num}]";
|
||||
Context.Updateable(inboundRecord).ExecuteCommand();
|
||||
}
|
||||
string supplierCode = string.Empty;
|
||||
@@ -248,11 +273,11 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("修改领料数量前请先撤销已有领料出库记录!");
|
||||
}
|
||||
if (outRecordbound.BatchNo != feed_order)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("修改领料号前请先撤销已有领料出库记录!");
|
||||
}
|
||||
//if (outRecordbound.BatchNo != feed_order)
|
||||
//{
|
||||
// Context.Ado.RollbackTran();
|
||||
// throw new Exception("修改领料号前请先撤销已有领料出库记录!");
|
||||
//}
|
||||
}
|
||||
Context.Ado.CommitTran();
|
||||
return result > 0;
|
||||
|
||||
Reference in New Issue
Block a user