入库申请同步
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// mes申请入库子表
|
||||
/// </summary>
|
||||
[SugarTable("prd_instock_d")]
|
||||
public partial class PrdInstockD : BaseEntity<string>
|
||||
{
|
||||
public PrdInstockD()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 入库申请主表id
|
||||
/// </summary>
|
||||
public string instock_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料id
|
||||
/// </summary>
|
||||
public string material_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料编号
|
||||
/// </summary>
|
||||
public string material_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string unit_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public string quantity { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string code_batch { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 条码编号
|
||||
/// </summary>
|
||||
public string barcode { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// mes入库申请主表
|
||||
/// </summary>
|
||||
[SugarTable("prd_instock_h")]
|
||||
public partial class PrdInstockH : BaseEntity<string>
|
||||
{
|
||||
public PrdInstockH()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 入库单创建日期
|
||||
/// </summary>
|
||||
public DateTime bill_date { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 单据类型
|
||||
/// </summary>
|
||||
public string bill_type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 入库仓库ID
|
||||
/// </summary>
|
||||
public string warehouse_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string carry_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 起始库位编号
|
||||
/// </summary>
|
||||
public string location_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据ID
|
||||
/// </summary>
|
||||
public string source_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 检验(0-未检 1-已检)
|
||||
/// </summary>
|
||||
public string is_check { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 1 申请入库 2 已入库
|
||||
/// </summary>
|
||||
public int? status { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Tnb.ProductionMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// mes入库申请服务
|
||||
/// </summary>
|
||||
public interface IPrdInstockService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 入库申请同步
|
||||
/// </summary>
|
||||
/// <param name="dic">source_id</param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> SyncInstock(Dictionary<string, string> dic);
|
||||
}
|
||||
}
|
||||
55
ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
Normal file
55
ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// mes入库申请
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<PrdInstockH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
|
||||
|
||||
public PrdInstockService(
|
||||
ISqlSugarRepository<PrdInstockH> repository,
|
||||
IBillRullService billRullService,
|
||||
IUserManager userManager
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库申请同步
|
||||
/// </summary>
|
||||
/// <param name="dic">source_id</param>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> SyncInstock(Dictionary<string, string> dic)
|
||||
{
|
||||
string sourceId = dic.ContainsKey("source_id") ? dic["source_id"] : "";
|
||||
if (!string.IsNullOrEmpty(sourceId))
|
||||
{
|
||||
return await _repository.UpdateAsync(x => new PrdInstockH()
|
||||
{
|
||||
status = 1
|
||||
}, x => x.id == sourceId);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user