油漆
This commit is contained in:
115
server/ZR.Service/mes/wms/WMExitwarehouseService.cs
Normal file
115
server/ZR.Service/mes/wms/WMExitwarehouseService.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.pro;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
|
||||
[AppService(ServiceType = typeof(IWMExitwarehouseService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WMExitwarehouseService : BaseService<WmInfo>, IWMExitwarehouseService
|
||||
{
|
||||
private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
//普通入库
|
||||
public bool ExitwarehouseCommmon(string original)
|
||||
{
|
||||
ResultionPackageCodeDto packageCode = ResolutionPackagecode(original);
|
||||
string patchCode = packageCode.PatchCode;
|
||||
|
||||
|
||||
int result = Context.Deleteable<WmGoodsNowProduction>().Where(it => it.PackageCodeClient == patchCode).ExecuteCommand();
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断箱子是否在成品库中
|
||||
/// </summary>
|
||||
/// <param name="PatchCode"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public bool IsExistedWarehouse(string originalCode)
|
||||
{
|
||||
ResultionPackageCodeDto resultionPackage = ResolutionPackagecode(originalCode);
|
||||
|
||||
return Context.Queryable<WmGoodsNowProduction>().Where(it => it.PackageCodeClient == resultionPackage.PatchCode).Any();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 解析外箱标签码
|
||||
/// </summary>
|
||||
/// <param name="packagecode"></param>
|
||||
/// <returns></returns>
|
||||
private ResultionPackageCodeDto ResolutionPackagecode(string packagecode)
|
||||
{
|
||||
ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto();
|
||||
try
|
||||
{
|
||||
resultionPackageCode.originalCode = packagecode;
|
||||
|
||||
// todo 解析外箱标签码
|
||||
string[] splitstr = packagecode.Split('^');
|
||||
resultionPackageCode.PatchCode = splitstr[0].Substring(5);
|
||||
|
||||
//todo 解析零件号
|
||||
string partnumber = splitstr[1].Substring(11);
|
||||
//int length = lingshi.Length - 2;
|
||||
//string partnumber = lingshi.Substring(0, length);
|
||||
resultionPackageCode.PartNumner = partnumber;
|
||||
//todo 解析工单号
|
||||
string workoderidid = splitstr[2].Substring(7);
|
||||
resultionPackageCode.WorkoderID = workoderidid;
|
||||
//todo 生产描述
|
||||
resultionPackageCode.ProductionTime = "20" + workoderidid.Substring(0, 6);
|
||||
//todo 解析箱子中产品数量
|
||||
string product_num = splitstr[3].Substring(4);
|
||||
resultionPackageCode.Quantity = int.Parse(product_num);
|
||||
//todo 产品描述 partnumber
|
||||
// ProWorklplan_v2 plan= Context.Queryable<ProWorklplan_v2>().Where(it => it.Partnumber == partnumber).First();
|
||||
//if(plan != null)
|
||||
// {
|
||||
// resultionPackageCode.ProductionDescribe = plan.ProductName;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// resultionPackageCode.ProductionDescribe = "生产计划无此零件号";
|
||||
// }
|
||||
ProWorkorder_v2 workorder = Context.Queryable<ProWorkorder_v2>().Where(it => it.FinishedPartNumber == partnumber).First();
|
||||
|
||||
if (workorder != null)
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = workorder.ProductDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = "生产工单无此零件号";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error($"外箱标签码,解析失败 {ex.Message}");
|
||||
|
||||
}
|
||||
|
||||
return resultionPackageCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user