CreatedBy="U3和U5"
This commit is contained in:
parent
5ae427387a
commit
64723e0a8d
@ -11,7 +11,7 @@ using Infrastructure.Converter;
|
||||
namespace DOAN.WebApi.Controllers.Mobile.product
|
||||
{
|
||||
/// <summary>
|
||||
/// 首件检验标签和末件检验标签打印接口
|
||||
/// 首件检验标签和末件检验标签打印接口 U13和U16
|
||||
/// </summary>
|
||||
|
||||
[Route("mes/Mobile/PrintAndReportWork2")]
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
using DOAN.Admin.WebApi.Filters;
|
||||
using DOAN.Model.MES.product;
|
||||
using DOAN.Model.MES.product.Dto;
|
||||
using DOAN.Service.Mobile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DOAN.Service.Mobile.IService;
|
||||
using DOAN.Model.Mobile.Dto;
|
||||
using DOAN.Service.MES.product.IService;
|
||||
using Infrastructure.Converter;
|
||||
|
||||
namespace DOAN.WebApi.Controllers.Mobile.product
|
||||
{
|
||||
[Route("mes/Mobile/PrintAndReportWork3")]
|
||||
public class PADPrintAndReportWork3Controller : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 打印和报工表接口 U3和U5线
|
||||
/// </summary>
|
||||
private readonly IPADPrintAndReportWork3Service printAndReportWork3Service;
|
||||
|
||||
public PADPrintAndReportWork3Controller(IPADPrintAndReportWork3Service _printAndReportWork3Service)
|
||||
{
|
||||
this.printAndReportWork3Service = _printAndReportWork3Service;
|
||||
}
|
||||
|
||||
// TODO 获取首件检验标签
|
||||
[HttpGet("firstInspectionLabel")]
|
||||
public IActionResult GetFirstInspectionLabel(string workorder)
|
||||
{
|
||||
var response = printAndReportWork3Service.GetFirstInspectionLabel(workorder);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 校验箱子标签
|
||||
[HttpGet("CheckBoxInspectionLabel")]
|
||||
public IActionResult CheckBoxInspectionLabel(string workorder, string box_label)
|
||||
{
|
||||
var response = printAndReportWork3Service.CheckBoxInspectionLabel(workorder, box_label);
|
||||
return SUCCESS(response);
|
||||
return SUCCESS(true);
|
||||
}
|
||||
|
||||
//TODO 校验首标签
|
||||
[HttpGet("CheckfirstInspectionLabel")]
|
||||
public IActionResult CheckFirstInspectionLabel(string workorder, string first_label)
|
||||
{
|
||||
var response = printAndReportWork3Service.CheckFirstInspectionLabel(workorder, first_label);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
//TODO 获取末件检验标签
|
||||
[HttpGet("getendinspectionlabel")]
|
||||
public IActionResult GetEndInspectionLabel(string workorder)
|
||||
{
|
||||
var response = printAndReportWork3Service.GetEndInspectionLabel(workorder);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//TODO 校验末件标签
|
||||
[HttpGet("CheckEndInspectionLabel")]
|
||||
public IActionResult CheckEndInspectionLabel(string workorder, string end_label)
|
||||
{
|
||||
var response = printAndReportWork3Service.CheckEndInspectionLabel(workorder, end_label);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -34,6 +34,14 @@ namespace DOAN.Model.Mobile
|
||||
public string EndLabel { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// created_by
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "created_by")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CreatedTime
|
||||
/// </summary>
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DOAN.Service.Mobile.IService
|
||||
{
|
||||
public interface IPADPrintAndReportWork3Service
|
||||
{
|
||||
string GetFirstInspectionLabel(string workorder);
|
||||
string CheckBoxInspectionLabel(string workorder, string box_label);
|
||||
string CheckFirstInspectionLabel(string workorder, string first_label);
|
||||
string GetEndInspectionLabel(string workorder);
|
||||
string CheckEndInspectionLabel(string workorder, string end_label);
|
||||
}
|
||||
}
|
||||
173
DOAN.Service/Mobile/PADPrintAndReportWork3Service.cs
Normal file
173
DOAN.Service/Mobile/PADPrintAndReportWork3Service.cs
Normal file
@ -0,0 +1,173 @@
|
||||
using DOAN.Model.MES.product;
|
||||
using DOAN.Model.Mobile;
|
||||
using DOAN.Service.Mobile.IService;
|
||||
using Infrastructure.Attribute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DOAN.Service.Mobile
|
||||
{
|
||||
|
||||
[AppService(ServiceType = typeof(IPADPrintAndReportWork3Service), ServiceLifetime = LifeTime.Transient)]
|
||||
public class PADPrintAndReportWork3Service : BaseService<ProReportwork>, IPADPrintAndReportWork3Service
|
||||
{
|
||||
public string GetFirstInspectionLabel(string workorder)
|
||||
{
|
||||
return Context.Queryable<ProInspectionLabel>().Where(it => it.Workorder == workorder).Select(it => it.FirstLabel).First() ?? "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
public string CheckBoxInspectionLabel(string workorder, string box_label)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(box_label))
|
||||
{
|
||||
return "箱标签传入为空!";
|
||||
}
|
||||
//TODO U3 U5 箱标签解析
|
||||
string[] box_labelArray= box_label.Split('/');
|
||||
if(box_labelArray.Length <=1)
|
||||
{
|
||||
return "箱标签解析失败!";
|
||||
}
|
||||
|
||||
// 提取工单规格
|
||||
string workorderProductionCode = Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder).Select(it => it.ProductionCode).First();
|
||||
if (string.IsNullOrEmpty(workorderProductionCode))
|
||||
{
|
||||
return "工单规格异常,规格为空!";
|
||||
}
|
||||
if (box_labelArray[0] == workorderProductionCode)
|
||||
{
|
||||
return "合格";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "外箱标签规格与工单规格不匹配";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public string CheckFirstInspectionLabel(string workorder, string first_label)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(first_label))
|
||||
{
|
||||
first_label = first_label.Replace(" ", " ");
|
||||
string workorderSpecification = Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder).Select(it => it.Specification).First();
|
||||
if (string.IsNullOrEmpty(workorderSpecification))
|
||||
{
|
||||
return "工单规格异常,规格为空!";
|
||||
}
|
||||
if (first_label.Contains(workorderSpecification))
|
||||
{
|
||||
bool isExist = Context.Queryable<ProInspectionLabel>().Where(it => it.Workorder == workorder).Any();
|
||||
if (isExist)
|
||||
{
|
||||
|
||||
Context.Updateable<ProInspectionLabel>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.SetColumns(it => new ProInspectionLabel() { FirstLabel = first_label, UpdatedTime = DateTime.Now, UpdatedBy = "U3和U5" })
|
||||
.ExecuteCommand();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ProInspectionLabel insert = new ProInspectionLabel()
|
||||
{
|
||||
Id = XueHua,
|
||||
Workorder = workorder,
|
||||
FirstLabel = first_label,
|
||||
CreatedTime = DateTime.Now,
|
||||
CreatedBy="U3和U5"
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
Context.Insertable(insert).ExecuteCommand();
|
||||
}
|
||||
|
||||
return "合格";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "标签不匹配";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return "标签异常";
|
||||
}
|
||||
}
|
||||
|
||||
public string CheckEndInspectionLabel(string workorder, string end_label)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(end_label))
|
||||
{
|
||||
end_label = end_label.Replace(" ", " ");
|
||||
string workorderSpecification = Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder).Select(it => it.Specification).First();
|
||||
if (string.IsNullOrEmpty(workorderSpecification))
|
||||
{
|
||||
return "工单规格异常,规格为空!";
|
||||
}
|
||||
if (end_label.Contains(workorderSpecification))
|
||||
{
|
||||
bool isExist = Context.Queryable<ProInspectionLabel>().Where(it => it.Workorder == workorder).Any();
|
||||
if (isExist)
|
||||
{
|
||||
|
||||
Context.Updateable<ProInspectionLabel>()
|
||||
.Where(it => it.Workorder == workorder)
|
||||
.SetColumns(it => new ProInspectionLabel() { EndLabel = end_label, UpdatedTime = DateTime.Now , UpdatedBy = "U3和U5" })
|
||||
.ExecuteCommand();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ProInspectionLabel insert = new ProInspectionLabel()
|
||||
{
|
||||
Id = XueHua,
|
||||
Workorder = workorder,
|
||||
EndLabel = end_label,
|
||||
CreatedTime = DateTime.Now,
|
||||
CreatedBy = "U3和U5"
|
||||
|
||||
};
|
||||
|
||||
|
||||
Context.Insertable(insert).ExecuteCommand();
|
||||
}
|
||||
|
||||
return "合格";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "标签不匹配";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return "标签异常";
|
||||
}
|
||||
}
|
||||
|
||||
public string GetEndInspectionLabel(string workorder)
|
||||
{
|
||||
return Context.Queryable<ProInspectionLabel>().Where(it => it.Workorder == workorder).Select(it => it.EndLabel).First() ?? "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user