2024-12-03 20:10:18 +08:00
|
|
|
using DOAN.Model.MES.base_;
|
2024-12-03 19:21:32 +08:00
|
|
|
using DOAN.Model.MES.product;
|
2024-12-03 20:10:18 +08:00
|
|
|
using DOAN.Model.Mobile.ReportFlow.Dto;
|
2024-12-03 19:21:32 +08:00
|
|
|
using DOAN.Model.Public;
|
|
|
|
|
using DOAN.Service.Mobile.IService;
|
|
|
|
|
using DOAN.Service.Public.IPublicService;
|
|
|
|
|
using Infrastructure.Attribute;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2024-12-10 16:41:20 +08:00
|
|
|
using SqlSugar.DistributedSystem.Snowflake;
|
|
|
|
|
using System.Diagnostics;
|
2024-12-03 19:21:32 +08:00
|
|
|
|
|
|
|
|
namespace DOAN.Service.Mobile;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 广告管理Service业务层处理
|
|
|
|
|
/// </summary>
|
|
|
|
|
[AppService(ServiceType = typeof(IReportFlowService), ServiceLifetime = LifeTime.Transient)]
|
|
|
|
|
public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowService
|
|
|
|
|
{
|
|
|
|
|
public ProWorkorder GetWorkOrderDetail(string workorder)
|
|
|
|
|
{
|
2024-12-03 19:39:52 +08:00
|
|
|
return Context.Queryable<ProWorkorder>().Where(x => x.Workorder == workorder).First();
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-03 20:10:18 +08:00
|
|
|
public ProReportwork01 GetProcessReportWorkDetail(string workorder, int process)
|
2024-12-03 19:39:52 +08:00
|
|
|
{
|
2024-12-03 20:10:18 +08:00
|
|
|
return Context.Queryable<ProReportwork01>().Where(x => x.Workorder == workorder && x.ProcessId == process).First();
|
2024-12-03 19:39:52 +08:00
|
|
|
}
|
2024-12-10 16:54:57 +08:00
|
|
|
|
2024-12-10 16:41:20 +08:00
|
|
|
/// <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>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool FeedProcessReportwork(string workorder, int processId, int finish_num, string stove_code, string feed_order, string Worker)
|
2024-12-03 19:39:52 +08:00
|
|
|
{
|
|
|
|
|
int result = 0;
|
2024-12-10 16:41:20 +08:00
|
|
|
bool Exist = Context.Queryable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == processId).Any();
|
|
|
|
|
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.JobDate == DateTime.Now)
|
|
|
|
|
.SetColumns(it => it.UpdatedBy == Worker)
|
|
|
|
|
.SetColumns(it => it.UpdatedTime == DateTime.Now)
|
|
|
|
|
.ExecuteCommand();
|
|
|
|
|
Context.Updateable<ProWorkorder>().Where(it => it.Workorder == workorder)
|
2024-12-10 16:54:57 +08:00
|
|
|
.SetColumns(it => it.StoveCode == stove_code)
|
|
|
|
|
.SetColumns(it => it.FeedOrder == feed_order)
|
2024-12-10 16:41:20 +08:00
|
|
|
.ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ProReportwork01 proReportwork01 = new ProReportwork01();
|
|
|
|
|
proReportwork01.Id = XueHua;
|
|
|
|
|
proReportwork01.Workorder = workorder;
|
|
|
|
|
proReportwork01.ProcessId = processId;
|
|
|
|
|
proReportwork01.FinishNum = finish_num;
|
|
|
|
|
|
|
|
|
|
proReportwork01.Worker = Worker;
|
|
|
|
|
proReportwork01.JobDate = DateTime.Now;
|
|
|
|
|
proReportwork01.CreatedBy = Worker;
|
|
|
|
|
proReportwork01.CreatedTime = DateTime.Now;
|
|
|
|
|
result = Context.Insertable(proReportwork01).ExecuteCommand();
|
|
|
|
|
Context.Updateable<ProWorkorder>().Where(it => it.Workorder == workorder)
|
2024-12-10 16:54:57 +08:00
|
|
|
.SetColumns(it => it.StoveCode == stove_code)
|
|
|
|
|
.SetColumns(it => it.FeedOrder == feed_order)
|
2024-12-03 19:39:52 +08:00
|
|
|
.ExecuteCommand();
|
|
|
|
|
|
2024-12-10 16:41:20 +08:00
|
|
|
}
|
|
|
|
|
return result > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ProcessReportWork(string workorder, int process, int finish_num, int bad_num, string Worker)
|
|
|
|
|
{
|
|
|
|
|
int result = 0;
|
|
|
|
|
bool Exist = Context.Queryable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == process).Any();
|
|
|
|
|
if (Exist)
|
|
|
|
|
{
|
|
|
|
|
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.JobDate == 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.JobDate = DateTime.Now;
|
|
|
|
|
proReportwork01.CreatedBy = Worker;
|
|
|
|
|
proReportwork01.CreatedTime = DateTime.Now;
|
|
|
|
|
result = Context.Insertable(proReportwork01).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return result > 0;
|
2024-12-03 19:21:32 +08:00
|
|
|
}
|
2024-12-03 19:51:09 +08:00
|
|
|
|
2024-12-10 16:41:20 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 出货工序报工
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="workorder"></param>
|
|
|
|
|
/// <param name="processId"></param>
|
|
|
|
|
/// <param name="finish_num"></param>
|
|
|
|
|
/// <param name="bad_num"></param>
|
|
|
|
|
/// <param name="feed_order"></param>
|
|
|
|
|
/// <param name="Worker"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool ShipmentProcessReportwork(string workorder, int processId, int finish_num, int bad_num, string customer_order, string Worker)
|
|
|
|
|
{
|
|
|
|
|
int result = 0;
|
|
|
|
|
bool Exist = Context.Queryable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == processId).Any();
|
|
|
|
|
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.JobDate == DateTime.Now)
|
|
|
|
|
.SetColumns(it => it.UpdatedBy == Worker)
|
|
|
|
|
.SetColumns(it => it.UpdatedTime == DateTime.Now)
|
|
|
|
|
.ExecuteCommand();
|
|
|
|
|
Context.Updateable<ProWorkorder>().Where(it => it.Workorder == workorder)
|
2024-12-10 16:54:57 +08:00
|
|
|
.SetColumns(it => it.CustomerOrder == customer_order)
|
2024-12-10 16:41:20 +08:00
|
|
|
.ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ProReportwork01 proReportwork01 = new ProReportwork01();
|
|
|
|
|
proReportwork01.Id = XueHua;
|
|
|
|
|
proReportwork01.Workorder = workorder;
|
|
|
|
|
proReportwork01.ProcessId = processId;
|
|
|
|
|
proReportwork01.FinishNum = finish_num;
|
|
|
|
|
proReportwork01.Worker = Worker;
|
|
|
|
|
proReportwork01.JobDate = DateTime.Now;
|
|
|
|
|
proReportwork01.CreatedBy = Worker;
|
|
|
|
|
proReportwork01.CreatedTime = DateTime.Now;
|
|
|
|
|
result = Context.Insertable(proReportwork01).ExecuteCommand();
|
|
|
|
|
Context.Updateable<ProWorkorder>().Where(it => it.Workorder == workorder)
|
2024-12-10 16:54:57 +08:00
|
|
|
.SetColumns(it => it.CustomerOrder == customer_order)
|
2024-12-10 16:41:20 +08:00
|
|
|
.ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return result > 0;
|
|
|
|
|
}
|
2024-12-03 19:51:09 +08:00
|
|
|
|
2024-12-03 20:10:18 +08:00
|
|
|
public List<ProReportWorkDetialDto> GetWorkOrderReportWorkList(string workorder)
|
2024-12-03 19:51:09 +08:00
|
|
|
{
|
2024-12-03 20:10:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Context.Queryable<ProReportwork01>()
|
|
|
|
|
.LeftJoin<BaseWorkProcesses>((rw, wp) => rw.ProcessId == wp.Id)
|
|
|
|
|
.Where((rw, wp) => rw.Workorder == workorder)
|
|
|
|
|
.OrderBy(rw => rw.ProcessId)
|
|
|
|
|
.Select((rw, wp) => new ProReportWorkDetialDto()
|
|
|
|
|
{
|
|
|
|
|
ProcessName = wp.Name,
|
|
|
|
|
}, true)
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-03 19:51:09 +08:00
|
|
|
}
|
2024-12-03 19:21:32 +08:00
|
|
|
}
|
|
|
|
|
|