仓库管理_物料管理:初始化
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
<Compile Remove="mes\md\MdMaterialReceiptService.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="mes\wms\IService\IWMExitwarehouseService.cs~RFf4cb4c.TMP" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
26
ZR.Service/mes/wms/IService/IWMExitwarehouseService.cs
Normal file
26
ZR.Service/mes/wms/IService/IWMExitwarehouseService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
public interface IWMExitwarehouseService
|
||||
{
|
||||
/// <summary>
|
||||
/// 一般退库
|
||||
/// </summary>
|
||||
/// <param name="original"></param>
|
||||
/// <returns></returns>
|
||||
public bool ExitwarehouseCommmon(string original);
|
||||
/// <summary>
|
||||
/// 判断箱子是否存在陈平库中
|
||||
/// </summary>
|
||||
/// <param name="originalCode"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public bool IsExistedWarehouse(string originalCode);
|
||||
|
||||
}
|
||||
}
|
||||
24
ZR.Service/mes/wms/IService/IWmMaterialService.cs
Normal file
24
ZR.Service/mes/wms/IService/IWmMaterialService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料记录表service接口
|
||||
/// </summary>
|
||||
public interface IWmMaterialService : IBaseService<WmMaterial>
|
||||
{
|
||||
PagedInfo<WmMaterialDto> GetList(WmMaterialQueryDto parm);
|
||||
|
||||
WmMaterial GetInfo(string Id);
|
||||
|
||||
WmMaterial AddWmMaterial(WmMaterial parm);
|
||||
|
||||
int UpdateWmMaterial(WmMaterial parm);
|
||||
|
||||
}
|
||||
}
|
||||
115
ZR.Service/mes/wms/WMExitwarehouseService.cs
Normal file
115
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 = 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,6 +10,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.pro;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
@@ -218,17 +220,25 @@ namespace ZR.Service.mes.wms
|
||||
string product_num = splitstr[3].Substring(4);
|
||||
resultionPackageCode.Quantity = product_num;
|
||||
//todo 产品描述 partnumber
|
||||
ProWorklplan_v2 plan= Context.Queryable<ProWorklplan_v2>().Where(it => it.Partnumber == partnumber).First();
|
||||
if(plan != null)
|
||||
// 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 = plan.ProductName;
|
||||
resultionPackageCode.ProductionDescribe = workorder.ProductDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = "生产计划无此零件号";
|
||||
resultionPackageCode.ProductionDescribe = "生产工单无此零件号";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
98
ZR.Service/mes/wms/WmMaterialService.cs
Normal file
98
ZR.Service/mes/wms/WmMaterialService.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
|
||||
using ZR.Repository;
|
||||
|
||||
using System.Linq;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料记录表Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IWmMaterialService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WmMaterialService : BaseService<WmMaterial>, IWmMaterialService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询物料记录表列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmMaterialDto> GetList(WmMaterialQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmMaterial>();
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<WmMaterial, WmMaterialDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public WmMaterial GetInfo(string Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加物料记录表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmMaterial AddWmMaterial(WmMaterial model)
|
||||
{
|
||||
model.Id= SnowFlakeSingle.Instance.NextId().ToString();
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改物料记录表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateWmMaterial(WmMaterial model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new WmMaterial()
|
||||
//{
|
||||
// Partnumber = model.Partnumber,
|
||||
// U8InventoryCode = model.U8InventoryCode,
|
||||
// BlankNum = model.BlankNum,
|
||||
// Unit = model.Unit,
|
||||
// ProductName = model.ProductName,
|
||||
// Color = model.Color,
|
||||
// Specification = model.Specification,
|
||||
// Description = model.Description,
|
||||
// Version = model.Version,
|
||||
// Remarks = model.Remarks,
|
||||
// Sort = model.Sort,
|
||||
// Search1 = model.Search1,
|
||||
// Search2 = model.Search2,
|
||||
// Status = model.Status,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user