防错并且报工
This commit is contained in:
parent
b38d6b647c
commit
e30d2ed2d2
@ -123,7 +123,7 @@ namespace DOAN.WebApi.Controllers.JobKanban
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 获取某条产线 某个日期,某个班组的生产中的工单 上位机接口
|
||||
//TODO 获取某条产线 某个日期,某个班组的生产中的工单 上位机接口 (废弃)
|
||||
[HttpGet("get_producting_workorder")]
|
||||
public IActionResult GetProductingWorkorder(string line_code, DateTime handleDate)
|
||||
{
|
||||
@ -138,7 +138,7 @@ namespace DOAN.WebApi.Controllers.JobKanban
|
||||
}
|
||||
return SUCCESS(response);
|
||||
}
|
||||
//TODO 添加标签日志 上位机接口
|
||||
//TODO 添加标签日志 上位机接口 (废弃)
|
||||
[HttpGet("add_label_log")]
|
||||
public IActionResult AddLabelLog(string labelContext, string workOrder)
|
||||
{
|
||||
@ -152,7 +152,7 @@ namespace DOAN.WebApi.Controllers.JobKanban
|
||||
|
||||
}
|
||||
|
||||
//TODO 扫码校验判断标签是否与当前工单匹配 0 不匹配 1匹配
|
||||
//TODO 扫码校验判断标签是否与当前工单匹配 0 不匹配 1匹配 (废弃)
|
||||
[HttpGet("label_workorder_match")]
|
||||
public IActionResult LabelWorkOrderMatch(string LabelContext,string workOrder)
|
||||
{
|
||||
@ -164,6 +164,26 @@ namespace DOAN.WebApi.Controllers.JobKanban
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 防错并且报工
|
||||
/// <summary>
|
||||
/// 防错并且报工
|
||||
/// </summary>
|
||||
/// <param name="workorder"></param>
|
||||
/// <param name="labelContext"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="CustomException"></exception>
|
||||
[HttpGet("errorProofingAndReportingWork")]
|
||||
public IActionResult ErrorProofingAndReportingWork(string workorder,string labelContext)
|
||||
{
|
||||
if (string.IsNullOrEmpty(labelContext) || string.IsNullOrEmpty(workorder))
|
||||
{
|
||||
throw new CustomException("workorder或者labelContext为空");
|
||||
}
|
||||
|
||||
int response= workorderProgressService.ErrorProofingAndReportingWork(workorder, labelContext);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO 完成 工单和报工 (启用)
|
||||
|
||||
52
DOAN.Model/MES/product/ProReportworkDetail.cs
Normal file
52
DOAN.Model/MES/product/ProReportworkDetail.cs
Normal file
@ -0,0 +1,52 @@
|
||||
namespace DOAN.Model.MES.product;
|
||||
/// <summary>
|
||||
/// 报工表 详情
|
||||
/// </summary>
|
||||
[SugarTable("pro_reportwork_detail")]
|
||||
public class ProReportworkDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 雪花
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
|
||||
public string Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工单号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "workorder")]
|
||||
public string Workorder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "label_code")]
|
||||
public string LabelCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_BY")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_TIME")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
}
|
||||
@ -33,7 +33,7 @@ namespace DOAN.Service.JobKanban.IService
|
||||
int LabelWorkOrderMatch(string LabelContext, string workOrder);
|
||||
|
||||
|
||||
|
||||
int ErrorProofingAndReportingWork(string workorder, string labelContext);
|
||||
|
||||
int FinishAndReportWorkorder(string workorder, int finish_num);
|
||||
|
||||
|
||||
@ -238,6 +238,57 @@ namespace DOAN.Service.JobKanban
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 防错并且报工
|
||||
/// </summary>
|
||||
/// <param name="workorder"></param>
|
||||
/// <param name="labelContext"></param>
|
||||
/// <returns></returns>
|
||||
public int ErrorProofingAndReportingWork(string workorder, string labelContext)
|
||||
{
|
||||
ProWorkorder checked_workorder = Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder)
|
||||
.First();
|
||||
if (!labelContext.Contains(checked_workorder.Specification))
|
||||
{
|
||||
// 产品不属于这个工单里
|
||||
return -1;
|
||||
}
|
||||
// 记录条码
|
||||
ProReportworkDetail detail = new ProReportworkDetail();
|
||||
detail.Id = XueHua;
|
||||
detail.Workorder=workorder;
|
||||
detail.LabelCode = labelContext;
|
||||
detail.CreatedBy = "MES";
|
||||
detail.CreatedTime = DateTime.Now;
|
||||
Context.Insertable(detail).ExecuteCommand();
|
||||
|
||||
// 累加报工数
|
||||
ProReportwork reportWork = new ProReportwork();
|
||||
reportWork.Id = XueHua;
|
||||
reportWork.FkWorkorder = workorder;
|
||||
reportWork.DispatchNum = checked_workorder.DeliveryNum;
|
||||
reportWork.FinishedNum = 1;
|
||||
reportWork.GroupCode = checked_workorder.GroupCode;
|
||||
reportWork.LineCode = checked_workorder.LineCode;
|
||||
reportWork.CreatedTime = DateTime.Now;
|
||||
reportWork.CreatedBy = "kanban";
|
||||
reportWork.UpdatedBy = "kanban";
|
||||
reportWork.UpdatedTime = DateTime.Now;
|
||||
var x= Context.Storageable(reportWork).WhereColumns(it=>it.FkWorkorder).ToStorage();
|
||||
int result= x.AsInsertable.ExecuteCommand();//不存在插入
|
||||
result+= x.AsUpdateable
|
||||
.IgnoreColumns("Id")
|
||||
.IgnoreColumns("DispatchNum")
|
||||
.IgnoreColumns("FinishedNum")
|
||||
.IgnoreColumns("GroupCode")
|
||||
.IgnoreColumns("CreatedTime")
|
||||
.IgnoreColumns("LineCode")
|
||||
.IgnoreColumns("CreatedBy")
|
||||
.SetColumns(it => it.FinishedNum== it.FinishedNum+1)
|
||||
.ExecuteCommand();//存在更新
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public int FinishAndReportWorkorder(string workorder, int finish_num)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user