178 lines
6.1 KiB
C#
178 lines
6.1 KiB
C#
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(workorder))
|
|
{
|
|
return "工单号传入为空!";
|
|
}
|
|
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() ?? "";
|
|
}
|
|
|
|
}
|
|
}
|